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
a2069071f2742abb159f57d7d7e67bfdca68a608
146
py
Python
losses/__init__.py
aliyun/3D-Local-CNN-for-Gait-Recognition
ebff3fd395c5e864ebd881a1ff06aa8b36682929
[ "Apache-2.0" ]
18
2021-12-20T03:29:38.000Z
2022-03-22T08:58:41.000Z
losses/__init__.py
aliyun/3D-Local-CNN-for-Gait-Recognition
ebff3fd395c5e864ebd881a1ff06aa8b36682929
[ "Apache-2.0" ]
3
2022-01-04T08:45:31.000Z
2022-03-18T00:13:50.000Z
losses/__init__.py
aliyun/3D-Local-CNN-for-Gait-Recognition
ebff3fd395c5e864ebd881a1ff06aa8b36682929
[ "Apache-2.0" ]
2
2022-02-22T01:39:36.000Z
2022-03-02T05:50:43.000Z
#! /usr/bin/env python from .triplet import TripletLoss, HardTripletLoss, FullTripletLoss from .cross_entropy import LabelSmoothCrossEntropyLoss
29.2
66
0.842466
15
146
8.133333
0.866667
0
0
0
0
0
0
0
0
0
0
0
0.09589
146
4
67
36.5
0.924242
0.143836
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
a21881997931f4a8fe7741e3375e04be4712682c
37
py
Python
aaa.py
kushjaggi/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3f5f62f24dafff48f694e72d1bfe1c84f9236342
[ "MIT" ]
107
2020-06-29T16:14:03.000Z
2022-03-16T15:12:01.000Z
aaa.py
kushjaggi/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3f5f62f24dafff48f694e72d1bfe1c84f9236342
[ "MIT" ]
47
2020-06-29T17:04:50.000Z
2022-02-23T14:37:04.000Z
aaa.py
kushjaggi/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3f5f62f24dafff48f694e72d1bfe1c84f9236342
[ "MIT" ]
108
2020-06-29T15:32:17.000Z
2022-03-11T16:25:18.000Z
while True: print('a', end = '')
12.333333
24
0.486486
5
37
3.6
1
0
0
0
0
0
0
0
0
0
0
0
0.27027
37
2
25
18.5
0.666667
0
0
0
0
0
0.027027
0
0
0
0
0
0
1
0
true
0
0
0
0
0.5
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
bf3ffed06b6735c41e50ad0b38248b4e3fa43f24
263
py
Python
configs/nuimages/cascade_mask_rcnn_r50_fpn_coco-20e_1x_nuim.py
Guangyun-Xu/mmdetection3d
75c5c6cd590386bd1539a686c5fd2cc45c5480d5
[ "Apache-2.0" ]
2,216
2020-07-09T19:10:11.000Z
2022-03-31T12:39:26.000Z
configs/nuimages/cascade_mask_rcnn_r50_fpn_coco-20e_1x_nuim.py
Guangyun-Xu/mmdetection3d
75c5c6cd590386bd1539a686c5fd2cc45c5480d5
[ "Apache-2.0" ]
1,174
2020-07-10T07:02:28.000Z
2022-03-31T12:38:56.000Z
configs/nuimages/cascade_mask_rcnn_r50_fpn_coco-20e_1x_nuim.py
Guangyun-Xu/mmdetection3d
75c5c6cd590386bd1539a686c5fd2cc45c5480d5
[ "Apache-2.0" ]
681
2020-07-09T19:40:06.000Z
2022-03-31T11:02:24.000Z
_base_ = './cascade_mask_rcnn_r50_fpn_1x_nuim.py' load_from = 'http://download.openmmlab.com/mmdetection/v2.0/cascade_rcnn/cascade_mask_rcnn_r50_fpn_20e_coco/cascade_mask_rcnn_r50_fpn_20e_coco_bbox_mAP-0.419__segm_mAP-0.365_20200504_174711-4af8e66e.pth' # noqa
65.75
211
0.859316
47
263
4.191489
0.638298
0.167513
0.228426
0.274112
0.390863
0.284264
0.284264
0
0
0
0
0.15415
0.038023
263
3
212
87.666667
0.624506
0.015209
0
0
0
0.5
0.883268
0.14786
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
bf52553509fbead0c7c2ca9ae361c29aa854dfaf
43
py
Python
application/controllers/__init__.py
ribrea/served-fastapi
a36f15160a082c21a01c582b0b2af19e6b4e52c5
[ "MIT" ]
1
2022-03-03T19:12:34.000Z
2022-03-03T19:12:34.000Z
application/controllers/__init__.py
ribrea/served-fastapi
a36f15160a082c21a01c582b0b2af19e6b4e52c5
[ "MIT" ]
null
null
null
application/controllers/__init__.py
ribrea/served-fastapi
a36f15160a082c21a01c582b0b2af19e6b4e52c5
[ "MIT" ]
null
null
null
""" This is controller for application. """
14.333333
35
0.697674
5
43
6
1
0
0
0
0
0
0
0
0
0
0
0
0.139535
43
3
36
14.333333
0.810811
0.813953
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
bf5b66ce20660f861151f452e232302f05846c83
406
py
Python
ramps_arduino/arduino-cli_setup.py
Ladvien/ramps_controller
5fa1410c57bcc9112df16e1781341a9d1315f189
[ "MIT" ]
2
2021-02-04T12:07:56.000Z
2022-02-10T14:00:52.000Z
ramps_arduino/arduino-cli_setup.py
Ladvien/ramps_controller
5fa1410c57bcc9112df16e1781341a9d1315f189
[ "MIT" ]
null
null
null
ramps_arduino/arduino-cli_setup.py
Ladvien/ramps_controller
5fa1410c57bcc9112df16e1781341a9d1315f189
[ "MIT" ]
null
null
null
import os, sys # Install arduino-cli os.system('curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/bin sh') # Configure arduino-cli os.system('arduino-cli config init') # Update the core. os.system('arduino-cli core update-index') # Add Arduino Mega core. os.system('arduino-cli core install arduino:avr') os.system('arduino-cli core install arduino:megaavr')
27.066667
112
0.758621
62
406
4.967742
0.451613
0.227273
0.194805
0.233766
0.331169
0.331169
0.233766
0
0
0
0
0
0.103448
406
14
113
29
0.846154
0.199507
0
0
0
0.166667
0.709375
0
0
0
0
0
0
1
0
true
0
0.166667
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
1
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
bf77656bbc0b2646cf21dc135f166feb6bb5117a
74
py
Python
logger/__init__.py
stanfordmlgroup/chexaid
d815afbdfdea63cd3aa9151f1f8a1093b7c02412
[ "MIT" ]
8
2020-03-04T22:16:06.000Z
2022-02-13T20:04:49.000Z
logger/__init__.py
stanfordmlgroup/chexaid
d815afbdfdea63cd3aa9151f1f8a1093b7c02412
[ "MIT" ]
2
2020-03-23T21:43:40.000Z
2020-05-06T13:17:39.000Z
logger/__init__.py
stanfordmlgroup/chexaid
d815afbdfdea63cd3aa9151f1f8a1093b7c02412
[ "MIT" ]
5
2020-08-01T01:07:36.000Z
2021-12-14T17:28:09.000Z
from .test_logger import TestLogger from .train_logger import TrainLogger
24.666667
37
0.864865
10
74
6.2
0.7
0.387097
0
0
0
0
0
0
0
0
0
0
0.108108
74
2
38
37
0.939394
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
bf7ddefca5c1917dd4061ddaacc4a91a719e19ad
142
py
Python
dice2.py
courtney-rosenthal/python-examples
24112a351aadbbb8b881668807950534eb8e728a
[ "Unlicense" ]
null
null
null
dice2.py
courtney-rosenthal/python-examples
24112a351aadbbb8b881668807950534eb8e728a
[ "Unlicense" ]
null
null
null
dice2.py
courtney-rosenthal/python-examples
24112a351aadbbb8b881668807950534eb8e728a
[ "Unlicense" ]
null
null
null
from random import randint from die_image import die a = randint(1, 6) print(die(a)) b = randint(1, 6) print(die(b)) print("You rolled", a+b)
17.75
26
0.697183
28
142
3.5
0.464286
0.081633
0.183673
0.285714
0.346939
0
0
0
0
0
0
0.033058
0.147887
142
7
27
20.285714
0.77686
0
0
0
0
0
0.070423
0
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
0.428571
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
5
bfd679ead4c63751f71a9a9f43847ea6e2388402
247
py
Python
src/pytest_describe_it/__init__.py
tkukushkin/pytest-describe-it
021b65fd92cfe0143f3b0a07e39bac3e23b6245f
[ "MIT" ]
5
2019-08-08T09:39:28.000Z
2021-05-09T17:59:21.000Z
src/pytest_describe_it/__init__.py
tkukushkin/pytest-describe-it
021b65fd92cfe0143f3b0a07e39bac3e23b6245f
[ "MIT" ]
null
null
null
src/pytest_describe_it/__init__.py
tkukushkin/pytest-describe-it
021b65fd92cfe0143f3b0a07e39bac3e23b6245f
[ "MIT" ]
null
null
null
import pytest from _pytest.mark.structures import MarkDecorator __all__ = ['describe', 'it'] def describe(what: str) -> MarkDecorator: return pytest.mark.describe(what) def it(what: str) -> MarkDecorator: return pytest.mark.it(what)
17.642857
49
0.724696
31
247
5.612903
0.419355
0.172414
0.229885
0.298851
0.413793
0.413793
0
0
0
0
0
0
0.153846
247
13
50
19
0.832536
0
0
0
0
0
0.040486
0
0
0
0
0
0
1
0.285714
false
0
0.285714
0.285714
0.857143
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
44a31e911645cb7bfd0cd9f885e224f784c61b34
13,146
py
Python
python/plugins/processing/tests/Grass7AlgorithmsVectorTest.py
dyna-mis/Hilabeling
cb7d5d4be29624a20c8a367162dbc6fd779b2b52
[ "MIT" ]
null
null
null
python/plugins/processing/tests/Grass7AlgorithmsVectorTest.py
dyna-mis/Hilabeling
cb7d5d4be29624a20c8a367162dbc6fd779b2b52
[ "MIT" ]
null
null
null
python/plugins/processing/tests/Grass7AlgorithmsVectorTest.py
dyna-mis/Hilabeling
cb7d5d4be29624a20c8a367162dbc6fd779b2b52
[ "MIT" ]
1
2021-12-25T08:40:30.000Z
2021-12-25T08:40:30.000Z
# -*- coding: utf-8 -*- """ *************************************************************************** Grass7AlgorithmsVectorTest.py ----------------------------- Date : April 2018 Copyright : (C) 2018 by Nyall Dawson Email : nyall dot dawson at gmail dot com *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * *************************************************************************** """ __author__ = 'Nyall Dawson' __date__ = 'March 2018' __copyright__ = '(C) 2018, Nyall Dawson' # This will get replaced with a git SHA1 when you do a git archive __revision__ = ':%H$' import AlgorithmsTestBase import nose2 import shutil import os import tempfile import re from qgis.core import (QgsVectorLayer, QgsApplication, QgsFeature, QgsGeometry, QgsPointXY, QgsProcessingContext, QgsProject, QgsProcessingFeedback, QgsProcessingFeatureSourceDefinition) from qgis.testing import ( start_app, unittest ) from processing.algs.grass7.Grass7Utils import Grass7Utils testDataPath = os.path.join(os.path.dirname(__file__), 'testdata') class TestGrass7AlgorithmsVectorTest(unittest.TestCase, AlgorithmsTestBase.AlgorithmsTest): @classmethod def setUpClass(cls): start_app() from processing.core.Processing import Processing Processing.initialize() cls.cleanup_paths = [] cls.temp_dir = tempfile.mkdtemp() cls.cleanup_paths.append(cls.temp_dir) assert Grass7Utils.installedVersion() @classmethod def tearDownClass(cls): from processing.core.Processing import Processing Processing.deinitialize() for path in cls.cleanup_paths: shutil.rmtree(path) def test_definition_file(self): return 'grass7_algorithms_vector_tests.yaml' def testMemoryLayerInput(self): # create a memory layer and add to project and context layer = QgsVectorLayer("Point?crs=epsg:3857&field=fldtxt:string&field=fldint:integer", "testmem", "memory") self.assertTrue(layer.isValid()) pr = layer.dataProvider() f = QgsFeature() f.setAttributes(["test", 123]) f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(100, 200))) f2 = QgsFeature() f2.setAttributes(["test2", 457]) f2.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(110, 200))) self.assertTrue(pr.addFeatures([f, f2])) self.assertEqual(layer.featureCount(), 2) QgsProject.instance().addMapLayer(layer) context = QgsProcessingContext() context.setProject(QgsProject.instance()) alg = QgsApplication.processingRegistry().createAlgorithmById('grass7:v.buffer') self.assertIsNotNone(alg) temp_file = os.path.join(self.temp_dir, 'grass_output.shp') parameters = {'input': 'testmem', 'cats': '', 'where': '', 'type': [0, 1, 4], 'distance': 1, 'minordistance': None, 'angle': 0, 'column': None, 'scale': 1, 'tolerance': 0.01, '-s': False, '-c': False, '-t': False, 'output': temp_file, 'GRASS_REGION_PARAMETER': None, 'GRASS_SNAP_TOLERANCE_PARAMETER': -1, 'GRASS_MIN_AREA_PARAMETER': 0.0001, 'GRASS_OUTPUT_TYPE_PARAMETER': 0, 'GRASS_VECTOR_DSCO': '', 'GRASS_VECTOR_LCO': ''} feedback = QgsProcessingFeedback() results, ok = alg.run(parameters, context, feedback) self.assertTrue(ok) self.assertTrue(os.path.exists(temp_file)) # make sure that layer has correct features res = QgsVectorLayer(temp_file, 'res') self.assertTrue(res.isValid()) self.assertEqual(res.featureCount(), 2) QgsProject.instance().removeMapLayer(layer) def testFeatureSourceInput(self): # create a memory layer and add to project and context layer = QgsVectorLayer("Point?crs=epsg:3857&field=fldtxt:string&field=fldint:integer", "testmem", "memory") self.assertTrue(layer.isValid()) pr = layer.dataProvider() f = QgsFeature() f.setAttributes(["test", 123]) f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(100, 200))) f2 = QgsFeature() f2.setAttributes(["test2", 457]) f2.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(110, 200))) self.assertTrue(pr.addFeatures([f, f2])) self.assertEqual(layer.featureCount(), 2) # select first feature layer.selectByIds([next(layer.getFeatures()).id()]) self.assertEqual(len(layer.selectedFeatureIds()), 1) QgsProject.instance().addMapLayer(layer) context = QgsProcessingContext() context.setProject(QgsProject.instance()) alg = QgsApplication.processingRegistry().createAlgorithmById('grass7:v.buffer') self.assertIsNotNone(alg) temp_file = os.path.join(self.temp_dir, 'grass_output_sel.shp') parameters = {'input': QgsProcessingFeatureSourceDefinition('testmem', True), 'cats': '', 'where': '', 'type': [0, 1, 4], 'distance': 1, 'minordistance': None, 'angle': 0, 'column': None, 'scale': 1, 'tolerance': 0.01, '-s': False, '-c': False, '-t': False, 'output': temp_file, 'GRASS_REGION_PARAMETER': None, 'GRASS_SNAP_TOLERANCE_PARAMETER': -1, 'GRASS_MIN_AREA_PARAMETER': 0.0001, 'GRASS_OUTPUT_TYPE_PARAMETER': 0, 'GRASS_VECTOR_DSCO': '', 'GRASS_VECTOR_LCO': ''} feedback = QgsProcessingFeedback() results, ok = alg.run(parameters, context, feedback) self.assertTrue(ok) self.assertTrue(os.path.exists(temp_file)) # make sure that layer has correct features res = QgsVectorLayer(temp_file, 'res') self.assertTrue(res.isValid()) self.assertEqual(res.featureCount(), 1) QgsProject.instance().removeMapLayer(layer) def testOutputToGeopackage(self): # create a memory layer and add to project and context layer = QgsVectorLayer("Point?crs=epsg:3857&field=fldtxt:string&field=fldint:integer", "testmem", "memory") self.assertTrue(layer.isValid()) pr = layer.dataProvider() f = QgsFeature() f.setAttributes(["test", 123]) f.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(100, 200))) f2 = QgsFeature() f2.setAttributes(["test2", 457]) f2.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(110, 200))) self.assertTrue(pr.addFeatures([f, f2])) self.assertEqual(layer.featureCount(), 2) QgsProject.instance().addMapLayer(layer) context = QgsProcessingContext() context.setProject(QgsProject.instance()) alg = QgsApplication.processingRegistry().createAlgorithmById('grass7:v.buffer') self.assertIsNotNone(alg) temp_file = os.path.join(self.temp_dir, 'grass_output.gpkg') parameters = {'input': 'testmem', 'cats': '', 'where': '', 'type': [0, 1, 4], 'distance': 1, 'minordistance': None, 'angle': 0, 'column': None, 'scale': 1, 'tolerance': 0.01, '-s': False, '-c': False, '-t': False, 'output': temp_file, 'GRASS_REGION_PARAMETER': None, 'GRASS_SNAP_TOLERANCE_PARAMETER': -1, 'GRASS_MIN_AREA_PARAMETER': 0.0001, 'GRASS_OUTPUT_TYPE_PARAMETER': 0, 'GRASS_VECTOR_DSCO': '', 'GRASS_VECTOR_LCO': ''} feedback = QgsProcessingFeedback() results, ok = alg.run(parameters, context, feedback) self.assertTrue(ok) self.assertTrue(os.path.exists(temp_file)) # make sure that layer has correct features res = QgsVectorLayer(temp_file, 'res') self.assertTrue(res.isValid()) self.assertEqual(res.featureCount(), 2) QgsProject.instance().removeMapLayer(layer) def testVectorLayerInput(self): alg = QgsApplication.processingRegistry().createAlgorithmById('grass7:v.buffer') self.assertIsNotNone(alg) self.assertFalse(alg.commands) def get_command(alg): command = alg.commands[-1] command = re.sub(r'output=".*?"', 'output="###"', command) command = command.replace(testDataPath, 'testdata') return command # GML source source = os.path.join(testDataPath, 'points.gml') vl = QgsVectorLayer(source) self.assertTrue(vl.isValid()) alg.loadVectorLayer('test_layer', vl, external=False) self.assertEqual(get_command(alg), 'v.in.ogr min_area=None snap=None input="testdata/points.gml" output="###" --overwrite -o') # try with external -- not support for GML, so should fall back to v.in.ogr alg.loadVectorLayer('test_layer', vl, external=True) self.assertEqual(get_command(alg), 'v.in.ogr min_area=None snap=None input="testdata/points.gml" output="###" --overwrite -o') # SHP source source = os.path.join(testDataPath, 'lines_z.shp') vl = QgsVectorLayer(source) self.assertTrue(vl.isValid()) alg.loadVectorLayer('test_layer', vl, external=False) self.assertEqual(get_command(alg), 'v.in.ogr min_area=None snap=None input="testdata/lines_z.shp" output="###" --overwrite -o') # try with external -- should work for shapefile alg.loadVectorLayer('test_layer', vl, external=True) self.assertEqual(get_command(alg), 'v.external input="testdata/lines_z.shp" output="###" --overwrite -o') # GPKG source source = os.path.join(testDataPath, 'custom/pol.gpkg') vl = QgsVectorLayer(source + '|layername=pol2') self.assertTrue(vl.isValid()) alg.loadVectorLayer('test_layer', vl, external=False) self.assertEqual(get_command(alg), 'v.in.ogr min_area=None snap=None input="testdata/custom/pol.gpkg" layer="pol2" output="###" --overwrite -o') # try with external -- should work for Geopackage (although grass itself tends to crash here!) alg.loadVectorLayer('test_layer', vl, external=True) self.assertEqual(get_command(alg), 'v.external input="testdata/custom/pol.gpkg" layer="pol2" output="###" --overwrite -o') # different layer source = os.path.join(testDataPath, 'custom/pol.gpkg') vl = QgsVectorLayer(source + '|layername=pol3') self.assertTrue(vl.isValid()) alg.loadVectorLayer('test_layer', vl, external=False) self.assertEqual(get_command(alg), 'v.in.ogr min_area=None snap=None input="testdata/custom/pol.gpkg" layer="pol3" output="###" --overwrite -o') alg.loadVectorLayer('test_layer', vl, external=True) self.assertEqual(get_command(alg), 'v.external input="testdata/custom/pol.gpkg" layer="pol3" output="###" --overwrite -o') # GPKG no layer: you get what you get and you don't get upset source = os.path.join(testDataPath, 'custom/pol.gpkg') vl = QgsVectorLayer(source) self.assertTrue(vl.isValid()) alg.loadVectorLayer('test_layer', vl, external=False) self.assertEqual(get_command(alg), 'v.in.ogr min_area=None snap=None input="testdata/custom/pol.gpkg" output="###" --overwrite -o') alg.loadVectorLayer('test_layer', vl, external=True) self.assertEqual(get_command(alg), 'v.external input="testdata/custom/pol.gpkg" output="###" --overwrite -o') if __name__ == '__main__': nose2.main()
42.406452
152
0.565952
1,278
13,146
5.716745
0.213615
0.038325
0.019573
0.036956
0.754996
0.749521
0.737339
0.722557
0.715713
0.705858
0
0.018958
0.297809
13,146
309
153
42.543689
0.772506
0.123231
0
0.698276
0
0.034483
0.193705
0.071814
0
0
0
0
0.185345
1
0.034483
false
0
0.047414
0.00431
0.094828
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
44cdddc6cc91c7b8443448796f33bf7b6fb65e82
3,108
py
Python
ismore/ismore_tests/test_bmi_control.py
DerekYJC/bmi_python
7b9cf3f294a33688db24b0863c1035e9cc6999ea
[ "Apache-2.0" ]
null
null
null
ismore/ismore_tests/test_bmi_control.py
DerekYJC/bmi_python
7b9cf3f294a33688db24b0863c1035e9cc6999ea
[ "Apache-2.0" ]
12
2020-07-31T18:58:31.000Z
2022-02-10T14:36:00.000Z
ismore/ismore_tests/test_bmi_control.py
DerekYJC/bmi_python
7b9cf3f294a33688db24b0863c1035e9cc6999ea
[ "Apache-2.0" ]
4
2020-03-06T15:39:00.000Z
2021-05-26T17:03:21.000Z
import ismore.invasive.bmi_ismoretasks as bmi_ismoretasks import ismore.invasive.patient_display as patient_display import ismore.invasive.bmitasks_w_display as bmitasks_w_display from riglib import experiment from features.hdf_features import SaveHDF import tables import multiprocessing as mp import numpy as np import matplotlib.pyplot as plt import time #import seaborn from ismore_tests import test_clda Task = experiment.make(bmitasks_w_display.VisualFeedbackWithDisplay, [SaveHDF]) targets = bmitasks_w_display.VisualFeedbackWithDisplay.armassist_w_disp() plant_type = 'ArmAssist' fnm = '/Users/preeyakhanna/ismore/ismore_tests/sim_data/aa_20160405_15_12_03.pkl' kwargs=dict(assist_level_time=50, assist_level=(1.,1.),session_length=100, timeout_time=60., enc_path=fnm, dec_path=fnm) #dec = pickle.load(open(fnm)) task_is = Task(targets, plant_type=plant_type, **kwargs) #task_is.decoder = dec.corresp_dec task_is.run_sync() pnm = test_clda.save_dec_enc(task_is, pref='is_') # Task = experiment.make(patient_display.vfb_w_disp, [SaveHDF]) # targets = bmi_ismoretasks.SimBMIControl.armassist_simple(length=100) # targets = patient_display.vfb_w_disp.armassist_w_word() # plant_type = 'ArmAssist' # fnm = '/Users/preeyakhanna/ismore/ismore_tests/sim_data/aa_20160405_15_12_03.pkl' # kwargs=dict(assist_level_time=50, assist_level=(1.,1.),session_length=100, # timeout_time=60., enc_path=fnm, dec_path=fnm) # #dec = pickle.load(open(fnm)) # task_is = Task(targets, plant_type=plant_type, **kwargs) # #task_is.decoder = dec.corresp_dec # task_is.run_sync() # pnm = test_clda.save_dec_enc(task_is, pref='is_') # Task = experiment.make(bmi_ismoretasks.SimBMIControlwRating, [SaveHDF]) # targets = bmi_ismoretasks.SimBMIControl.armassist_simple(length=100) # plant_type = 'ArmAssist' # fnm = '/Users/preeyakhanna/ismore/ismore_tests/sim_data/aa_20160405_15_12_03.pkl' # kwargs=dict(assist_level_time=50, assist_level=(1.,1.),session_length=100, # timeout_time=60., enc_path=fnm, dec_path=fnm) # task_is = Task(targets, plant_type=plant_type, **kwargs) # task_is.run_sync() Task = experiment.make(bmi_ismoretasks.SimBMIControl, [SaveHDF]) targets = bmi_ismoretasks.SimBMIControl.armassist_simple(length=100) plant_type = 'ArmAssist' fnm = '/Users/preeyakhanna/ismore/ismore_tests/sim_data/aa_20160405_15_12_03.pkl' kwargs=dict(assist_level_time=50, assist_level=(1.,0.),session_length=100, timeout_time=60., enc_path=fnm, dec_path=fnm) task_is = Task(targets, plant_type=plant_type, **kwargs) task_is.run_sync() pnm = test_clda.save_dec_enc(task_is, pref='is_') Task = experiment.make(bmi_ismoretasks.BMIControl_with_Patient, [SaveHDF]) targets = bmi_ismoretasks.SimBMIControl.armassist_simple(length=100) plant_type = 'ArmAssist' fnm = '/Users/preeyakhanna/ismore/ismore_tests/sim_data/aa_20160405_15_12_03.pkl' kwargs=dict(assist_level_time=50, assist_level=(1.,0.),session_length=100, timeout_time=60., enc_path=fnm, dec_path=fnm) task_is = Task(targets, plant_type=plant_type, **kwargs) task_is.run_sync() pnm = test_clda.save_dec_enc(task_is, pref='is_')
34.921348
83
0.794402
472
3,108
4.898305
0.17161
0.041522
0.030277
0.045415
0.762111
0.729239
0.729239
0.729239
0.729239
0.701125
0
0.044624
0.084299
3,108
88
84
35.318182
0.767744
0.364221
0
0.578947
0
0
0.131173
0.112654
0
0
0
0
0
1
0
false
0
0.289474
0
0.289474
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
78165069c2e3c9cfb28b4b01cd549c548756f63c
55
py
Python
CodeWars/8 Kyu/Simple multiplication.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
CodeWars/8 Kyu/Simple multiplication.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
CodeWars/8 Kyu/Simple multiplication.py
anubhab-code/Competitive-Programming
de28cb7d44044b9e7d8bdb475da61e37c018ac35
[ "MIT" ]
null
null
null
def simple_multiplication(n) : return n * (8 + n%2)
27.5
30
0.636364
9
55
3.777778
0.777778
0
0
0
0
0
0
0
0
0
0
0.046512
0.218182
55
2
31
27.5
0.744186
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
784e717afa88a738d60e6b0e679371f2fa34d91f
97
py
Python
login/tests.py
rvladimirvm/book_reservation
6d449e233de9faa6a4f8bf45729e9117604ed961
[ "MIT" ]
2
2018-12-14T05:09:17.000Z
2018-12-18T02:30:07.000Z
login/tests.py
rvladimirvm/book_reservation
6d449e233de9faa6a4f8bf45729e9117604ed961
[ "MIT" ]
13
2018-12-14T04:54:40.000Z
2019-03-28T04:14:44.000Z
login/tests.py
rvladimirvm/book_reservation
6d449e233de9faa6a4f8bf45729e9117604ed961
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- ''' Here all test for login. ''' from __future__ import unicode_literals
16.166667
39
0.670103
13
97
4.615385
1
0
0
0
0
0
0
0
0
0
0
0.012346
0.164948
97
5
40
19.4
0.728395
0.484536
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
786e597795849af2087dd20df9edd858ff179926
172
py
Python
wordle/views.py
Amirkz80/persian_wordle
ee4b5ff5166a4fec6ca71f846672b3360e708a0c
[ "Apache-2.0" ]
null
null
null
wordle/views.py
Amirkz80/persian_wordle
ee4b5ff5166a4fec6ca71f846672b3360e708a0c
[ "Apache-2.0" ]
null
null
null
wordle/views.py
Amirkz80/persian_wordle
ee4b5ff5166a4fec6ca71f846672b3360e708a0c
[ "Apache-2.0" ]
null
null
null
from django.shortcuts import render def main_page(request): """This function handels requests to the main page""" return render(request, 'wordle/main_page.html')
24.571429
57
0.744186
24
172
5.25
0.75
0.190476
0
0
0
0
0
0
0
0
0
0
0.156977
172
6
58
28.666667
0.868966
0.273256
0
0
0
0
0.176471
0.176471
0
0
0
0
0
1
0.333333
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
1
0
0
1
0
1
0
0
5
787bd87431c70048c0e6df3c8c901b567897ab33
203
py
Python
04/02-divisible_a.py
nogand/py0122
05d8b00bb1b8018ae6e616599adf4ef07196121a
[ "CC0-1.0" ]
null
null
null
04/02-divisible_a.py
nogand/py0122
05d8b00bb1b8018ae6e616599adf4ef07196121a
[ "CC0-1.0" ]
null
null
null
04/02-divisible_a.py
nogand/py0122
05d8b00bb1b8018ae6e616599adf4ef07196121a
[ "CC0-1.0" ]
null
null
null
for i in range(1,101): print(i,"(",end="") if i % 2 == 0: print(2,",",end="") if i % 3 == 0: print(3,",",end="") if i % 5 == 0: print(5,",",end="") print(")")
20.3
27
0.349754
31
203
2.290323
0.419355
0.211268
0.253521
0
0
0
0
0
0
0
0
0.098485
0.349754
203
9
28
22.555556
0.439394
0
0
0
0
0
0.024631
0
0
0
0
0
0
1
0
false
0
0
0
0
0.555556
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
5
789f9e1c5d2861d34fcf925fcefaec4e02800ef1
296
py
Python
Model/model.py
Habba5/Heuristic-solution-of-Ishop
b2cd9ba807b61a6435be86d6092f6f2dbea18a98
[ "MIT" ]
null
null
null
Model/model.py
Habba5/Heuristic-solution-of-Ishop
b2cd9ba807b61a6435be86d6092f6f2dbea18a98
[ "MIT" ]
2
2018-01-12T18:38:17.000Z
2018-01-15T08:00:43.000Z
Model/model.py
Habba5/Heuristic-solution-of-Ishop
b2cd9ba807b61a6435be86d6092f6f2dbea18a98
[ "MIT" ]
null
null
null
class Model(object): def __init__(self): self.username = None self.password = None self.deck = None def username(self): return self.username def password(self): return self.password def deck(self): return self.deck
19.733333
29
0.560811
33
296
4.909091
0.333333
0.185185
0.259259
0
0
0
0
0
0
0
0
0
0.358108
296
15
30
19.733333
0.852632
0
0
0
0
0
0
0
0
0
0
0
0
1
0.363636
false
0.272727
0
0.272727
0.727273
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
5
78a88d2510c612b6bcd5c3220d152c8962bc5624
50
py
Python
test/setup.py
GSargsyan/capstone
ce425d2d8bc78a91b7d4884292d3cefb86dfd133
[ "Apache-2.0" ]
null
null
null
test/setup.py
GSargsyan/capstone
ce425d2d8bc78a91b7d4884292d3cefb86dfd133
[ "Apache-2.0" ]
null
null
null
test/setup.py
GSargsyan/capstone
ce425d2d8bc78a91b7d4884292d3cefb86dfd133
[ "Apache-2.0" ]
null
null
null
import sys import cv2 sys.path.append("../src/")
10
26
0.68
8
50
4.25
0.75
0
0
0
0
0
0
0
0
0
0
0.022727
0.12
50
4
27
12.5
0.75
0
0
0
0
0
0.14
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
78b36d545f2a16baaf2c3eb4768d480610f7b303
431
py
Python
php_apcu/tests/common.py
divyamamgai/integrations-extras
8c40a9cf870578687cc224ee91d3c70cd3a435a4
[ "BSD-3-Clause" ]
158
2016-06-02T16:25:31.000Z
2022-03-16T15:55:14.000Z
php_apcu/tests/common.py
divyamamgai/integrations-extras
8c40a9cf870578687cc224ee91d3c70cd3a435a4
[ "BSD-3-Clause" ]
554
2016-03-15T17:39:12.000Z
2022-03-31T10:29:16.000Z
php_apcu/tests/common.py
divyamamgai/integrations-extras
8c40a9cf870578687cc224ee91d3c70cd3a435a4
[ "BSD-3-Clause" ]
431
2016-05-13T15:33:13.000Z
2022-03-31T10:06:46.000Z
EXPECTED_METRICS = { "php_apcu.cache.mem_size": 0, "php_apcu.cache.num_slots": 1, "php_apcu.cache.ttl": 0, "php_apcu.cache.num_hits": 0, "php_apcu.cache.num_misses": 0, "php_apcu.cache.num_inserts": 0, "php_apcu.cache.num_entries": 0, "php_apcu.cache.num_expunges": 0, "php_apcu.cache.uptime": 1, "php_apcu.sma.avail_mem": 1, "php_apcu.sma.seg_size": 1, "php_apcu.sma.num_seg": 1, }
28.733333
37
0.649652
72
431
3.569444
0.291667
0.326848
0.420233
0.354086
0.373541
0
0
0
0
0
0
0.033803
0.176334
431
14
38
30.785714
0.690141
0
0
0
0
0
0.640371
0.552204
0
0
0
0
0
1
0
false
0
0
0
0
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
78c3088d0b766d8c02910ae32d90d69ff49b1fbb
5,085
py
Python
tests/test_spider/management.py
devkral/spkbspider
97e448b4da412acebd66c4469c7fcdd07bf90ed2
[ "MIT" ]
5
2019-06-24T14:15:54.000Z
2021-05-14T23:16:31.000Z
tests/test_spider/management.py
devkral/spkbspider
97e448b4da412acebd66c4469c7fcdd07bf90ed2
[ "MIT" ]
2
2018-06-19T09:56:18.000Z
2018-11-20T12:02:44.000Z
tests/test_spider/management.py
devkral/spkbspider
97e448b4da412acebd66c4469c7fcdd07bf90ed2
[ "MIT" ]
null
null
null
from io import StringIO from django.core.management import call_command from django.test import TransactionTestCase from spkcspider.apps.spider.models import ( AuthToken, ReferrerObject, UserComponent ) from spkcspider.apps.spider_accounts.models import SpiderUser class ManagementTests(TransactionTestCase): def setUp(self): self.user = SpiderUser.objects.create_user( username="testuser1", password="abc", is_active=True ) def test_update_dynamic_content(self): out = StringIO() call_command('update_dynamic_content', stdout=out) self.assertNotIn('failed', out.getvalue()) def test_revoke_persistent_auth_tokens(self): uc = UserComponent.objects.get( name="home" ) AuthToken.objects.create( persist=-1, usercomponent=uc ) AuthToken.objects.create( persist=0, usercomponent=uc ) AuthToken.objects.create( persist=1, usercomponent=uc ) out = StringIO() call_command('revoke_auth_tokens', stdout=out) self.assertEqual(AuthToken.objects.count(), 2) self.assertEqual(out.getvalue(), "count: 1\n") out = StringIO() call_command('revoke_auth_tokens', "--anchor=all", stdout=out) self.assertEqual(AuthToken.objects.count(), 0) self.assertEqual(out.getvalue(), "count: 2\n") def test_revoke_anchor_component_auth_tokens(self): uc = UserComponent.objects.get( name="home" ) AuthToken.objects.create( persist=-1, usercomponent=uc ) AuthToken.objects.create( persist=0, usercomponent=uc ) AuthToken.objects.create( persist=1, usercomponent=uc ) out = StringIO() call_command('revoke_auth_tokens', '--anchor=1', stdout=out) self.assertEqual(AuthToken.objects.count(), 2) self.assertEqual(out.getvalue(), "count: 1\n") out = StringIO() call_command('revoke_auth_tokens', "--anchor=0", stdout=out) self.assertEqual(AuthToken.objects.count(), 1) self.assertEqual(out.getvalue(), "count: 1\n") out = StringIO() call_command('revoke_auth_tokens', "--anchor=persist", stdout=out) self.assertEqual(AuthToken.objects.count(), 1) self.assertEqual(out.getvalue(), "count: 0\n") def test_revoke_referrer_auth_tokens(self): uc = UserComponent.objects.get( name="home" ) AuthToken.objects.create( persist=-1, usercomponent=uc, referrer=ReferrerObject.objects.get_or_create( url="http://example.com" )[0] ) AuthToken.objects.create( persist=0, usercomponent=uc, referrer=ReferrerObject.objects.get_or_create( url="http://example.com" )[0] ) AuthToken.objects.create( persist=1, usercomponent=uc, referrer=ReferrerObject.objects.get_or_create( url="http://example.com" )[0] ) AuthToken.objects.create( persist=1, usercomponent=uc, referrer=ReferrerObject.objects.get_or_create( url="http://example.com/test" )[0] ) AuthToken.objects.create( persist=-1, usercomponent=uc, referrer=ReferrerObject.objects.get_or_create( url="http://example.com/test" )[0] ) AuthToken.objects.create( persist=0, usercomponent=uc, referrer=ReferrerObject.objects.get_or_create( url="http://example.com/test" )[0] ) AuthToken.objects.create( persist=0, usercomponent=uc, referrer=ReferrerObject.objects.get_or_create( url="http://example2.com/test" )[0] ) out = StringIO() call_command( 'revoke_auth_tokens', '--referrer=http://example.com', stdout=out ) self.assertEqual(AuthToken.objects.count(), 4) self.assertEqual(out.getvalue(), "count: 3\n") out = StringIO() call_command( 'revoke_auth_tokens', '--referrer=http://example.com/test', '--anchor=persist', stdout=out ) self.assertEqual(AuthToken.objects.count(), 2) self.assertEqual(out.getvalue(), "count: 2\n") out = StringIO() call_command( 'revoke_auth_tokens', '--oldest=1', '--anchor=all', stdout=out ) self.assertEqual(AuthToken.objects.count(), 1) self.assertEqual(out.getvalue(), "count: 1\n") # the last is the latest and not affected self.assertTrue(AuthToken.objects.get( referrer__url="http://example2.com/test", ))
31.78125
77
0.569125
502
5,085
5.639442
0.155378
0.124338
0.101024
0.133168
0.777464
0.753444
0.753444
0.725539
0.70929
0.682091
0
0.012034
0.313668
5,085
159
78
31.981132
0.79914
0.00767
0
0.618056
0
0
0.11816
0.004362
0
0
0
0
0.125
1
0.034722
false
0.006944
0.034722
0
0.076389
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
78c33ea0ea80a0b66081bb21a5a9b19b15f1bb74
47
py
Python
component/parameter/__init__.py
sepal-contrib/planet-order
794c26dfa2d4b24f84894e7faf5708b1246fa3cb
[ "MIT" ]
null
null
null
component/parameter/__init__.py
sepal-contrib/planet-order
794c26dfa2d4b24f84894e7faf5708b1246fa3cb
[ "MIT" ]
null
null
null
component/parameter/__init__.py
sepal-contrib/planet-order
794c26dfa2d4b24f84894e7faf5708b1246fa3cb
[ "MIT" ]
null
null
null
from .directory import * from .planet import *
15.666667
24
0.744681
6
47
5.833333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.170213
47
2
25
23.5
0.897436
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
1534165cacd0fd47f3a7cb983e6003c55f56d8ac
5,522
py
Python
main.py
P-J-Y/SErup
730e3a9be3214d6ca2364d321d8e65597f44938f
[ "MIT" ]
1
2021-12-04T13:14:21.000Z
2021-12-04T13:14:21.000Z
main.py
P-J-Y/SErup
730e3a9be3214d6ca2364d321d8e65597f44938f
[ "MIT" ]
10
2021-10-31T14:48:16.000Z
2021-12-24T13:51:13.000Z
main.py
P-J-Y/SErup
730e3a9be3214d6ca2364d321d8e65597f44938f
[ "MIT" ]
null
null
null
from sunpy.net import attrs as a from sunpy.net import Fido #1、活动区的时刻现在用的初始时刻,实际上应该考虑从初始到end #2、加入判断活动区是否在cme附近的判定 #3、如果事件在边缘,那么画一个方框就会报错,所以我限制了事件的位置不能太偏边缘 #给出时间范围内的活动区位置、时间范围等信息 tstart = '2015/05/01 07:23:56' tend = '2015/05/02 08:40:29' event_type = 'CE' #CME 可以设置成其他的 如 AR、FL from sunpy.net import hek2vso h2v = hek2vso.H2VClient() CEresult = Fido.search(a.Time(tstart, tend), a.hek.EventType(event_type)) vso_records = h2v.translate_and_query(CEresult[0][0]) len(vso_records[0]) tend = CEresult['hek']['event_starttime'][0] tstart = "2015/05/01 07:00:05" #q = h2v.full_query((a.Time('2011/08/09 07:23:56', '2011/08/09 12:40:29'), a.hek.EventType('FL'))) #print(CEresult['hek']['event_starttime']) #print(CEresult['hek']['event_endtime']) #print(CEresult['hek']['event_coord1']) #print(CEresult['hek']['event_coord2']) # 角秒 event_coord1/2/3 第一二三个坐标,还有其他参数见https://www.lmsal.com/hek/VOEvent_Spec.html event_type = 'AR' ARresult = Fido.search(a.Time(tstart, tend), a.hek.EventType(event_type)) vso_records = h2v.translate_and_query(ARresult[0][0]) len(vso_records[0]) #q = h2v.full_query((a.Time('2011/08/09 07:23:56', '2011/08/09 12:40:29'), a.hek.EventType('FL'))) #print(ARresult['hek']['event_starttime']) #print(ARresult['hek']['event_endtime']) #print(ARresult['hek']['event_coord1']) #print(ARresult['hek']['event_coord2']) # 角秒 event_coord1/2/3 第一二三个坐标,还有其他参数见https://www.lmsal.com/hek/VOEvent_Spec.html from sunpy.net.helioviewer import HelioviewerClient import matplotlib.pyplot as plt from sunpy.map import Map import astropy.units as u from astropy.coordinates import SkyCoord import numpy as np from astropy.units import Quantity for i in range(20): thetime = ARresult['hek']['event_starttime'][i] thex = ARresult['hek']['event_coord1'][i] they = ARresult['hek']['event_coord2'][i] if np.abs(thex)>800 or np.abs(they)>800: continue hv = HelioviewerClient() file = hv.download_jp2(thetime, observatory="SDO", instrument="HMI", measurement="continuum") hmi = Map(file) bottom_left = SkyCoord((thex - 100) * u.arcsec, (they - 100) * u.arcsec, frame=hmi.coordinate_frame) # 给出区域左下点的坐标(第一个参数是x坐标,第二个是y) width = 200 * u.arcsec height = 200 * u.arcsec file = hv.download_jp2(thetime, observatory="SDO", instrument="AIA", measurement="171") aia = Map(file) aia_submap = aia.submap(bottom_left, width=width, height=height) hmi_submap = hmi.submap(bottom_left, width=width, height=height) # aia.submap(bottom_left, width=width, height=height).peek() # plt.savefig('aia.png') # hmi.submap(bottom_left, width=width, height=height).peek() # plt.savefig('hmi.png') figure1 = plt.figure(frameon=False) ax1 = plt.axes([0, 0, 1, 1]) # Disable the axis ax1.set_axis_off() # Plot the map. Since are not interested in the exact map coordinates, we can # simply use :meth:`~matplotlib.Axes.imshow`. norm = aia_submap.plot_settings['norm'] norm.vmin, norm.vmax = np.percentile(aia_submap.data, [1, 99.9]) ax1.imshow(aia_submap.data, norm=norm, cmap=aia_submap.plot_settings['cmap']) plt.savefig('figure/aia%d.png'%i) figure2 = plt.figure(frameon=False) ax2 = plt.axes([0, 0, 1, 1]) # Disable the axis ax2.set_axis_off() # Plot the map. Since are not interested in the exact map coordinates, we can # simply use :meth:`~matplotlib.Axes.imshow`. # norm = hmi_submap.plot_settings['norm'] # norm.vmin, norm.vmax = np.percentile(hmi_submap.data, [1, 99.9]) ax2.imshow(hmi_submap.data, # norm=norm, cmap=hmi_submap.plot_settings['cmap']) plt.savefig('figure/hmi%d.png'%i) ''' #给出helioviewer相应位置的太阳图像 thetime = ARresult['hek']['event_starttime'][0] hv = HelioviewerClient() file = hv.download_jp2(thetime, observatory="SDO", instrument="HMI",measurement="continuum") hmi = Map(file) bottom_left = SkyCoord((ARresult['hek']['event_coord1'][0]-100) * u.arcsec, (ARresult['hek']['event_coord2'][0]-100) * u.arcsec, frame=hmi.coordinate_frame) #给出区域左下点的坐标(第一个参数是x坐标,第二个是y) width = 200 * u.arcsec height = 200 * u.arcsec file = hv.download_jp2(thetime, observatory="SDO", instrument="AIA",measurement="171") aia = Map(file) aia_submap = aia.submap(bottom_left, width=width, height=height) hmi_submap = hmi.submap(bottom_left, width=width, height=height) #aia.submap(bottom_left, width=width, height=height).peek() #plt.savefig('aia.png') #hmi.submap(bottom_left, width=width, height=height).peek() #plt.savefig('hmi.png') figure1 = plt.figure(frameon=False) ax1 = plt.axes([0, 0, 1, 1]) # Disable the axis ax1.set_axis_off() # Plot the map. Since are not interested in the exact map coordinates, we can # simply use :meth:`~matplotlib.Axes.imshow`. norm = aia_submap.plot_settings['norm'] norm.vmin, norm.vmax = np.percentile(aia_submap.data, [1, 99.9]) ax1.imshow(aia_submap.data, norm=norm, cmap=aia_submap.plot_settings['cmap']) plt.savefig('aia.png') figure2 = plt.figure(frameon=False) ax2 = plt.axes([0, 0, 1, 1]) # Disable the axis ax2.set_axis_off() # Plot the map. Since are not interested in the exact map coordinates, we can # simply use :meth:`~matplotlib.Axes.imshow`. #norm = hmi_submap.plot_settings['norm'] #norm.vmin, norm.vmax = np.percentile(hmi_submap.data, [1, 99.9]) ax2.imshow(hmi_submap.data, # norm=norm, cmap=hmi_submap.plot_settings['cmap']) plt.savefig('hmi.png') '''
38.615385
185
0.692503
821
5,522
4.554202
0.202192
0.032094
0.042792
0.044932
0.750468
0.724793
0.716234
0.713025
0.713025
0.713025
0
0.047266
0.145599
5,522
143
186
38.615385
0.745231
0.251539
0
0.035714
0
0
0.083405
0
0
0
0
0
0
1
0
false
0
0.178571
0
0.178571
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
15563b76eae5c3a430f3680e0d1271fa83909fc2
241
py
Python
winton_kafka_streams/processor/serde/_base.py
szczeles/winton-kafka-streams
8034cdffe4bf2ac3fa4fdf7210101dc6cdb97ed6
[ "Apache-2.0" ]
null
null
null
winton_kafka_streams/processor/serde/_base.py
szczeles/winton-kafka-streams
8034cdffe4bf2ac3fa4fdf7210101dc6cdb97ed6
[ "Apache-2.0" ]
null
null
null
winton_kafka_streams/processor/serde/_base.py
szczeles/winton-kafka-streams
8034cdffe4bf2ac3fa4fdf7210101dc6cdb97ed6
[ "Apache-2.0" ]
1
2019-04-28T23:31:24.000Z
2019-04-28T23:31:24.000Z
""" Base class for serde implementations """ import abc class BaseSerde(metaclass=abc.ABCMeta): @abc.abstractmethod def serialise(self, value): pass @abc.abstractmethod def deserialise(self, value): pass
14.176471
39
0.6639
26
241
6.153846
0.653846
0.2125
0.25
0
0
0
0
0
0
0
0
0
0.240664
241
16
40
15.0625
0.874317
0.149378
0
0.5
0
0
0
0
0
0
0
0
0
1
0.25
false
0.25
0.125
0
0.5
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
5
1572d9a090bef022c33eb5fe3c4397e328b35e7a
1,542
py
Python
venv/lib/python3.8/site-packages/keras/api/_v1/keras/__init__.py
JIANG-CX/data_labeling
8d2470bbb537dfc09ed2f7027ed8ee7de6447248
[ "MIT" ]
1
2021-05-24T10:08:51.000Z
2021-05-24T10:08:51.000Z
venv/lib/python3.8/site-packages/keras/api/_v1/keras/__init__.py
JIANG-CX/data_labeling
8d2470bbb537dfc09ed2f7027ed8ee7de6447248
[ "MIT" ]
null
null
null
venv/lib/python3.8/site-packages/keras/api/_v1/keras/__init__.py
JIANG-CX/data_labeling
8d2470bbb537dfc09ed2f7027ed8ee7de6447248
[ "MIT" ]
null
null
null
# This file is MACHINE GENERATED! Do not edit. # Generated by: tensorflow/python/tools/api/generator/create_python_api.py script. """Public API for tf.keras namespace. """ from __future__ import print_function as _print_function import sys as _sys from keras import __version__ from keras.api._v1.keras import activations from keras.api._v1.keras import applications from keras.api._v1.keras import backend from keras.api._v1.keras import callbacks from keras.api._v1.keras import constraints from keras.api._v1.keras import datasets from keras.api._v1.keras import estimator from keras.api._v1.keras import experimental from keras.api._v1.keras import initializers from keras.api._v1.keras import layers from keras.api._v1.keras import losses from keras.api._v1.keras import metrics from keras.api._v1.keras import mixed_precision from keras.api._v1.keras import models from keras.api._v1.keras import optimizers from keras.api._v1.keras import preprocessing from keras.api._v1.keras import regularizers from keras.api._v1.keras import utils from keras.api._v1.keras import wrappers from keras.engine.input_layer import Input from keras.engine.sequential import Sequential from keras.engine.training import Model del _print_function from tensorflow.python.util import module_wrapper as _module_wrapper if not isinstance(_sys.modules[__name__], _module_wrapper.TFModuleWrapper): _sys.modules[__name__] = _module_wrapper.TFModuleWrapper( _sys.modules[__name__], "keras", public_apis=None, deprecation=True, has_lite=False)
36.714286
82
0.822309
235
1,542
5.13617
0.310638
0.1715
0.188898
0.220381
0.474731
0.474731
0.081193
0.081193
0.081193
0
0
0.013768
0.105058
1,542
41
83
37.609756
0.86087
0.10441
0
0
1
0
0.003642
0
0
0
0
0
0
1
0
true
0
0.83871
0
0.83871
0.064516
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
1
0
1
0
0
0
0
5
ec6d9226b407d9a48482959920de0452733155a5
41
py
Python
tests/__init__.py
pepomes/ledger_diff
3ac414c8079e707e7b84ea757cb02a65b3b19227
[ "MIT" ]
null
null
null
tests/__init__.py
pepomes/ledger_diff
3ac414c8079e707e7b84ea757cb02a65b3b19227
[ "MIT" ]
null
null
null
tests/__init__.py
pepomes/ledger_diff
3ac414c8079e707e7b84ea757cb02a65b3b19227
[ "MIT" ]
null
null
null
"""Unit test package for ledger_diff."""
20.5
40
0.707317
6
41
4.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.121951
41
1
41
41
0.777778
0.829268
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
ec8db7816a3ee22397b571d9a18bc8b27c6d202d
832
py
Python
matematica/primos.py
FabianoBill/Estudos-em-python
32c3f9e37b83630c923ff7c0c77aa7d80fbc3174
[ "MIT" ]
1
2021-05-24T19:44:04.000Z
2021-05-24T19:44:04.000Z
matematica/primos.py
FabianoBill/Estudos-em-python
32c3f9e37b83630c923ff7c0c77aa7d80fbc3174
[ "MIT" ]
null
null
null
matematica/primos.py
FabianoBill/Estudos-em-python
32c3f9e37b83630c923ff7c0c77aa7d80fbc3174
[ "MIT" ]
null
null
null
def maior_primo(n): """ Recebe n >= 2 e devolve o próximo número primo > n. Ex: >>> maior_primo(7) 11 >>> maior_primo(25) 29 :param n: number :return: number """ while n >= 2: c = 0 p = n + 1 while 1 <= p <= n + 1: if (n + 1) % p == 0: c += 1 p -= 1 if c == 2: return n + 1 n += 1 def menor_primo(n): """ Recebe n >= 2 e devolve o próximo número primo < n. Ex: >>> menor_primo(100) 97 >>> menor_primo(7) 5 :param n: number :return: number """ while n >= 2: c = 0 p = n - 1 while 1 <= p <= n - 1: if (n - 1) % p == 0: c += 1 p -= 1 if c == 2: return n - 1 n -= 1
17.702128
59
0.362981
116
832
2.551724
0.25
0.067568
0.040541
0.087838
0.763514
0.763514
0.763514
0.763514
0.763514
0.763514
0
0.096154
0.5
832
46
60
18.086957
0.615385
0.323317
0
0.454545
0
0
0
0
0
0
0
0
0
1
0.090909
false
0
0
0
0.181818
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
eca224e58eb80c3226a2e05de0ff920ca9abd741
42
py
Python
cvxgraphalgs/structures/__init__.py
hermish/cvx-graph-algorithms
733e137a906bd6c2965d5853d2798a8a01db945c
[ "MIT" ]
7
2020-05-11T10:01:31.000Z
2021-11-16T16:08:29.000Z
cvxgraphalgs/structures/__init__.py
hermish/graph-algorithms
733e137a906bd6c2965d5853d2798a8a01db945c
[ "MIT" ]
1
2020-05-12T16:15:33.000Z
2020-06-05T16:40:57.000Z
cvxgraphalgs/structures/__init__.py
hermish/cvx-graph-algorithms
733e137a906bd6c2965d5853d2798a8a01db945c
[ "MIT" ]
null
null
null
from cvxgraphalgs.structures.cut import *
21
41
0.833333
5
42
7
1
0
0
0
0
0
0
0
0
0
0
0
0.095238
42
1
42
42
0.921053
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
ecb8efa1685b966af3415bd9e419ca226a5fe81b
222
py
Python
sika/task_bypass/tasktypes/filter/sql.py
rainyjonne/airbnb-pipeline
5e07e26519ac86dc5a58cc4b34710818edd241ae
[ "MIT" ]
null
null
null
sika/task_bypass/tasktypes/filter/sql.py
rainyjonne/airbnb-pipeline
5e07e26519ac86dc5a58cc4b34710818edd241ae
[ "MIT" ]
null
null
null
sika/task_bypass/tasktypes/filter/sql.py
rainyjonne/airbnb-pipeline
5e07e26519ac86dc5a58cc4b34710818edd241ae
[ "MIT" ]
null
null
null
from pandasql import sqldf # input: string & dataframe -> output: dataframe def sql(_last_output_name, df, syntax): globals()[_last_output_name] = df filtered_df = sqldf(syntax, globals()) return filtered_df
24.666667
48
0.725225
29
222
5.275862
0.586207
0.130719
0.183007
0.20915
0
0
0
0
0
0
0
0
0.175676
222
8
49
27.75
0.836066
0.207207
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
5
ecc39453ae7985073d4aa5d6374c7117d593cd0d
166
py
Python
dhukiya/apps/core/templatetags/page_title.py
fikryans/dhukiya_porto
9108e51a2feeb275e07c77f81edae07636cf89b6
[ "MIT" ]
null
null
null
dhukiya/apps/core/templatetags/page_title.py
fikryans/dhukiya_porto
9108e51a2feeb275e07c77f81edae07636cf89b6
[ "MIT" ]
null
null
null
dhukiya/apps/core/templatetags/page_title.py
fikryans/dhukiya_porto
9108e51a2feeb275e07c77f81edae07636cf89b6
[ "MIT" ]
null
null
null
from django import template from ..models import Setting register = template.Library() @register.simple_tag() def home_page_title(): return Setting.objects.all()
23.714286
32
0.777108
22
166
5.727273
0.772727
0
0
0
0
0
0
0
0
0
0
0
0.120482
166
7
32
23.714286
0.863014
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0.166667
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
5
ecd8869715f25aa6304200f93a481cb6588c709d
29
py
Python
__scraping__/aliexpress.com - requests, urllib, API/aliexpress_api_client/__init__.py
whitmans-max/python-examples
881a8f23f0eebc76816a0078e19951893f0daaaa
[ "MIT" ]
140
2017-02-21T22:49:04.000Z
2022-03-22T17:51:58.000Z
__scraping__/aliexpress.com - requests, urllib, API/aliexpress_api_client/__init__.py
whitmans-max/python-examples
881a8f23f0eebc76816a0078e19951893f0daaaa
[ "MIT" ]
5
2017-12-02T19:55:00.000Z
2021-09-22T23:18:39.000Z
__scraping__/aliexpress.com - requests, urllib, API/aliexpress_api_client/__init__.py
whitmans-max/python-examples
881a8f23f0eebc76816a0078e19951893f0daaaa
[ "MIT" ]
79
2017-01-25T10:53:33.000Z
2022-03-11T16:13:57.000Z
from .core import AliExpress
14.5
28
0.827586
4
29
6
1
0
0
0
0
0
0
0
0
0
0
0
0.137931
29
1
29
29
0.96
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
ece04cc56d644422e9a808a3c2a73b6b1b76a048
150
py
Python
Mecanica/cinematica/__init__.py
VictorArnaud/Fisica
081c0b358339ad2dbe615fb43bb1a792cc360442
[ "MIT" ]
2
2020-07-20T13:00:44.000Z
2022-01-11T10:55:29.000Z
Mecanica/cinematica/__init__.py
VictorArnaud/Fisica
081c0b358339ad2dbe615fb43bb1a792cc360442
[ "MIT" ]
null
null
null
Mecanica/cinematica/__init__.py
VictorArnaud/Fisica
081c0b358339ad2dbe615fb43bb1a792cc360442
[ "MIT" ]
null
null
null
from .basico import Basico from .lancamento import LancamentoVertical from .mu import MU from .muv import MUV from .ultrapassagem import Ultrapassagem
30
42
0.84
20
150
6.3
0.4
0
0
0
0
0
0
0
0
0
0
0
0.126667
150
5
43
30
0.961832
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.2
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
0
0
0
5
ece71b58a4c0f01bde7919683d35726950ef78e4
168
py
Python
dynaconfig/exceptions.py
CD3/dynaconfig
8960a739d1095b50764abf83519554c2ab1ddfd5
[ "MIT" ]
null
null
null
dynaconfig/exceptions.py
CD3/dynaconfig
8960a739d1095b50764abf83519554c2ab1ddfd5
[ "MIT" ]
1
2020-09-01T17:06:37.000Z
2020-09-03T11:54:20.000Z
renderconftree/exceptions.py
CD3/renderconftree
c2c8a63bc66835e2b1ac7aee8a18466bf8c38375
[ "MIT" ]
null
null
null
class CircularDependency(Exception): pass class UnparsedExpressions(Exception): pass class UnknownFilter(Exception): pass class FilterError(Exception): pass
14
37
0.791667
16
168
8.3125
0.4375
0.390977
0.406015
0
0
0
0
0
0
0
0
0
0.136905
168
11
38
15.272727
0.917241
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
01b73cfcf4783c38a195cb1db2e01fa36ce56c80
132
py
Python
awesome100/filters.py
sks444/awesome100
ae9f16d4101ffc2be9140e77cec1f0b67b725af0
[ "MIT" ]
2
2018-10-30T05:30:50.000Z
2020-05-22T14:42:35.000Z
awesome100/filters.py
sks444/awesome100
ae9f16d4101ffc2be9140e77cec1f0b67b725af0
[ "MIT" ]
34
2018-04-13T11:01:44.000Z
2018-04-18T23:06:20.000Z
awesome100/filters.py
sks444/awesome100
ae9f16d4101ffc2be9140e77cec1f0b67b725af0
[ "MIT" ]
null
null
null
import logging class NoDebugFilter(logging.Filter): def filter(self, record): return record.levelname is not 'DEBUG'
16.5
46
0.712121
16
132
5.875
0.8125
0
0
0
0
0
0
0
0
0
0
0
0.204545
132
7
47
18.857143
0.895238
0
0
0
0
0
0.037879
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
01f470006c206f0bea3291651c0957fc5599b694
86
py
Python
enthought/units/api.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
3
2016-12-09T06:05:18.000Z
2018-03-01T13:00:29.000Z
enthought/units/api.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
1
2020-12-02T00:51:32.000Z
2020-12-02T08:48:55.000Z
enthought/units/api.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
null
null
null
# proxy module from __future__ import absolute_import from scimath.units.api import *
21.5
38
0.825581
12
86
5.5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.127907
86
3
39
28.666667
0.88
0.139535
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
bf010dfc245f932afdbc6d1b69d7571ba3ec0793
48
py
Python
grafanalib/__init__.py
STandon-3/grafanalib
dcc30c0f97a796991916e2c4c46632e986e88461
[ "Apache-2.0" ]
1,469
2016-12-06T17:57:50.000Z
2022-03-26T22:45:32.000Z
grafanalib/__init__.py
sdementen/grafanalib
915ed42f451a78a2faf1fc76be809129f6d38554
[ "Apache-2.0" ]
267
2016-12-14T10:02:56.000Z
2022-03-28T12:02:58.000Z
grafanalib/__init__.py
sdementen/grafanalib
915ed42f451a78a2faf1fc76be809129f6d38554
[ "Apache-2.0" ]
261
2016-12-11T22:50:28.000Z
2022-03-30T04:44:54.000Z
"""Routines for building Grafana dashboards."""
24
47
0.75
5
48
7.2
1
0
0
0
0
0
0
0
0
0
0
0
0.104167
48
1
48
48
0.837209
0.854167
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
174bdf19092d1bd4e3b5d9672dd76c8ef00b603a
36
py
Python
yaksok/__main__.py
EunDaengED/yaksok
0460b19660372f298d6fbe6f3a1cd3f1f77c442f
[ "BSD-3-Clause" ]
170
2015-03-31T16:01:37.000Z
2022-03-31T06:19:05.000Z
yaksok/__main__.py
seojunyang/yaksok
73f14863d04f054eef2926f25a091f72f60352a5
[ "BSD-3-Clause" ]
13
2015-04-05T22:52:43.000Z
2022-03-31T06:24:17.000Z
yaksok/__main__.py
seojunyang/yaksok
73f14863d04f054eef2926f25a091f72f60352a5
[ "BSD-3-Clause" ]
31
2015-04-01T00:48:35.000Z
2022-03-31T07:54:50.000Z
from . import yaksok yaksok.main()
9
20
0.722222
5
36
5.2
0.8
0
0
0
0
0
0
0
0
0
0
0
0.166667
36
3
21
12
0.866667
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
1765528a24fc6442d5d1e94d5616768cab6341ad
185
py
Python
tests/res/apps/templatelibs_app/templatetags/portable_filters.py
spothero/coffin
9ea6a9173cbfed592c5b4776c489dba8d9280d52
[ "BSD-3-Clause" ]
1
2016-11-19T06:32:20.000Z
2016-11-19T06:32:20.000Z
tests/res/apps/templatelibs_app/templatetags/portable_filters.py
spothero/coffin
9ea6a9173cbfed592c5b4776c489dba8d9280d52
[ "BSD-3-Clause" ]
null
null
null
tests/res/apps/templatelibs_app/templatetags/portable_filters.py
spothero/coffin
9ea6a9173cbfed592c5b4776c489dba8d9280d52
[ "BSD-3-Clause" ]
1
2019-08-14T09:51:23.000Z
2019-08-14T09:51:23.000Z
"""Register a portable filter with a Coffin library object. """ def foo(value): return "{foo}" from coffin.template import Library register = Library() register.filter('foo', foo)
20.555556
59
0.718919
25
185
5.32
0.6
0.225564
0
0
0
0
0
0
0
0
0
0
0.151351
185
9
60
20.555556
0.847134
0.302703
0
0
0
0
0.065041
0
0
0
0
0
0
1
0.2
false
0
0.2
0.2
0.6
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
5
1778682188dc3b786d2fd8f1626a1f14874c08e0
199
py
Python
apps/inventory/models/__init__.py
luishgranja/superdrogas
721327fca32374199e434d38bb77ca714e2da25c
[ "MIT" ]
8
2019-06-05T00:57:34.000Z
2020-06-16T09:38:52.000Z
apps/inventory/models/__init__.py
luishgranja/superdrogas
721327fca32374199e434d38bb77ca714e2da25c
[ "MIT" ]
16
2020-02-12T00:32:20.000Z
2022-03-11T23:48:38.000Z
apps/inventory/models/__init__.py
ivanmtoroc/superdrogas
77762bfd09ca7c4973e3a05c415218d6e2c04b84
[ "MIT" ]
9
2020-05-01T06:54:28.000Z
2022-02-11T11:31:49.000Z
""" Inventory models Manage inventory data in the database """ from .batch_model import Batch from .brand_model import Brand from .category_model import Category from .product_model import Product
18.090909
37
0.809045
28
199
5.607143
0.5
0.280255
0
0
0
0
0
0
0
0
0
0
0.140704
199
10
38
19.9
0.918129
0.276382
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
178b4c4817b8f5fd40e831c1abf1781bd2ab9d36
57
py
Python
pia/blueprints/builtin/__init__.py
soasme/bamboo
5c2b879dcbeafc46990d6bfda6f376acc7a55f01
[ "0BSD" ]
4
2016-04-04T17:30:43.000Z
2016-04-11T11:03:38.000Z
pia/blueprints/builtin/__init__.py
soasme/pia
5c2b879dcbeafc46990d6bfda6f376acc7a55f01
[ "0BSD" ]
2
2016-04-04T09:44:57.000Z
2016-04-04T09:49:44.000Z
pia/blueprints/builtin/__init__.py
soasme/pia
5c2b879dcbeafc46990d6bfda6f376acc7a55f01
[ "0BSD" ]
null
null
null
# -*- coding: utf-8 -*- from .core import bp as builtin
14.25
31
0.614035
9
57
3.888889
1
0
0
0
0
0
0
0
0
0
0
0.022222
0.210526
57
3
32
19
0.755556
0.368421
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
bda22e10be35af35c845c951791d5c7e26884a95
7,180
py
Python
dataset/nyu.py
FLHonker/MKAT-code
39260ae70d5a304892031da2013a1be48d118f03
[ "MIT" ]
1
2022-02-28T15:16:35.000Z
2022-02-28T15:16:35.000Z
dataset/nyu.py
FLHonker/MKAT-code
39260ae70d5a304892031da2013a1be48d118f03
[ "MIT" ]
null
null
null
dataset/nyu.py
FLHonker/MKAT-code
39260ae70d5a304892031da2013a1be48d118f03
[ "MIT" ]
null
null
null
#coding:utf-8 import os import torch import torch.utils.data as data from PIL import Image from scipy.io import loadmat import numpy as np import glob from torchvision import transforms import random import matplotlib.pyplot as plt def colormap(N=256, normalized=False): def bitget(byteval, idx): return ((byteval & (1 << idx)) != 0) dtype = 'float32' if normalized else 'uint8' cmap = np.zeros((N, 3), dtype=dtype) for i in range(N): r = g = b = 0 c = i for j in range(8): r = r | (bitget(c, 0) << 7-j) g = g | (bitget(c, 1) << 7-j) b = b | (bitget(c, 2) << 7-j) c = c >> 3 cmap[i] = np.array([r, g, b]) cmap = cmap/255 if normalized else cmap return cmap class NYUv2(data.Dataset): """NYUv2 depth dataset loader. **Parameters:** - **root** (string): Root directory path. - **split** (string, optional): 'train' for training set, and 'test' for test set. Default: 'train'. - **num_classes** (string, optional): The number of classes, must be 40 or 13. Default:13. - **transform** (callable, optional): A function/transform that takes in an PIL image and returns a transformed version. Default: None. - **target_transforms** (callable, optional): A list of function/transform that takes in the target and transform it. Default: None. - **ds_type** (string, optional): To pick samples with labels or not. Default: 'labeled'. """ cmap = colormap() def __init__(self, root, split='train', num_classes=13, transform=None, ds_type='labeled'): assert(split in ('train', 'test')) assert(ds_type in ('labeled', 'unlabeled')) self.root = root self.split = split self.ds_type = ds_type self.transform = transform self.num_classes = num_classes self.train_idx = np.array([255, ] + list(range(num_classes))) if ds_type == 'labeled': split_mat = loadmat(os.path.join( self.root, 'nyuv2-meta-data', 'splits.mat')) idxs = split_mat[self.split+'Ndxs'].reshape(-1) self.images = [os.path.join(self.root, '480_640', 'IMAGE', '%d.png' % (idx-1)) for idx in idxs] if self.num_classes == 13: self.targets = [os.path.join(self.root, 'nyuv2-meta-data', '%s_labels_13' % self.split, 'new_nyu_class13_%04d.png' % idx) for idx in idxs] elif self.num_classes == 40: self.targets = [os.path.join(self.root, '480_640', 'SEGMENTATION', '%04d.png' % idx) for idx in idxs] else: raise ValueError( 'Invalid number of classes! Please use 13 or 40') else: self.images = [glob.glob(os.path.join( self.root, 'unlabeled_images/*.png'))] print(self.split, len(self.images)) def __getitem__(self, idx): if self.ds_type == 'labeled': image = Image.open(self.images[idx]) target = Image.open(self.targets[idx]) if self.transform: image, target = self.transform(image, target) #print(target) target = self.train_idx[target] return image, target else: image = Image.open(self.images[idx]) if self.transforms is not None: image = self.transforms(image) image = transforms.ToTensor()(image) return image, None def __len__(self): return len(self.images) @classmethod def decode_target(cls, target): target = (target+1).astype('uint8') # 255 -> 0, 0->1, 1->2 return cls.cmap[target] class NYUv2Depth(data.Dataset): """NYUv2 depth dataset loader. **Parameters:** - **root** (string): Root directory path. - **split** (string, optional): 'train' for training set, and 'test' for test set. Default: 'train'. - **num_classes** (string, optional): The number of classes, must be 40 or 13. Default:13. - **transform** (callable, optional): A function/transform that takes in an PIL image and returns a transformed version. Default: None. - **target_transforms** (callable, optional): A list of function/transform that takes in the target and transform it. Default: None. - **ds_type** (string, optional): To pick samples with labels or not. Default: 'labeled'. """ cmap = colormap() def __init__(self, root, split='train', num_classes=13, transform=None, #target_transforms=None, ds_type='labeled'): assert(split in ('train', 'test')) assert(ds_type in ('labeled', 'unlabeled')) self.root = root self.split = split self.ds_type = ds_type self.transform = transform self.num_classes = num_classes self.train_idx = np.array([255, ] + list(range(num_classes))) if ds_type == 'labeled': split_mat = loadmat(os.path.join( self.root, 'nyuv2-meta-data', 'splits.mat')) idxs = split_mat[self.split+'Ndxs'].reshape(-1) self.images = [os.path.join(self.root, '480_640', 'IMAGE', '%d.png' % (idx-1)) for idx in idxs] if self.num_classes == 13: self.targets = [os.path.join(self.root, 'nyuv2-meta-data', '%s_labels_13' % self.split, 'new_nyu_class13_%04d.png' % idx) for idx in idxs] elif self.num_classes == 40: self.targets = [os.path.join(self.root, '480_640', 'SEGMENTATION', '%04d.png' % idx) for idx in idxs] else: raise ValueError( 'Invalid number of classes! Please use 13 or 40') self.depths = [os.path.join( self.root, 'FINAL_480_640', 'DEPTH', '%04d.png' % idx) for idx in idxs] else: self.images = [glob.glob(os.path.join( self.root, 'unlabeled_images/*.png'))] def __getitem__(self, idx): if self.ds_type == 'labeled': image = Image.open(self.images[idx]) depth = Image.open(self.depths[idx]) #print(np.array(depth,dtype='float').max()) if self.transform: image, depth = self.transform(image, depth) return image, depth / 1000 else: image = Image.open(self.images[idx]) if self.transform is not None: image = self.transform(image) #image = transforms.ToTensor()(image) return image, None def __len__(self): return len(self.images) @classmethod def decode_target(cls, target): cm = plt.get_cmap('jet') target = (target/7).clip(0,1) target = cm(target)[:,:,:,:3] return target
37.202073
143
0.546797
877
7,180
4.381984
0.179019
0.031226
0.028623
0.040073
0.755399
0.741348
0.741348
0.741348
0.735883
0.716628
0
0.028507
0.325766
7,180
192
144
37.395833
0.765338
0.204875
0
0.642336
0
0
0.095035
0.016373
0
0
0
0
0.029197
1
0.072993
false
0
0.072993
0.021898
0.248175
0.007299
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
bdbb8425172b52d06c04862a403cf8ba05b1bf52
58
py
Python
src/utils/Debugging.py
Gabvaztor/tensorflowCode
e206ea4544552b87c2d43274cea3182f6b385a87
[ "Apache-2.0" ]
4
2019-12-14T08:06:18.000Z
2020-09-12T10:09:31.000Z
src/utils/Debugging.py
Gabvaztor/tensorflowCode
e206ea4544552b87c2d43274cea3182f6b385a87
[ "Apache-2.0" ]
null
null
null
src/utils/Debugging.py
Gabvaztor/tensorflowCode
e206ea4544552b87c2d43274cea3182f6b385a87
[ "Apache-2.0" ]
2
2020-09-12T10:10:07.000Z
2021-09-15T11:58:37.000Z
string_separator = '-------------------------------------'
58
58
0.275862
2
58
7.5
1
0
0
0
0
0
0
0
0
0
0
0
0.034483
58
1
58
58
0.267857
0
0
0
0
0
0.627119
0.627119
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
1
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
da4338fc4b10b89806b530c0fca61e76e37aae6a
114
py
Python
tests/test_jupytoc.py
axelbellec/Jupytoc
66f4ff89b4a7e00f7b1fb58a03be0cb46b6f6d2e
[ "MIT" ]
2
2016-11-23T23:12:47.000Z
2019-05-08T19:24:32.000Z
tests/test_jupytoc.py
axelbellec/Jupytoc
66f4ff89b4a7e00f7b1fb58a03be0cb46b6f6d2e
[ "MIT" ]
1
2016-11-25T16:49:17.000Z
2016-11-25T16:49:17.000Z
tests/test_jupytoc.py
axelbellec/Jupytoc
66f4ff89b4a7e00f7b1fb58a03be0cb46b6f6d2e
[ "MIT" ]
null
null
null
import sure from jupytoc import core def test_jupytoc_class_exists(): core.should.have.property('Jupytoc')
14.25
40
0.77193
16
114
5.3125
0.75
0
0
0
0
0
0
0
0
0
0
0
0.140351
114
7
41
16.285714
0.867347
0
0
0
0
0
0.061404
0
0
0
0
0
0
1
0.25
true
0
0.5
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
1
0
0
0
0
5
16f9da207a6a8269bc8e5c3b3bfba4ba3ec3de8c
143
py
Python
scrape.py
Kazuhiro47/Another-SDSE
a0b5fdabc4bb9df318b7936ac36b87ebeebae9e0
[ "MIT" ]
4
2018-01-31T20:54:33.000Z
2020-12-08T23:10:05.000Z
scrape.py
Kazuhiro47/Another-SDSE
a0b5fdabc4bb9df318b7936ac36b87ebeebae9e0
[ "MIT" ]
null
null
null
scrape.py
Kazuhiro47/Another-SDSE
a0b5fdabc4bb9df318b7936ac36b87ebeebae9e0
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """@package scrape @date Created on nov. 15 09:30 2017 @author samuel_r """ def get_translation(jp_text): return
14.3
35
0.657343
22
143
4.136364
1
0
0
0
0
0
0
0
0
0
0
0.094017
0.181818
143
9
36
15.888889
0.683761
0.636364
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
e505ab2794978b07993464d8b6ccda98b9506d12
80
py
Python
app/apis/v1/roles/models/__init__.py
excalibur1987/team-management
ed6dfaf83280dad947edb31b404680d6083d7e62
[ "MIT" ]
null
null
null
app/apis/v1/roles/models/__init__.py
excalibur1987/team-management
ed6dfaf83280dad947edb31b404680d6083d7e62
[ "MIT" ]
null
null
null
app/apis/v1/roles/models/__init__.py
excalibur1987/team-management
ed6dfaf83280dad947edb31b404680d6083d7e62
[ "MIT" ]
null
null
null
from ._Role import Role from ._RoleEntityPermission import RoleEntityPermission
26.666667
55
0.875
8
80
8.5
0.5
0
0
0
0
0
0
0
0
0
0
0
0.1
80
2
56
40
0.944444
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
e50b6e8bd66ebe74f3a746fff16807c8f81eccc8
190
py
Python
crestify/archivers/archive_service.py
punto1/crestify
7353979118a0a86b2431d21090444d31215d4cbb
[ "BSD-3-Clause" ]
214
2016-02-26T11:51:32.000Z
2019-08-13T01:33:03.000Z
crestify/archivers/archive_service.py
punto1/crestify
7353979118a0a86b2431d21090444d31215d4cbb
[ "BSD-3-Clause" ]
29
2017-04-10T08:15:11.000Z
2019-03-09T08:46:50.000Z
crestify/archivers/archive_service.py
dhamaniasad/crestify
7ee095d7a8ccecc902edf3fd143f7051b67ef229
[ "BSD-3-Clause" ]
25
2016-03-22T15:18:29.000Z
2019-07-16T05:48:18.000Z
# -*- coding: utf-8 -*- class ArchiveService: def get_service_name(self): return 'DEFAULT' def submit(self, url): pass class ArchiveException(Exception): pass
15.833333
34
0.626316
21
190
5.571429
0.809524
0
0
0
0
0
0
0
0
0
0
0.007092
0.257895
190
11
35
17.272727
0.822695
0.110526
0
0.285714
0
0
0.041916
0
0
0
0
0
0
1
0.285714
false
0.285714
0
0.142857
0.714286
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
5
e53f5672e79f38b682784c324d0aef59480c3b2b
184
py
Python
Ej16Busqueda.py
mariaSerrabona/EjerciciosColectivos
c3a1d50d618bd932d398badfb2d5c9dc98d375e4
[ "Apache-2.0" ]
null
null
null
Ej16Busqueda.py
mariaSerrabona/EjerciciosColectivos
c3a1d50d618bd932d398badfb2d5c9dc98d375e4
[ "Apache-2.0" ]
null
null
null
Ej16Busqueda.py
mariaSerrabona/EjerciciosColectivos
c3a1d50d618bd932d398badfb2d5c9dc98d375e4
[ "Apache-2.0" ]
null
null
null
"""Implemente el método de mediana de tres para seleccionar un valor pivote como una modificación de ordenamientoRapido. Lleve a cabo un experimento para comparar las dos técnicas. """
61.333333
97
0.809783
27
184
5.518519
0.851852
0
0
0
0
0
0
0
0
0
0
0
0.146739
184
3
98
61.333333
0.949045
0.961957
0
null
0
null
0
0
null
0
0
0.333333
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
1
0
0
0
1
0
0
0
0
0
0
5
e55d3af6f8175ba555932838caca09a611111362
1,251
py
Python
src/pydes/exp/__init__.py
gmarciani/demule
72168ba3aca84f58a882bebc821bbf85ee08dcde
[ "MIT" ]
1
2021-03-06T11:05:22.000Z
2021-03-06T11:05:22.000Z
src/pydes/exp/__init__.py
gmarciani/pydes
72168ba3aca84f58a882bebc821bbf85ee08dcde
[ "MIT" ]
null
null
null
src/pydes/exp/__init__.py
gmarciani/pydes
72168ba3aca84f58a882bebc821bbf85ee08dcde
[ "MIT" ]
null
null
null
""" Keep in mind the following table: ╔════════════╦════════════════════════════════════════════════╗ ║ ║ BITS ║ ║ ╠═════╦═══════╦════════════╦═════════════════════╣ ║ ║ 8 ║ 16 ║ 32 ║ 64 ║ ╠════════════╬═════╬═══════╬════════════╬═════════════════════╣ ║ MODULUS ║ 127 ║ 32479 ║ 2147483647 ║ 9223372036854775783 ║ ╠════════════╬═════╬═══════╬════════════╬═════════════════════╣ ║ MULTIPLIER ║ 14 ║ 16374 ║ 48271 ║ ║ ╠════════════╬═════╬═══════╬════════════╬═════════════════════╣ ║ STREAMS ║ 64 ║ 128 ║ 256 ║ 512 ║ ╠════════════╬═════╬═══════╬════════════╬═════════════════════╣ ║ JUMPER ║ 14 ║ 32748 ║ 22925 ║ ║ ╠════════════╬═════╬═══════╬════════════╬═════════════════════╣ ║ CHECKV ║ ║ ║ 399268537 ║ ║ ╠════════════╬═════╬═══════╬════════════╬═════════════════════╣ ║ CHECKI ║ ║ ║ 10000 ║ ║ ╚════════════╩═════╩═══════╩════════════╩═════════════════════╝ """ # import os # EXP_DIR = os.path.dirname(os.path.abspath(__file__)) + '/resources' # PLT_EXT = 'svg' # RES_EXT = 'txt'
44.678571
69
0.195044
106
1,251
7.896226
0.471698
0.026284
0.46595
0.236559
0
0
0
0
0
0
0
0.106407
0.301359
1,251
27
70
46.333333
0.16476
0.985612
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
e5ee65b14d07a693cdd4a2320971f0905fc6ae74
74
py
Python
src/zhinst/toolkit/interface/__init__.py
abdurakhimov/zhinst-toolkit
a09a58bd0bfb473800136306989691329e77e90f
[ "MIT" ]
14
2020-07-09T09:14:39.000Z
2022-03-23T05:15:40.000Z
src/zhinst/toolkit/interface/__init__.py
abdurakhimov/zhinst-toolkit
a09a58bd0bfb473800136306989691329e77e90f
[ "MIT" ]
104
2020-08-07T09:38:40.000Z
2022-03-29T11:42:32.000Z
src/zhinst/toolkit/interface/__init__.py
abdurakhimov/zhinst-toolkit
a09a58bd0bfb473800136306989691329e77e90f
[ "MIT" ]
16
2020-07-09T09:17:36.000Z
2022-01-18T14:16:08.000Z
from .interface import InstrumentConfiguration, DeviceTypes, LoggerModule
37
73
0.878378
6
74
10.833333
1
0
0
0
0
0
0
0
0
0
0
0
0.081081
74
1
74
74
0.955882
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
e5f2ced8a4d509f10f816bb07a292dbef04c6f16
51
py
Python
.venv/lib/python3.8/site-packages/cleo/config/__init__.py
RivtLib/replit01
ce1ae18b446a9c844f40e88a51c71fbc45ab3ad7
[ "MIT" ]
1
2020-08-07T16:09:57.000Z
2020-08-07T16:09:57.000Z
.venv/lib/python3.8/site-packages/cleo/config/__init__.py
RivtLib/replit01
ce1ae18b446a9c844f40e88a51c71fbc45ab3ad7
[ "MIT" ]
null
null
null
.venv/lib/python3.8/site-packages/cleo/config/__init__.py
RivtLib/replit01
ce1ae18b446a9c844f40e88a51c71fbc45ab3ad7
[ "MIT" ]
null
null
null
from .application_config import ApplicationConfig
25.5
50
0.882353
5
51
8.8
1
0
0
0
0
0
0
0
0
0
0
0
0.098039
51
1
51
51
0.956522
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
e5f60523db8fe4a1da0aeaa2059442c4cd259170
174
py
Python
configs/nuimages/htc_r50_fpn_coco-20e_1x_nuim.py
Guangyun-Xu/mmdetection3d
75c5c6cd590386bd1539a686c5fd2cc45c5480d5
[ "Apache-2.0" ]
2,216
2020-07-09T19:10:11.000Z
2022-03-31T12:39:26.000Z
configs/nuimages/htc_r50_fpn_coco-20e_1x_nuim.py
Guangyun-Xu/mmdetection3d
75c5c6cd590386bd1539a686c5fd2cc45c5480d5
[ "Apache-2.0" ]
1,174
2020-07-10T07:02:28.000Z
2022-03-31T12:38:56.000Z
configs/nuimages/htc_r50_fpn_coco-20e_1x_nuim.py
Guangyun-Xu/mmdetection3d
75c5c6cd590386bd1539a686c5fd2cc45c5480d5
[ "Apache-2.0" ]
681
2020-07-09T19:40:06.000Z
2022-03-31T11:02:24.000Z
_base_ = './htc_r50_fpn_1x_nuim.py' load_from = 'http://download.openmmlab.com/mmdetection/v2.0/htc/htc_r50_fpn_20e_coco/htc_r50_fpn_20e_coco_20200319-fe28c577.pth' # noqa
43.5
136
0.810345
31
174
4.032258
0.709677
0.144
0.216
0.192
0.256
0
0
0
0
0
0
0.158537
0.057471
174
3
137
58
0.603659
0.022989
0
0
0
0.5
0.821429
0.142857
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
f91bf5285d2341b509e118b7a347a28f868f69da
9,155
py
Python
src/posts/tests_selenium.py
devbabar/django-blog
b9f00ebdd619214631231932c27c06684ab97631
[ "BSD-3-Clause" ]
1
2020-08-03T18:24:55.000Z
2020-08-03T18:24:55.000Z
src/posts/tests_selenium.py
devbabar/django-blog
b9f00ebdd619214631231932c27c06684ab97631
[ "BSD-3-Clause" ]
null
null
null
src/posts/tests_selenium.py
devbabar/django-blog
b9f00ebdd619214631231932c27c06684ab97631
[ "BSD-3-Clause" ]
2
2020-12-17T00:15:29.000Z
2022-02-07T11:20:13.000Z
from django.test import TestCase from django.test import LiveServerTestCase from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver import ActionChains from selenium.webdriver.support import expected_conditions as EC from django.contrib.auth.models import User from django.core.urlresolvers import reverse from posts.models import Post class BasicBlogPostTestCase(LiveServerTestCase): def setUp(self): User.objects.create_user(username="Alex", password="alex1234") self.selenium = webdriver.Firefox() self.selenium.maximize_window() super(BasicBlogPostTestCase, self).setUp() def tearDown(self): # self.selenium.quit() super(BasicBlogPostTestCase, self).tearDown() # '''------------------------------------------------------------------ # Registration with wrong credentials to test form validation errors # ------------------------------------------------------------------''' # def test_registration_with_wrong_credentials(self): # selenium = self.selenium # selenium.get("http://127.0.0.1:8000/posts/") # selenium.find_element_by_id("signup-btn").click() # selenium.find_element_by_id("id_username").send_keys("mark") # selenium.find_element_by_id("id_first_name").send_keys("mark") # selenium.find_element_by_id("id_last_name").send_keys("smith") # selenium.find_element_by_id("id_email").send_keys("mark@gmail.com") # selenium.find_element_by_id("id_password1").send_keys("mark1234") # # wrong password2 # selenium.find_element_by_id("id_password2").send_keys("mark") # selenium.find_element_by_name("register").click() '''------------------------------------------------------------------ Registration with correct credentials ------------------------------------------------------------------''' def test_registration_with_correct_credentials(self): selenium = self.selenium selenium.get("http://127.0.0.1:8000/posts/") selenium.find_element_by_id("signup-btn").click() selenium.find_element_by_id("id_username").send_keys("mark") selenium.find_element_by_id("id_first_name").send_keys("mark") selenium.find_element_by_id("id_last_name").send_keys("smith") selenium.find_element_by_id("id_email").send_keys("mark@gmail.com") selenium.find_element_by_id("id_password1").send_keys("mark1234") selenium.find_element_by_id("id_password2").send_keys("mark1234") selenium.find_element_by_name("register").click() self.selenium.close() '''------------------------------------------------------------------ Login and Logout functions ------------------------------------------------------------------''' def test_login_and_logout(self): selenium = self.selenium #Opening the link we want to test, live_server_url follow the setUp database # selenium.get('%s%s' % (self.live_server_url,reverse("posts:login"))) #url follow the credentials from actual database selenium.get('http://127.0.0.1:8000/posts/accounts/login/') ''' Login with credentials''' username_input = selenium.find_element_by_id("id_username") password_input = selenium.find_element_by_id("id_password") login_click = selenium.find_element_by_name("login") username_input.send_keys("kevin") password_input.send_keys("kevin1234") login_click.click() ''' logout by clicking logout button ''' logout_click = selenium.find_element_by_name("logout") logout_click.click() self.selenium.close() '''------------------------------------------------------------------ Access to Dashboard and Create Post ------------------------------------------------------------------''' def test_dashboard(self): selenium = self.selenium selenium.get('http://127.0.0.1:8000/posts/') wait = WebDriverWait(selenium, 1000) login_dashboard_click = selenium.find_element_by_id("login-btn").click() username_input = selenium.find_element_by_id("id_username") password_input = selenium.find_element_by_id("id_password") login_click = selenium.find_element_by_name("login") username_input.send_keys("kevin") password_input.send_keys("kevin1234") login_click.click() dashboard_btn = selenium.find_element_by_name("dashboard").click() self.selenium.execute_script("window.scrollTo(0,document.body.scrollHeight);") create_post_btn = selenium.find_element_by_id("create-post").click() self.selenium.execute_script("window.scrollTo(0,document.body.scrollHeight);") title_input = selenium.find_element_by_id("id_title") content_input = selenium.find_element_by_id("id_content") image_btn = selenium.find_element_by_xpath("//input[@type='file']") title_input.send_keys("selenium test1") content_input.send_keys("this is a test for selenium automated test") image_btn.send_keys("/Users/babarbaig/Documents/django/final/django_blog/basic_blog/env/src/static/sample_images/foggy_hills.jpg") publish_input = selenium.find_element_by_id("id_publish").click() selenium.find_element_by_link_text("6").click() selenium.find_element_by_id("submit-btn").click() self.selenium.execute_script("window.scrollTo(0,1400);") wait.until(EC.visibility_of_element_located((By.ID,"content-display"))) dashboard_btn = selenium.find_element_by_name("dashboard").click() self.selenium.close() '''------------------------------------------------------------------ Testing @login_required decorator to delete the post ------------------------------------------------------------------''' def test_login_required_decorator(self): selenium = self.selenium selenium.get('http://127.0.0.1:8000/posts/dashboard/1/') def test_delete_post(self): selenium = self.selenium selenium.get("http://127.0.0.1:8000/posts/login") username_input = selenium.find_element_by_id("id_username").send_keys("kevin") password_input = selenium.find_element_by_id("id_password").send_keys("kevin1234") login_click = selenium.find_element_by_name("login").click() dashboard_btn = selenium.find_element_by_name("dashboard").click() delete_post_btn = selenium.find_element_by_class_name("delete-post").click() self.selenium.close() '''------------------------------------------------------------------ Edit the existing post, update title, content and date ------------------------------------------------------------------''' def test_update_post(self): selenium = self.selenium selenium.get("http://127.0.0.1:8000/posts/login") username_input = selenium.find_element_by_id("id_username").send_keys("kevin") password_input = selenium.find_element_by_id("id_password").send_keys("kevin1234") login_click = selenium.find_element_by_name("login").click() dashboard_btn = selenium.find_element_by_name("dashboard").click() delete_post_btn = selenium.find_element_by_class_name("edit-post").click() title_input = selenium.find_element_by_id("id_title").clear() title_input = selenium.find_element_by_id("id_title").send_keys("Post update test1") content_input = selenium.find_element_by_id("id_content").send_keys("this is a test for selenium automated test to edit post") # image_btn = selenium.find_element_by_xpath("//input[@type='file']") # image_btn.send_keys("/Users/babarbaig/Documents/django/final/django_blog/basic_blog/env/src/static/sample_images/foggy_hills.jpg") publish_input = selenium.find_element_by_id("id_publish").click() selenium.find_element_by_link_text("15").click() selenium.find_element_by_class_name("submit-btn").click() self.selenium.execute_script("window.scrollTo(0,1400);") self.selenium.close() '''------------------------------------------------------------------ Draft Post button ------------------------------------------------------------------''' def test_draft_post_btn(self): selenium = self.selenium selenium.get("http://127.0.0.1:8000/posts/login") username_input = selenium.find_element_by_id("id_username").send_keys("kevin") password_input = selenium.find_element_by_id("id_password").send_keys("kevin1234") login_click = selenium.find_element_by_name("login").click() dashboard_btn = selenium.find_element_by_name("dashboard").click() draft_post_btn = selenium.find_element_by_id("draft-post").click() self.selenium.execute_script("window.scrollTo(0,document.body.scrollHeight);") self.selenium.close() '''------------------------------------------------------------------ Future Post button ------------------------------------------------------------------''' def test_future_post_btn(self): selenium = self.selenium selenium.get("http://127.0.0.1:8000/posts/login") username_input = selenium.find_element_by_id("id_username").send_keys("kevin") password_input = selenium.find_element_by_id("id_password").send_keys("kevin1234") login_click = selenium.find_element_by_name("login").click() dashboard_btn = selenium.find_element_by_name("dashboard").click() draft_post_btn = selenium.find_element_by_id("future-post").click() self.selenium.execute_script("window.scrollTo(0,document.body.scrollHeight);") self.selenium.close()
40.688889
134
0.678755
1,149
9,155
5.097476
0.139252
0.12293
0.194639
0.215127
0.705822
0.704968
0.685163
0.665016
0.665016
0.610039
0
0.019001
0.085964
9,155
224
135
40.870536
0.680927
0.136647
0
0.478992
0
0.008403
0.209008
0.054962
0
0
0
0
0
1
0.084034
false
0.092437
0.092437
0
0.184874
0
0
0
0
null
0
1
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
5
0059ddcf89c54e5fba5dff7bcba4bab8a9a6e5a1
54
py
Python
mymodule.py
MarcusDMelv/Modules-and-Packages
921b1bbcae43e99144ad0699bec02ed298aaeedc
[ "Unlicense" ]
null
null
null
mymodule.py
MarcusDMelv/Modules-and-Packages
921b1bbcae43e99144ad0699bec02ed298aaeedc
[ "Unlicense" ]
null
null
null
mymodule.py
MarcusDMelv/Modules-and-Packages
921b1bbcae43e99144ad0699bec02ed298aaeedc
[ "Unlicense" ]
null
null
null
def my_func(): print('Hey I am in my module .py')
18
38
0.611111
11
54
2.909091
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.240741
54
2
39
27
0.780488
0
0
0
0
0
0.462963
0
0
0
0
0
0
1
0.5
true
0
0
0
0.5
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
0
1
0
5
00b938538994b7d4b3e56f111e2ec8fe4467c72b
5,211
py
Python
epytope/Data/pssms/arb/mat/B_1801_10.py
christopher-mohr/epytope
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
[ "BSD-3-Clause" ]
7
2021-02-01T18:11:28.000Z
2022-01-31T19:14:07.000Z
epytope/Data/pssms/arb/mat/B_1801_10.py
christopher-mohr/epytope
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
[ "BSD-3-Clause" ]
22
2021-01-02T15:25:23.000Z
2022-03-14T11:32:53.000Z
epytope/Data/pssms/arb/mat/B_1801_10.py
christopher-mohr/epytope
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
[ "BSD-3-Clause" ]
4
2021-05-28T08:50:38.000Z
2022-03-14T11:45:32.000Z
B_1801_10 = {0: {'A': -0.20414852195261698, 'C': -0.09303522458742573, 'E': 0.462813628429747, 'D': 1.021847975624291, 'G': -0.568520326853175, 'F': 0.47284650125016514, 'I': 0.01148750953705946, 'H': 0.1759793703852634, 'K': -0.5393450393426207, 'M': 1.243954658102086, 'L': 0.05008365445603805, 'N': 0.5539262234522379, 'Q': -0.2521398339469929, 'P': -0.2050947988446696, 'S': -0.15286660750868136, 'R': -0.3774933880842903, 'T': 0.19762802012421768, 'W': 0.4040629639983594, 'V': -0.22299622255522825, 'Y': 0.36544369208299166}, 1: {'A': -4.0, 'C': -0.7359051470414066, 'E': 0.8376093065939714, 'D': -0.7474331638871945, 'G': -4.0, 'F': -0.6578967417637765, 'I': -0.6150939515155593, 'H': -0.7640943604838305, 'K': -0.7640943604838305, 'M': -0.6150939515155593, 'L': -0.21831153338671802, 'N': -4.0, 'Q': -4.0, 'P': -0.7219505266052939, 'S': -0.7359051470414066, 'R': -0.7331070842311451, 'T': -0.6529834339199454, 'W': -0.6578967417637765, 'V': -0.9586214888657072, 'Y': -0.6578967417637765}, 2: {'A': 0.10798547643444077, 'C': -0.26715991835945335, 'E': 0.36081360978274246, 'D': -0.09008219159020757, 'G': -0.6603646436169889, 'F': 0.17118762361553239, 'I': -0.21142602883275693, 'H': -0.3519775718810501, 'K': -0.3706107296171122, 'M': -0.033708820554268694, 'L': 0.1180531834181836, 'N': 0.3829393437819988, 'Q': 0.15859387321494428, 'P': -0.5740299105595835, 'S': 0.44479491479554106, 'R': -0.4071459716837121, 'T': 0.3014931408321418, 'W': 0.6447725034445011, 'V': -0.14013242431559622, 'Y': -0.17654989897114814}, 3: {'A': 0.5663280503397209, 'C': -0.15749572757327682, 'E': -0.2704587122156019, 'D': 0.12570141508751181, 'G': -0.13967251246826115, 'F': 0.16463133961743967, 'I': -0.04871773338910357, 'H': 0.0739467255222277, 'K': -0.17295909237216694, 'M': 0.22334981899261375, 'L': 0.15869426885942625, 'N': -0.48908140258907856, 'Q': 0.4516358335330356, 'P': -0.4968843318952132, 'S': 0.18529822420362338, 'R': 0.04883645147679577, 'T': -0.5725355087908933, 'W': -0.2800411801053027, 'V': -0.1876208867743905, 'Y': 0.11885738321802458}, 4: {'A': 0.19119145015268016, 'C': 0.1340637361810549, 'E': -0.3048865791922139, 'D': 0.23448539358622406, 'G': -0.08355594821285033, 'F': 0.2820467958633979, 'I': -0.22152898776155686, 'H': -0.7733762285825364, 'K': -0.18618751612884646, 'M': -0.12813278956945548, 'L': 0.5791945454365681, 'N': 0.3026857101394684, 'Q': -0.09820175963017401, 'P': -0.6095123230356685, 'S': 0.1470675764203309, 'R': -0.4674575217973605, 'T': 0.30055759558655537, 'W': -0.07139611520842556, 'V': -0.2247033183913327, 'Y': -0.5215699606792437}, 5: {'A': 0.1418419037730798, 'C': 1.047476777113171, 'E': -0.14513920535043723, 'D': -0.2031381286232562, 'G': -0.31570338037099527, 'F': -0.058647158525705574, 'I': 0.5579440676215701, 'H': 0.07414484892820586, 'K': -0.055842410332572236, 'M': 0.18704869087558038, 'L': 0.12220453730280892, 'N': 0.5107765185978944, 'Q': -0.3162078851919444, 'P': -0.38727211791271654, 'S': -0.09232830182931381, 'R': 0.07237744599081297, 'T': -0.7077238762234999, 'W': -0.16721986568429492, 'V': 0.046065573995572984, 'Y': -0.270321839087498}, 6: {'A': 0.03515077951985164, 'C': 0.516457339304653, 'E': -0.10507513327465279, 'D': -0.43402002485478103, 'G': 0.03128316737064395, 'F': 0.38899946058673146, 'I': 0.169373526549728, 'H': -0.660582051344357, 'K': -0.6416800208009236, 'M': -0.06615090022108959, 'L': 0.22729777221049685, 'N': -0.3844854811535258, 'Q': -0.6781382560878352, 'P': -0.15770985939927093, 'S': -0.06847358332003207, 'R': -0.21760485342658858, 'T': 0.4476418449947174, 'W': 0.3504862914437292, 'V': 0.12535619690792038, 'Y': 0.22291349732172314}, 7: {'A': 0.8334426631914846, 'C': -0.19912764797074434, 'E': -0.22187517000096701, 'D': -0.16967724968591916, 'G': 0.03888725236419358, 'F': 0.6300275293832098, 'I': -0.3764837005925863, 'H': 0.24219228715944555, 'K': -0.9791994236411045, 'M': 0.9213008484706979, 'L': -0.33495545465257287, 'N': -0.287663928440889, 'Q': -0.34886003215444444, 'P': -0.11672733301451262, 'S': -0.19613168748321982, 'R': -0.6183733852046136, 'T': -0.03889703040085502, 'W': 0.4637777588069227, 'V': 0.35670684011018766, 'Y': 0.529720557066562}, 8: {'A': 0.25092768361117135, 'C': -0.41226172129818034, 'E': 0.07674934946863102, 'D': -0.12964391657101323, 'G': -0.2053051027661268, 'F': -0.267792463750142, 'I': -0.22285342057658405, 'H': 0.028106699602576817, 'K': 0.34730030660638667, 'M': -0.15020679928391917, 'L': 0.15892649741929457, 'N': -0.4081542544625435, 'Q': -0.19029475713277483, 'P': -0.2685830769923678, 'S': 0.30408191353000913, 'R': -0.18629574533195106, 'T': 0.21750142092504293, 'W': -0.011639374598245598, 'V': 0.059459205014008296, 'Y': -0.08613821897984268}, 9: {'A': 0.04584124051870606, 'C': -0.30539560824076395, 'E': -4.0, 'D': -4.0, 'G': -0.5381450598348739, 'F': 0.4686915717433694, 'I': -0.31833051518632416, 'H': -0.9012837478699065, 'K': -0.9595575476545142, 'M': 1.0183899336538003, 'L': 0.11404706948774408, 'N': -4.0, 'Q': -4.0, 'P': -4.0, 'S': 0.49720739705853406, 'R': -0.9012837478699065, 'T': -0.548321246025092, 'W': -0.49289083923616056, 'V': -0.2855872878705088, 'Y': 0.7440378482198684}, -1: {'slope': 0.10426571741348334, 'intercept': -0.47215760476019286}}
5,211
5,211
0.69622
620
5,211
5.848387
0.358065
0.005516
0.001655
0.002206
0.003861
0.003861
0.003861
0
0
0
0
0.711366
0.079831
5,211
1
5,211
5,211
0.044838
0
0
0
0
0
0.041059
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
1
0
0
1
1
1
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
da99f1316f7f8d21f871a8c028da1f5d0e3a593b
108
py
Python
simple_site_manager/__init__.py
zeraien/simple-site-manager
e5b0814d960126486ca444c6cb33132dae8d0e57
[ "MIT" ]
null
null
null
simple_site_manager/__init__.py
zeraien/simple-site-manager
e5b0814d960126486ca444c6cb33132dae8d0e57
[ "MIT" ]
6
2015-04-07T15:31:03.000Z
2015-04-07T15:36:14.000Z
simple_site_manager/__init__.py
zeraien/simple-site-manager
e5b0814d960126486ca444c6cb33132dae8d0e57
[ "MIT" ]
null
null
null
from simple_site_manager.siteman import Site, Server, main_func if __name__ == "__main__": main_func()
21.6
63
0.759259
15
108
4.666667
0.733333
0.228571
0
0
0
0
0
0
0
0
0
0
0.148148
108
4
64
27
0.76087
0
0
0
0
0
0.074074
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
dabd414b8854449d5dbf3dea0ca8673fd00c22a7
1,613
py
Python
tests/integration/unit_test/test_unit_test_python3_9.py
thedavlee/aws-sam-cli-app-templates
b8ca90d56f058d40a87d8983bc6c33c9222a66fb
[ "Apache-2.0" ]
null
null
null
tests/integration/unit_test/test_unit_test_python3_9.py
thedavlee/aws-sam-cli-app-templates
b8ca90d56f058d40a87d8983bc6c33c9222a66fb
[ "Apache-2.0" ]
null
null
null
tests/integration/unit_test/test_unit_test_python3_9.py
thedavlee/aws-sam-cli-app-templates
b8ca90d56f058d40a87d8983bc6c33c9222a66fb
[ "Apache-2.0" ]
null
null
null
from tests.integration.unit_test.unit_test_base import UnitTestBase class UnitTest_python3_9_cookiecutter_aws_sam_hello_python(UnitTestBase.Python39UnitTestBase): directory = "python3.9/cookiecutter-aws-sam-hello-python" code_directories = ["hello_world"] class UnitTest_python3_9_cookiecutter_aws_sam_hello_python_datadog(UnitTestBase.Python39UnitTestBase): directory = "python3.9/cookiecutter-aws-sam-hello-python-datadog" code_directories = ["hello_world"] class UnitTest_python3_9_cookiecutter_aws_sam_eventBridge_python(UnitTestBase.Python39UnitTestBase): directory = "python3.9/cookiecutter-aws-sam-eventBridge-python" code_directories = ["hello_world_function"] class UnitTest_python3_9_cookiecutter_aws_sam_eventbridge_schema_app_python(UnitTestBase.Python39UnitTestBase): directory = "python3.9/cookiecutter-aws-sam-eventbridge-schema-app-python" code_directories = ["hello_world_function"] def _test_unit_tests(self, code_directory: str): self.skipTest("eventbridge schema app requires credential to pull missing files, skip") pass class UnitTest_python3_9_cookiecutter_aws_sam_step_functions_sample_app(UnitTestBase.Python39UnitTestBase): directory = "python3.9/cookiecutter-aws-sam-step-functions-sample-app" code_directories = [ "functions/stock_buyer", "functions/stock_checker", "functions/stock_seller", ] class UnitTest_python3_9_cookiecutter_aws_sam_efs_python(UnitTestBase.Python39UnitTestBase): directory = "python3.9/cookiecutter-aws-sam-efs-python" code_directories = ["hello_efs"]
40.325
111
0.803472
188
1,613
6.521277
0.25
0.078303
0.195759
0.225122
0.781403
0.781403
0.727569
0.670473
0.606036
0.368679
0
0.025122
0.111593
1,613
39
112
41.358974
0.830426
0
0
0.153846
0
0
0.314321
0.226906
0
0
0
0
0
1
0.038462
false
0.038462
0.038462
0
0.769231
0
0
0
0
null
0
1
1
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
5
dace80c173624ddff792864e6b8cc66e2ada201a
52
py
Python
rezero/transformer/__init__.py
mpariente/rezero
6bcf1df00bc9a3560b093a2bbe12dade92f86eba
[ "MIT" ]
376
2020-03-11T21:18:13.000Z
2022-02-25T23:43:32.000Z
rezero/transformer/__init__.py
mpariente/rezero
6bcf1df00bc9a3560b093a2bbe12dade92f86eba
[ "MIT" ]
15
2020-03-12T00:07:34.000Z
2022-01-25T09:58:48.000Z
rezero/transformer/__init__.py
mpariente/rezero
6bcf1df00bc9a3560b093a2bbe12dade92f86eba
[ "MIT" ]
54
2020-03-12T08:37:35.000Z
2022-01-24T01:42:19.000Z
from .rztx import RZTXEncoderLayer, RZTXDecoderLayer
52
52
0.884615
5
52
9.2
1
0
0
0
0
0
0
0
0
0
0
0
0.076923
52
1
52
52
0.958333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
dad31c172b2337dab66b16fd827885db847ed271
61
py
Python
reagent/net_builder/parametric_dqn/__init__.py
kellielu/ReAgent
c538992672220453cdc95044def25c4e0691a8b0
[ "BSD-3-Clause" ]
2
2021-10-31T01:05:46.000Z
2021-11-08T09:43:25.000Z
reagent/net_builder/parametric_dqn/__init__.py
kellielu/ReAgent
c538992672220453cdc95044def25c4e0691a8b0
[ "BSD-3-Clause" ]
null
null
null
reagent/net_builder/parametric_dqn/__init__.py
kellielu/ReAgent
c538992672220453cdc95044def25c4e0691a8b0
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/env python3 from . import fully_connected # noqa
20.333333
37
0.737705
9
61
4.888889
1
0
0
0
0
0
0
0
0
0
0
0.019231
0.147541
61
2
38
30.5
0.826923
0.42623
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
daf37ebbf2d8d19e99edc5e504b87f502b0dcbef
147
py
Python
tools/__init__.py
FusionBolt/OrtKI
72be04ba79d533ec241e65082afb4523fa9162f5
[ "MIT" ]
null
null
null
tools/__init__.py
FusionBolt/OrtKI
72be04ba79d533ec241e65082afb4523fa9162f5
[ "MIT" ]
null
null
null
tools/__init__.py
FusionBolt/OrtKI
72be04ba79d533ec241e65082afb4523fa9162f5
[ "MIT" ]
null
null
null
#!/usr/bin/env python # coding=utf-8 import sys import os sys.path.append(os.path.join('..', 'onnxruntime', 'cmake', 'external', 'onnx', 'defs'))
21
87
0.659864
22
147
4.409091
0.818182
0
0
0
0
0
0
0
0
0
0
0.007576
0.102041
147
6
88
24.5
0.727273
0.22449
0
0
0
0
0.303571
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
9706a1d4bcd515cc09444385fff387ab74a7003e
42
py
Python
dev/Tools/Python/2.7.13/mac/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyxb/bundles/saml20/ecp.py
jeikabu/lumberyard
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
[ "AML" ]
123
2015-01-12T06:43:22.000Z
2022-03-20T18:06:46.000Z
dev/Tools/Python/2.7.13/mac/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyxb/bundles/saml20/ecp.py
jeikabu/lumberyard
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
[ "AML" ]
103
2015-01-08T18:35:57.000Z
2022-01-18T01:44:14.000Z
dev/Tools/Python/2.7.13/mac/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyxb/bundles/saml20/ecp.py
jeikabu/lumberyard
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
[ "AML" ]
54
2015-02-15T17:12:00.000Z
2022-03-07T23:02:32.000Z
from pyxb.bundles.saml20.raw.ecp import *
21
41
0.785714
7
42
4.714286
1
0
0
0
0
0
0
0
0
0
0
0.052632
0.095238
42
1
42
42
0.815789
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
97129aca1fcf3a4e0d198e57284cefba5661d501
108
py
Python
escapyde/__init__.py
Diapolo10/escapyde
2db109b579431ecb6dcd76d4789e7fc94d9d9e50
[ "MIT" ]
null
null
null
escapyde/__init__.py
Diapolo10/escapyde
2db109b579431ecb6dcd76d4789e7fc94d9d9e50
[ "MIT" ]
null
null
null
escapyde/__init__.py
Diapolo10/escapyde
2db109b579431ecb6dcd76d4789e7fc94d9d9e50
[ "MIT" ]
1
2022-02-07T21:49:12.000Z
2022-02-07T21:49:12.000Z
"""A library for simplifying ANSI escape sequences in Python""" from .ansi import * from .colours import *
21.6
63
0.740741
15
108
5.333333
0.8
0
0
0
0
0
0
0
0
0
0
0
0.166667
108
4
64
27
0.888889
0.527778
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
97390cbaaa7d94604f2574d0f4da6ec7af6c2156
50
py
Python
level2scraper/ZeroMQ/__init__.py
cryptassic/level2Scraper
209ee769439c04f8db6e9ca941b89b6a1922a037
[ "MIT" ]
null
null
null
level2scraper/ZeroMQ/__init__.py
cryptassic/level2Scraper
209ee769439c04f8db6e9ca941b89b6a1922a037
[ "MIT" ]
null
null
null
level2scraper/ZeroMQ/__init__.py
cryptassic/level2Scraper
209ee769439c04f8db6e9ca941b89b6a1922a037
[ "MIT" ]
null
null
null
from .ZeroMq_Handlers import Publisher, Subscriber
50
50
0.88
6
50
7.166667
1
0
0
0
0
0
0
0
0
0
0
0
0.08
50
1
50
50
0.934783
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
97628552296599b4cbf86d759be0cd6f635ded89
41
py
Python
pyserasa/__init__.py
lfdivino/pySerasa
d4b8b6b0906ee297f2be9f3adc134bcb14024b74
[ "MIT" ]
null
null
null
pyserasa/__init__.py
lfdivino/pySerasa
d4b8b6b0906ee297f2be9f3adc134bcb14024b74
[ "MIT" ]
1
2019-11-14T19:16:44.000Z
2019-11-14T19:16:44.000Z
pyserasa/__init__.py
lfdivino/pySerasa
d4b8b6b0906ee297f2be9f3adc134bcb14024b74
[ "MIT" ]
2
2019-10-08T13:23:50.000Z
2020-11-16T21:06:22.000Z
from . import crednet, parserStringDados
20.5
40
0.829268
4
41
8.5
1
0
0
0
0
0
0
0
0
0
0
0
0.121951
41
1
41
41
0.944444
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
977eb9dbe8e1b25b158aa0d1dd04890527136e3b
3,068
py
Python
my_functions.py
chapman-phys220-2017f/cw-07-nikki-and-riley
ef04c55160e0699b421d4c0211f6fcf2f4c836fc
[ "MIT" ]
null
null
null
my_functions.py
chapman-phys220-2017f/cw-07-nikki-and-riley
ef04c55160e0699b421d4c0211f6fcf2f4c836fc
[ "MIT" ]
null
null
null
my_functions.py
chapman-phys220-2017f/cw-07-nikki-and-riley
ef04c55160e0699b421d4c0211f6fcf2f4c836fc
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # Name: Riley Kendall and Nikki Schwartz # Student ID: 2274503 # Email: kenda106@mail.chapman.edu # Course: PHYS220/MATH220/CPSC220 Fall 2017 # Assignment: CLASSWORK 7 import array_calculus import numpy as np #sin(x) function def sin(x): '''sin(x) Takes the x-coordinate domain and determines corresponding y-coordinates Args: x (array) : x-coordinates Returns: out2 (array) : y-coordinates, described as "f" in taylor_approx file ''' out1 = list() yValues = () for k in range(0,len(x)): yValues = np.sin(x[k]) out1.insert(k,yValues) out2 = np.array(out1) return out2 #cos(x) function def cos(x): '''cos(x) Takes the x-coordinate domain and determines corresponding y-coordinates Args: x (array) : x-coordinates Returns: out2 (array) : y-coordinates, described as "f" in taylor_approx file ''' out1 = list() yValues = () for k in range(0,len(x)): yValues = np.cos(x[k]) out1.insert(k,yValues) out2 = np.array(out1) return out2 #tanh(x) function def tanh(x): '''tanh(x) Takes the x-coordinate domain and determines corresponding y-coordinates Args: x (array) : x-coordinates Returns: out2 (array) : y-coordinates, described as "f" in taylor_approx file ''' out1 = list() yValues = () for k in range(0,len(x)): yValues = np.tanh(x[k]) out1.insert(k,yValues) out2 = np.array(out1) return out2 #poly(x) function def poly(x): '''poly(x) Takes the x-coordinate domain and determines corresponding y-coordinates Args: x (array) : x-coordinates Returns: out2 (array) : y-coordinates, described as "f" in taylor_approx file ''' out1 = list() yValues = () for k in range(0,len(x)): yValues = ((x[k]**2)/10)+(np.sin(2*x[k]))/2 #np.tanh(x[k]) out1.insert(k,yValues) out2 = np.array(out1) return out2 #denom(x) function def denom(x): '''denom(x) Takes the x-coordinate domain and determines corresponding y-coordinates Args: x (array) : x-coordinates Returns: out2 (array) : y-coordinates, described as "f" in taylor_approx file ''' out1 = list() yValues = () for k in range(0,len(x)): if x[k] == 0: yValues = np.nan else: yValues = 1/(x[k]) out1.insert(k,yValues) out2 = np.array(out1) return out2 #theta(x) function def theta(x): '''theta(x) Takes the x-coordinate domain and determines corresponding y-coordinates Args: x (array) : x-coordinates Returns: out2 (array) : y-coordinates, described as "f" in taylor_approx file ''' out1 = list() yValues = () for k in range(0,len(x)): yValues = (x[k]) if (x[k]) < 0: yValues = 0 if (x[k]) == 0: yValues = (1/2) if (x[k]) > 0: yValues = 1 out1.insert(k,yValues) out2 = np.array(out1) return out2
25.355372
76
0.585724
428
3,068
4.182243
0.175234
0.080447
0.040223
0.03352
0.794972
0.781564
0.767039
0.767039
0.767039
0.767039
0
0.036835
0.283246
3,068
120
77
25.566667
0.777171
0.483051
0
0.610169
0
0
0
0
0
0
0
0
0
1
0.101695
false
0
0.033898
0
0.237288
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
9784b6859b7180dfb358110f5ded4026f48a13d9
166
py
Python
src/aioquic/quic/__init__.py
COMSYS/aioquic
3f575b0d0094bb661a19e6e5d0b4fae973ecc991
[ "BSD-3-Clause" ]
null
null
null
src/aioquic/quic/__init__.py
COMSYS/aioquic
3f575b0d0094bb661a19e6e5d0b4fae973ecc991
[ "BSD-3-Clause" ]
null
null
null
src/aioquic/quic/__init__.py
COMSYS/aioquic
3f575b0d0094bb661a19e6e5d0b4fae973ecc991
[ "BSD-3-Clause" ]
null
null
null
""" Statically define whether the measurementheaders should be enabled TODO: Make this adjustable at runtime """ class Measurement_Headers(): Active : bool = True
27.666667
66
0.771084
20
166
6.35
1
0
0
0
0
0
0
0
0
0
0
0
0.156627
166
6
67
27.666667
0.907143
0.626506
0
0
0
0
0
0
0
0
0
0.166667
0
1
0
true
0
0
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
1
0
0
0
1
0
0
5
97c24349bcecd03bad91a912c5455296ca9d74b7
43
py
Python
weldx_widgets/visualization/__init__.py
marscher/weldx-widgets
4e708c47dbc021349cf48be97ab6e14003f3ef8e
[ "BSD-3-Clause" ]
null
null
null
weldx_widgets/visualization/__init__.py
marscher/weldx-widgets
4e708c47dbc021349cf48be97ab6e14003f3ef8e
[ "BSD-3-Clause" ]
null
null
null
weldx_widgets/visualization/__init__.py
marscher/weldx-widgets
4e708c47dbc021349cf48be97ab6e14003f3ef8e
[ "BSD-3-Clause" ]
null
null
null
"""Visualization tools for weldx types."""
21.5
42
0.72093
5
43
6.2
1
0
0
0
0
0
0
0
0
0
0
0
0.116279
43
1
43
43
0.815789
0.837209
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
8af6b4730ee8b1efa4cc5de97c239afa15c54a99
74
py
Python
kosh/exec_graphs/__init__.py
LLNL/kosh
5dcc1f020c70c4e7e1fdadff3950ce1cbe0a6e10
[ "MIT" ]
6
2020-09-28T19:26:29.000Z
2022-03-14T20:28:57.000Z
kosh/exec_graphs/__init__.py
LLNL/kosh
5dcc1f020c70c4e7e1fdadff3950ce1cbe0a6e10
[ "MIT" ]
null
null
null
kosh/exec_graphs/__init__.py
LLNL/kosh
5dcc1f020c70c4e7e1fdadff3950ce1cbe0a6e10
[ "MIT" ]
2
2021-03-02T20:22:54.000Z
2021-06-17T23:57:23.000Z
from .core import KoshExecutionGraph, populate, find_network_ends # noqa
37
73
0.824324
9
74
6.555556
1
0
0
0
0
0
0
0
0
0
0
0
0.121622
74
1
74
74
0.907692
0.054054
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
8afe5e1f2d32de58106f0025d2dfdfba237357c0
183
py
Python
src/utils/building_height.py
YCaptain/MapWorld-pred
12f35cd0744cabe1303321e0256b17967fe43da9
[ "MIT" ]
null
null
null
src/utils/building_height.py
YCaptain/MapWorld-pred
12f35cd0744cabe1303321e0256b17967fe43da9
[ "MIT" ]
null
null
null
src/utils/building_height.py
YCaptain/MapWorld-pred
12f35cd0744cabe1303321e0256b17967fe43da9
[ "MIT" ]
null
null
null
import random def random_height(targ, meta): res = { "height": random.randint(5, 18) } return res def get_height(targ, meta): res = dict() return res
12.2
39
0.584699
24
183
4.375
0.541667
0.190476
0.266667
0.32381
0
0
0
0
0
0
0
0.023438
0.300546
183
14
40
13.071429
0.796875
0
0
0.222222
0
0
0.032787
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0
0.555556
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
5
c10f9ce4f7b5417e2be7c8ed23c51a7e99da5e8c
292
py
Python
yandex_checkout/domain/common/response_object.py
tonchik-tm/yandex-checkout-sdk-python
7680e85a3e3416a1b3d2a6dd6bd3de84ba646d1d
[ "MIT" ]
1
2021-03-19T06:47:48.000Z
2021-03-19T06:47:48.000Z
yandex_checkout/domain/common/response_object.py
tonchik-tm/yandex-checkout-sdk-python
7680e85a3e3416a1b3d2a6dd6bd3de84ba646d1d
[ "MIT" ]
null
null
null
yandex_checkout/domain/common/response_object.py
tonchik-tm/yandex-checkout-sdk-python
7680e85a3e3416a1b3d2a6dd6bd3de84ba646d1d
[ "MIT" ]
null
null
null
from yandex_checkout.domain.common.base_object import BaseObject from yandex_checkout.domain.common.data_context import DataContext class ResponseObject(BaseObject): """ Base class for request objects """ @staticmethod def context(): return DataContext.RESPONSE
24.333333
66
0.753425
32
292
6.75
0.65625
0.092593
0.166667
0.222222
0.277778
0
0
0
0
0
0
0
0.178082
292
11
67
26.545455
0.9
0.10274
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
true
0
0.333333
0.166667
0.833333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
1
1
0
0
5
c146b6c70003ac142b40da590b908af7e7f2e976
623
py
Python
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/settings/database/prod.py
dem4ply/cookiecutter-django
e116b2261fa9a37a62978f8c891c08377d82f950
[ "BSD-3-Clause" ]
null
null
null
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/settings/database/prod.py
dem4ply/cookiecutter-django
e116b2261fa9a37a62978f8c891c08377d82f950
[ "BSD-3-Clause" ]
null
null
null
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/settings/database/prod.py
dem4ply/cookiecutter-django
e116b2261fa9a37a62978f8c891c08377d82f950
[ "BSD-3-Clause" ]
null
null
null
import os os.environ[ '{{ cookiecutter.project_slug|upper }}__RABBITMQ__KEY__URL' ] #mysql DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': os.environ[ '{{ cookiecutter.project_slug|upper }}__DATABASE__NAME' ], 'USER': os.environ[ '{{ cookiecutter.project_slug|upper }}__DATABASE__USER' ], 'PASSWORD': os.environ[ '{{ cookiecutter.project_slug|upper }}__DATABASE__PASSWORD' ], 'HOST': os.environ[ '{{ cookiecutter.project_slug|upper }}__DATABASE__HOST' ], 'PORT': os.environ[ '{{ cookiecutter.project_slug|upper }}__DATABASE__PORT' ], }, }
36.647059
94
0.661316
64
623
5.9375
0.359375
0.142105
0.331579
0.442105
0.689474
0.689474
0.592105
0
0
0
0
0
0.170144
623
16
95
38.9375
0.73501
0.008026
0
0
0
0
0.627229
0.411669
0
0
0
0
0
1
0
false
0.083333
0.083333
0
0.083333
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
1
0
0
0
0
0
5
c14a0503cc1855786bcbdf9f8e3b2d2254a030b8
195
py
Python
image/rl/trainers/__init__.py
00schen/asha
69af936803cc8f4a0f7ac3db8d31a15385077295
[ "MIT" ]
1
2022-03-13T19:12:48.000Z
2022-03-13T19:12:48.000Z
image/rl/trainers/__init__.py
00schen/asha
69af936803cc8f4a0f7ac3db8d31a15385077295
[ "MIT" ]
null
null
null
image/rl/trainers/__init__.py
00schen/asha
69af936803cc8f4a0f7ac3db8d31a15385077295
[ "MIT" ]
null
null
null
from .enc_dec_sac_trainer_s1 import EncDecSACTrainer from .enc_dec_sac_trainer_s2_latent import EncDecSACTrainer as LatentEncDecSACTrainer from .enc_dec_awac_trainer import TorchEncDecAWACTrainer
65
85
0.917949
26
195
6.423077
0.538462
0.125749
0.179641
0.155689
0.239521
0
0
0
0
0
0
0.010989
0.066667
195
3
86
65
0.906593
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
c1567b02f9f3629e38c3a57007b11e70996d0da6
30
py
Python
samples/src/main/resources/datasets/python/84.py
sritchie/kotlingrad
8165ed1cd77220a5347c58cded4c6f2bcf22ee30
[ "Apache-2.0" ]
11
2020-12-19T01:19:44.000Z
2021-12-25T20:43:33.000Z
src/main/resources/datasets/python/84.py
breandan/katholic
081c39f3acc73ff41f5865563debe78a36e1038f
[ "Apache-2.0" ]
null
null
null
src/main/resources/datasets/python/84.py
breandan/katholic
081c39f3acc73ff41f5865563debe78a36e1038f
[ "Apache-2.0" ]
2
2021-01-25T07:59:20.000Z
2021-08-07T07:13:49.000Z
def test21(a, b): a + b.x
10
17
0.466667
7
30
2
0.714286
0.285714
0
0
0
0
0
0
0
0
0
0.1
0.333333
30
2
18
15
0.6
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0
0.5
0
1
1
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
5
c17d719b132fc77042ffead7256ae52eb4f91eab
1,280
py
Python
Variado_GeekUniversity/guppe/doctests.py
PauloFTeixeira/curso_python
9040c7dcc5262620f6330bb9637710bb8899bc6b
[ "MIT" ]
null
null
null
Variado_GeekUniversity/guppe/doctests.py
PauloFTeixeira/curso_python
9040c7dcc5262620f6330bb9637710bb8899bc6b
[ "MIT" ]
null
null
null
Variado_GeekUniversity/guppe/doctests.py
PauloFTeixeira/curso_python
9040c7dcc5262620f6330bb9637710bb8899bc6b
[ "MIT" ]
null
null
null
""" Doctests Doctests são testes que colocamos na docstring das funções/métodos Python. def soma(a, b): # soma os números a e b #>>> soma(1, 2) #3 #>>> soma(4, 6) #10 # return a + b Para rodar um test do doctest: python -m doctest -v nome_do_mobulo.py # Saída Trying: soma(1, 2) Expecting: 3 ok 1 items had no tests: doctests 1 items passed all tests: 1 tests in doctests.soma 1 tests in 2 items. 1 passed and 0 failed. Test passed. # Outro Exemplo, Aplicando o TDD def duplicar(valores): #duplica os valores em uma lista #>>> duplicar([1, 2, 3, 4]) #[2, 4, 6, 8] #>>> duplicar([]) #[] #>>> duplicar(['a', 'b', 'c']) #['aa', 'bb', 'cc'] #>>> duplicar([True, None]) #Traceback (most recent call last): # ... #TypeError: unsupported operand type(s) for *: 'int' and 'NoneType' # #return [2 * elemento for elemento in valores] # Erro inesperado... OBS: Dentro do doctest, o Python não reconhece string com aspas duplas. Precisa ser aspas simples. def fala_oi(): #Fala oi #>>> fala_oi() #'oi' # #return "oi" """ # Um último caso estranho... def verdade(): """Retorna verdade >>> verdade() True """ return True
14.712644
98
0.575
178
1,280
4.11236
0.573034
0.008197
0.016393
0.032787
0
0
0
0
0
0
0
0.028292
0.282031
1,280
86
99
14.883721
0.768226
0.945313
0
0
0
0
0
0
0
0
0
0.011628
0
1
0.5
true
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
1
0
0
1
1
0
0
0
1
0
0
5
c19548c3e01c53a58155b26ffd4d1b35f498d033
32
py
Python
emma/query/__init__.py
Nibblecomm/EmmaPython
61dca6d5ff36714547120a6410c3b5734bc59d50
[ "MIT" ]
10
2015-06-02T13:24:53.000Z
2021-07-16T15:03:45.000Z
emma/query/__init__.py
Nibblecomm/EmmaPython
61dca6d5ff36714547120a6410c3b5734bc59d50
[ "MIT" ]
11
2015-09-20T01:39:36.000Z
2021-04-14T13:06:25.000Z
emma/query/__init__.py
Nibblecomm/EmmaPython
61dca6d5ff36714547120a6410c3b5734bc59d50
[ "MIT" ]
12
2015-05-26T23:39:28.000Z
2021-03-15T07:42:48.000Z
"""Emma Search Syntax helpers"""
32
32
0.71875
4
32
5.75
1
0
0
0
0
0
0
0
0
0
0
0
0.09375
32
1
32
32
0.793103
0.8125
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
c1995c816969899e449c7315f1314a5570b2a50f
128
py
Python
cwlkernel/__init__.py
fabricebrito/CWLJNIKernel
c87d9d1ae326bb198c4b8e14836ce934b9841c0d
[ "Apache-2.0" ]
4
2020-02-28T16:03:26.000Z
2021-03-28T12:58:25.000Z
cwlkernel/__init__.py
fabricebrito/CWLJNIKernel
c87d9d1ae326bb198c4b8e14836ce934b9841c0d
[ "Apache-2.0" ]
1
2020-12-09T11:06:42.000Z
2020-12-09T19:08:23.000Z
cwlkernel/__init__.py
fabricebrito/CWLJNIKernel
c87d9d1ae326bb198c4b8e14836ce934b9841c0d
[ "Apache-2.0" ]
3
2020-04-10T15:09:11.000Z
2020-12-09T11:26:24.000Z
# noinspection PyUnresolvedReferences from . import kernel_magics # NOQA from .CWLKernel import version __version__ = version
21.333333
37
0.820313
13
128
7.692308
0.692308
0.28
0
0
0
0
0
0
0
0
0
0
0.140625
128
5
38
25.6
0.909091
0.3125
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
c1c7c50b2526fea0b781d87dab73e206098501c7
196
py
Python
ermaket/tests/dummy_scripts/script_dummy.py
SqrtMinusOne/ERMaket_Experiment
c4a7b61651edd15a619d9b690e2aaeaab4de282d
[ "Apache-2.0" ]
null
null
null
ermaket/tests/dummy_scripts/script_dummy.py
SqrtMinusOne/ERMaket_Experiment
c4a7b61651edd15a619d9b690e2aaeaab4de282d
[ "Apache-2.0" ]
null
null
null
ermaket/tests/dummy_scripts/script_dummy.py
SqrtMinusOne/ERMaket_Experiment
c4a7b61651edd15a619d9b690e2aaeaab4de282d
[ "Apache-2.0" ]
null
null
null
from ermaket.api.scripts import UserScript __all__ = ['dummy'] dummy = UserScript(id=101) @dummy.register def dummy1(): return 'dummy1' @dummy.register def dummy2(): return 'dummy2'
12.25
42
0.69898
24
196
5.541667
0.625
0.195489
0.240602
0
0
0
0
0
0
0
0
0.04321
0.173469
196
15
43
13.066667
0.777778
0
0
0.222222
0
0
0.086735
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0.222222
0.555556
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
c1d03b045d73da3253e2ed6dcc7a5fe303900cfc
154
py
Python
PyMOTW/source/inspect/inspect_getsourcelines_method.py
axetang/AxePython
3b517fa3123ce2e939680ad1ae14f7e602d446a6
[ "Apache-2.0" ]
1
2019-01-04T05:47:50.000Z
2019-01-04T05:47:50.000Z
PyMOTW/source/inspect/inspect_getsourcelines_method.py
axetang/AxePython
3b517fa3123ce2e939680ad1ae14f7e602d446a6
[ "Apache-2.0" ]
1
2020-07-18T03:52:03.000Z
2020-07-18T04:18:01.000Z
PyMOTW/source/inspect/inspect_getsourcelines_method.py
axetang/AxePython
3b517fa3123ce2e939680ad1ae14f7e602d446a6
[ "Apache-2.0" ]
2
2021-03-06T04:28:32.000Z
2021-03-06T04:59:17.000Z
#!/usr/bin/env python3 """ """ #end_pymotw_header import inspect import pprint import example pprint.pprint(inspect.getsourcelines(example.A.get_name))
14
57
0.779221
21
154
5.571429
0.714286
0
0
0
0
0
0
0
0
0
0
0.007143
0.090909
154
10
58
15.4
0.828571
0.246753
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.75
0
0.75
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
1
0
5
de00a6edadafa4e884a60494eaa1a6808bd194af
286
py
Python
clusterweb/interfaces/scaffold.py
clusterweb/ClusterWeb
a73d9e313af19236f215807d87d48f80da9259d5
[ "MIT" ]
null
null
null
clusterweb/interfaces/scaffold.py
clusterweb/ClusterWeb
a73d9e313af19236f215807d87d48f80da9259d5
[ "MIT" ]
null
null
null
clusterweb/interfaces/scaffold.py
clusterweb/ClusterWeb
a73d9e313af19236f215807d87d48f80da9259d5
[ "MIT" ]
null
null
null
#!/bin/env/python #-*- encoding: utf-8 -*- """ """ from __future__ import print_function, division class InterfaceScaffold(object): def __init__(self): pass def push(self): raise NotImplementedError def pull(self): raise NotImplementedError
15.888889
47
0.63986
29
286
6
0.793103
0.103448
0.321839
0
0
0
0
0
0
0
0
0.00463
0.244755
286
18
48
15.888889
0.800926
0.136364
0
0.25
0
0
0
0
0
0
0
0
0
1
0.375
false
0.125
0.125
0
0.625
0.125
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
5
de07d031cf3d7ac23d49a0e2f9a2a1b29bd3cfa7
39
py
Python
cachejar/__init__.py
hsolbrig/cachejar
2018f51397f7789cc02f9e19b50a32ab667d3f7b
[ "Apache-2.0" ]
null
null
null
cachejar/__init__.py
hsolbrig/cachejar
2018f51397f7789cc02f9e19b50a32ab667d3f7b
[ "Apache-2.0" ]
null
null
null
cachejar/__init__.py
hsolbrig/cachejar
2018f51397f7789cc02f9e19b50a32ab667d3f7b
[ "Apache-2.0" ]
null
null
null
from cachejar.jar import factory, jar
13
37
0.794872
6
39
5.166667
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.153846
39
2
38
19.5
0.939394
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
a9ee2ba3372e341f70e2e2ed4f5159de28635095
132
py
Python
hummingbird/pipeline/pipeline_node.py
richardycao/hummingbird_python
d7d018fb62134c8ad8a25b76789ecab76e503891
[ "MIT" ]
null
null
null
hummingbird/pipeline/pipeline_node.py
richardycao/hummingbird_python
d7d018fb62134c8ad8a25b76789ecab76e503891
[ "MIT" ]
null
null
null
hummingbird/pipeline/pipeline_node.py
richardycao/hummingbird_python
d7d018fb62134c8ad8a25b76789ecab76e503891
[ "MIT" ]
null
null
null
class PipelineNode(object): def __init__(self, module_path, params): self.module_path = module_path self.params = params
22
42
0.734848
17
132
5.294118
0.529412
0.333333
0.311111
0
0
0
0
0
0
0
0
0
0.174242
132
5
43
26.4
0.825688
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0
0.5
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
5
e71a6ae9e06cf00b1f8e89188b762efca745f8be
126
py
Python
trade_remedies_api/reports/queries/__init__.py
uktrade/trade-remedies-api
fbe2d142ef099c7244788a0f72dd1003eaa7edce
[ "MIT" ]
1
2020-08-13T10:37:15.000Z
2020-08-13T10:37:15.000Z
trade_remedies_api/reports/queries/__init__.py
uktrade/trade-remedies-api
fbe2d142ef099c7244788a0f72dd1003eaa7edce
[ "MIT" ]
4
2020-09-10T13:41:52.000Z
2020-12-16T09:00:21.000Z
trade_remedies_api/reports/queries/__init__.py
uktrade/trade-remedies-api
fbe2d142ef099c7244788a0f72dd1003eaa7edce
[ "MIT" ]
null
null
null
from .user import users_by_date, total_public_users from .submission import roi_by_date from .registry import REPORT_REGISTRY
31.5
51
0.865079
20
126
5.1
0.6
0.117647
0
0
0
0
0
0
0
0
0
0
0.103175
126
3
52
42
0.902655
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
e71c63959df97fef009fbd748d40db6530c11c4b
50
py
Python
tests/__init__.py
NKPmedia/rising
2a580e9c74c8fb690e27e8bacf09ab97184ab1ee
[ "MIT" ]
1
2020-11-10T11:03:33.000Z
2020-11-10T11:03:33.000Z
tests/__init__.py
NKPmedia/rising
2a580e9c74c8fb690e27e8bacf09ab97184ab1ee
[ "MIT" ]
null
null
null
tests/__init__.py
NKPmedia/rising
2a580e9c74c8fb690e27e8bacf09ab97184ab1ee
[ "MIT" ]
null
null
null
from ._utils import LoadDummySample, DummyDataset
25
49
0.86
5
50
8.4
1
0
0
0
0
0
0
0
0
0
0
0
0.1
50
1
50
50
0.933333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
e72f94e26d6b716ffca0ca4a4894235873a0b9aa
346
py
Python
cellfinder_napari/plugins.py
noisysky/cellfinder-napari
cd264ab01e75ef432ab538b8c7ddee047953c99e
[ "BSD-3-Clause" ]
null
null
null
cellfinder_napari/plugins.py
noisysky/cellfinder-napari
cd264ab01e75ef432ab538b8c7ddee047953c99e
[ "BSD-3-Clause" ]
null
null
null
cellfinder_napari/plugins.py
noisysky/cellfinder-napari
cd264ab01e75ef432ab538b8c7ddee047953c99e
[ "BSD-3-Clause" ]
null
null
null
from cellfinder_napari.curation import CurationWidget from cellfinder_napari.detect import detect from cellfinder_napari.train import train def napari_experimental_provide_dock_widget(): return [ (detect, {"name": "Cell detection"}), (train, {"name": "Train network"}), (CurationWidget, {"name": "Curation"}), ]
28.833333
53
0.702312
36
346
6.555556
0.5
0.177966
0.254237
0
0
0
0
0
0
0
0
0
0.179191
346
11
54
31.454545
0.830986
0
0
0
0
0
0.135838
0
0
0
0
0
0
1
0.111111
true
0
0.333333
0.111111
0.555556
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
1
1
0
0
5
e73e826498a7ccaadf848a38a2cf80a12cdf0fee
36
py
Python
Python/Flask_MySQL/Lecture_Project/controllers/players.py
handtjaxon1/Coding-Dojo-Development
9cca0ae84749984a164541c476dc445b29b498b9
[ "MIT" ]
null
null
null
Python/Flask_MySQL/Lecture_Project/controllers/players.py
handtjaxon1/Coding-Dojo-Development
9cca0ae84749984a164541c476dc445b29b498b9
[ "MIT" ]
null
null
null
Python/Flask_MySQL/Lecture_Project/controllers/players.py
handtjaxon1/Coding-Dojo-Development
9cca0ae84749984a164541c476dc445b29b498b9
[ "MIT" ]
null
null
null
# Controller will be built Wednesday
36
36
0.833333
5
36
6
1
0
0
0
0
0
0
0
0
0
0
0
0.138889
36
1
36
36
0.967742
0.944444
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
e7aad8437260923a6f2f942520b49b072793f287
108
py
Python
random_ctfs/tghack19/pwn/pwntions_3/exploit.py
bernardosequeir/CTFfiles
36a6ceba49d9a9019056d3669c5e8f84aa83b618
[ "MIT" ]
null
null
null
random_ctfs/tghack19/pwn/pwntions_3/exploit.py
bernardosequeir/CTFfiles
36a6ceba49d9a9019056d3669c5e8f84aa83b618
[ "MIT" ]
5
2020-09-23T18:28:25.000Z
2020-09-23T18:28:41.000Z
random_ctfs/tghack19/pwn/pwntions_3/exploit.py
bernardosequeir/CTFSolutions
503944617cb18826d12ab98fa33fd761e791328a
[ "MIT" ]
null
null
null
from string import ascii_lowercase exploit="" for char in ascii_lowercase: exploit+=char*4 print exploit
21.6
34
0.796296
16
108
5.25
0.6875
0.333333
0.5
0
0
0
0
0
0
0
0
0.010753
0.138889
108
5
35
21.6
0.892473
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.2
null
null
0.2
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
5
e7c7e11374c3b76f35ee3b23968727ffd366e8e7
221
py
Python
python_level_3_solutions/3_2_get_numbers_from_user_1.py
PacktPublishing/Practical-Python-Learn-Python-Basics-Step-by-Step-Python-3
7e75e27a2da4ffcaf7ab1ed5d32809eccc3b8f9b
[ "MIT" ]
1
2022-01-24T08:37:00.000Z
2022-01-24T08:37:00.000Z
python_level_3_solutions/3_2_get_numbers_from_user_1.py
PacktPublishing/Practical-Python-Learn-Python-Basics-Step-by-Step-Python-3
7e75e27a2da4ffcaf7ab1ed5d32809eccc3b8f9b
[ "MIT" ]
null
null
null
python_level_3_solutions/3_2_get_numbers_from_user_1.py
PacktPublishing/Practical-Python-Learn-Python-Basics-Step-by-Step-Python-3
7e75e27a2da4ffcaf7ab1ed5d32809eccc3b8f9b
[ "MIT" ]
4
2022-01-30T00:13:59.000Z
2022-03-01T05:49:35.000Z
def compute_list_average(number_list): return sum(number_list) / len(number_list) number_list = [] for i in range(5): number_list.append(float(input("Give a number: "))) print(compute_list_average(number_list))
24.555556
55
0.746606
34
221
4.558824
0.558824
0.387097
0.232258
0.309677
0.36129
0
0
0
0
0
0
0.005181
0.126697
221
9
56
24.555556
0.797927
0
0
0
0
0
0.067568
0
0
0
0
0
0
1
0.166667
false
0
0
0.166667
0.333333
0.166667
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
5
99ccd133adcbb3b1543e6a2765ca4e989212c168
47
py
Python
tests/__init__.py
Laurentiu-Andronache/he
5e22d1c112e3db9c9893f7512c9bcef106bceb72
[ "MIT" ]
1
2019-02-25T12:38:25.000Z
2019-02-25T12:38:25.000Z
tests/__init__.py
Laurentiu-Andronache/he
5e22d1c112e3db9c9893f7512c9bcef106bceb72
[ "MIT" ]
null
null
null
tests/__init__.py
Laurentiu-Andronache/he
5e22d1c112e3db9c9893f7512c9bcef106bceb72
[ "MIT" ]
null
null
null
"""Added just so that I can `pylint tests`!"""
23.5
46
0.638298
8
47
3.75
1
0
0
0
0
0
0
0
0
0
0
0
0.170213
47
1
47
47
0.769231
0.851064
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
99dd51c45ce8f765764c4bb856f633ad28b738bc
128
py
Python
ChartApp/django_chart/admin.py
aishabazylzhanova/Blockchain_Analytics
021d717ab6cb7a5b943f7e048099b8870bd64f54
[ "MIT" ]
null
null
null
ChartApp/django_chart/admin.py
aishabazylzhanova/Blockchain_Analytics
021d717ab6cb7a5b943f7e048099b8870bd64f54
[ "MIT" ]
null
null
null
ChartApp/django_chart/admin.py
aishabazylzhanova/Blockchain_Analytics
021d717ab6cb7a5b943f7e048099b8870bd64f54
[ "MIT" ]
null
null
null
from django.contrib import admin from . models import Account # Register your models here. admin.site.register(Account)
18.285714
33
0.757813
17
128
5.705882
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.179688
128
7
34
18.285714
0.92381
0.203125
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
99e5a43cfbfdcd67d0e6c43ada1cece0f6ba5f66
154
py
Python
router/common.py
mpraiser/wsn_routing
a813622d701b195980c22578926d7b16e3e9cbbc
[ "MIT" ]
null
null
null
router/common.py
mpraiser/wsn_routing
a813622d701b195980c22578926d7b16e3e9cbbc
[ "MIT" ]
null
null
null
router/common.py
mpraiser/wsn_routing
a813622d701b195980c22578926d7b16e3e9cbbc
[ "MIT" ]
null
null
null
import numpy as np def distance(p1: np.array, p2: np.array) -> float: """Euclidean distance of two vectors""" return np.linalg.norm(p1 - p2, 2)
22
50
0.655844
25
154
4.04
0.72
0.138614
0
0
0
0
0
0
0
0
0
0.04065
0.201299
154
6
51
25.666667
0.780488
0.214286
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
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
1
0
0
1
0
1
0
0
5
99f33ffdbfda45e67c6969e1754df470fd66f0c0
46
py
Python
unityparser/errors.py
socialpoint-labs/unity-yaml-parser
91c175140ed32aed301bc34d4311f370da69a8ba
[ "MIT" ]
76
2019-06-17T13:17:59.000Z
2022-03-11T19:39:24.000Z
unityparser/errors.py
socialpoint-labs/unity-yaml-parser
91c175140ed32aed301bc34d4311f370da69a8ba
[ "MIT" ]
17
2019-06-07T09:04:27.000Z
2022-02-16T19:01:38.000Z
unityparser/errors.py
socialpoint-labs/unity-yaml-parser
91c175140ed32aed301bc34d4311f370da69a8ba
[ "MIT" ]
9
2019-10-08T16:07:35.000Z
2021-12-08T15:27:00.000Z
class UnityDocumentError(Exception): pass
15.333333
36
0.782609
4
46
9
1
0
0
0
0
0
0
0
0
0
0
0
0.152174
46
2
37
23
0.923077
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
8207251e153f66615718df9a90c715770d228402
278
py
Python
Curso/paquete/14_If_In.py
jsalmoralp/Python-Proyecto-Apuntes
cf4265e08e947aca1dbe9ec4ed1dfb7cb10e9309
[ "MIT" ]
null
null
null
Curso/paquete/14_If_In.py
jsalmoralp/Python-Proyecto-Apuntes
cf4265e08e947aca1dbe9ec4ed1dfb7cb10e9309
[ "MIT" ]
null
null
null
Curso/paquete/14_If_In.py
jsalmoralp/Python-Proyecto-Apuntes
cf4265e08e947aca1dbe9ec4ed1dfb7cb10e9309
[ "MIT" ]
null
null
null
print("-- Cursos --") print("Matemáticas - Biologia - Lenguas - Ciencias") curso = input("Ingrese el curso deseado: ") if curso in ("Matemáticas", "Biologia", "Lenguas", "Ciencias"): print("Curso {0} seleccionado".format(curso)) else: print("Este curso no existe...")
27.8
63
0.661871
32
278
5.75
0.625
0.206522
0.282609
0.369565
0
0
0
0
0
0
0
0.004237
0.151079
278
9
64
30.888889
0.775424
0
0
0
0
0
0.57554
0
0
0
0
0
0
1
0
false
0
0
0
0
0.571429
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
5
821dff9743fc3c6135851a0715a6c1b3118a142d
107,969
py
Python
AUTO-PLANNING/AutoTemplate/HYPSolution511/GT_MONACO_20200312.py
fishdda/RL-Application-in-TPS
183d8698d796e5bff3fc4d07ee512bc5a73c8f78
[ "MIT" ]
5
2019-03-28T15:00:30.000Z
2022-03-17T04:58:36.000Z
AUTO-PLANNING/AutoTemplate/HYPSolution511/GT_MONACO_20200312.py
fishdda/RL-Application-in-TPS
183d8698d796e5bff3fc4d07ee512bc5a73c8f78
[ "MIT" ]
null
null
null
AUTO-PLANNING/AutoTemplate/HYPSolution511/GT_MONACO_20200312.py
fishdda/RL-Application-in-TPS
183d8698d796e5bff3fc4d07ee512bc5a73c8f78
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Wed Jan 15 09:36:32 2020 @author: Henry Huang in Elekta Shanghai Co. Ltd. """ class HYP_Editor_MONACO551: ''' This Class was mainly used to generate a template automatically This version was only for Monaco551 TPS ''' def __init__(self,hyp_element_path, protocol_xlsx, demo_xml_path, output_xml_path, contourname_path, NAMING_LIB, hyp_path_new, updated_template_path, new_contourname_path): self.hypelement = hyp_element_path # hyp elements (including each parts) self.xlsx = protocol_xlsx # protocol xlsx self.demo_xml_path = demo_xml_path # demo dosenormsettings.xml self.ouput_xml_path = output_xml_path # updated dosenormsettings.xml self.contour_path = contourname_path # contournames fold path self.updated_contour_path = new_contourname_path # updated contournames fold path self.NAMING_LIB = NAMING_LIB # naming lib of each hospitals self.updated_hyp_path = hyp_path_new # new path for writing the hyp file self.new_template_path = updated_template_path def extract_xlsx(self,pt_id): ''' To extract data from protocol.xlsx for protocol_dict e.g. (Dmin > 60Gy) <-> ('GoalType' = 1, 'Dose = 6000', 'Volume = -1') -- Minimum dose (Dmax < 70Gy) <-> ('GoalType' = 2, 'Dose = 7000', 'Volume = -1') -- Maximum Dose (Dmean > 45Gy) -> ('GoalType' = 3, 'Dose = 4500', 'Volume = -1') -- Mean Dose(Lower Limit) (Dmean < 65Gy) -> ('GoalType' = 4, 'Dose = 6500', 'Volume = -1') -- Mean Dose(Upper Limit) (D50% > 50Gy) -> ('GoalType' = 5, 'Dose = 5000', 'Volume = 50') -- Minimum Dose Received by Relative Volume (D100cc > 50Gy) -> ('GoalType' = 6, 'Dose = 5000', 'Volume = 100000') -- Minimum Dose Received by Absolute Volume (D50% < 50Gy) -> ('GoalType' = 7, 'Dose = 5000', 'Volume = 50') -- Maximum Dose Received by Relative Volume (D100cc < 50Gy) -> ('GoalType' = 8, 'Dose = 5000', 'Volume = 100000') -- Maximum Dose Received by Absolute Volume (V50Gy > 100%) -> ('GoalType' = 9, 'Dose = 5000', 'Volume = 100') -- Minimum Relative Volume That Receives Dose (V50Gy > 100cc) -> ('GoalType' = 10, 'Dose = 5000', 'Volume = 1000000') -- Minimum Absolute Volume That Receives Dose (V50Gy < 50%) -> ('GoalType' = 11, 'Dose = 5000', 'Volume = 50') -- Maximum Relative Volume That Receives Dose (V50Gy < 100cc) -> ('GoalType' = 12, 'Dose = 5000', 'Volume = 1000000') -- Maximum Absolute Volume That Receives Dose ''' import pandas as pd protocol = pd.read_excel(self.xlsx, sheet_name=pt_id,header=None) protocol_list = [[protocol[0][i],protocol[1][i],protocol[2][i]] for i in range(protocol.shape[0])] name_set = set([item[0] for item in protocol_list if item[0] != 'frac' and item[0] != 'prep']) self.protocol_dict = {name : [] for name in name_set} for item in protocol_list: if item[0] != 'frac' and item[0] != 'prep': self.protocol_dict[item[0]].append([item[1],item[2]]) for key in self.protocol_dict.keys(): for i,item in enumerate(self.protocol_dict[key]): if 'D' in item[0] and 'cc' in item[0]: self.protocol_dict[key][i].append('8') elif 'D' in item[0] and '%' in item[0]: self.protocol_dict[key][i].append('7') elif 'V' in item[0] and 'Gy' in item[0]: self.protocol_dict[key][i].append('9') elif 'Dmax' in item[0]: self.protocol_dict[key][i].append('2') return self.protocol_dict def Read_HYP_element(self): ''' This function was used to extract all the elements from hyp file(Monaco55) ''' self.keyword = ['# Part1\n','# Part2\n','# Part3\n','# Part4_VMAT\n','# Part4_IMRT\n','# Part5\n', '# se\n','# pa\n','# qp\n','# oq\n','# mxd\n','# conf\n'] self.element = {} with open(self.hypelement,'r+') as f: line = f.readlines() self.index_ele = [line.index(item) for item in self.keyword] for i in range(len(self.keyword)-1): self.element[self.keyword[i]] = line[self.index_ele[i]+1:self.index_ele[i+1]] self.element[self.keyword[-1]] = line[self.index_ele[-1]+1:] # ss = line.split(' ') return self.element def pretty_xml(self,element, indent, newline, level=0): ''' # elemnt为传进来的Elment类,参数indent用于缩进,newline用于换行 to genereate a beautiful xml with tab ''' if element: # 判断element是否有子元素 if (element.text is None) or element.text.isspace(): # 如果element的text没有内容 element.text = newline + indent * (level + 1) else: element.text = newline + indent * (level + 1) + element.text.strip() + newline + indent * (level + 1) # else: # 此处两行如果把注释去掉,Element的text也会另起一行 # element.text = newline + indent * (level + 1) + element.text.strip() + newline + indent * level temp = list(element) # 将element转成list for subelement in temp: if temp.index(subelement) < (len(temp) - 1): # 如果不是list的最后一个元素,说明下一个行是同级别元素的起始,缩进应一致 subelement.tail = newline + indent * (level + 1) else: # 如果是list的最后一个元素, 说明下一行是母元素的结束,缩进应该少一个 subelement.tail = newline + indent * level self.pretty_xml(subelement, indent, newline, level=level + 1) # 对子元素进行递归操作 def modify_MONACO_contournames(self,protocol_name): '''read contournames file from FocalData to extract the structure names of CT ''' with open(self.contour_path, "r+") as f: line = f.readlines() old_name = [line[2+i*18].split('\n')[0] for i in range(int(len(line)/18))] self.name = [line[2+i*18].split('\n')[0] for i in range(int(len(line)/18))] diff_name = [item for item in self.name if item not in protocol_name] # Rule for name modification for i,item in enumerate(self.name): if item in diff_name: if item == 'T joint R': self.name[i] = 'T.Joint R' elif item == 'T joint L': self.name[i] = 'T.Joint L' elif item == 'A Duct L': self.name[i] = 'A.D L' elif item == 'A Duct R': self.name[i] = 'A.D R' elif item == 'Pitutary': self.name[i] = 'Pituitary' elif item == 'T Loble L': self.name[i] = 'T.Lobe L' elif item == 'T Loble R': self.name[i] = 'T.Lobe R' elif item == 'Optical chiasm': self.name[i] = 'Optical Chiasm' elif item == 'Spinal cord': self.name[i] = 'Spinal Cord' elif item == 'L eye': self.name[i] = 'Eye L' elif item == 'R eye': self.name[i] = 'Eye R' with open("C:/auto template/Contour_RenameLog.txt", 'a', encoding="utf8") as logf: nameRecord = str(old_name) + "\t" + str(self.name) logf.write(nameRecord) logf.close() print("Done") for i in range(int(len(line)/18)): line[2+i*18] = self.name[i] + '\n' s=''.join(line) f = open(self.updated_contour_path,'w+') f.seek(0) f.write(s) f.close() print(diff_name) return self.name def mkdir(self): import os folder = os.path.exists(self.new_template_path) if not folder: #判断是否存在文件夹如果不存在则创建为文件夹 os.makedirs(self.new_template_path) #makedirs 创建文件时如果路径不存在会创建这个路径 print ("--- new folder... ---") print ("--- OK ---") else: print ("--- There is this folder! ---") def name_sorting(self): ''' This function was used for sorting name e.g. target first OARs next normal tissues Body/Patient ''' self.sorted_name = ['PGTVrpn','PGTVnx','PGTVnd','PCTV', 'Optical Chiasm','Brain Stem','Spinal Cord', 'Optical Nerve R','Optical Nerve L', 'Lens R','Lens L','Eye R','Eye L', 'Pituitary','Brain','Parotid R','Parotid L', 'T.Joint R','T.Joint L','T.Lobe R', 'T.Lobe L', 'Larynx','A.D L','A.D R', 'Mandible','Oral Cavity','Lung','R6','R7'] return self.sorted_name def xml_solution(self,protocol_name): ''' This function was used for extracting xml file and try to combine with protocol to generate xml together. ''' from lxml import etree as et # demo_xml_path = 'C:/Users/xhuae08006/Desktop/XHTOMO_AUTO/Modifier/demo_dosenormsettings.xml' parser = et.XMLParser(encoding="utf-8", remove_blank_text=True) tree = et.parse(self.demo_xml_path,parser=parser) root1 = tree.getroot() name = self.modify_MONACO_contournames(protocol_name) for child in root1[1]: # print(child.tag, child.attrib) for subchild in child.findall('DoseStructureParametersList'): for i,strname in enumerate(name): # subchild -> DoseStructureParametersList, 16 means the number of structures et.SubElement(subchild, 'DoseStructureParameter') et.SubElement(subchild[i],'StructureName').text = strname et.SubElement(subchild[i],'Enabled').text = '-1' et.SubElement(subchild[i],'HighDoseRef').text ='5' et.SubElement(subchild[i],'MinDoseRef').text = '95' et.SubElement(subchild[i],'PrescribedDose').text = '-1' et.SubElement(subchild[i],'RefDoseList') et.SubElement(subchild[i],'DoseGoalList') if strname in self.protocol_dict.keys(): print('OK') for subsubchild in subchild[i].findall('DoseGoalList'): print(subsubchild) for k in range(len(self.protocol_dict[strname])): et.SubElement(subsubchild,'DoseGoal') et.SubElement(subsubchild[k],'GoalType').text = self.protocol_dict[strname][k][-1] if self.protocol_dict[strname][k][-1] == '9': et.SubElement(subsubchild[k],'Dose').text = str(float(self.protocol_dict[strname][k][0].split('Gy')[0].split('V')[1])*100) else: et.SubElement(subsubchild[k],'Dose').text = str(float(self.protocol_dict[strname][k][1].split('Gy')[0])*100) if self.protocol_dict[strname][k][-1] == '8': et.SubElement(subsubchild[k],'Volume').text = str(float(self.protocol_dict[strname][k][0].split('cc')[0].split('D')[1])*1000) elif self.protocol_dict[strname][k][-1] == '7': et.SubElement(subsubchild[k],'Volume').text = self.protocol_dict[strname][k][0].split('%')[0].split('D')[1] elif self.protocol_dict[strname][k][-1] == '9': et.SubElement(subsubchild[k],'Volume').text = str(self.protocol_dict[strname][k][1]*100) elif self.protocol_dict[strname][k][-1] == '2': et.SubElement(subsubchild[k],'Volume').text = str(-1) et.SubElement(subsubchild[k],'Tolerance').text = '0' else: print('Flase') for subsubchild in subchild[i].findall('RefDoseList'): print() et.SubElement(subsubchild,'RefDose') et.SubElement(subsubchild[0],'RefType').text = '0' et.SubElement(subsubchild[0],'RefValue').text = '-1' # xml_path_output = 'C:/Users/xhuae08006/Desktop/XHTOMO_AUTO/Modifier/test_dosenormsettings.xml' self.pretty_xml(root1, ' ', '\n') # 执行美化方法 tree.write(self.ouput_xml_path,pretty_print = True,encoding="utf-8",standalone ="yes", xml_declaration = True) print('Done!') def exist_read_mod(self,path1): self.line = [] # store the pointer's location in file with open(path1, "r+",errors = 'ignore') as f: line1 = f.readline() self.line.append(line1) while line1: # pointer.append(f.tell()) #record the pointer loaction to help write line1 = f.readline() self.line.append(line1) return self.line def classify(self,strt_ind_list): self.level_OARs = {} for item in strt_ind_list: if item[2] > 2 and item[2] < 7: self.level_OARs[item[0]] = 1 elif item[2] > 6 and item[2] < 16: self.level_OARs[item[0]] = 2 elif item[2] == 16: self.level_OARs[item[0]] = 3 elif item[2] > 16 and item[2] < 24: self.level_OARs[item[0]] = 3 return self.level_OARs def modify_qp_551(self,Vol,Dose,Weight,Opti_all,Surf_margin): ''' This function is target penalty ''' if Opti_all == 1: for i,item in enumerate(self.element['# qp\n']): if item.split('=')[0] == ' refvolume': self.element['# qp\n'][i] = ''.join([' refvolume=',str(Vol),'\n']) elif item.split('=')[0] == ' isoconstraint': self.element['# qp\n'][i] = ''.join([' isoconstraint=',str(Dose),'\n']) elif item.split('=')[0] == ' weight': self.element['# qp\n'][i] = ''.join([' weight=',str(Weight),'\n']) elif item.split('=')[0] == ' sanesurfacedose': self.element['# qp\n'][i] = ''.join([' sanesurfacedose=',str(Surf_margin),'\n']) elif item.split('=')[0] == ' applyshrinkmargintooars': self.element['# qp\n'][i] = ''.join([' applyshrinkmargintooars=',str(1-Opti_all),'\n']) return self.element['# qp\n'] def modify_po_551(self,po,Dose,alpha): ''' This function is target EUD ''' self.po = po self.po[18] = ''.join([' isoconstraint=',str(Dose),'\n']) self.po[10] = ''.join([' alpha=',str(alpha),'\n']) self.po[-2] = ''.join([' !END\n']) return self.po[:-1] def modify_se_551(self,Dose,Weight,Shrink_margin,Opti_all,Powe_Law): ''' Serial function ''' if Opti_all == 1: for i,item in enumerate(self.element['# se\n']): if item.split('=')[0] == ' isoconstraint': self.element['# se\n'][i] = ''.join([' isoconstraint=',str(Dose),'\n']) elif item.split('=')[0] == ' weight': self.element['# se\n'][i] = ''.join([' weight=',str(Weight),'\n']) elif item.split('=')[0] == ' exponent': self.element['# se\n'][i] = ''.join([' exponent=',str(Powe_Law),'\n']) elif item.split('=')[0] == ' applyshrinkmargintooars': self.element['# se\n'][i] = ''.join([' applyshrinkmargintooars=',str(1-Opti_all),'\n']) else: for i,item in enumerate(self.element['# se\n']): if item.split('=')[0] == ' isoconstraint': self.element['# se\n'][i] = ''.join([' isoconstraint=',str(Dose),'\n']) elif item.split('=')[0] == ' weight': self.element['# se\n'][i] = ''.join([' weight=',str(Weight),'\n']) elif item.split('=')[0] == ' exponent': self.element['# se\n'][i] = ''.join([' exponent=',str(Powe_Law),'\n']) elif item.split('=')[0] == ' applyshrinkmargintooars': self.element['# se\n'][i] = ''.join([' applyshrinkmargintooars=',str(1-Opti_all),'\n']) elif item.split('=')[0] == ' groupmargins': for j,jtem in enumerate(self.tar_nam): self.element['# se\n'].insert(i,' !END\n') self.element['# se\n'].insert(i,' targetmargin='+str(Shrink_margin)+'\n') self.element['# se\n'].insert(i,' shrinkmargintarget='+jtem+'\n') self.element['# se\n'].insert(i,' !SHRINKMARGINTARGET\n') return self.element['# se\n'] def modify_pa_551(self,Ref_dose,Volume,Weight,Powe_Law,Opti_all,Shrink_margin): ''' Parallel Function ''' if Opti_all == 1: for i,item in enumerate(self.element['# pa\n']): if item.split('=')[0] == ' refdose': self.element['# pa\n'][i] = ''.join([' refdose=',str(Ref_dose),'\n']) elif item.split('=')[0] == ' isoconstraint': self.element['# pa\n'][i] = ''.join([' isoconstraint=',str(Volume),'\n']) elif item.split('=')[0] == ' weight': self.element['# pa\n'][i] = ''.join([' weight=',str(Weight),'\n']) elif item.split('=')[0] == ' exponent': self.element['# pa\n'][i] = ''.join([' exponent=',str(Powe_Law),'\n']) elif item.split('=')[0] == ' applyshrinkmargintooars': self.element['# pa\n'][i] = ''.join([' applyshrinkmargintooars=',str(1-Opti_all),'\n']) else: for i,item in enumerate(self.element['# pa\n']): if item.split('=')[0] == ' refdose': self.element['# pa\n'][i] = ''.join([' refdose=',str(Ref_dose),'\n']) elif item.split('=')[0] == ' isoconstraint': self.element['# pa\n'][i] = ''.join([' isoconstraint=',str(Volume),'\n']) elif item.split('=')[0] == ' weight': self.element['# pa\n'][i] = ''.join([' weight=',str(Weight),'\n']) elif item.split('=')[0] == ' exponent': self.element['# pa\n'][i] = ''.join([' exponent=',str(Powe_Law),'\n']) elif item.split('=')[0] == ' applyshrinkmargintooars': self.element['# pa\n'][i] = ''.join([' applyshrinkmargintooars=',str(1-Opti_all),'\n']) elif item.split('=')[0] == ' groupmargins': for j,jtem in enumerate(self.tar_nam): self.element['# pa\n'].insert(i,' !END\n') self.element['# pa\n'].insert(i,' targetmargin='+str(Shrink_margin)+'\n') self.element['# pa\n'].insert(i,' shrinkmargintarget='+jtem+'\n') self.element['# pa\n'].insert(i,' !SHRINKMARGINTARGET\n') return self.element['# pa\n'] def modify_mxd_551(self,Dose,Weight,Opti_all,Shrink_margin): ''' Maximum Dose ''' if Opti_all == 1: # means all structure voxels would be considered in for i,item in enumerate(self.element['# mxd\n']): if item.split('=')[0] == ' isoconstraint': self.element['# mxd\n'][i] = ''.join([' isoconstraint=',str(Dose),'\n' ]) elif item.split('=')[0] == ' weight': self.element['# mxd\n'][i] = ''.join([' weight=',str(Weight),'\n']) elif item.split('=')[0] == ' applyshrinkmargintooars': self.element['# mxd\n'][i] = ''.join([' applyshrinkmargintooars=',str(1-Opti_all),'\n']) else: # means should shrink for each PTV for i,item in enumerate(self.element['# oq\n']): if item.split('=')[0] == ' isoconstraint': self.element['# mxd\n'][i] = ''.join([' isoconstraint=',str(Dose),'\n' ]) elif item.split('=')[0] == ' weight': self.element['# mxd\n'][i] = ''.join([' weight=',str(Weight),'\n']) elif item.split('=')[0] == ' applyshrinkmargintooars': self.element['# mxd\n'][i] = ''.join([' applyshrinkmargintooars=',str(1-Opti_all),'\n']) elif item.split('=')[0] == ' groupmargins': for j,jtem in enumerate(self.tar_nam): self.element['# mxd\n'].insert(i,' !END\n') self.element['# mxd\n'].insert(i,' targetmargin='+str(Shrink_margin)+'\n') self.element['# mxd\n'].insert(i,' shrinkmargintarget='+jtem+'\n') self.element['# mxd\n'].insert(i,' !SHRINKMARGINTARGET\n') return self.element['# mxd\n'] def modify_qod_551(self,Dose,RMS,Shrink_margin,Opti_all): ''' quadratic overdose self.tar_nam = ['PGTVprn','PGTVnx','PGTVnd','PCTV'] ''' if Opti_all == 1: # means all structure voxels would be considered in for i,item in enumerate(self.element['# oq\n']): if item.split('=')[0] == ' thresholddose': self.element['# oq\n'][i] = ''.join([' thresholddose=',str(Dose),'\n']) elif item.split('=')[0] == ' isoconstraint': self.element['# oq\n'][i] = ''.join([' isoconstraint=',str(RMS),'\n']) elif item.split('=')[0] == ' applyshrinkmargintooars': self.element['# oq\n'][i] = ''.join([' applyshrinkmargintooars=',str(1-Opti_all),'\n']) else: # means should shrink for each PTV for i,item in enumerate(self.element['# oq\n']): if item.split('=')[0] == ' thresholddose': self.element['# oq\n'][i] = ''.join([' thresholddose=',str(Dose),'\n']) elif item.split('=')[0] == ' isoconstraint': self.element['# oq\n'][i] = ''.join([' isoconstraint=',str(RMS),'\n']) elif item.split('=')[0] == ' applyshrinkmargintooars': self.element['# oq\n'][i] = ''.join([' applyshrinkmargintooars=',str(1-Opti_all),'\n']) elif item.split('=')[0] == ' groupmargins': for j,jtem in enumerate(self.tar_nam): self.element['# oq\n'].insert(i,' !END\n') self.element['# oq\n'].insert(i,' targetmargin='+str(Shrink_margin)+'\n') self.element['# oq\n'].insert(i,' shrinkmargintarget='+jtem+'\n') self.element['# oq\n'].insert(i,' !SHRINKMARGINTARGET\n') return self.element['# oq\n'] def read_csv(self): self.pres_strt,self.dose_frac = [],[] self.pres_strt_ind = {} # initialization import csv with open(self.csv) as csvfile: readCSV = csv.reader(csvfile, delimiter=',') prep = [row for row in readCSV] prep = [item for item in prep if item != []] for i,item in enumerate(prep): prep[i][-1] = prep[i][-1].replace(' ','') self.pres_strt = list(set([l[0] for l in prep if l[0] != 'prep' and l[0] != 'frac' ])) self.dose_frac = [l for l in prep if l[0] == 'prep' or l[0] == 'frac' ] for item in self.pres_strt: self.pres_strt_ind[item] = [] # initialization for item in prep: if item[0] != 'prep' and item[0] != 'frac': if item[2][-1] != '%': self.pres_strt_ind[item[0]].append((item[1],float(item[2])/100)) else: self.pres_strt_ind[item[0]].append((item[1],float(item[2][:-1]))) return self.pres_strt,self.dose_frac,self.pres_strt_ind def write_colone(self): self.template_line.append('') s=''.join(self.template_line) f = open(self.updated_hyp_path,'w+') f.seek(0) f.write(s) f.close() def cf_OAR(self,path_new,OBJ): ''' this function is aimed to convert the item to most helpful one ''' import re weight_OARs = 0.01 k_se = 12 k_pa = 3 self.cost_fun = [] for i,j in enumerate(OBJ[1]): if j[0][0] == 'D': if j[0] == 'Dmean': se = self.modify_se(path_new['se'], j[1], weight_OARs, 0, 0, 1) self.cost_fun.extend(se) elif j[0] == 'Dmax': mxd =self.modify_mxd(path_new['mxd'], j[1], weight_OARs, 0, 0) self.cost_fun.extend(mxd) else: se = self.modify_se(path_new['se'], j[1]*0.75, weight_OARs, 0, 0, 16) self.cost_fun.extend(se) elif j[0][0] == 'V' : ss = (re.findall("\d+", j[0])) s = float(ss[0]) flag = j[1] if flag <= 15.0: se = self.modify_se(path_new['se'], s*0.75, weight_OARs, 3, 0, k_se) self.cost_fun.extend(se) else: pa = self.modify_pa(path_new['pa'], s, flag, weight_OARs, k_pa, 0, 0) self.cost_fun.extend(pa) return self.cost_fun def ge_tem_pros(self,strt_ind_list,path_beam,dose_frac): import math self.template_line = [] grid = 3 tar = [(item[0],item[1],float(item[1][0][0][1:])) for item in strt_ind_list if 'PTV' in item[0] or 'PGTV' in item[0] or 'GTV' in item[0]] tar.sort(key=lambda x:x[2],reverse = True) tar_nam = [item[0] for item in tar] OARs_nam = [item[0] for item in strt_ind_list if item[0] not in tar_nam] prep_name = [] prep_name = prep_name + tar_nam + OARs_nam ##tar_res_nam = [item[0] for item in OARs_nam_level if 'PTV' in item[0] or 'PGTV' in item[0]] ind = self.path[0].rindex('\\') path_new = {} for item in self.path: path_new[item[int(ind+1):-4]] = self.exist_read_mod(item) pres = float(dose_frac[1][1])/100 weight_target = 1 weight_OARs = 0.01 k_se = 12 k_pa = 3 RMS = 1 max_dose = 47.5 ## ================== part1 ================= ## part1 = ['000610b6\n','!LAYERING\n'] for item in prep_name: if item == 'patient' or item == 'BODY': part1.append(str(' ' + item + '\n')) else: part1.append(str(' ' + item + ':T\n')) part1.append('!END\n') ## ================== part2 ================ ## part2 = path_new['part2'] ## read template part2[-2] = ' conformalavoidance=0\n' part2 = part2[:-1] target = [] OARs = [] for i,item in enumerate(tar): if i != len(tar)-1: ## inner target 1 part2[1] = ' name=' + item[0] +'\n' # prep_v = float((item[1][0][1]+3)/100) prep_d = float(item[1][0][0][1:]) tar_pen = self.modify_po(path_new['po'],prep_d,0.6) qod = self.modify_qod(path_new['qod'],prep_d+2,RMS,0) target = target + part2 + tar_pen + qod target.append('!END\n') else: ## external target part2[1] = ' name=' + item[0] +'\n' # prep_v = float((item[1][0][1]+3)/100) prep_d = float(item[1][0][0][1:]) po = self.modify_po(path_new['po'],prep_d,0.6) ## set two quadratic overdose to external targets qod1 = self.modify_qod(path_new['qod'],pres,RMS,0) # QOD2 = temp_tool.modify_QOD(QOD_path,prep_d-4,RMS1,grid) qod2 = self.modify_qod(path_new['qod'],prep_d*1.1,RMS,grid*math.floor(abs(prep_d*1.1-pres)/grid)) target = target + part2 + po +qod1 + qod2 target.append('!END\n') for item in strt_ind_list: if item[0] not in tar_nam: if item[-1] == 5: ## stem and cord part2[1] = ' name=' + item[0] +'\n' cf1 = self.cf_OAR(path_new,item) OARs = OARs + part2 + cf1 OARs.append('!END\n') elif item[-1] == 6: ## normal tissues part2[1] = ' name=' + item[0] +'\n' cf2 = self.cf_OAR(path_new,item) OARs = OARs + part2 + cf2 OARs.append('!END\n') elif item[-1] == 7: ## normal tissues part2[1] = ' name=' + item[0] +'\n' cf3 = self.cf_OAR(path_new,item) OARs = OARs + part2 + cf3 OARs.append('!END\n') elif item[-1] == 8: ## normal tissues part2[1] = ' name=' + item[0] +'\n' cf4 = self.cf_OAR(path_new,item) OARs = OARs + part2 + cf4 OARs.append('!END\n') elif item[-1] == 9: ## normal tissues part2[1] = ' name=' + item[0] +'\n' cf5 = self.cf_OAR(path_new,item) OARs = OARs + part2 + cf5 OARs.append('!END\n') elif item[-1] == 100: ## patient part2[1] = ' name=' + item[0] +'\n' ## global maximum dose mxd1 = self.modify_mxd(path_new['mxd'], round(pres*1.06,2), weight_OARs, 1, 0) ## the outer target dose QOD1 = self.modify_qod(path_new['qod'],max_dose,RMS,grid*0) QOD2 = self.modify_qod(path_new['qod'],max_dose*0.8,RMS/2,grid*math.floor((max_dose*0.2)/grid)) QOD3 = self.modify_qod(path_new['qod'],max_dose*0.6,RMS/2,grid*math.floor((max_dose*0.4)/grid)) OARs = OARs + part2 + mxd1 + QOD1 + QOD2 + QOD3 OARs.append('!END\n') ## ================== part3 ================ ## part3 = path_new['part3'] part3[-2] = '!END\n' ## ================== part4 ================ ## part4 = self.exist_read_mod(path_beam) part4[-2] = '!END\n' ## ================== part5 ================ ## part5 = path_new['part5'] for i,item in enumerate(part5): if 'FRACTIONS' in item: part5[i] = ''.join(['!FRACTIONS ',dose_frac[0][1],'\n']) elif 'PRESCRIPTION' in item: part5[i] = ''.join(['!PRESCRIPTION ',str(float(dose_frac[1][1])/100),'\n']) ## ================== template ==================== ## self.template_line = self.template_line + part1 + target + OARs + part3[:-1] + part4[:-1] + part5[:-1] print('###############################') print('template has been generated !') print('###############################') return self.template_line def hyp_solution_XHTOMO_HEADNECK(self,grid,fractions,prescription_dose,delivery_type): ''' tar = [('PGTVrpn', 0.95, 61.6), ('PGTVnx', 0.95, 61.6), ('PGTVnd', 0.95, 59.36), ('PCTV', 0.95, 50.4)] OARs_level1 = ['Brain Stem','Spinal Cord'] OARs_level2 = ['Optical Chiasm','Optical Nerve R','Optical Nerve L','Lens R','Lens L'] OARs_level3 = ['Eye R','Eye L','Parotid R','Parotid L',,'Pituitary','Brain'] OARs_level4 = ['T.Joint R','T.Joint L','T.Lobe R','T.Lobe L','Larynx','A.D L','A.D R','Mandible','Oral Cavity','Lung'] ''' OARs_level1 = ['Brain Stem','Spinal Cord'] OARs_level2 = ['Optical Chiasm','Optical Nerve R','Optical Nerve L','Lens R','Lens L','Eye R','Eye L'] OARs_level3 = ['Parotid R','Parotid L','Pituitary','Brain','Larynx','Oral Cavity'] OARs_level4 = ['T.Joint R','T.Joint L','T.Lobe R','T.Lobe L','A.D L','A.D R','Mandible','Lung'] OARs_level5 = ['R1','R2','R3','R4','R5','R6','R7','R8','R9'] # ring structures self.template_line = [] # deal with target tar = [(key,self.protocol_dict[key][0][1],float(self.protocol_dict[key][0][0].split('V')[1].split('Gy')[0])) for key in self.protocol_dict.keys() if 'PCTV' in key or 'PGTV' in key or 'GTV' in key] tar.sort(key=lambda x:x[2],reverse = True) tar_nam = [item[0] for item in tar] sorted_name = self.name_sorting() OARs_nam = [item for item in sorted_name if item not in tar_nam and item in self.protocol_dict.keys()] prep_name = tar_nam + OARs_nam +['BODY'] OARs_nam = OARs_nam + ['BODY'] ## ============================ part1 ============================== ## part1 = ['000510b6\n','!LAYERING\n'] # Monaco5.11 serial number: 000510b6 for item in prep_name: if item == 'patient' or item == 'BODY': part1.append(str(' ' + item + '\n')) else: part1.append(str(' ' + item + ':T\n')) part1.append('!END\n') ## ============================ part2 ============================== ## part2 = self.element['# Part2\n'][:-1] ## read template target = [] OARs = [] # Target part for i,item in enumerate(tar): if i != len(tar)-1: ## inner target part2[1] = ' name=' + item[0] +'\n' # setting target penalty tar_pen = self.modify_qp(Vol = item[1],Dose = item[2],Weight = 1.0,Opti_all = 1,Surf_margin = 0) # setting quadratic overdose qod = self.modify_qod(Dose = item[2]+2,RMS = 0.5,Shrink_margin = 0) # combine them together target = target + part2 + tar_pen[:-1] + qod[:-1] target.append('!END\n') else: ## external target part2[1] = ' name=' + item[0] +'\n' # setting target penalty tar_pen_ext = self.modify_qp(Vol = item[1],Dose = item[2],Weight = 1.0,Opti_all = 1,Surf_margin = 0) target = target + part2 + tar_pen_ext[:-1] # first quadratic overdose to contrain inner target reigon to prevent hot dose release to low dose region qod1 = self.modify_qod(Dose = tar[i-1][-1],RMS = 0.5,Shrink_margin = 0) target = target + qod1[:-1] # second quadratic overdose to constarin 110% percent of external target dose region qod2 = self.modify_qod(Dose = round(item[2]*1.1,2),RMS = 0.75,Shrink_margin = grid) target = target + qod2[:-1] # third quadratic overdose to constrain 102% percent of external target dose region qod3 = self.modify_qod(Dose = round(item[2]*1.02,2),RMS = 1,Shrink_margin = grid*2) target = target + qod3[:-1] target.append('!END\n') # OARs part for item in OARs_nam: ''' D_x_cc < y Gy => if x < 10, then two cost functions were added: 1. serial (k = 12, Isoconstraint(EUD) = 0.75*y) 2. maximum dose (isoconstraint = y) D_x_% < y Gy 1. if 40% < x < 60%, then one cost function was added: serial (k = 1, isocostraint = y) 2. if 20% < x < 40%, then one cost function was added: serial (k = 8, isoconstraint = 0.95*y) 3. if 10% < x < 20%, then one cost function was added: serial (k = 12, isoconstaraint = 0.85*y) 4. if 0% < x < 10%, then one cost function was added: serial (k = 15, isoconstraint = 0.75*y) ''' if item in OARs_level1: # setting a serial and maximum cost function part2[1] = ' name=' + item +'\n' # CF: serial to contrain high dose region cf1 = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*0.90,Weight=0.01, Shrink_margin=0,Opti_all=0,Powe_Law=12) # CF: maximum to constrain maximum point if 'max' in self.protocol_dict[item][0][0].split('D')[1]: cf2 = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, Opti_all=1,Shrink_margin=0) elif '0.1cc' in self.protocol_dict[item][0][0].split('D')[1]: cf2 = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*0.9,Weight=0.01, Opti_all=1,Shrink_margin=0) else: cf2 = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf1[:-1] + cf2[:-1] OARs.append('!END\n') elif item in OARs_level2: # setting a maximum CF if Dx% < D5%, else setting a serial CF part2[1] = ' name=' + item +'\n' cf = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item in OARs_level3: # setting two serial CFs if it appears D50%, else setting one serial CF part2[1] = ' name=' + item +'\n' if '50%' in self.protocol_dict[item][0][0].split('D'): cf1 = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*1.5,Weight=0.01, Shrink_margin=3,Opti_all=0,Powe_Law=15) OARs = OARs + part2 + cf1[:-1] cf2 = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, Shrink_margin=0,Opti_all=0,Powe_Law=1) OARs = OARs + cf2[:-1] OARs.append('!END\n') else: cf1 = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, Shrink_margin=0,Opti_all=0,Powe_Law=15) OARs = OARs + part2 + cf1[:-1] OARs.append('!END\n') elif item in OARs_level4: # setting a serial CFs if it don't appear D50%, else setting one parallel CFs part2[1] = ' name=' + item +'\n' if len(self.protocol_dict[item]) == 1: # only one statistics DVH evaluation index if '50%' not in self.protocol_dict[item][0][0].split('D'): cf = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, Shrink_margin=3,Opti_all=0,Powe_Law=12) elif '50%' in self.protocol_dict[item][0][0].split('D'): cf = self.modify_pa(Ref_dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Volume = 50, Weight=0.01,Powe_Law=4,Opti_all=0,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') else: # DVH statistics indices more than one CF = [] for key in self.protocol_dict[item]: if 'cc' in key[0]: if float(key[0].split('D')[1].split('cc')[0]) <= 10: cf1 = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]), Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=12) cf2 = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, Opti_all=0,Shrink_margin=0) cf = cf1[:-1] + cf2[:-1] elif '%' in key[0]: if float(key[0].split('D')[1].split('%')[0]) <= 60 and float(key[0].split('D')[1].split('%')[0]) > 40: cf = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]), Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=1) elif float(key[0].split('D')[1].split('%')[0]) <= 40 and float(key[0].split('D')[1].split('%')[0]) > 20: cf = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*0.99, Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=10) elif float(key[0].split('D')[1].split('%')[0]) <= 20 and float(key[0].split('D')[1].split('%')[0]) > 10: cf = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*0.98, Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=15) elif float(key[0].split('D')[1].split('%')[0]) <= 10: cf = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*0.97, Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=20) cf = cf[:-1] CF = CF + cf OARs = OARs + part2 + CF OARs.append('!END\n') elif item in OARs_level5: part2[1] = ' name=' + item +'\n' cf = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'BODY': ## patient part2[1] = ' name=' + item +'\n' ## global maximum dose mxd1 = self.modify_mxd(Dose= tar[0][-1]*1.1, Weight=0.01, Opti_all=1, Shrink_margin=0) OARs = OARs + part2 + mxd1[:-1] ## the outer target dose QOD1 = self.modify_qod(Dose = tar[-1][-1], RMS = 0.5, Shrink_margin = 0) OARs = OARs + QOD1[:-1] QOD2 = self.modify_qod(Dose = tar[-1][-1]-5, RMS = 1.0, Shrink_margin = grid) OARs = OARs + QOD2[:-1] QOD3 = self.modify_qod(Dose = tar[-1][-1]-10, RMS = 1.5, Shrink_margin = grid*2) OARs = OARs + QOD3[:-1] QOD4 = self.modify_qod(Dose = tar[-1][-1]-15, RMS = 2.0, Shrink_margin = grid*3) OARs = OARs + QOD4[:-1] OARs.append('!END\n') # ## ============================ part3 ============================== ## part3 = self.element['# Part3\n'][:-1] ## ============================ part4 ============================== ## # here are two selections for part4 if delivery_type == 'VMAT': # VMAT 360 ARC part4 = self.element['# Part4_VMAT\n'][:-1] elif delivery_type == 'IMRT': # IMRT 9beams part4 = self.element['# Part4_IMRT\n'][:-1] ## ============================ part5 ============================== ## part5 = self.element['# Part5\n'][:-1] for i,item in enumerate(part5): if 'FRACTIONS' in item: part5[i] = ''.join(['!FRACTIONS ',str(fractions),'\n']) elif 'PRESCRIPTION' in item: part5[i] = ''.join(['!PRESCRIPTION ',str(float(prescription_dose)),'\n']) ## ================== template ==================== ## self.template_line = self.template_line + part1 + target + OARs + part3 + part4 + part5 print('###############################') print('template has been generated !') print('###############################') return self.template_line def hyp_solution_NPC_V1(self,grid,fractions,prescription_dose,delivery_type): ''' hyp_solution_NPC used for Head and neck cases tar = [('PGTVrpn', 0.95, 61.6), ('PGTVnx', 0.95, 61.6), ('PGTVnd', 0.95, 59.36), ('PCTV', 0.95, 50.4)] OARs_level1 = ['Brain Stem','Spinal Cord'] OARs_level2 = ['Optical Chiasm','Optical Nerve R','Optical Nerve L','Lens R','Lens L'] OARs_level3 = ['Eye R','Eye L','Parotid R','Parotid L',,'Pituitary','Brain'] OARs_level4 = ['T.Joint R','T.Joint L','T.Lobe R','T.Lobe L','Larynx','A.D L','A.D R','Mandible','Oral Cavity','Lung'] ''' self.template_line = [] # deal with target tar = [(key,self.protocol_dict[key][0][1], float(self.protocol_dict[key][0][0].split('V')[1].split('Gy')[0])) for key in self.protocol_dict.keys() if 'PCTV' in key or 'PGTV' in key or 'GTV' in key] tar.sort(key=lambda x:x[2],reverse = True) self.tar_nam = [item[0] for item in tar] sorted_name = self.name_sorting() OARs_nam = [item for item in sorted_name if item not in self.tar_nam and item in self.protocol_dict.keys()] + ['R6','R7'] prep_name = self.tar_nam + OARs_nam +['BODY'] OARs_nam = OARs_nam + ['BODY'] ## ============================ part1 ============================== ## part1 = ['000510b6\n','!LAYERING\n'] # Monaco5.11 serial number: 000510b6 for item in prep_name: if item == 'patient' or item == 'BODY': part1.append(str(' ' + item + '\n')) else: part1.append(str(' ' + item + ':T\n')) part1.append('!END\n') ## ============================ part2 ============================== ## part2 = self.element['# Part2\n'][:-1] ## read template target = [] OARs = [] # Target part for i,item in enumerate(tar): if i != len(tar)-1: ## inner target part2[1] = ' name=' + item[0] +'\n' # setting target penalty tar_pen = self.modify_qp_551(Vol = item[1],Dose = item[2],Weight = 1.0,Opti_all = 1,Surf_margin = 0) # setting quadratic overdose qod = self.modify_qod_551(Dose = int(item[2]+1.5),RMS = 0.25,Shrink_margin = 0,Opti_all = 0) # combine them together target = target + part2 + tar_pen[:-1] + qod[:-1] target.append('!END\n') else: ## external target part2[1] = ' name=' + item[0] +'\n' # setting target penalty tar_pen_ext = self.modify_qp_551(Vol = item[1],Dose = item[2],Weight = 1.0,Opti_all = 1,Surf_margin = 0) target = target + part2 + tar_pen_ext[:-1] # first quadratic overdose to contrain inner target reigon to prevent hot dose release to low dose region qod1 = self.modify_qod_551(Dose = tar[i-1][-1],RMS = 0.25,Shrink_margin = 0,Opti_all = 0) target = target + qod1[:-1] # second quadratic overdose to constarin 110% percent of external target dose region qod2 = self.modify_qod(Dose = int(item[2]*1.1),RMS = 0.5,Shrink_margin = grid) target = target + qod2[:-1] # third quadratic overdose to constrain 102% percent of external target dose region qod3 = self.modify_qod(Dose = int(item[2]*1.02),RMS = 0.75,Shrink_margin = grid*2) target = target + qod3[:-1] target.append('!END\n') # OARs part for item in OARs_nam: ''' D_x_cc < y Gy => if x < 10, then two cost functions were added: 1. serial (k = 12, Isoconstraint(EUD) = 0.75*y) 2. maximum dose (isoconstraint = y) D_x_% < y Gy 1. if 40% < x < 60%, then one cost function was added: serial (k = 1, isocostraint = y) 2. if 20% < x < 40%, then one cost function was added: serial (k = 8, isoconstraint = 0.95*y) 3. if 10% < x < 20%, then one cost function was added: serial (k = 12, isoconstaraint = 0.85*y) 4. if 0% < x < 10%, then one cost function was added: serial (k = 15, isoconstraint = 0.75*y) ''' if item == 'Brain Stem': part2[1] = ' name=' + item +'\n' # select the maximum value from protocol request and 0.8*prescription dose max_dose = max(float(self.protocol_dict[item][0][1].split('Gy')[0]), 0.8*tar[0][-1]) # select CF: maximum cf = self.modify_mxd(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Spinal Cord': part2[1] = ' name=' + item +'\n' # select the maximum value from protocol request and 0.75*prescription dose max_dose = max(float(self.protocol_dict[item][0][1].split('Gy')[0]), 0.75*tar[0][-1]) # select CF:maximum cf = self.modify_mxd(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Optical Chiasm' or item == 'Optical Nerve L' or item == 'Optical Nerve R': part2[1] = ' name=' + item +'\n' # select the maximum value from protocol request and 0.75*prescription dose max_dose = max(float(self.protocol_dict[item][0][1].split('Gy')[0]), 0.75*tar[0][-1]) # select CF:maximum cf = self.modify_mxd(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Lens R' or item == 'Lens L': part2[1] = ' name=' + item +'\n' # select the maximum value from protocol request max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) # select CF:maximum cf = self.modify_mxd(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Eye R' or item == 'Eye L': part2[1] = ' name=' + item +'\n' if '%' in self.protocol_dict[item][0][0]: percent = float(self.protocol_dict[item][0][0].split('D')[1].split('%')[0]) if percent < 10: # select CF: maximum max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf = self.modify_mxd(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) elif percent < 35: # select CF: serial eud_dose = 0.75*tar[0][-1] cf = self.modify_se(Dose=int(eud_dose),Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=12) elif 'cc' in self.protocol_dict[item][0][0]: vol = float(self.protocol_dict[item][0][0].split('D')[1].split('cc')[0]) if vol < 10: # select CF: maximum max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf = self.modify_mxd(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) elif vol < 35: # select CF: serial eud_dose = 0.75*tar[0][-1] cf = self.modify_se(Dose=int(eud_dose),Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Parotid R' or item == 'Parotid L': part2[1] = ' name=' + item +'\n' # select CF1: serial (constrain high dose region) eud_dose1 = 0.5*tar[0][-1] cf1 = self.modify_se(Dose= eud_dose1,Weight=0.01,Shrink_margin=grid,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf1[:-1] # select CF2: serial (constrain mean dose) eud_dose2 = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf2 = self.modify_se(Dose= eud_dose2,Weight=0.01,Shrink_margin=0,Opti_all=1,Powe_Law=1) OARs = OARs + cf2[:-1] OARs.append('!END\n') elif item == 'Oral Cavity': part2[1] = ' name=' + item +'\n' # select CF1: serial (constrain high dose region) eud_dose = 0.65*tar[0][-1] cf1 = self.modify_se(Dose= int(eud_dose),Weight=0.01,Shrink_margin=grid,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf1[:-1] # select CF2: serial (constrain mean dose, eud = pro_dose+2Gy) eud_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf2 = self.modify_se(Dose= int(eud_dose),Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=1) OARs = OARs + cf2[:-1] OARs.append('!END\n') elif item == 'Larynx': part2[1] = ' name=' + item +'\n' # select CF1: serial (constrain high dose region) eud_dose = 0.65*tar[0][-1] cf1 = self.modify_se(Dose= int(eud_dose),Weight=0.01,Shrink_margin=grid,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf1[:-1] # select CF2: parallel (constrain mean dose, eud = pro_dose+2Gy) max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf2 = self.modify_pa(Ref_dose= int(max_dose),Volume = 50, Weight=0.01,Powe_Law=4,Opti_all=1,Shrink_margin=0) OARs = OARs + cf2[:-1] OARs.append('!END\n') elif item == 'Pitutary' or item == 'Pituitary': part2[1] = ' name=' + item +'\n' # select CF: Parallel (constrain D50% and optimize all) max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf = self.modify_pa(Ref_dose= int(max_dose),Volume = 50, Weight=0.01,Powe_Law=4,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'T.Lobe R' or item == 'T.Lobe L': part2[1] = ' name=' + item +'\n' # select CF: Serial (constrain high dose region) eud_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf1 = self.modify_se(Dose= int(eud_dose),Weight=0.01,Shrink_margin=grid,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Brain': part2[1] = ' name=' + item +'\n' # select CF: Maximum (Constrain D5%) max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf = self.modify_mxd(Dose= int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Mandible': part2[1] = ' name=' + item +'\n' # select CF1: Quadratic Overdose(Constrain D2cc/Max Dose) max_dose = tar[0][-1] cf1 = self.modify_qod(Dose= int(max_dose),RMS = 0.25,Shrink_margin = 0) # cf1 = self.modify_mxd(Dose=max_dose,Weight=0.01,Opti_all=1,Shrink_margin=0) # cf1 = self.modify_se(Dose= max_dose*0.75,Weight=0.01,Shrink_margin=0.25,Opti_all=0,Powe_Law=12) OARs + part2 + cf1[:-1] # select CF1: Serial (Constrain D50% dose ) eud_dose = tar[0][-1]*0.6 cf2 = self.modify_se(Dose= int(eud_dose),Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=1) OARs = OARs + cf2[:-1] OARs.append('!END\n') elif item == 'A.D L' or item == 'A.D R' or item == 'T.Joint R' or item == 'T.Joint L': part2[1] = ' name=' + item +'\n' # select CF: Parallel (Constrain D50% dose ) max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf = self.modify_pa(Ref_dose= int(max_dose),Volume = 50, Weight=0.01,Powe_Law=4,Opti_all=0,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Lung': part2[1] = ' name=' + item +'\n' # select CF: Serial (Constrain high dose ) eud_dose = tar[0][-1]*0.6 cf = self.modify_se(Dose= int(eud_dose),Weight=0.01,Shrink_margin=grid,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') # assistance structure like SPPRV,BSPRV,R6,R7 elif item == 'SPPRV': part2[1] = ' name=' + item +'\n' # select CF: Maximum (Constrain high dose ) max_dose = tar[-1][-1]*0.6 cf = self.modify_mxd(Dose= int(max_dose), Weight=0.01, Opti_all=1, Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'BSPRV': part2[1] = ' name=' + item +'\n' # select CF: Maximum (Constrain high dose ) max_dose = tar[-1][-1]*0.7 cf = self.modify_mxd(Dose= int(max_dose), Weight=0.01, Opti_all=1, Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'R6' or item == 'R7': part2[1] = ' name=' + item +'\n' # select CF: Maximum (Constrain high dose ) max_dose = tar[-1][-1]*0.7 cf = self.modify_mxd(Dose= int(max_dose), Weight=0.01, Opti_all=1, Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') # if item in OARs_level1: # # # setting a serial and maximum cost function # part2[1] = ' name=' + item +'\n' # # # CF: serial to contrain high dose region # cf1 = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*0.90,Weight=0.01, # Shrink_margin=0,Opti_all=0,Powe_Law=12) # # # CF: maximum to constrain maximum point # if 'max' in self.protocol_dict[item][0][0].split('D')[1]: # # cf2 = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, # Opti_all=1,Shrink_margin=0) # # elif '0.1cc' in self.protocol_dict[item][0][0].split('D')[1]: # # cf2 = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*0.9,Weight=0.01, # Opti_all=1,Shrink_margin=0) # else: # # cf2 = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, # Opti_all=1,Shrink_margin=0) # # # OARs = OARs + part2 + cf1[:-1] + cf2[:-1] # OARs.append('!END\n') # # # elif item in OARs_level2: # # # setting a maximum CF if Dx% < D5%, else setting a serial CF # part2[1] = ' name=' + item +'\n' # # cf = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, # Opti_all=1,Shrink_margin=0) # # OARs = OARs + part2 + cf[:-1] # OARs.append('!END\n') # # elif item in OARs_level3: # # # setting two serial CFs if it appears D50%, else setting one serial CF # part2[1] = ' name=' + item +'\n' # # if '50%' in self.protocol_dict[item][0][0].split('D'): # # cf1 = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*1.5,Weight=0.01, # Shrink_margin=3,Opti_all=0,Powe_Law=15) # OARs = OARs + part2 + cf1[:-1] # # # cf2 = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, # Shrink_margin=0,Opti_all=0,Powe_Law=1) # OARs = OARs + cf2[:-1] # # # OARs.append('!END\n') # # else: # # cf1 = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, # Shrink_margin=0,Opti_all=0,Powe_Law=15) # # # OARs = OARs + part2 + cf1[:-1] # OARs.append('!END\n') # # elif item in OARs_level4: # # # setting a serial CFs if it don't appear D50%, else setting one parallel CFs # part2[1] = ' name=' + item +'\n' # # if len(self.protocol_dict[item]) == 1: # # only one statistics DVH evaluation index # if '50%' not in self.protocol_dict[item][0][0].split('D'): # # cf = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, # Shrink_margin=3,Opti_all=0,Powe_Law=12) # # elif '50%' in self.protocol_dict[item][0][0].split('D'): # # cf = self.modify_pa(Ref_dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Volume = 50, # Weight=0.01,Powe_Law=4,Opti_all=0,Shrink_margin=0) # # OARs = OARs + part2 + cf[:-1] # OARs.append('!END\n') # # else: # # # DVH statistics indices more than one # CF = [] # # for key in self.protocol_dict[item]: # # if 'cc' in key[0]: # # if float(key[0].split('D')[1].split('cc')[0]) <= 10: # # cf1 = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]), # Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=12) # # cf2 = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, # Opti_all=0,Shrink_margin=0) # # cf = cf1[:-1] + cf2[:-1] # # elif '%' in key[0]: # # if float(key[0].split('D')[1].split('%')[0]) <= 60 and float(key[0].split('D')[1].split('%')[0]) > 40: # # cf = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]), # Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=1) # # elif float(key[0].split('D')[1].split('%')[0]) <= 40 and float(key[0].split('D')[1].split('%')[0]) > 20: # # cf = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*0.99, # Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=10) # # elif float(key[0].split('D')[1].split('%')[0]) <= 20 and float(key[0].split('D')[1].split('%')[0]) > 10: # # cf = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*0.98, # Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=15) # # elif float(key[0].split('D')[1].split('%')[0]) <= 10: # # cf = self.modify_se(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0])*0.97, # Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=20) # # cf = cf[:-1] # # CF = CF + cf # # OARs = OARs + part2 + CF # OARs.append('!END\n') # # elif item in OARs_level5: # # part2[1] = ' name=' + item +'\n' # # cf = self.modify_mxd(Dose=float(self.protocol_dict[item][0][1].split('Gy')[0]),Weight=0.01, # Opti_all=1,Shrink_margin=0) # # OARs = OARs + part2 + cf[:-1] # OARs.append('!END\n') elif item == 'BODY' or item == 'Patient' or item == 'Body': ## patient part2[1] = ' name=' + item +'\n' ## global maximum dose mxd1 = self.modify_mxd(Dose= int(tar[0][-1]*1.1), Weight=0.01, Opti_all=1, Shrink_margin=0) OARs = OARs + part2 + mxd1[:-1] ## the outer target dose QOD1 = self.modify_qod(Dose = int(tar[-1][-1]), RMS = 0.5, Shrink_margin = 0) OARs = OARs + QOD1[:-1] QOD2 = self.modify_qod(Dose = int(tar[-1][-1])-5, RMS = 0.75, Shrink_margin = grid) OARs = OARs + QOD2[:-1] QOD3 = self.modify_qod(Dose = int(tar[-1][-1])-10, RMS = 1, Shrink_margin = grid*2) OARs = OARs + QOD3[:-1] QOD4 = self.modify_qod(Dose = int(tar[-1][-1])-15, RMS = 1.25, Shrink_margin = grid*3) OARs = OARs + QOD4[:-1] QOD5 = self.modify_qod(Dose = int(tar[-1][-1])-20, RMS = 1.5, Shrink_margin = grid*4) OARs = OARs + QOD5[:-1] OARs.append('!END\n') # ## ============================ part3 ============================== ## part3 = self.element['# Part3\n'][:-1] ## ============================ part4 ============================== ## # here are two selections for part4 if delivery_type == 'VMAT': # VMAT 360 ARC part4 = self.element['# Part4_VMAT\n'][:-1] elif delivery_type == 'IMRT': # IMRT 9beams step&shoot part4 = self.element['# Part4_IMRT\n'][:-1] ## ============================ part5 ============================== ## part5 = self.element['# Part5\n'][:-1] for i,item in enumerate(part5): if 'FRACTIONS' in item: part5[i] = ''.join(['!FRACTIONS ',str(fractions),'\n']) elif 'PRESCRIPTION' in item: part5[i] = ''.join(['!PRESCRIPTION ',str(float(prescription_dose)),'\n']) elif 'DOSEGRIDSIZE' in item: part5[i] = ''.join(['!DOSEGRIDSIZE ',str(float(grid)),'\n']) # elif 'MAXNARCS' in item: # part5[i] = ''.join(['!MAXNARCS ',str(float(ARCS)),'\n']) ## ================== template ==================== ## self.template_line = self.template_line + part1 + target + OARs + part3 + part4 + part5 print('###############################') print('template has been generated !') print('###############################') return self.template_line def hyp_solution_NPC_V2(self,grid,fractions,prescription_dose,delivery_type): ''' This is another version of NPC model ''' self.template_line = [] # deal with target tar = [(key,self.protocol_dict[key][0][1], float(self.protocol_dict[key][0][0].split('V')[1].split('Gy')[0])) for key in self.protocol_dict.keys() if 'PCTV' in key or 'PGTV' in key or 'GTV' in key] tar.sort(key=lambda x:x[2],reverse = True) self.tar_nam = [item[0] for item in tar] sorted_name = self.name_sorting() OARs_nam = [item for item in sorted_name if item not in self.tar_nam and item in self.protocol_dict.keys()] + ['R6','R7'] prep_name = self.tar_nam + OARs_nam +['BODY'] OARs_nam = OARs_nam + ['BODY'] ## ============================ part1 ============================== ## part1 = ['000510b6\n','!LAYERING\n'] # Monaco5.11 serial number: 000510b6 for item in prep_name: if item == 'patient' or item == 'BODY': part1.append(str(' ' + item + '\n')) else: part1.append(str(' ' + item + ':T\n')) part1.append('!END\n') ## ============================ part2 ============================== ## part2 = self.element['# Part2\n'][:-1] ## read template target = [] OARs = [] # Target part for i,item in enumerate(tar): if i != len(tar)-1: ## inner target part2[1] = ' name=' + item[0] +'\n' # setting target penalty tar_pen = self.modify_qp_551(Vol = item[1],Dose = item[2],Weight = 1.0,Opti_all = 1,Surf_margin = 0) # setting quadratic overdose qod = self.modify_qod_551(Dose = int(item[2]+1.5),RMS = 0.25,Shrink_margin = 0,Opti_all = 0) # combine them together target = target + part2 + tar_pen[:-1] + qod[:-1] target.append('!END\n') else: ## external target part2[1] = ' name=' + item[0] +'\n' # setting target penalty tar_pen_ext = self.modify_qp_551(Vol = item[1],Dose = item[2],Weight = 1.0,Opti_all = 1,Surf_margin = 0) target = target + part2 + tar_pen_ext[:-1] # first quadratic overdose to contrain inner target reigon to prevent hot dose release to low dose region qod1 = self.modify_qod_551(Dose = tar[i-1][-1],RMS = 0.25,Shrink_margin = 0,Opti_all = 0) target = target + qod1[:-1] # second quadratic overdose to constarin 110% percent of external target dose region qod2 = self.modify_qod_551(Dose = int(item[2]*1.1),RMS = 0.5,Shrink_margin = grid*2, Opti_all= 0) target = target + qod2[:-1] # third quadratic overdose to constrain 102% percent of external target dose region qod3 = self.modify_qod_551(Dose = int(item[2]*1.02),RMS = 0.75,Shrink_margin = grid*3, Opti_all = 0) target = target + qod3[:-1] target.append('!END\n') # OARs part for item in OARs_nam: ''' D_x_cc < y Gy => if x < 10, then two cost functions were added: 1. serial (k = 12, Isoconstraint(EUD) = 0.75*y) 2. maximum dose (isoconstraint = y) D_x_% < y Gy 1. if 40% < x < 60%, then one cost function was added: serial (k = 1, isocostraint = y) 2. if 20% < x < 40%, then one cost function was added: serial (k = 8, isoconstraint = 0.95*y) 3. if 10% < x < 20%, then one cost function was added: serial (k = 12, isoconstaraint = 0.85*y) 4. if 0% < x < 10%, then one cost function was added: serial (k = 15, isoconstraint = 0.75*y) ''' if item == 'Brain Stem': part2[1] = ' name=' + item +'\n' # select the maximum value from protocol request and 0.8*prescription dose max_dose = max(float(self.protocol_dict[item][0][1].split('Gy')[0]), 0.8*tar[0][-1]) # select CF: maximum cf = self.modify_mxd_551(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Spinal Cord': part2[1] = ' name=' + item +'\n' # select the maximum value from protocol request and 0.75*prescription dose max_dose = max(float(self.protocol_dict[item][0][1].split('Gy')[0]), 0.75*tar[0][-1]) # select CF:maximum cf = self.modify_mxd_551(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Optical Chiasm' or item == 'Optical Nerve L' or item == 'Optical Nerve R': part2[1] = ' name=' + item +'\n' # select the maximum value from protocol request and 0.75*prescription dose max_dose = max(float(self.protocol_dict[item][0][1].split('Gy')[0]), 0.75*tar[0][-1]) # select CF:maximum cf = self.modify_mxd_551(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Lens R' or item == 'Lens L': part2[1] = ' name=' + item +'\n' # select the maximum value from protocol request max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) # select CF:maximum cf = self.modify_mxd_551(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Eye R' or item == 'Eye L': part2[1] = ' name=' + item +'\n' if '%' in self.protocol_dict[item][0][0]: percent = float(self.protocol_dict[item][0][0].split('D')[1].split('%')[0]) if percent < 10: # select CF: maximum max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf = self.modify_mxd_551(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) elif percent < 35: # select CF: serial eud_dose = 0.75*tar[0][-1] cf = self.modify_se_551(Dose=int(eud_dose),Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=12) elif 'cc' in self.protocol_dict[item][0][0]: vol = float(self.protocol_dict[item][0][0].split('D')[1].split('cc')[0]) if vol < 10: # select CF: maximum max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf = self.modify_mxd_551(Dose=int(max_dose),Weight=0.01,Opti_all=1,Shrink_margin=0) elif vol < 35: # select CF: serial eud_dose = 0.75*tar[0][-1] cf = self.modify_se_551(Dose=int(eud_dose),Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Parotid R' or item == 'Parotid L': part2[1] = ' name=' + item +'\n' # select CF1: serial (constrain high dose region) eud_dose1 = 0.5*tar[0][-1] cf1 = self.modify_se_551(Dose= eud_dose1,Weight=0.01,Shrink_margin=grid,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf1[:-1] # select CF2: serial (constrain mean dose) eud_dose2 = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf2 = self.modify_se_551(Dose= eud_dose2,Weight=0.01,Shrink_margin=0,Opti_all=1,Powe_Law=1) OARs = OARs + cf2[:-1] OARs.append('!END\n') elif item == 'Oral Cavity': part2[1] = ' name=' + item +'\n' # select CF1: serial (constrain high dose region) eud_dose = 0.65*tar[0][-1] cf1 = self.modify_se_551(Dose= int(eud_dose),Weight=0.01,Shrink_margin=grid,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf1[:-1] # select CF2: serial (constrain mean dose, eud = pro_dose+2Gy) eud_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf2 = self.modify_se_551(Dose= int(eud_dose),Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=1) OARs = OARs + cf2[:-1] OARs.append('!END\n') elif item == 'Larynx': part2[1] = ' name=' + item +'\n' # select CF1: serial (constrain high dose region) eud_dose = 0.65*tar[0][-1] cf1 = self.modify_se_551(Dose= int(eud_dose),Weight=0.01,Shrink_margin=grid,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf1[:-1] # select CF2: parallel (constrain mean dose, eud = pro_dose+2Gy) max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf2 = self.modify_pa_551(Ref_dose= int(max_dose),Volume = 50, Weight=0.01,Powe_Law=4,Opti_all=1,Shrink_margin=0) OARs = OARs + cf2[:-1] OARs.append('!END\n') elif item == 'Pitutary' or item == 'Pituitary': part2[1] = ' name=' + item +'\n' # select CF: Parallel (constrain D50% and optimize all) max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf = self.modify_pa_551(Ref_dose= int(max_dose),Volume = 50, Weight=0.01,Powe_Law=4,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'T.Lobe R' or item == 'T.Lobe L': part2[1] = ' name=' + item +'\n' # select CF: Serial (constrain high dose region) eud_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf1 = self.modify_se_551(Dose= int(eud_dose),Weight=0.01,Shrink_margin=grid,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Brain': part2[1] = ' name=' + item +'\n' # select CF: Maximum (Constrain D5%) max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf = self.modify_mxd_551(Dose= int(max_dose)+5,Weight=0.01,Opti_all=1,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Mandible': part2[1] = ' name=' + item +'\n' # select CF1: Quadratic Overdose(Constrain D2cc/Max Dose) max_dose = tar[0][-1] cf1 = self.modify_qod_551(Dose= int(max_dose),RMS = 0.25,Shrink_margin = 0, Opti_all = 0) # cf1 = self.modify_mxd(Dose=max_dose,Weight=0.01,Opti_all=1,Shrink_margin=0) # cf1 = self.modify_se(Dose= max_dose*0.75,Weight=0.01,Shrink_margin=0.25,Opti_all=0,Powe_Law=12) OARs + part2 + cf1[:-1] # select CF1: Serial (Constrain D50% dose ) eud_dose = tar[0][-1]*0.6 cf2 = self.modify_se_551(Dose= int(eud_dose),Weight=0.01,Shrink_margin=0,Opti_all=0,Powe_Law=1) OARs = OARs + cf2[:-1] OARs.append('!END\n') elif item == 'A.D L' or item == 'A.D R' or item == 'T.Joint R' or item == 'T.Joint L': part2[1] = ' name=' + item +'\n' # select CF: Parallel (Constrain D50% dose ) max_dose = float(self.protocol_dict[item][0][1].split('Gy')[0]) cf = self.modify_pa_551(Ref_dose= int(max_dose),Volume = 50, Weight=0.01,Powe_Law=4,Opti_all=0,Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'Lung': part2[1] = ' name=' + item +'\n' # select CF: Serial (Constrain high dose ) eud_dose = tar[0][-1]*0.6 cf = self.modify_se_551(Dose= int(eud_dose),Weight=0.01,Shrink_margin=grid,Opti_all=0,Powe_Law=12) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') # assistance structure like SPPRV,BSPRV,R6,R7 elif item == 'SPPRV': part2[1] = ' name=' + item +'\n' # select CF: Maximum (Constrain high dose ) max_dose = tar[-1][-1]*0.6 cf = self.modify_mxd_551(Dose= int(max_dose), Weight=0.01, Opti_all=1, Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'BSPRV': part2[1] = ' name=' + item +'\n' # select CF: Maximum (Constrain high dose ) max_dose = tar[-1][-1]*0.7 cf = self.modify_mxd_551(Dose= int(max_dose), Weight=0.01, Opti_all=1, Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'R6' or item == 'R7': part2[1] = ' name=' + item +'\n' # select CF: Maximum (Constrain high dose ) max_dose = tar[-1][-1]*0.7 cf = self.modify_mxd_551(Dose= int(max_dose), Weight=0.01, Opti_all=1, Shrink_margin=0) OARs = OARs + part2 + cf[:-1] OARs.append('!END\n') elif item == 'BODY' or item == 'Patient' or item == 'Body': ## patient part2[1] = ' name=' + item +'\n' ## global maximum dose mxd1 = self.modify_mxd_551(Dose= int(tar[0][-1]*1.1), Weight=0.01, Opti_all=1, Shrink_margin=0) OARs = OARs + part2 + mxd1[:-1] ## the outer target dose QOD1 = self.modify_qod_551(Dose = int(tar[-1][-1]), RMS = 0.5, Shrink_margin = 0, Opti_all=0) OARs = OARs + QOD1[:-1] QOD2 = self.modify_qod_551(Dose = int(tar[-1][-1])-5, RMS = 0.75, Shrink_margin = grid,Opti_all = 0) OARs = OARs + QOD2[:-1] QOD3 = self.modify_qod_551(Dose = int(tar[-1][-1])-10, RMS = 1, Shrink_margin = grid*2,Opti_all = 0) OARs = OARs + QOD3[:-1] QOD4 = self.modify_qod_551(Dose = int(tar[-1][-1])-15, RMS = 1.25, Shrink_margin = grid*3, Opti_all= 0) OARs = OARs + QOD4[:-1] QOD5 = self.modify_qod_551(Dose = int(tar[-1][-1])-20, RMS = 2.0, Shrink_margin = grid*4, Opti_all = 0) OARs = OARs + QOD5[:-1] OARs.append('!END\n') ## ============================ part3 ============================== ## part3 = self.element['# Part3\n'][:-1] ## ============================ part4 ============================== ## # here are two selections for part4 if delivery_type == 'VMAT': # VMAT 360 ARC part4 = self.element['# Part4_VMAT\n'][:-1] elif delivery_type == 'IMRT': # IMRT 9beams step&shoot part4 = self.element['# Part4_IMRT\n'][:-1] ## ============================ part5 ============================== ## part5 = self.element['# Part5\n'][:-1] for i,item in enumerate(part5): if 'FRACTIONS' in item: part5[i] = ''.join(['!FRACTIONS ',str(fractions),'\n']) elif 'PRESCRIPTION' in item: part5[i] = ''.join(['!PRESCRIPTION ',str(float(prescription_dose)),'\n']) elif 'DOSEGRIDSIZE' in item: part5[i] = ''.join(['!DOSEGRIDSIZE ',str(float(grid)),'\n']) # elif 'MAXNARCS' in item: # part5[i] = ''.join(['!MAXNARCS ',str(float(ARCS)),'\n']) ## ================== template ==================== ## self.template_line = self.template_line + part1 + target + OARs + part3 + part4 + part5 print('###############################') print('template has been generated !') print('###############################') return self.template_line def hyp_solution_Prostate_V1(self,grid,fractions,prescription_dose,delivery_type): return 1 def initial(self,struct,struct_set,path_beam,selection): ## ============ Read struct file =========== ## contours = self.read_struct(struct) stru_name = [item['name'] for item in contours] pres_name,dose_frac,strt_index = self.read_csv() ## ============ Read CSV file ============== ## ## if pres_name in stru_name Err = [] self.tras = {} for item in pres_name: if item not in stru_name: print('Name Error: {}'.format(item)) Err.append(item) print('This means this name is not in the struct_name.\n') for item in stru_name: print('the name in strut_set were: {}'.format(item)) # stat = input('Do you want to change the name? if Yes enter 1 & No enter 0\n') stat = '0' print("stat:",stat) if stat == '1': for item in Err: print('Original one:{}'.format(item)) ss = input('new one:') self.tras[item] = ss else: pass for item in strt_index.keys(): if item in Err: strt_index[self.tras[item]] = strt_index[item] del strt_index[item] self.strt_ind_list = [] ## solve the order issue for key in strt_index.keys(): if key in struct_set.keys(): self.strt_ind_list.append((key,strt_index[key],struct_set[key])) for item in stru_name: if item == 'Body' or item == 'patient' or item == 'BODY': self.strt_ind_list.append((item,'',struct_set[item])) self.strt_ind_list.sort(key=lambda x:x[2]) if selection == '1': ## this indicate the prostate template = self.ge_tem_pros1(self.strt_ind_list,path_beam,dose_frac) else: template = self.ge_tem_HN(self.strt_ind_list,path_beam,dose_frac) template[-1] = '!ISPHANTOMMATERIAL 0\n' self.write_colone(template) return self.strt_ind_list,self.tras class Initialization_MON551(HYP_Editor_MONACO551): ''' This class save all the initialization parameters for generation ''' def __init__(self,pt_id, delivery_method, fx, prep_dose, grid_dose, path, protocol_xlsx, PT_path): import os self.pt_id = pt_id self.delivery_method = delivery_method self.fx = fx self.prep_dose = prep_dose self.grid_dose = grid_dose self.protocol_xlsx = protocol_xlsx # original template folder and file path hyp_element_path = os.path.join(path,'hyp_element551.txt') demo_xml_path = os.path.join(path,'demo_dosenormsettings.xml') self.absolute_path = os.path.join(path,'remaining4files') # updated new template folder and file path self.updated_template_path = os.path.join(path,self.pt_id) updated_template_path2 = os.path.join(path,self.pt_id) output_xml_path = os.path.join(self.updated_template_path,self.pt_id+self.delivery_method+'.dosenormsettings.xml') hyp_path_new = os.path.join(self.updated_template_path,self.pt_id+self.delivery_method+'.hyp') # once ct image was loaded, check the structure name with protocol contourname_path = PT_path + self.pt_id + '/1~CT1/contournames' new_contourname_path = PT_path + self.pt_id + '/1~CT1/contournames1' NAMING_LIB = {'TARGET_NAME_LIB':{'gtv','ctv','ptv','pgtv','pctv'}, 'OARs_NAME_LIB_HN': {'Level1':{'spinal cord','brain stem','stem','cord','prv','prv bs','scprv','prv sc'}, 'Level2':{'optical nerve r','optical nerve l','optical nerve', 'lens r','lens l','lens', 'eye r','eye l','eye', 'brain','optical chiasm' }}} HYP_Editor_MONACO551.__init__(self,hyp_element_path, protocol_xlsx, demo_xml_path, output_xml_path, contourname_path, NAMING_LIB, hyp_path_new, updated_template_path2, new_contourname_path) def Standardize_Contour_Name(self): ''' This script was used for naming standardization ''' self.new_name = HYP_Editor_MONACO551.modify_MONACO_contournames(self,protocol_name) def MAIN_GENERATE(self,LABEL): ''' Main function for generate template ''' from shutil import copyfile import os HYP_Editor_MONACO551.mkdir(self) # read protocol to dict self.protocol_dict = HYP_Editor_MONACO551.extract_xlsx(self,self.pt_id) # read hyp elements into RAM self.ele = HYP_Editor_MONACO551.Read_HYP_element(self) #print(ele) # generate new hyp file if LABEL == 'NPC': self.updated_template = HYP_Editor_MONACO551.hyp_solution_NPC_V2(self, grid=self.grid_dose, fractions=self.fx, prescription_dose=self.prep_dose, delivery_type=self.delivery_method) elif LABEL == 'Prostate': self.updated_template = HYP_Editor_MONACO551.hyp_solution_Prostate_V1(self, grid=self.grid_dose, fractions=self.fx, prescription_dose=self.prep_dose, delivery_type=self.delivery_method) HYP_Editor_MONACO551.write_colone(self) # generate new xml file HYP_Editor_MONACO551.xml_solution(self,list(self.protocol_dict.keys())) # remaining task: copy the remaining 4 files into new template folder # X.PLN, X.TEL, X.isodosesettings, X.dvhparam copyfile(os.path.join(self.absolute_path,self.delivery_method,'5.51.isodosesettings.xml'), os.path.join(self.updated_template_path,self.pt_id+self.delivery_method+'.isodosesettings.xml')) copyfile(os.path.join(self.absolute_path,self.delivery_method,'5.51.dvhparam.xml'), os.path.join(self.updated_template_path,self.pt_id+self.delivery_method+'.dvhparam.xml')) copyfile(os.path.join(self.absolute_path,self.delivery_method,'5.51.PLN'), os.path.join(self.updated_template_path,self.pt_id+self.delivery_method+'.pln')) copyfile(os.path.join(self.absolute_path,self.delivery_method,'5.51.TEL'), os.path.join(self.updated_template_path,self.pt_id+self.delivery_method+'.tel'))
46.943043
205
0.419426
11,525
107,969
3.813362
0.056833
0.030945
0.042959
0.037771
0.802771
0.773852
0.750984
0.730824
0.694214
0.679105
0
0.049904
0.437644
107,969
2,300
206
46.943043
0.67393
0.183747
0
0.561465
0
0
0.087429
0.011288
0
0
0
0
0
1
0.024412
false
0.000872
0.007847
0.000872
0.051439
0.024412
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
82290ab1c6c1a0b169383ab9b805d4ee695efb58
107
py
Python
demo.py
VIKASH6162/TestingGit
c0850d434bf2480c1a2a24db70762c22deaa7a58
[ "MIT" ]
null
null
null
demo.py
VIKASH6162/TestingGit
c0850d434bf2480c1a2a24db70762c22deaa7a58
[ "MIT" ]
null
null
null
demo.py
VIKASH6162/TestingGit
c0850d434bf2480c1a2a24db70762c22deaa7a58
[ "MIT" ]
null
null
null
print("Hello Git") print("After commiting this file using -am") print("Now trying to commit with -m only")
26.75
44
0.728972
18
107
4.333333
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.140187
107
3
45
35.666667
0.847826
0
0
0
0
0
0.719626
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
416b7ee002cf89d5bb0cd05c923cf8b0e2db1096
18
py
Python
study002.py
jinkyukim-me/Back_to_Basic
e7d8878055c46aa06f3cc57854dccc28a5d5542b
[ "MIT" ]
null
null
null
study002.py
jinkyukim-me/Back_to_Basic
e7d8878055c46aa06f3cc57854dccc28a5d5542b
[ "MIT" ]
null
null
null
study002.py
jinkyukim-me/Back_to_Basic
e7d8878055c46aa06f3cc57854dccc28a5d5542b
[ "MIT" ]
null
null
null
print(int("얼마"))
6
16
0.555556
3
18
3.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.111111
18
2
17
9
0.625
0
0
0
0
0
0.117647
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
41af98d51b3bc431ab818ccb1efb162df0f5936b
121
py
Python
server/router.py
voze/COMMS
0e175885e55f3e990fc1ab663ca1be70a7492726
[ "MIT" ]
null
null
null
server/router.py
voze/COMMS
0e175885e55f3e990fc1ab663ca1be70a7492726
[ "MIT" ]
null
null
null
server/router.py
voze/COMMS
0e175885e55f3e990fc1ab663ca1be70a7492726
[ "MIT" ]
null
null
null
from message import * def route(session, request): session.send_message(Response(ServerSender(), str(request.body)))
30.25
69
0.760331
15
121
6.066667
0.8
0
0
0
0
0
0
0
0
0
0
0
0.107438
121
4
69
30.25
0.842593
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
5
ec33a6b4a8d5821989a5e6739f12f4317c095728
30
py
Python
modules/sql/Sql.py
Team-Alphas/MissValenciaBot-Pro
1749336d3e8b7b5568175cc67cfb929689455b6c
[ "MIT" ]
null
null
null
modules/sql/Sql.py
Team-Alphas/MissValenciaBot-Pro
1749336d3e8b7b5568175cc67cfb929689455b6c
[ "MIT" ]
null
null
null
modules/sql/Sql.py
Team-Alphas/MissValenciaBot-Pro
1749336d3e8b7b5568175cc67cfb929689455b6c
[ "MIT" ]
null
null
null
#le telethon ka partner fuck
15
29
0.766667
5
30
4.6
1
0
0
0
0
0
0
0
0
0
0
0
0.2
30
1
30
30
0.958333
0.9
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
ec3a7acfebf899eb23bd4f8a64688f9317b4f23a
4,734
py
Python
cluster_toolkit/miscentering.py
marcpaterno/cluster_toolkit
3025b3b1733ed05bfe1ac3844a368326b26a78e4
[ "MIT" ]
18
2017-12-05T18:20:12.000Z
2021-06-02T06:26:30.000Z
cluster_toolkit/miscentering.py
matthewkirby/cluster_toolkit
ee5352d799aa1048cc1d5a1b4e01890be429f94b
[ "MIT" ]
18
2017-11-23T04:23:58.000Z
2019-09-17T17:48:19.000Z
cluster_toolkit/miscentering.py
matthewkirby/cluster_toolkit
ee5352d799aa1048cc1d5a1b4e01890be429f94b
[ "MIT" ]
9
2018-07-27T20:00:35.000Z
2021-06-13T19:38:01.000Z
"""Miscentering effects for projected profiles. """ import cluster_toolkit from cluster_toolkit import _dcast import numpy as np def Sigma_mis_single_at_R(R, Rsigma, Sigma, M, conc, Omega_m, Rmis, delta=200): """Miscentered surface mass density [Msun h/pc^2 comoving] of a profile miscentered by an amount Rmis Mpc/h comoving. Units are Msun h/pc^2 comoving. Args: R (float or array like): Projected radii Mpc/h comoving. Rsigma (array like): Projected radii of the centered surface mass density profile. Sigma (float or array like): Surface mass density Msun h/pc^2 comoving. M (float): Halo mass Msun/h. conc (float): concentration. Omega_m (float): Matter density fraction. Rmis (float): Miscentered distance in Mpc/h comoving. delta (int; optional): Overdensity, default is 200. Returns: float or array like: Miscentered projected surface mass density. """ R = np.asarray(R) scalar_input = False if R.ndim == 0: R = R[None] #makes R 1D scalar_input = True if R.ndim > 1: raise Exception("R cannot be a >1D array.") if np.min(R) < np.min(Rsigma): raise Exception("Minimum R must be >= min(R_Sigma)") if np.max(R) > np.max(Rsigma): raise Exception("Maximum R must be <= max(R_Sigma)") Sigma_mis = np.zeros_like(R) cluster_toolkit._lib.Sigma_mis_single_at_R_arr(_dcast(R), len(R), _dcast(Rsigma), _dcast(Sigma), len(Rsigma), M, conc, delta, Omega_m, Rmis, _dcast(Sigma_mis)) if scalar_input: return np.squeeze(Sigma_mis) return Sigma_mis def Sigma_mis_at_R(R, Rsigma, Sigma, M, conc, Omega_m, Rmis, delta=200, kernel="rayleigh"): """Miscentered surface mass density [Msun h/pc^2 comoving] convolved with a distribution for Rmis. Units are Msun h/pc^2 comoving. Args: R (float or array like): Projected radii Mpc/h comoving. Rsigma (array like): Projected radii of the centered surface mass density profile. Sigma (float or array like): Surface mass density Msun h/pc^2 comoving. M (float): Halo mass Msun/h. conc (float): concentration. Omega_m (float): Matter density fraction. Rmis (float): Miscentered distance in Mpc/h comoving. delta (int; optional): Overdensity, default is 200. kernel (string; optional): Kernal for convolution. Options: rayleigh or gamma. Returns: float or array like: Miscentered projected surface mass density. """ R = np.asarray(R) scalar_input = False if R.ndim == 0: R = R[None] #makes R 1D scalar_input = True #Exception checking if R.ndim > 1: raise Exception("R cannot be a >1D array.") if np.min(R) < np.min(Rsigma): raise Exception("Minimum R must be >= min(R_Sigma)") if np.max(R) > np.max(Rsigma): raise Exception("Maximum R must be <= max(R_Sigma)") if kernel == "rayleigh": integrand_switch = 0 elif kernel == "gamma": integrand_switch = 1 else: raise Exception("Miscentering kernel must be either "+ "'rayleigh' or 'gamma'") Sigma_mis = np.zeros_like(R) cluster_toolkit._lib.Sigma_mis_at_R_arr(_dcast(R), len(R), _dcast(Rsigma), _dcast(Sigma), len(Rsigma), M, conc, delta, Omega_m, Rmis, integrand_switch, _dcast(Sigma_mis)) if scalar_input: return np.squeeze(Sigma_mis) return Sigma_mis def DeltaSigma_mis_at_R(R, Rsigma, Sigma_mis): """Miscentered excess surface mass density profile at R. Units are Msun h/pc^2 comoving. Args: R (float or array like): Projected radii to evaluate profile. Rsigma (array like): Projected radii of miscentered Sigma profile. Sigma_mis (array like): Miscentered Sigma profile. Returns: float array like: Miscentered excess surface mass density profile. """ R = np.asarray(R) scalar_input = False if R.ndim == 0: R = R[None] #makes R 1D scalar_input = True if R.ndim > 1: raise Exception("R cannot be a >1D array.") if np.min(R) < np.min(Rsigma): raise Exception("Minimum R must be >= min(R_Sigma)") if np.max(R) > np.max(Rsigma): raise Exception("Maximum R must be <= max(R_Sigma)") DeltaSigma_mis = np.zeros_like(R) cluster_toolkit._lib.DeltaSigma_mis_at_R_arr(_dcast(R), len(R), _dcast(Rsigma), _dcast(Sigma_mis), len(Rsigma), _dcast(DeltaSigma_mis)) if scalar_input: return np.squeeze(DeltaSigma_mis) return DeltaSigma_mis
39.123967
113
0.634981
669
4,734
4.364723
0.165919
0.041096
0.061644
0.019178
0.787329
0.780479
0.733904
0.723288
0.712329
0.681507
0
0.009483
0.264892
4,734
120
114
39.45
0.829598
0.399451
0
0.65625
0
0
0.12972
0
0
0
0
0
0
1
0.046875
false
0
0.046875
0
0.1875
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
ec4faaf121cf656686405fc910ea8e11d29291de
1,135
py
Python
parsing.py
NikitaKarabeinikau/COVID19_Outbreak_Simulation
2ed859bafc25af2012985d664d908285c8ef5c0e
[ "Apache-2.0" ]
null
null
null
parsing.py
NikitaKarabeinikau/COVID19_Outbreak_Simulation
2ed859bafc25af2012985d664d908285c8ef5c0e
[ "Apache-2.0" ]
1
2020-06-29T11:18:26.000Z
2020-06-29T11:18:26.000Z
parsing.py
jivnov/COVID19_Outbreak_Simulation
ace4ab3219671ccd51a906bff657e2df71fba2f7
[ "Apache-2.0" ]
1
2020-06-22T12:55:58.000Z
2020-06-22T12:55:58.000Z
import csv import requests import os def download(): path = os.getcwd() death_url = ('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv') confiermed_url =('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv') recovered_url=('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv') req = requests.get(death_url) url_content = req.content csv_file = open(path+'/static/data/death.csv','wb') csv_file.write(url_content) csv_file.close() req = requests.get(confiermed_url) url_content = req.content csv_file = open(path+'/static/data/confiermd.csv','wb') csv_file.write(url_content) csv_file.close() req = requests.get(recovered_url) url_content = req.content csv_file = open(path+'/static/data/recovered.csv','wb') csv_file.write(url_content) csv_file.close()
37.833333
174
0.762996
164
1,135
4.95122
0.231707
0.077586
0.081281
0.103448
0.76601
0.76601
0.76601
0.76601
0.76601
0.76601
0
0.023952
0.117181
1,135
30
175
37.833333
0.786427
0
0
0.391304
0
0.130435
0.463908
0.065141
0
0
0
0
0
1
0.043478
false
0
0.130435
0
0.173913
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
6b88c75f2f784dd9f4a5981790b727d3c9de9e59
110
py
Python
evawiz/Template.python/pyMod.py
einsxiao/evawiz
12c148f46c89551c281271718893a92b26da2bfa
[ "BSD-2-Clause" ]
1
2019-06-07T03:44:39.000Z
2019-06-07T03:44:39.000Z
evawiz/Template.python/pyMod.py
einsxiao/evawiz
12c148f46c89551c281271718893a92b26da2bfa
[ "BSD-2-Clause" ]
null
null
null
evawiz/Template.python/pyMod.py
einsxiao/evawiz
12c148f46c89551c281271718893a92b26da2bfa
[ "BSD-2-Clause" ]
null
null
null
#!/opt/evawiz/python/bin/python #normal python defination code here def pyAdd(x,y): return abs(x)+abs(y)
18.333333
35
0.709091
19
110
4.105263
0.736842
0
0
0
0
0
0
0
0
0
0
0
0.136364
110
5
36
22
0.821053
0.581818
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
6be8a7e2faba12596c8dadbd439f30866dc1d983
1,618
py
Python
lstchain/spectra/crab.py
thomasgas/cta-lstchain
59dbc58f7dd7fb35aebce22489082ac885fac18b
[ "BSD-3-Clause" ]
null
null
null
lstchain/spectra/crab.py
thomasgas/cta-lstchain
59dbc58f7dd7fb35aebce22489082ac885fac18b
[ "BSD-3-Clause" ]
null
null
null
lstchain/spectra/crab.py
thomasgas/cta-lstchain
59dbc58f7dd7fb35aebce22489082ac885fac18b
[ "BSD-3-Clause" ]
null
null
null
import astropy.units as u import numpy as np __all__ = [ 'crab_hegra', 'crab_magic', ] def crab_magic(E): """ From http://adsabs.harvard.edu/abs/2015JHEAp...5...30A For each energy point, return the Crab Nebula flux Parameters ----------- E: `numpy.ndarray` of astropy.units.quantity.Quantity (energy units) Returns ------- dFdE: `numpy.ndarray` differential energy spectrum. astropy.units.quantity.Quantity units: 1/u.TeV / u.cm**2 / u.s par: `dict` with spectral parameters """ f0 = 3.23e-14 / u.GeV / u.cm**2 / u.s alpha = -2.47 beta = -0.24 e0 = 1000 * u.GeV par_var = [f0, alpha, beta, e0] par_dic = ['f0', 'alpha', 'beta', 'e0'] par = dict(zip(par_dic, par_var)) dFdE = f0 * np.power(E / e0, alpha + beta * np.log10(E/e0)) return dFdE.to(1/u.GeV / u.cm**2 / u.s), par def crab_hegra(E): """ From http://adsabs.harvard.edu/abs/2004ApJ...614..897A For each energy point, return the Crab Nebula flux Parameters ----------- E: `numpy.ndarray` of astropy.units.quantity.Quantity (energy units) Returns ------- dFdE: `numpy.ndarray` differential energy spectrum. astropy.units.quantity.Quantity units: 1/u.TeV / u.cm**2 / u.s par: `dict` with spectral parameters """ f0 = 2.83e-14 / u.GeV / u.cm**2 / u.s alpha = -2.62 e0 = 1000 * u.GeV par_var = [f0, alpha, e0] par_dic = ['f0', 'alpha', 'e0'] par = dict(zip(par_dic, par_var)) dFdE = f0 * np.power(E / e0, alpha) return dFdE.to(1/u.GeV / u.cm**2 / u.s), par
24.892308
72
0.576638
248
1,618
3.697581
0.282258
0.019629
0.026172
0.032715
0.846238
0.804798
0.804798
0.74373
0.693566
0.693566
0
0.060281
0.251545
1,618
64
73
25.28125
0.696945
0.461681
0
0.24
0
0
0.054124
0
0
0
0
0
0
1
0.08
false
0
0.08
0
0.24
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
d404ed9abe1814400a08557e756eaad5046f1d1c
79
py
Python
ybw/__init__.py
you-bowen/ybwNB
57cd8925657db807543685d044e3446fa221ad1d
[ "MIT" ]
4
2020-12-27T16:18:54.000Z
2021-04-04T02:19:16.000Z
ybw/__init__.py
you-bowen/ybwNB
57cd8925657db807543685d044e3446fa221ad1d
[ "MIT" ]
null
null
null
ybw/__init__.py
you-bowen/ybwNB
57cd8925657db807543685d044e3446fa221ad1d
[ "MIT" ]
null
null
null
__all__ = ['s','bin','get'] from . import s from . import bin from . import get
19.75
27
0.64557
13
79
3.615385
0.461538
0.638298
0
0
0
0
0
0
0
0
0
0
0.177215
79
4
28
19.75
0.723077
0
0
0
0
0
0.0875
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
d4173b12ab1f85f0ba67b69d07d4c1e7b6f68404
9,378
py
Python
sdk/python/pulumi_azure/compute/snapshot.py
davidobrien1985/pulumi-azure
811beeea473bd798d77354521266a87a2fac5888
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
sdk/python/pulumi_azure/compute/snapshot.py
davidobrien1985/pulumi-azure
811beeea473bd798d77354521266a87a2fac5888
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
sdk/python/pulumi_azure/compute/snapshot.py
davidobrien1985/pulumi-azure
811beeea473bd798d77354521266a87a2fac5888
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import json import warnings import pulumi import pulumi.runtime from typing import Union from .. import utilities, tables class Snapshot(pulumi.CustomResource): create_option: pulumi.Output[str] """ Indicates how the snapshot is to be created. Possible values are `Copy` or `Import`. Changing this forces a new resource to be created. """ disk_size_gb: pulumi.Output[float] """ The size of the Snapshotted Disk in GB. """ encryption_settings: pulumi.Output[dict] location: pulumi.Output[str] """ Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. """ name: pulumi.Output[str] """ Specifies the name of the Snapshot resource. Changing this forces a new resource to be created. """ resource_group_name: pulumi.Output[str] """ The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created. """ source_resource_id: pulumi.Output[str] """ Specifies a reference to an existing snapshot, when `create_option` is `Copy`. Changing this forces a new resource to be created. """ source_uri: pulumi.Output[str] """ Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created. """ storage_account_id: pulumi.Output[str] """ Specifies the ID of an storage account. Used with `source_uri` to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created. """ tags: pulumi.Output[dict] """ A mapping of tags to assign to the resource. """ def __init__(__self__, resource_name, opts=None, create_option=None, disk_size_gb=None, encryption_settings=None, location=None, name=None, resource_group_name=None, source_resource_id=None, source_uri=None, storage_account_id=None, tags=None, __props__=None, __name__=None, __opts__=None): """ Manages a Disk Snapshot. :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] create_option: Indicates how the snapshot is to be created. Possible values are `Copy` or `Import`. Changing this forces a new resource to be created. :param pulumi.Input[float] disk_size_gb: The size of the Snapshotted Disk in GB. :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. :param pulumi.Input[str] name: Specifies the name of the Snapshot resource. Changing this forces a new resource to be created. :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created. :param pulumi.Input[str] source_resource_id: Specifies a reference to an existing snapshot, when `create_option` is `Copy`. Changing this forces a new resource to be created. :param pulumi.Input[str] source_uri: Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created. :param pulumi.Input[str] storage_account_id: Specifies the ID of an storage account. Used with `source_uri` to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created. :param pulumi.Input[dict] tags: A mapping of tags to assign to the resource. The **encryption_settings** object supports the following: * `diskEncryptionKey` (`pulumi.Input[dict]`) * `secretUrl` (`pulumi.Input[str]`) * `sourceVaultId` (`pulumi.Input[str]`) * `enabled` (`pulumi.Input[bool]`) * `keyEncryptionKey` (`pulumi.Input[dict]`) * `keyUrl` (`pulumi.Input[str]`) * `sourceVaultId` (`pulumi.Input[str]`) """ if __name__ is not None: warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning) resource_name = __name__ if __opts__ is not None: warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning) opts = __opts__ if opts is None: opts = pulumi.ResourceOptions() if not isinstance(opts, pulumi.ResourceOptions): raise TypeError('Expected resource options to be a ResourceOptions instance') if opts.version is None: opts.version = utilities.get_version() if opts.id is None: if __props__ is not None: raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') __props__ = dict() if create_option is None: raise TypeError("Missing required property 'create_option'") __props__['create_option'] = create_option __props__['disk_size_gb'] = disk_size_gb __props__['encryption_settings'] = encryption_settings __props__['location'] = location __props__['name'] = name if resource_group_name is None: raise TypeError("Missing required property 'resource_group_name'") __props__['resource_group_name'] = resource_group_name __props__['source_resource_id'] = source_resource_id __props__['source_uri'] = source_uri __props__['storage_account_id'] = storage_account_id __props__['tags'] = tags super(Snapshot, __self__).__init__( 'azure:compute/snapshot:Snapshot', resource_name, __props__, opts) @staticmethod def get(resource_name, id, opts=None, create_option=None, disk_size_gb=None, encryption_settings=None, location=None, name=None, resource_group_name=None, source_resource_id=None, source_uri=None, storage_account_id=None, tags=None): """ Get an existing Snapshot resource's state with the given name, id, and optional extra properties used to qualify the lookup. :param str resource_name: The unique name of the resulting resource. :param str id: The unique provider ID of the resource to lookup. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] create_option: Indicates how the snapshot is to be created. Possible values are `Copy` or `Import`. Changing this forces a new resource to be created. :param pulumi.Input[float] disk_size_gb: The size of the Snapshotted Disk in GB. :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. :param pulumi.Input[str] name: Specifies the name of the Snapshot resource. Changing this forces a new resource to be created. :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created. :param pulumi.Input[str] source_resource_id: Specifies a reference to an existing snapshot, when `create_option` is `Copy`. Changing this forces a new resource to be created. :param pulumi.Input[str] source_uri: Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created. :param pulumi.Input[str] storage_account_id: Specifies the ID of an storage account. Used with `source_uri` to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created. :param pulumi.Input[dict] tags: A mapping of tags to assign to the resource. The **encryption_settings** object supports the following: * `diskEncryptionKey` (`pulumi.Input[dict]`) * `secretUrl` (`pulumi.Input[str]`) * `sourceVaultId` (`pulumi.Input[str]`) * `enabled` (`pulumi.Input[bool]`) * `keyEncryptionKey` (`pulumi.Input[dict]`) * `keyUrl` (`pulumi.Input[str]`) * `sourceVaultId` (`pulumi.Input[str]`) """ opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = dict() __props__["create_option"] = create_option __props__["disk_size_gb"] = disk_size_gb __props__["encryption_settings"] = encryption_settings __props__["location"] = location __props__["name"] = name __props__["resource_group_name"] = resource_group_name __props__["source_resource_id"] = source_resource_id __props__["source_uri"] = source_uri __props__["storage_account_id"] = storage_account_id __props__["tags"] = tags return Snapshot(resource_name, opts=opts, __props__=__props__) def translate_output_property(self, prop): return tables._CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop def translate_input_property(self, prop): return tables._SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop
56.155689
294
0.693431
1,232
9,378
5.040584
0.133929
0.056683
0.042512
0.064251
0.764895
0.736876
0.725926
0.712077
0.696135
0.690499
0
0.000138
0.225634
9,378
166
295
56.493976
0.854999
0.428876
0
0.027778
1
0
0.160724
0.013437
0
0
0
0
0
1
0.055556
false
0.013889
0.083333
0.027778
0.333333
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
d4416848088b25bfa2d29b0e6c90878853664097
189
py
Python
src/cmatools/combine/combine.py
jonathan-winn-geo/new-repo-example
2fbc54b1d42c57ca1105b1066e47627832cc8185
[ "BSD-3-Clause" ]
null
null
null
src/cmatools/combine/combine.py
jonathan-winn-geo/new-repo-example
2fbc54b1d42c57ca1105b1066e47627832cc8185
[ "BSD-3-Clause" ]
85
2020-08-12T15:59:48.000Z
2022-01-17T10:28:56.000Z
src/cmatools/combine/combine.py
cma-open/cmatools
ce5743dca7c5bf1f6ab7fe3af24893a65d0c2db7
[ "BSD-3-Clause" ]
null
null
null
from cmatools.helloworld.hello_world import hello_world from cmatools.observations.test import this_one def combined(): combined = f"{this_one()} {hello_world()}" return combined
23.625
55
0.767196
25
189
5.6
0.56
0.214286
0
0
0
0
0
0
0
0
0
0
0.137566
189
7
56
27
0.858896
0
0
0
0
0
0.148148
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.8
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5