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
cd59865cc99bbd34a4c7b6f23e90da1b530b8294
436
py
Python
features/__init__.py
jcq15/wechaty
b41d15c8d348dad0dbb2e16ad412006b9a1f2f54
[ "MIT" ]
9
2020-09-07T03:12:04.000Z
2022-02-22T15:22:33.000Z
features/__init__.py
jcq15/wechaty
b41d15c8d348dad0dbb2e16ad412006b9a1f2f54
[ "MIT" ]
null
null
null
features/__init__.py
jcq15/wechaty
b41d15c8d348dad0dbb2e16ad412006b9a1f2f54
[ "MIT" ]
4
2020-09-09T13:31:14.000Z
2022-03-05T00:57:21.000Z
from features.response_message import ResponseMessage from features.feature_manager import FeatureManager from features.self_intro_manager import SelfIntroManager from features.twenty_four_manager import TwentyFourManager from features.weather_manager import WeatherManager from features.astrology_manager import AstrologyManager from features.calculator_manager import CalculatorManager from features.oj_manager import OJManager
54.5
59
0.894495
50
436
7.6
0.46
0.252632
0
0
0
0
0
0
0
0
0
0
0.087156
436
8
60
54.5
0.954774
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
26ddead54f55db38747fa0d195dd948adc95ba73
147
py
Python
sglib/_gene_annotation_functions/_print_exon_statistics.py
mvinyard/guideID
fec14c8713960428fc31f68ece7ac36a7b2bcab9
[ "MIT" ]
null
null
null
sglib/_gene_annotation_functions/_print_exon_statistics.py
mvinyard/guideID
fec14c8713960428fc31f68ece7ac36a7b2bcab9
[ "MIT" ]
null
null
null
sglib/_gene_annotation_functions/_print_exon_statistics.py
mvinyard/guideID
fec14c8713960428fc31f68ece7ac36a7b2bcab9
[ "MIT" ]
null
null
null
def _print_exon_statistics(feature_df): groupby_feature = feature_df.groupby("gene_feature") return groupby_feature.describe()["length"].T
36.75
56
0.782313
19
147
5.631579
0.631579
0.168224
0.299065
0
0
0
0
0
0
0
0
0
0.102041
147
4
57
36.75
0.810606
0
0
0
0
0
0.121622
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0.333333
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
5
f80ca7093e5438be9637f9343133867d130408d6
86
py
Python
social/apps/flask_app/utils.py
raccoongang/python-social-auth
81c0a542d158772bd3486d31834c10af5d5f08b0
[ "BSD-3-Clause" ]
1,987
2015-01-01T16:12:45.000Z
2022-03-29T14:24:25.000Z
social/apps/flask_app/utils.py
raccoongang/python-social-auth
81c0a542d158772bd3486d31834c10af5d5f08b0
[ "BSD-3-Clause" ]
731
2015-01-01T22:55:25.000Z
2022-03-10T15:07:51.000Z
virtual/lib/python3.6/site-packages/social/apps/flask_app/utils.py
dennismwaniki67/awards
80ed10541f5f751aee5f8285ab1ad54cfecba95f
[ "MIT" ]
1,082
2015-01-01T16:27:26.000Z
2022-03-22T21:18:33.000Z
from social_flask.utils import get_helper, load_strategy, load_backend, psa, strategy
43
85
0.848837
13
86
5.307692
0.846154
0
0
0
0
0
0
0
0
0
0
0
0.093023
86
1
86
86
0.884615
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
f82e00e015218bb60d23d375745d910b30f15373
116
py
Python
plugins/demotoo.py
Fusion/reasonable-fidelity
02265c0d6fcc70305a6f5ef8627da1b3cb89b90f
[ "Apache-2.0" ]
2
2018-11-19T14:07:37.000Z
2018-12-13T19:03:59.000Z
plugins/demotoo.py
Fusion/reasonable-fidelity
02265c0d6fcc70305a6f5ef8627da1b3cb89b90f
[ "Apache-2.0" ]
null
null
null
plugins/demotoo.py
Fusion/reasonable-fidelity
02265c0d6fcc70305a6f5ef8627da1b3cb89b90f
[ "Apache-2.0" ]
null
null
null
def get_capabilities(): return [ "bogus_capability" ] def should_ignore_response(): return True
12.888889
29
0.655172
12
116
6
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.258621
116
8
30
14.5
0.837209
0
0
0
0
0
0.13913
0
0
0
0
0
0
1
0.333333
true
0
0
0.333333
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
1
0
0
1
0
0
0
5
3e07459aa034795df7de45dfd14b761927181111
142
py
Python
start.py
WoohTao/Scrapy_historical_weather
5001711287b5c8b175603fc65d704d12ee3b322e
[ "Apache-2.0" ]
6
2018-10-20T07:34:12.000Z
2019-11-19T06:03:30.000Z
start.py
WoohTao/Scrapy_historical_weather
5001711287b5c8b175603fc65d704d12ee3b322e
[ "Apache-2.0" ]
1
2019-11-19T06:40:16.000Z
2019-11-19T06:40:16.000Z
start.py
WoohTao/Scrapy_historical_weather
5001711287b5c8b175603fc65d704d12ee3b322e
[ "Apache-2.0" ]
null
null
null
# -*- coding:utf-8 -*- from scrapy import cmdline # scrapy crawl itcast (itcast为爬虫名) cmdline.execute("scrapy crawl ChineseWeather".split())
20.285714
54
0.732394
17
142
6.117647
0.764706
0.211538
0
0
0
0
0
0
0
0
0
0.008065
0.126761
142
6
55
23.666667
0.830645
0.373239
0
0
0
0
0.313953
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
3e1caf622ea42abbd3bae66bebafc2fefcea7c75
134
py
Python
code/python/driver/pathmagic.py
alguru/metagenemark-2
3389a6bb306acea87ab3ccb63c47281aadafb273
[ "MIT" ]
null
null
null
code/python/driver/pathmagic.py
alguru/metagenemark-2
3389a6bb306acea87ab3ccb63c47281aadafb273
[ "MIT" ]
1
2022-03-30T10:18:15.000Z
2022-03-30T10:18:15.000Z
code/python/driver/pathmagic.py
gatech-genemark/MetaGeneMark-2-exp
99f8cf091911b9200af97e722543ad84a247770f
[ "MIT" ]
1
2021-04-06T12:43:12.000Z
2021-04-06T12:43:12.000Z
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../lib")) # add custom library directory to path
26.8
111
0.708955
21
134
4.333333
0.666667
0.131868
0
0
0
0
0
0
0
0
0
0
0.149254
134
4
112
33.5
0.798246
0.268657
0
0
0
0
0.0625
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
3e2eca57edb66833f56c0c1f5a18618bae70fd34
250
py
Python
python/cendalytics/budapest/dmo/__init__.py
jiportilla/ontology
8a66bb7f76f805c64fc76cfc40ab7dfbc1146f40
[ "MIT" ]
null
null
null
python/cendalytics/budapest/dmo/__init__.py
jiportilla/ontology
8a66bb7f76f805c64fc76cfc40ab7dfbc1146f40
[ "MIT" ]
null
null
null
python/cendalytics/budapest/dmo/__init__.py
jiportilla/ontology
8a66bb7f76f805c64fc76cfc40ab7dfbc1146f40
[ "MIT" ]
null
null
null
from .cv_assembler_by_cnum import CvAssemblerByCnum from .data_reader_for_conference import DataReaderForConference from .data_transformer_for_conference import DataTransformerForConference from .data_transformer_for_jrs import DataTransformerForJrs
50
73
0.92
28
250
7.785714
0.571429
0.110092
0.174312
0.201835
0
0
0
0
0
0
0
0
0.064
250
4
74
62.5
0.931624
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
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
3e392903dca6834e62559dc51edf6285188215b2
680
py
Python
dodo.py
sondreod/pysj
e3bdfbf8990edd298b39eb144426139643a0edde
[ "MIT" ]
1
2021-12-15T14:10:48.000Z
2021-12-15T14:10:48.000Z
dodo.py
sondreod/pysj
e3bdfbf8990edd298b39eb144426139643a0edde
[ "MIT" ]
null
null
null
dodo.py
sondreod/pysj
e3bdfbf8990edd298b39eb144426139643a0edde
[ "MIT" ]
null
null
null
def task_format(): return { "actions": ["black .", "isort ."], "verbosity": 2, } def task_test(): return { "actions": ["tox -e py39"], "verbosity": 2, } def task_fulltest(): return { "actions": ["tox --skip-missing-interpreters"], "verbosity": 2, } def task_build(): return { "actions": ["flit build"], "task_dep": ["precommit"], "verbosity": 2, } def task_publish(): return { "actions": ["flit publish"], "task_dep": ["build"], "verbosity": 2, } def task_precommit(): return {"actions": None, "task_dep": ["format", "fulltest"]}
17
64
0.492647
64
680
5.09375
0.359375
0.128834
0.199387
0.260736
0
0
0
0
0
0
0
0.015054
0.316176
680
39
65
17.435897
0.686022
0
0
0.344828
0
0
0.319118
0.039706
0
0
0
0
0
1
0.206897
true
0
0
0.206897
0.413793
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
1
0
0
1
0
0
0
5
3e5012a8e7a11a50de0e51ca1f0179e87e5483ac
189
py
Python
cm/framework/messages/utils.py
adrianppg/cloudman
0e9dd73584847a0125251bd9b6c3e4633007d928
[ "MIT" ]
1
2021-02-28T18:59:50.000Z
2021-02-28T18:59:50.000Z
cm/framework/messages/utils.py
almahmoud/cloudman
41067dfd66c6334313069874f5f26e5a06884b71
[ "MIT" ]
1
2015-04-13T01:45:41.000Z
2015-04-17T01:17:01.000Z
cm/framework/messages/utils.py
almahmoud/cloudman
41067dfd66c6334313069874f5f26e5a06884b71
[ "MIT" ]
null
null
null
from cm.framework.messages import constants def get_level_tags(): """ Returns the message level tags. """ level_tags = constants.DEFAULT_TAGS.copy() return level_tags
18.9
46
0.698413
24
189
5.291667
0.666667
0.283465
0
0
0
0
0
0
0
0
0
0
0.21164
189
9
47
21
0.852349
0.164021
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
1
0
0
null
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
1
0
0
5
e44ed57975c64db4895a48588b048a1e8c6329a4
523
py
Python
d2ix/preprocess/__init__.py
tum-ewk/d2ix_public
dffcb474f51ccdc03a339e306b61b88c224a332d
[ "Apache-2.0" ]
2
2019-12-16T20:48:10.000Z
2020-11-24T03:20:36.000Z
d2ix/preprocess/__init__.py
tum-ewk/d2ix_public
dffcb474f51ccdc03a339e306b61b88c224a332d
[ "Apache-2.0" ]
4
2019-04-15T08:03:23.000Z
2019-04-15T08:05:17.000Z
d2ix/preprocess/__init__.py
tum-ewk/d2ix_public
dffcb474f51ccdc03a339e306b61b88c224a332d
[ "Apache-2.0" ]
8
2019-03-13T06:51:22.000Z
2020-08-31T11:04:56.000Z
from d2ix.preprocess.base_techs import process_base_techs from d2ix.preprocess.demand import process_demand from d2ix.preprocess.level import process_level from d2ix.preprocess.lvl_spatial import process_lvl_spatial from d2ix.preprocess.map_spatial_hierarchy import process_map_spatial_hierarchy from d2ix.preprocess.spatial_locations import process_spatial_locations from d2ix.preprocess.spec_techs import process_spec_techs from d2ix.preprocess.units import process_units from d2ix.preprocess.util import get_year_vector
52.3
79
0.89675
76
523
5.881579
0.263158
0.161074
0.362416
0.102908
0
0
0
0
0
0
0
0.01848
0.068834
523
9
80
58.111111
0.899384
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
e470798fa3cc0f60106bdf8506637d5fa96a3489
250
py
Python
generated-libraries/python/netapp/snapmirror_policy/sm_transfer_priority_enum.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
2
2017-03-28T15:31:26.000Z
2018-08-16T22:15:18.000Z
generated-libraries/python/netapp/snapmirror_policy/sm_transfer_priority_enum.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
null
null
null
generated-libraries/python/netapp/snapmirror_policy/sm_transfer_priority_enum.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
null
null
null
class SmTransferPriorityEnum(basestring): """ low|normal Possible values: <ul> <li> "low" , <li> "normal" </ul> """ @staticmethod def get_api_name(): return "sm-transfer-priority-enum"
16.666667
44
0.528
23
250
5.652174
0.826087
0
0
0
0
0
0
0
0
0
0
0
0.336
250
14
45
17.857143
0.783133
0.28
0
0
0
0
0.173611
0.173611
0
0
0
0
0
1
0.25
true
0
0
0.25
0.75
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
1
0
0
1
1
0
0
5
e476b381a79e451ab834eb18dd23ad107708f77a
1,254
py
Python
Gravity Engine/Gravity_Maths/Feeder.py
pootatookun/Gravity-Engine
d9b35dc20e85338ef045833a320c41667bf55ce0
[ "MIT" ]
1
2021-06-11T11:18:52.000Z
2021-06-11T11:18:52.000Z
Gravity Engine/Gravity_Maths/Feeder.py
pootatookun/Gravity-Engine-Beta-v1.0-0_0
d9b35dc20e85338ef045833a320c41667bf55ce0
[ "MIT" ]
1
2021-06-20T13:11:44.000Z
2021-06-20T13:11:44.000Z
Gravity Engine/Gravity_Maths/Feeder.py
pootatookun/Gravity-Engine
d9b35dc20e85338ef045833a320c41667bf55ce0
[ "MIT" ]
null
null
null
import numpy as nn class Feeder(object): def __init__(self, mass_array, multiplier, *position_coordinates) -> None: self.position_coordinates_ = nn.array([i for i in list(zip(position_coordinates[0],position_coordinates[1]))]) self.multiplier_ = multiplier self.mass_array_ = nn.array(mass_array) self.initial_speed_array_ = nn.zeros([len(self.position_coordinates_)]) self.multiplying_multiplier() def multiplying_multiplier(self): self.position_coordinates_ = self.position_coordinates_ * self.multiplier_ def multiplier(self): return self.multiplier_ def no_of_particles(self): return len(self.position_coordinates_) def position_coordinates(self): return self.position_coordinates_ def mass_array(self): return self.mass_array_ def initial_speed_array(self): return self.initial_speed_array_ def set_position_coordinates(self, position_coordinates): self.position_coordinates_ = position_coordinates def set_mass_array(self, mass_array): self.mass_array_ = mass_array def set_initial_speed_array(self, inital_speed_array): self.initial_speed_array_ = inital_speed_array
32.153846
118
0.720096
150
1,254
5.593333
0.226667
0.317044
0.219309
0.128725
0.240763
0.137068
0
0
0
0
0
0.002002
0.203349
1,254
38
119
33
0.837838
0
0
0
0
0
0
0
0
0
0
0
0
1
0.384615
false
0
0.038462
0.192308
0.653846
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
e48576a388ce0abbc98084078fdfa291351bb93f
2,088
py
Python
GeoPrivacy/metrics.py
quao627/GeoPrivacy
681a2ea8c403407a9c66a24e69f84cf0debc14f6
[ "MIT" ]
4
2021-07-01T07:52:48.000Z
2022-01-06T07:51:41.000Z
GeoPrivacy/metrics.py
quao627/GeoPrivacy
681a2ea8c403407a9c66a24e69f84cf0debc14f6
[ "MIT" ]
null
null
null
GeoPrivacy/metrics.py
quao627/GeoPrivacy
681a2ea8c403407a9c66a24e69f84cf0debc14f6
[ "MIT" ]
null
null
null
import math from geopy.distance import geodesic def euclidean(pt1, pt2): """ This function calculates the euclidean distance between two points. Parameters ---------- pt1 : tuple or list The coordinates of the first point. Eg. (41.58, -74.35) pt2 : tuple or list The coordinates of the second point. Eg. (41.58, -74.35) Returns ------- dist : float The euclidean distance between pt1 and pt2. """ x_diff = pt1[0] - pt2[0] y_diff = pt1[1] - pt2[1] dist = math.sqrt(pow(x_diff, 2) + pow(y_diff, 2)) return dist def geodesic_mile(pt1, pt2, lat_first=True): """ This function calculates the mile distance between two points. Parameters ---------- pt1 : tuple or list The coordinates of the first point. Eg. (41.58, -74.35) pt2 : tuple or list The coordinates of the second point. Eg. (41.58, -74.35) lat_first (optional) : boolean, default True True if the format of coordinates is (lat, lon). Returns ------- dist : float The mile distance between pt1 and pt2. """ if not lat_first: pt1 = (pt1[1], pt1[0]) pt2 = (pt2[1], pt2[0]) dist = geodesic(pt1, pt2).miles return dist def geodesic_km(pt1, pt2, lat_first=True): """ This function calculates the kilometer distance between two points. Parameters ---------- pt1 : tuple or list The coordinates of the first point. Eg. (41.58, -74.35) pt2 : tuple or list The coordinates of the second point. Eg. (41.58, -74.35) lat_first (optional) : boolean, default True True if the format of coordinates is (lat, lon). Returns ------- dist : float The kilometer distance between pt1 and pt2. """ if not lat_first: pt1 = (pt1[1], pt1[0]) pt2 = (pt2[1], pt2[0]) dist = geodesic(pt1, pt2).km return dist
26.43038
75
0.548372
274
2,088
4.135037
0.211679
0.079435
0.058252
0.074139
0.76346
0.742277
0.742277
0.742277
0.742277
0.666372
0
0.072622
0.340517
2,088
78
76
26.769231
0.750182
0.562739
0
0.473684
0
0
0
0
0
0
0
0
0
1
0.157895
false
0
0.105263
0
0.421053
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
e49b742549cab2b9d1745648fabf3160bdb11acc
2,278
py
Python
testing/data_validation/generate-random-ansatz-params.py
kottmanj/z-quantum-core
21752e92e79aafedbfeb6e7ae196bdc2fd5803e4
[ "Apache-2.0" ]
null
null
null
testing/data_validation/generate-random-ansatz-params.py
kottmanj/z-quantum-core
21752e92e79aafedbfeb6e7ae196bdc2fd5803e4
[ "Apache-2.0" ]
null
null
null
testing/data_validation/generate-random-ansatz-params.py
kottmanj/z-quantum-core
21752e92e79aafedbfeb6e7ae196bdc2fd5803e4
[ "Apache-2.0" ]
null
null
null
import json import sys with open(sys.argv[1], "r") as f: workflowresult = json.loads(f.read()) assert len(workflowresult.keys()) == 2 for key in workflowresult.keys(): assert workflowresult[key]["class"] == "generate-random-ansatz-params" if workflowresult[key]["inputParam:ansatz-specs"] != "None": assert ( workflowresult[key]["inputParam:ansatz-specs"] == "{'module_name': 'zquantum.core.interfaces.mock_objects', 'function_name': 'MockAnsatz', 'number_of_layers': 2, 'problem_size': 2}" ) assert workflowresult[key]["inputParam:number-of-params"] == "None" assert workflowresult[key]["inputParam:min-val"] == "-3.14" assert workflowresult[key]["inputParam:max-val"] == "3.14" assert workflowresult[key]["inputParam:seed"] == "1234" assert ( workflowresult[key]["params"]["schema"] == "zapata-v1-circuit_template_params" ) assert ( workflowresult[key]["params"]["parameters"]["real"][0] == -1.9372578516205565 ) assert ( workflowresult[key]["params"]["parameters"]["real"][1] == 0.7668430821301442 ) if workflowresult[key]["inputParam:number-of-params"] != "None": assert workflowresult[key]["inputParam:ansatz-specs"] == "None" assert workflowresult[key]["inputParam:number-of-params"] == "4" assert workflowresult[key]["inputParam:min-val"] == "-3.14" assert workflowresult[key]["inputParam:max-val"] == "3.14" assert workflowresult[key]["inputParam:seed"] == "1234" assert ( workflowresult[key]["params"]["schema"] == "zapata-v1-circuit_template_params" ) assert ( workflowresult[key]["params"]["parameters"]["real"][0] == -1.9372578516205565 ) assert ( workflowresult[key]["params"]["parameters"]["real"][1] == 0.7668430821301442 ) assert ( workflowresult[key]["params"]["parameters"]["real"][2] == -0.3910697990353209 ) assert ( workflowresult[key]["params"]["parameters"]["real"][3] == 1.7920519057224706 ) print("Workflow result is as expected")
36.15873
146
0.585601
220
2,278
6.018182
0.309091
0.269637
0.33006
0.249245
0.743958
0.743958
0.679003
0.655589
0.655589
0.655589
0
0.078397
0.244074
2,278
62
147
36.741935
0.690476
0
0
0.480769
0
0.019231
0.306848
0.12511
0
0
0
0
0.384615
1
0
false
0
0.038462
0
0.038462
0.019231
0
0
0
null
1
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
0
0
0
0
0
0
5
e4a0cc44cd348cb8fadb281e70ec8b3a9e720410
52
py
Python
src/gridemissions/viz/__init__.py
elijahjpassmore/gridemissions
18f773494c49034a5dc1488cd16f1f8b52445c18
[ "MIT" ]
4
2021-03-24T06:06:03.000Z
2022-03-12T13:55:30.000Z
src/gridemissions/viz/__init__.py
elijahjpassmore/gridemissions
18f773494c49034a5dc1488cd16f1f8b52445c18
[ "MIT" ]
null
null
null
src/gridemissions/viz/__init__.py
elijahjpassmore/gridemissions
18f773494c49034a5dc1488cd16f1f8b52445c18
[ "MIT" ]
1
2022-03-28T16:58:54.000Z
2022-03-28T16:58:54.000Z
from .base import set_plots, heatmap, add_watermark
26
51
0.826923
8
52
5.125
1
0
0
0
0
0
0
0
0
0
0
0
0.115385
52
1
52
52
0.891304
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
e4cebe93b7f98fe96eba2b4400344e16a3f3353d
102
py
Python
nncls/utils/__init__.py
xiaohu2015/nncls
b7071b69c0ca9521e914eab2f8dcfaf1a80723d6
[ "Apache-2.0" ]
8
2021-11-10T13:09:26.000Z
2021-12-12T00:11:46.000Z
nncls/utils/__init__.py
xiaohu2015/nncls
b7071b69c0ca9521e914eab2f8dcfaf1a80723d6
[ "Apache-2.0" ]
null
null
null
nncls/utils/__init__.py
xiaohu2015/nncls
b7071b69c0ca9521e914eab2f8dcfaf1a80723d6
[ "Apache-2.0" ]
null
null
null
from .registry import Registry from .torch_utils import load_state_dict_from_url, _log_api_usage_once
34
70
0.882353
17
102
4.764706
0.764706
0
0
0
0
0
0
0
0
0
0
0
0.088235
102
2
71
51
0.870968
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
e4eed99229a7f821d7de536596e36e61ede0d7e0
69
py
Python
f1.py
fengshou12/test001
58d325b2d3816dd1ff65d87fb68f696cd417ab08
[ "MIT" ]
1
2019-12-30T02:55:03.000Z
2019-12-30T02:55:03.000Z
f1.py
fengshou12/test001
58d325b2d3816dd1ff65d87fb68f696cd417ab08
[ "MIT" ]
null
null
null
f1.py
fengshou12/test001
58d325b2d3816dd1ff65d87fb68f696cd417ab08
[ "MIT" ]
null
null
null
num1 = 10, num=10 num2 = 20 num3=213412 print('dev写的') = 123231312
7.666667
17
0.666667
11
69
4.181818
0.909091
0
0
0
0
0
0
0
0
0
0
0.428571
0.188406
69
8
18
8.625
0.392857
0
0
0
0
0
0.072464
0
0
0
0
0
0
0
null
null
0
0
null
null
0.166667
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
5
903609aa1026f91d672d62f00da65259dba612ec
972
py
Python
spec/python/test_bits_simple_le.py
DarkShadow44/kaitai_struct_tests
4bb13cef82965cca66dda2eb2b77cd64e9f70a12
[ "MIT" ]
11
2018-04-01T03:58:15.000Z
2021-08-14T09:04:55.000Z
spec/python/test_bits_simple_le.py
DarkShadow44/kaitai_struct_tests
4bb13cef82965cca66dda2eb2b77cd64e9f70a12
[ "MIT" ]
73
2016-07-20T10:27:15.000Z
2020-12-17T18:56:46.000Z
spec/python/test_bits_simple_le.py
DarkShadow44/kaitai_struct_tests
4bb13cef82965cca66dda2eb2b77cd64e9f70a12
[ "MIT" ]
37
2016-08-15T08:25:56.000Z
2021-08-28T14:48:46.000Z
# Autogenerated from KST: please remove this line if doing any edits by hand! import unittest from bits_simple_le import BitsSimpleLe class TestBitsSimpleLe(unittest.TestCase): def test_bits_simple_le(self): with BitsSimpleLe.from_file('src/fixed_struct.bin') as r: self.assertEqual(r.byte_1, 80) self.assertEqual(r.byte_2, 65) self.assertEqual(r.bits_a, True) self.assertEqual(r.bits_b, 1) self.assertEqual(r.bits_c, 4) self.assertEqual(r.large_bits_1, 331) self.assertEqual(r.spacer, 3) self.assertEqual(r.large_bits_2, 393) self.assertEqual(r.normal_s2, -1) self.assertEqual(r.byte_8_9_10, 4407632) self.assertEqual(r.byte_11_to_14, 760556875) self.assertEqual(r.byte_15_to_19, 1099499455812) self.assertEqual(r.byte_20_to_27, 18446744073709551615) self.assertEqual(r.test_if_b1, 123)
38.88
77
0.661523
135
972
4.533333
0.496296
0.343137
0.366013
0.196078
0.081699
0
0
0
0
0
0
0.120219
0.246914
972
24
78
40.5
0.715847
0.07716
0
0
1
0
0.022346
0
0
0
0
0
0.736842
1
0.052632
false
0
0.105263
0
0.210526
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
1
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
5
90424f3b405014b5b48a03073590bd2a9b2c35f5
164
py
Python
facebook/feincms/urls.py
christianbertschy/django-facebook-graph
066e4b6a179d04a548795a48e122a7db687619ae
[ "Apache-2.0" ]
1
2015-09-24T00:36:28.000Z
2015-09-24T00:36:28.000Z
facebook/feincms/urls.py
christianbertschy/django-facebook-graph
066e4b6a179d04a548795a48e122a7db687619ae
[ "Apache-2.0" ]
null
null
null
facebook/feincms/urls.py
christianbertschy/django-facebook-graph
066e4b6a179d04a548795a48e122a7db687619ae
[ "Apache-2.0" ]
null
null
null
from django.conf.urls.defaults import * from views import redirect_to_slug urlpatterns = patterns('', url(r'^$', redirect_to_slug, name='redirect_to_slug'), )
23.428571
58
0.743902
23
164
5.043478
0.652174
0.258621
0.362069
0
0
0
0
0
0
0
0
0
0.121951
164
7
59
23.428571
0.805556
0
0
0
0
0
0.109091
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
5f39db4cd3e4b72a89d9712dca06e829fd0fd085
22
py
Python
src/tests.py
itsMatiYo/Wikipedia-pictures-downloader-bot
594ceed94aec3543fc78c41e674c32b3e53b8366
[ "MIT" ]
7
2021-11-08T09:10:41.000Z
2022-03-04T10:38:49.000Z
src/tests.py
itsMatiYo/Wikipedia-pictures-downloader-bot
594ceed94aec3543fc78c41e674c32b3e53b8366
[ "MIT" ]
null
null
null
src/tests.py
itsMatiYo/Wikipedia-pictures-downloader-bot
594ceed94aec3543fc78c41e674c32b3e53b8366
[ "MIT" ]
null
null
null
# pytests coming soon
11
21
0.772727
3
22
5.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.181818
22
1
22
22
0.944444
0.863636
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
5f43212f119a1ff4afa6858fc13f7c21007d8da9
989
py
Python
third_party/saltedge/test/test_providers_api.py
ltowarek/budget-supervisor
862a2d720aecd4ad2fded9c63bc839190ebbc77e
[ "MIT" ]
1
2022-03-01T10:28:31.000Z
2022-03-01T10:28:31.000Z
third_party/saltedge/test/test_providers_api.py
ltowarek/budget-supervisor
862a2d720aecd4ad2fded9c63bc839190ebbc77e
[ "MIT" ]
75
2020-11-07T20:14:55.000Z
2021-10-05T15:08:22.000Z
third_party/saltedge/test/test_providers_api.py
ltowarek/budget-supervisor
862a2d720aecd4ad2fded9c63bc839190ebbc77e
[ "MIT" ]
null
null
null
# coding: utf-8 """ Salt Edge Account Information API API Reference for services # noqa: E501 OpenAPI spec version: 5.0.0 Contact: support@saltedge.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import swagger_client from swagger_client.api.providers_api import ProvidersApi # noqa: E501 from swagger_client.rest import ApiException class TestProvidersApi(unittest.TestCase): """ProvidersApi unit test stubs""" def setUp(self): self.api = ProvidersApi() # noqa: E501 def tearDown(self): pass def test_providers_get(self): """Test case for providers_get List of providers # noqa: E501 """ pass def test_providers_provider_code_get(self): """Test case for providers_provider_code_get Show a provider # noqa: E501 """ pass if __name__ == '__main__': unittest.main()
20.604167
71
0.672396
121
989
5.272727
0.504132
0.062696
0.053292
0.062696
0.08464
0.08464
0
0
0
0
0
0.025367
0.242669
989
47
72
21.042553
0.826435
0.403438
0
0.1875
1
0
0.015656
0
0
0
0
0
0
1
0.25
false
0.1875
0.3125
0
0.625
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
1
1
0
1
0
0
5
5f58059ae0b8051c288c7cac431227947bd08d35
130
py
Python
survey/admin.py
viethngn/Data_Collection_Demo
c83b648ad066083d3df52f8dab3f280e9713e51f
[ "MIT" ]
null
null
null
survey/admin.py
viethngn/Data_Collection_Demo
c83b648ad066083d3df52f8dab3f280e9713e51f
[ "MIT" ]
null
null
null
survey/admin.py
viethngn/Data_Collection_Demo
c83b648ad066083d3df52f8dab3f280e9713e51f
[ "MIT" ]
null
null
null
from django.contrib import admin # Register your models here. from .models import SurveyResult admin.site.register(SurveyResult)
21.666667
33
0.823077
17
130
6.294118
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.115385
130
5
34
26
0.930435
0.2
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
5fc8e9cc9b73d2784094080988dc5d4820700b46
253
py
Python
RecoLocalTracker/SiStripRecHitConverter/python/customiseNewStripCPE.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
852
2015-01-11T21:03:51.000Z
2022-03-25T21:14:00.000Z
RecoLocalTracker/SiStripRecHitConverter/python/customiseNewStripCPE.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
30,371
2015-01-02T00:14:40.000Z
2022-03-31T23:26:05.000Z
RecoLocalTracker/SiStripRecHitConverter/python/customiseNewStripCPE.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
3,240
2015-01-02T05:53:18.000Z
2022-03-31T17:24:21.000Z
import FWCore.ParameterSet.Config as cms def customiseNewStripCPE(process): process.StripCPEfromTrackAngleESProducer.parameters.useLegacyError = True process.StripCPEfromTrackAngleESProducer.parameters.maxChgOneMIP = -6000. return process
31.625
77
0.83004
21
253
10
0.761905
0.371429
0.466667
0
0
0
0
0
0
0
0
0.017778
0.110672
253
7
78
36.142857
0.915556
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
5
39a8a539955b45a1f2d27fed752e7287009ebe30
125
py
Python
DiamondModels/modelos/admin.py
FR98/diamond-models
d478aca90481baef13ba604de180ed89f5964f17
[ "MIT" ]
null
null
null
DiamondModels/modelos/admin.py
FR98/diamond-models
d478aca90481baef13ba604de180ed89f5964f17
[ "MIT" ]
null
null
null
DiamondModels/modelos/admin.py
FR98/diamond-models
d478aca90481baef13ba604de180ed89f5964f17
[ "MIT" ]
null
null
null
from django.contrib import admin from modelos.models import Modelo # Register your models here. admin.site.register(Modelo)
20.833333
33
0.816
18
125
5.666667
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.12
125
6
34
20.833333
0.927273
0.208
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
39ccc06864ab736d85f84828c7eaaa194b46cb90
1,305
py
Python
smbl/prog/plugins/gnuplot.py
karel-brinda/snakemake-lib
5922fa2fc4060d86172e991361a1cceb0af51af8
[ "MIT" ]
26
2015-03-16T03:37:02.000Z
2021-01-18T17:34:16.000Z
smbl/prog/plugins/gnuplot.py
karel-brinda/smbl
5922fa2fc4060d86172e991361a1cceb0af51af8
[ "MIT" ]
12
2015-02-05T10:57:16.000Z
2016-06-07T18:09:57.000Z
smbl/prog/plugins/gnuplot.py
karel-brinda/snakemake-lib
5922fa2fc4060d86172e991361a1cceb0af51af8
[ "MIT" ]
6
2015-06-03T20:06:49.000Z
2020-12-13T09:48:03.000Z
# # TODO: # - fix CygWin error # import smbl import snakemake import os from ._program import * GNUPLOT4 = get_bin_file_path("gnuplot4") GNUPLOT5 = get_bin_file_path("gnuplot5") ########################################## ########################################## class GnuPlot4(Program): @classmethod def get_installation_files(cls): return [ GNUPLOT4, ] @classmethod def install(cls): fn=cls.download_file("http://sourceforge.net/projects/gnuplot/files/gnuplot/4.6.6/gnuplot-4.6.6.tar.gz/download","gnuplot.tar.gz") dir=cls.extract_tar(fn,strip=1) cls.run_configure(dir,other_args="--with-pdf") cls.run_make(dir) cls.install_file("src/gnuplot",GNUPLOT4) @classmethod def supported_platforms(cls): return ["osx","linux"] class GnuPlot5(Program): @classmethod def get_installation_files(cls): return [ GNUPLOT5, ] @classmethod def install(cls): fn=cls.download_file("http://sourceforge.net/projects/gnuplot/files/gnuplot/5.0.0/gnuplot-5.0.0.tar.gz/download","gnuplot.tar.gz") dir=cls.extract_tar(fn,strip=1) cls.run_configure(dir,other_args="--with-pdf") cls.run_make(dir) cls.install_file("src/gnuplot",GNUPLOT5) @classmethod def supported_platforms(cls): return ["osx","linux"]
22.5
133
0.649042
169
1,305
4.863905
0.313609
0.10219
0.024331
0.034063
0.742092
0.742092
0.742092
0.742092
0.501217
0.501217
0
0.021641
0.150192
1,305
57
134
22.894737
0.719567
0.019157
0
0.578947
0
0.052632
0.246914
0
0
0
0
0.017544
0
1
0.157895
false
0
0.105263
0.105263
0.421053
0
0
0
0
null
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
1
0
0
0
5
39d60e36698e11fb22a4745fc2718a4460abb0aa
201
py
Python
fanfou/__init__.py
LitoMore/fanfou-py
775f34c47b8d3ae03b877e853c0c194d0769f460
[ "MIT" ]
42
2017-05-28T01:32:33.000Z
2021-12-30T12:32:11.000Z
fanfou/__init__.py
LitoMore/fanfou-py
775f34c47b8d3ae03b877e853c0c194d0769f460
[ "MIT" ]
null
null
null
fanfou/__init__.py
LitoMore/fanfou-py
775f34c47b8d3ae03b877e853c0c194d0769f460
[ "MIT" ]
11
2017-07-21T08:00:36.000Z
2021-12-30T12:32:12.000Z
from fanfou.auth import OAuth, XAuth from fanfou.photo import pack_image from fanfou.api import bound, print_api __version__ = '0.2.6' __all__ = ['OAuth', 'XAuth', 'pack_image', 'bound', 'print_api']
28.714286
64
0.741294
31
201
4.419355
0.548387
0.218978
0.189781
0
0
0
0
0
0
0
0
0.017045
0.124378
201
6
65
33.5
0.761364
0
0
0
0
0
0.19403
0
0
0
0
0
0
1
0
false
0
0.6
0
0.6
0.4
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
39e77ff7ec36ba1dfe2bc1178e17e2fad6b9a03c
1,588
py
Python
src/utils/permissions_manager.py
gastbob40/discord_brawl_bot
90ee7ef6492b5e4272a8baa42fd97f8369b07864
[ "MIT" ]
null
null
null
src/utils/permissions_manager.py
gastbob40/discord_brawl_bot
90ee7ef6492b5e4272a8baa42fd97f8369b07864
[ "MIT" ]
null
null
null
src/utils/permissions_manager.py
gastbob40/discord_brawl_bot
90ee7ef6492b5e4272a8baa42fd97f8369b07864
[ "MIT" ]
null
null
null
import discord import yaml class PermissionsManager: @staticmethod def has_perm(member: discord.Member, perm_name: str) -> bool: with open('src/_data/permissions.yml', 'r') as file: permissions = yaml.safe_load(file) if perm_name not in permissions: raise Exception(f'{perm_name} not found in configuration file') for role in member.roles: if role.id in permissions[perm_name]: return True return False @staticmethod def add_perm(perm_name: str, role_id: int) -> bool: with open('src/_data/permissions.yml', 'r') as file: permissions = yaml.safe_load(file) if perm_name not in permissions: raise Exception(f'{perm_name} not found in configuration file') permissions[perm_name].append(role_id) with open('src/_data/permissions.yml', 'w', encoding='utf8') as outfile: yaml.dump(permissions, outfile, default_flow_style=False, allow_unicode=True) return True @staticmethod def remove_perm(perm_name: str, role_id: int) -> bool: with open('src/_data/permissions.yml', 'r') as file: permissions = yaml.safe_load(file) if perm_name not in permissions: raise Exception(f'{perm_name} not found in configuration file') permissions[perm_name].remove(role_id) with open('src/_data/permissions.yml', 'w', encoding='utf8') as outfile: yaml.dump(permissions, outfile, default_flow_style=False, allow_unicode=True) return True
31.76
89
0.646725
205
1,588
4.84878
0.258537
0.096579
0.066398
0.075453
0.779678
0.779678
0.779678
0.779678
0.779678
0.779678
0
0.001689
0.254408
1,588
49
90
32.408163
0.837838
0
0
0.666667
0
0
0.168242
0.078765
0
0
0
0
0
1
0.090909
false
0
0.060606
0
0.30303
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
39f408f98eb75288db151c22ba359196abecf1b8
157
py
Python
src/drf_yasg2/apps.py
gdalmau/drf-yasg
acff90ac26eba01e363bfd3ecc75b71a6a37088a
[ "BSD-3-Clause" ]
65
2020-10-06T15:37:49.000Z
2022-02-24T05:18:28.000Z
src/drf_yasg2/apps.py
gdalmau/drf-yasg
acff90ac26eba01e363bfd3ecc75b71a6a37088a
[ "BSD-3-Clause" ]
48
2020-10-07T11:14:40.000Z
2021-02-03T15:07:39.000Z
src/drf_yasg2/apps.py
gdalmau/drf-yasg
acff90ac26eba01e363bfd3ecc75b71a6a37088a
[ "BSD-3-Clause" ]
4
2020-10-10T18:03:33.000Z
2020-10-23T07:56:34.000Z
from django.apps import AppConfig class DrfYasgConfig(AppConfig): name = "drf_yasg2" verbose_name = "drf_yasg2" def ready(self): pass
15.7
33
0.675159
19
157
5.421053
0.789474
0.135922
0.23301
0
0
0
0
0
0
0
0
0.016807
0.242038
157
9
34
17.444444
0.84874
0
0
0
0
0
0.11465
0
0
0
0
0
0
1
0.166667
false
0.166667
0.166667
0
0.833333
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
5
843e59b7ef643a04bb00d678b8aea0ae94cdbc74
87
py
Python
07 Capstone - Detect breast cancer metastases/utils/__init__.py
jhorchler/udacity-machine-learning-engineer
65b806951c9c0c4faef1ec2db7f0dbb987f11922
[ "MIT" ]
null
null
null
07 Capstone - Detect breast cancer metastases/utils/__init__.py
jhorchler/udacity-machine-learning-engineer
65b806951c9c0c4faef1ec2db7f0dbb987f11922
[ "MIT" ]
null
null
null
07 Capstone - Detect breast cancer metastases/utils/__init__.py
jhorchler/udacity-machine-learning-engineer
65b806951c9c0c4faef1ec2db7f0dbb987f11922
[ "MIT" ]
null
null
null
from .data import HDF5Matrix, PCamDataset, get_matrixes, get_mean_std, ImgAugTransform
43.5
86
0.850575
11
87
6.454545
0.909091
0
0
0
0
0
0
0
0
0
0
0.012658
0.091954
87
1
87
87
0.886076
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
845fb8ce9b3556487d1dffd64a50589462dabb85
124,154
py
Python
gen_city.py
kevin-ewing/city_blender_scripting
022a0e35aac1736c67c0ccc755f12b2c69e5051c
[ "Unlicense" ]
null
null
null
gen_city.py
kevin-ewing/city_blender_scripting
022a0e35aac1736c67c0ccc755f12b2c69e5051c
[ "Unlicense" ]
null
null
null
gen_city.py
kevin-ewing/city_blender_scripting
022a0e35aac1736c67c0ccc755f12b2c69e5051c
[ "Unlicense" ]
null
null
null
''' Procedural generation of a citycape By Kevin Ewing Spring 2022 Middlebury Animation Studio Independent project ''' from colorsys import hsv_to_rgb from dataclasses import dataclass from random import randint, uniform from os import getcwd from sys import argv from time import time import math as m import bpy # To render or not to render that is the question RENDER = True # City global variables SIZE_OF_CITY = 120 CENTER_FACTOR = 5 CENTER_SIZE = 9 MAX_BRIGHT = 13 RIVER_CURVE_FACTOR = .20 RIVER_SIZE = 4 # Render global variables RENDER_SIZE_FACTOR = 1 RENDER_SAMPLE_FACTOR = 1 ''' Each building is initialized with a Building struct: conjoined: false exists: true x: y: height: threshold: ''' @dataclass class Building: conjoined: bool exists: bool x: float y: float height: float tier_threshold: float # Blender will update the view with each primitive addition, we do not want that, instead # lets block it from updating the view until the end # https://blender.stackexchange.com/questions/7358/python-performance-with-blender- # operators def run_ops_without_view_layer_update(func): ''' Workaround function as mentioned above to only update the meshes after everything has been generated, severely shortens the amount of time building generation takes ''' from bpy.ops import _BPyOpsSubModOp view_layer_update = _BPyOpsSubModOp._view_layer_update def dummy_view_layer_update(context): pass try: _BPyOpsSubModOp._view_layer_update = dummy_view_layer_update func() finally: _BPyOpsSubModOp._view_layer_update = view_layer_update def main(): ''' Main function clears scene, sets conditions, generates building plan then starts generation does not do the rendering ''' # Initializing the empty array of the full city plan, will make 2d city_plan = [] # Checkpoint before buildings are cleared checkpoint = time() print("Clearing all buildings...") # Clearing all objects and materials from the prior scene bpy.ops.object.select_all(action='SELECT') bpy.ops.object.delete() bpy.context.scene.render.engine = 'CYCLES' for material in bpy.data.materials: bpy.data.materials.remove(material) # Checkpoint after the buildings are cleared; before city is planned print("--- %s seconds ---\n" % (time() - checkpoint)) checkpoint = time() print("Randomizing center of city and sun...") # Randomly generates the "city center" center_coord = SIZE_OF_CITY // CENTER_FACTOR center_x = randint(-center_coord, center_coord) center_y = randint(-center_coord, center_coord) sun_distance = 2 * SIZE_OF_CITY sun_x = uniform(-sun_distance, sun_distance) sun_decider = randint(0, 1) if sun_decider: sun_y = m.sqrt(m.pow(sun_distance, 2) - m.pow(sun_x, 2)) else: sun_y = - m.sqrt(m.pow(sun_distance, 2) - m.pow(sun_x, 2)) sun_z = uniform(1, 50) # Adds Sun sun_angle_z = m.pi - m.atan(sun_x / sun_y) if sun_decider: sun_angle_x = m.atan(sun_distance / (sun_z)) else: sun_angle_x = -m.atan(sun_distance / (sun_z)) sun_strength = uniform(1, MAX_BRIGHT) bpy.ops.object.light_add( type='SUN', radius=1, location=( sun_x, sun_y, sun_z), rotation=( sun_angle_x, 0, sun_angle_z), scale=( 1, 1, 1)) bpy.context.object.data.energy = sun_strength sun_mat = bpy.data.materials.new(name="sun_mat") sun_mat.use_nodes = True for n in sun_mat.node_tree.nodes: if n.type == 'BSDF_PRINCIPLED': n.inputs["Emission Strength"].default_value = 10 n.inputs["Emission"].default_value = (1, 1, 1, 1) bpy.ops.mesh.primitive_ico_sphere_add( subdivisions=5, radius=5, enter_editmode=False, align='WORLD', location=( sun_x, sun_y, sun_z), scale=( 1, 1, 1)) bpy.context.object.data.materials.append(sun_mat) bpy.context.object.visible_shadow = False # Checkpoint after generating city center and placing sun; before camera print("--- %s seconds ---\n" % (time() - checkpoint)) checkpoint = time() print("Randomizing camera...") # Randomly places the Camera in the first quadrant of the scene camera_distance = uniform(.8 * SIZE_OF_CITY, 1 * SIZE_OF_CITY) camera_x = uniform(0, camera_distance) camera_y = m.sqrt(m.pow(camera_distance, 2) - m.pow(camera_x, 2)) camera_z = uniform(5, 20) # Adds Camera camera_angle_z = m.pi - m.atan(camera_x / camera_y) camera_angle_x = m.atan(camera_distance / (camera_z - 5)) bpy.ops.object.camera_add( enter_editmode=False, align='VIEW', location=( camera_x, camera_y, camera_z), rotation=( camera_angle_x, 0, camera_angle_z), scale=( 1, 1, 1)) bpy.context.scene.camera = bpy.context.object # Checkpoint after creating sun before floor print("--- %s seconds ---\n" % (time() - checkpoint)) checkpoint = time() print("Creating floor...") # Adds floor facing the camera mat = bpy.data.materials.new(name="floor") mat.use_nodes = True for n in mat.node_tree.nodes: if n.type == 'BSDF_PRINCIPLED': n.inputs["Metallic"].default_value = 0.65 n.inputs["Roughness"].default_value = 0.15 # Creates the geometry node tree in create_mountain_tree() # And assigns that to the geometry node modifier bpy.ops.mesh.primitive_plane_add( size=400, enter_editmode=False, align='WORLD', location=( 0, 0, 0), scale=( 1, 1, 1)) bpy.ops.object.modifier_add(type='NODES') bpy.data.node_groups["Geometry Nodes"].name = "mountain" create_mountain_tree() bpy.ops.object.shade_smooth() bpy.context.object.data.materials.append(mat) # Checkpoint after floor is generated print("--- %s seconds ---\n" % (time() - checkpoint)) checkpoint = time() print("Creating color palette and setting world color...") world_fixed_color = uniform(0.4, 0.85) world_saturation = uniform(0.4, 0.8) world_value = uniform(0.2, 1) # Sets world color world_strength = uniform(0, sun_strength / MAX_BRIGHT) bpy.data.worlds["World"].node_tree.nodes["Background"].inputs[0].default_value = ( hsv_to_rgb( world_fixed_color, world_saturation, world_value)[0], hsv_to_rgb( world_fixed_color, world_saturation, world_value)[1], hsv_to_rgb( world_fixed_color, world_saturation, world_value)[2], world_strength) # Checkpoint after creating the pallette but before planning city print("--- %s seconds ---\n" % (time() - checkpoint)) checkpoint = time() print("Generating building plans...") for i in range(-SIZE_OF_CITY // 2, SIZE_OF_CITY // 2): temp = [] for j in range(-SIZE_OF_CITY // 2, SIZE_OF_CITY // 2): temp.append(plan_building(i, j, center_x, center_y)) city_plan.append(temp) print("--- %s seconds ---\n" % (time() - checkpoint)) checkpoint = time() print("Carving River...") carve_river(city_plan) print("--- %s seconds ---\n" % (time() - checkpoint)) checkpoint = time() print("Joining Buildings...") fixed_color = uniform(0, 1) saturation = uniform(0.1, 1) value = uniform(0.2, 1) join_buildings(city_plan, fixed_color, saturation, value) print("--- %s seconds ---\n" % (time() - checkpoint)) checkpoint = time() print("Building all buildings...") build_all_buildings(city_plan, fixed_color, saturation, value) print("--- %s seconds ---\n" % (time() - checkpoint)) checkpoint = time() print("Seting up composite...") setup_composite() print("--- %s seconds ---\n" % (time() - checkpoint)) checkpoint = time() def carve_park(city_plan): ''' Carves out a park in the city ''' center = randint(-SIZE_OF_CITY // 2, SIZE_OF_CITY) height = randint(0, 12) width = randint(0, 12) for i in range(center + (-height // 2), center + (height // 2)): for j in range(center + (-width // 2), center + (width // 2)): try: city_plan[i][j].exists = False except IndexError: pass def carve_river(city_plan): ''' Carves out a river through the city ''' edge = False direction = 0 for cols in city_plan: rand_start = randint(0, len(cols)) current_x = rand_start current_y = 0 while edge == False: dir_change = uniform(0, 1) if dir_change < RIVER_CURVE_FACTOR: direction = (direction - 1) % 4 elif dir_change < RIVER_CURVE_FACTOR * 2: direction = (direction + 1) % 4 try: if direction == 0: current_y += 1 elif direction == 1: current_x += 1 elif direction == 2: current_y -= 1 else: current_x -= 1 # clear around try: for i in range(-RIVER_SIZE // 2, RIVER_SIZE // 2): for j in range(-RIVER_SIZE // 2, RIVER_SIZE // 2): city_plan[current_x + i][current_y + j].exists = False except IndexError: pass # If actual plan is at edge then we do exit loop city_plan[current_x][current_y].exists = False except IndexError: edge = True def join_buildings(city_plan, fixed_color, saturation, value): ''' Will randomly join two neighboring buildings if they are not already joined Assigns one to be twice the width and marks the other's stuct as exists = false ''' for cols in range(len(city_plan)): for rows in range(len(city_plan[cols])): if (uniform(0, 1) < 0.08 and city_plan[cols][rows].height < 4 and city_plan[cols][rows].conjoined == False): if uniform(0, 1) < 0.5: try: if (city_plan[cols][rows + 1].conjoined == False and city_plan[cols][rows + 1].exists and city_plan[cols][rows].exists): city_plan[cols][rows].exists = False city_plan[cols][rows + 1].exists = False city_plan[cols][rows + 1].conjoined = True bpy.ops.mesh.primitive_cube_add(location=( city_plan[cols][rows].x, city_plan[cols][rows].y + .5, city_plan[cols][rows].height), scale=(.40, .90, city_plan[cols][rows].height)) bpy.context.object.data.materials.append(build_mat( fixed_color, saturation, value, 0)) except IndexError: # Erroring is OK, if it has just gone off the edge of # the map pass else: try: if (city_plan[cols + 1][rows].conjoined == False and city_plan[cols + 1][rows].exists and city_plan[cols][rows].exists): city_plan[cols][rows].exists = False city_plan[cols + 1][rows].exists = False city_plan[cols + 1][rows].conjoined = True bpy.ops.mesh.primitive_cube_add(location=( city_plan[cols][rows].x + 0.5, city_plan[cols][rows].y, city_plan[cols][rows].height), scale=(.90, .40, city_plan[cols][rows].height)) bpy.context.object.data.materials.append( build_mat(fixed_color, saturation, value, 0)) except IndexError: # Erroring is OK, if it has just gone off the edge of # the map pass def setup_composite(): ''' Sets up the composite node tree for denoise and glare help with: https://blender.stackexchange.com/questions/19500/controling-compositor-by-python ''' # switch on nodes and get reference bpy.context.scene.use_nodes = True tree = bpy.context.scene.node_tree # clear default nodes for node in tree.nodes: tree.nodes.remove(node) # create input image node image_node = tree.nodes.new(type='CompositorNodeRLayers') # create glare node glare_node = tree.nodes.new('CompositorNodeGlare') glare_node.glare_type = "FOG_GLOW" glare_node.size = 5 # create output node comp_node = tree.nodes.new('CompositorNodeComposite') # link nodes links = tree.links links.new(image_node.outputs[0], glare_node.inputs[0]) links.new(glare_node.outputs[0], comp_node.inputs[0]) def plan_building(x, y, center_x, center_y): ''' Initializes the building based of the x and y of the building and how far from the city center it is going to be ''' height = determine_building_height(x, y, center_x, center_y, SIZE_OF_CITY) tier_threshold = randint(0, 20) * height # Building is first actually initialized return Building(False, True, x, y, height, tier_threshold) def build_mat(fixed_color, saturation, value, shiny): ''' Helper function to build the material based on predetermined parameters defined in main ''' color_addition = uniform(-0.15, 0.15) varied_color = fixed_color + color_addition if varied_color > 1: varied_color - 1 if varied_color < 0: varied_color + 1 sat_addition = uniform(-0.1, 0.1) varied_saturation = saturation + sat_addition value_addition = uniform(-0.1, 0.1) varied_value = value + value_addition if shiny: built_mat = bpy.data.materials.new(name=str( varied_color + varied_saturation + varied_value)) built_mat.use_nodes = True for n in built_mat.node_tree.nodes: if n.type == 'BSDF_PRINCIPLED': n.inputs["Metallic"].default_value = 0.5 n.inputs["Roughness"].default_value = 0.05 n.inputs["Base Color"].default_value = ( hsv_to_rgb( varied_color, varied_saturation, varied_value)[0], hsv_to_rgb( varied_color, varied_saturation, varied_value)[1], hsv_to_rgb( varied_color, varied_saturation, varied_value)[2], 1.0) else: built_mat = bpy.data.materials.new(name="mat") built_mat.diffuse_color = ( hsv_to_rgb( varied_color, varied_saturation, varied_value)[0], hsv_to_rgb( varied_color, varied_saturation, varied_value)[1], hsv_to_rgb( varied_color, varied_saturation, varied_value)[2], 1.0) return built_mat def build_all_buildings(city_plan, fixed_color, saturation, value): ''' Actually places the cubes in blender based on the city plan, and will generate the color on the fly ''' # Determines the highest tiered building in the city th_max = 0 for cols in city_plan: for row in cols: if row.tier_threshold > th_max: th_max = row.tier_threshold # Breaks down the building tiers based from the maximum one generated for cols in city_plan: for row in cols: if not row.exists: pass elif row.tier_threshold > (11 * (th_max / 15)): pointed_building( row.x, row.y, row.height, build_mat( fixed_color, saturation, value, 0)) elif row.tier_threshold > (9 * (th_max / 15)): tiered_building( row.x, row.y, row.height, build_mat( fixed_color, saturation, value, 0)) elif row.tier_threshold > (8 * (th_max / 15)): striped_building( row.x, row.y, row.height, build_mat( fixed_color, saturation, value, 0)) elif row.tier_threshold > (7 * (th_max / 15)): spired_building( row.x, row.y, row.height, build_mat( fixed_color, saturation, value, 0)) elif row.tier_threshold > (6 * (th_max / 15)): crossed_building( row.x, row.y, row.height, build_mat( fixed_color, saturation, value, 0)) elif row.tier_threshold > (5 * (th_max / 15)): glass_building( row.x, row.y, row.height, build_mat( fixed_color, saturation, value, 1)) elif row.tier_threshold > (4 * (th_max / 15)): slotted_building( row.x, row.y, row.height, build_mat( fixed_color, saturation, value, 0)) elif row.tier_threshold > (2 * (th_max / 15)): pass else: bpy.ops.mesh.primitive_cube_add(location=(row.x, row.y, row.height), scale=(.40, .40, row.height)) bpy.context.object.data.materials.append( build_mat(fixed_color, saturation, value, 0)) def determine_building_height(x, y, center_x, center_y, SIZE_OF_CITY): ''' Determines the building threshold based on the distance from the city center Designed to ease in and out of the downtown area Uses a sigmoid growth curve ''' distance = m.sqrt((x - center_x)**2 + (y - center_y)**2) minimum = (distance ** 0.25) / (SIZE_OF_CITY / 10) maximum = 9 - (8 / (1 + m.pow(1.3, (-1.4 * (distance - CENTER_SIZE))))) return uniform(minimum, maximum) def pointed_building(x, y, height, mat): ''' Generates the pointed building given the location height and passed the mat ''' bpy.ops.mesh.primitive_cube_add(location=(x, y, height), scale=(.45, .45, height)) bpy.context.object.data.materials.append(mat) size_of_point = uniform(0.05, 0.12) length_of_point = uniform(10, 20) * size_of_point bpy.ops.object.duplicate_move( OBJECT_OT_duplicate={ "linked": False, "mode": 'TRANSLATION'}, TRANSFORM_OT_translate={ "value": (0, 0, 0), "orient_type": 'GLOBAL', "orient_matrix": ( (0, 0, 0), (0, 0, 0), (0, 0, 0)), "orient_matrix_type": 'GLOBAL', "constraint_axis": (False, False, False), "mirror": False, "use_proportional_edit": False, "proportional_edit_falloff": 'SMOOTH', "proportional_size": 1, "use_proportional_connected": False, "use_proportional_projected": False, "snap": False, "snap_target": 'CLOSEST', "snap_point": (0, 0, 0), "snap_align": False, "snap_normal": (0, 0, 0), "gpencil_strokes": False, "cursor_transform": False, "texture_space": False, "remove_on_cancel": False, "release_confirm": False, "use_accurate": False, "use_automerge_and_split": False}) bpy.ops.transform.resize( value=(size_of_point, size_of_point, 1), orient_type='GLOBAL', orient_matrix=( (1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, True, False), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False) bpy.ops.transform.translate( value=(0, 0, length_of_point), orient_type='GLOBAL', orient_matrix=( (1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=( False, False, True), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False) def tiered_building(x, y, height, mat): ''' Generates the tiered building given the location height and passed the mat ''' bpy.ops.mesh.primitive_cube_add(location=(x, y, height / 4), scale=( .45, .45, height / 4)) bpy.context.object.data.materials.append(mat) bpy.ops.mesh.primitive_cube_add(location=(x, y, 3 * (height / 4)), scale=( .4, .4, height / 4)) bpy.context.object.data.materials.append(mat) bpy.ops.mesh.primitive_cube_add(location=(x, y, 5 * (height / 4)), scale=( .35, .35, height / 4)) bpy.context.object.data.materials.append(mat) bpy.ops.mesh.primitive_cube_add(location=(x, y, 7 * (height / 4)), scale=( .3, .3, height / 4)) bpy.context.object.data.materials.append(mat) def striped_building(x, y, height, mat): ''' Generates the striped building given the location height and passed the mat ''' step_height_factor = uniform(1.05, 1.2) bpy.ops.mesh.primitive_cube_add(location=(x, y, height), scale=( .35, .35, height)) bpy.context.object.data.materials.append(mat) bpy.ops.mesh.primitive_cube_add(location=(x + .25, y + .25, height / step_height_factor), scale=(.13, .13, height / step_height_factor)) bpy.context.object.data.materials.append(mat) bpy.ops.mesh.primitive_cube_add(location=(x - .25, y + .25, height / step_height_factor), scale=(.13, .13, height / step_height_factor)) bpy.context.object.data.materials.append(mat) bpy.ops.mesh.primitive_cube_add(location=(x + .25, y - .25, height / step_height_factor), scale=(.13, .13, height / step_height_factor)) bpy.context.object.data.materials.append(mat) bpy.ops.mesh.primitive_cube_add(location=(x - .25, y - .25, height / step_height_factor), scale=(.13, .13, height / step_height_factor)) bpy.context.object.data.materials.append(mat) bpy.ops.mesh.primitive_cube_add(location=( x, y, height + 2 * (step_height_factor - 1)), scale=(.3, .3, height)) bpy.context.object.data.materials.append(mat) def spired_building(x, y, height, mat): ''' Generates the spired building given the location height and passed the mat ''' bpy.ops.mesh.primitive_cube_add(location=(x, y, height), scale=( .40, .40, height)) bpy.context.object.data.materials.append(mat) bpy.ops.mesh.primitive_cone_add(location=(x, y, 2 * height + .14), scale=( .34, .34, .7)) bpy.ops.object.shade_smooth() bpy.context.object.data.materials.append(mat) bpy.ops.mesh.primitive_cube_add(location=(x, y, 2 * height + .14), scale=( .38, .38, .08)) bpy.context.object.data.materials.append(mat) def crossed_building(x, y, height, mat): ''' Generates the crossed building given the location height and passed the mat ''' max_beam_count = 12 number_beams = randint(3, max_beam_count) bpy.ops.mesh.primitive_cube_add(location=(x, y, height), scale=( .35, .35, height + .04)) bpy.context.object.data.materials.append(mat) beam_offset = 2 * (.35 / number_beams) for i in range(number_beams + 1): bpy.ops.mesh.primitive_cube_add(location=(x, y - .35 + (beam_offset * i), height), scale=(.4, .4 / (3 * number_beams), height)) bpy.context.object.data.materials.append(mat) bpy.ops.mesh.primitive_cube_add(location=(x - .35 + (beam_offset * i), y, height), scale=(.4 / (3 * number_beams), .4, height)) bpy.context.object.data.materials.append(mat) def glass_building(x, y, height, mat): ''' Generates the spired building given the location height and passed the mat ''' bpy.ops.mesh.primitive_cube_add(location=(x, y, height), scale=( .40, .40, height)) bpy.context.object.data.materials.append(mat) def slotted_building(x, y, height, mat): ''' Generates the slotted building given the location height and passed the mat ''' bpy.ops.mesh.primitive_cube_add(location=(x, y, height), scale=( .39, .39, height)) bpy.context.object.data.materials.append(mat) floors = int(height // .2) for i in range(floors + 1): bpy.ops.mesh.primitive_cube_add(location=(x, y, i * .4), scale=( .4, .4, .02)) bpy.context.object.data.materials.append(mat) def create_mountain_tree(): ''' Generates the node tree for the mountain geometry node to be applied to the plane mesh Code created with https://github.com/Korchy/blender_nodetree_source ''' # MATERIAL node_tree1 = bpy.data.node_groups.get('mountain') for node in node_tree1.nodes: node_tree1.nodes.remove(node) # INPUTS input = node_tree1.inputs.new('NodeSocketGeometry', 'Geometry') if hasattr(input, 'attribute_domain'): input.attribute_domain = 'POINT' if hasattr(input, 'hide_value'): input.hide_value = False if hasattr(input, 'name'): input.name = 'Geometry' # OUTPUTS output = node_tree1.outputs.new('NodeSocketGeometry', 'Geometry') if hasattr(output, 'attribute_domain'): output.attribute_domain = 'POINT' if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Geometry' # NODES group_output_1 = node_tree1.nodes.new('NodeGroupOutput') if hasattr(group_output_1, 'color'): group_output_1.color = (0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(group_output_1, 'hide'): group_output_1.hide = False if hasattr(group_output_1, 'is_active_output'): group_output_1.is_active_output = True if hasattr(group_output_1, 'location'): group_output_1.location = (998.134765625, 181.331298828125) if hasattr(group_output_1, 'mute'): group_output_1.mute = False if hasattr(group_output_1, 'name'): group_output_1.name = 'Group Output' if hasattr(group_output_1, 'use_custom_color'): group_output_1.use_custom_color = False if hasattr(group_output_1, 'width'): group_output_1.width = 140.0 subdivide_mesh_1 = node_tree1.nodes.new('GeometryNodeSubdivideMesh') if hasattr(subdivide_mesh_1, 'color'): subdivide_mesh_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(subdivide_mesh_1, 'hide'): subdivide_mesh_1.hide = False if hasattr(subdivide_mesh_1, 'location'): subdivide_mesh_1.location = (-539.3538818359375, 257.773681640625) if hasattr(subdivide_mesh_1, 'mute'): subdivide_mesh_1.mute = False if hasattr(subdivide_mesh_1, 'name'): subdivide_mesh_1.name = 'Subdivide Mesh' if hasattr(subdivide_mesh_1, 'use_custom_color'): subdivide_mesh_1.use_custom_color = False if hasattr(subdivide_mesh_1, 'width'): subdivide_mesh_1.width = 140.0 input_ = next((input_ for input_ in subdivide_mesh_1.inputs if input_.identifier == 'Level'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 1 if hasattr(input_, 'display_shape'): input_.display_shape = 'CIRCLE' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Level' if hasattr(input_, 'show_expanded'): input_.show_expanded = False position_1 = node_tree1.nodes.new('GeometryNodeInputPosition') if hasattr(position_1, 'color'): position_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(position_1, 'hide'): position_1.hide = False if hasattr(position_1, 'location'): position_1.location = (-457.5484619140625, 73.76937866210938) if hasattr(position_1, 'mute'): position_1.mute = False if hasattr(position_1, 'name'): position_1.name = 'Position' if hasattr(position_1, 'use_custom_color'): position_1.use_custom_color = False if hasattr(position_1, 'width'): position_1.width = 140.0 output = next((output for output in position_1.outputs if output.identifier == 'Position'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Position' if hasattr(output, 'show_expanded'): output.show_expanded = False math_002_1 = node_tree1.nodes.new('ShaderNodeMath') if hasattr(math_002_1, 'color'): math_002_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(math_002_1, 'hide'): math_002_1.hide = False if hasattr(math_002_1, 'location'): math_002_1.location = (-1863.360595703125, -196.51612854003906) if hasattr(math_002_1, 'mute'): math_002_1.mute = False if hasattr(math_002_1, 'name'): math_002_1.name = 'Math.002' if hasattr(math_002_1, 'operation'): math_002_1.operation = 'ABSOLUTE' if hasattr(math_002_1, 'use_clamp'): math_002_1.use_clamp = False if hasattr(math_002_1, 'use_custom_color'): math_002_1.use_custom_color = False if hasattr(math_002_1, 'width'): math_002_1.width = 140.0 input_ = next( (input_ for input_ in math_002_1.inputs if input_.identifier == 'Value'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_002_1.inputs if input_.identifier == 'Value_001'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_002_1.inputs if input_.identifier == 'Value_002'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in math_002_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND_DOT' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False math_1 = node_tree1.nodes.new('ShaderNodeMath') if hasattr(math_1, 'color'): math_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(math_1, 'hide'): math_1.hide = False if hasattr(math_1, 'location'): math_1.location = (-1860.6793212890625, -58.374664306640625) if hasattr(math_1, 'mute'): math_1.mute = False if hasattr(math_1, 'name'): math_1.name = 'Math' if hasattr(math_1, 'operation'): math_1.operation = 'INVERSE_SQRT' if hasattr(math_1, 'use_clamp'): math_1.use_clamp = False if hasattr(math_1, 'use_custom_color'): math_1.use_custom_color = False if hasattr(math_1, 'width'): math_1.width = 140.0 input_ = next( (input_ for input_ in math_1.inputs if input_.identifier == 'Value'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_1.inputs if input_.identifier == 'Value_001'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_1.inputs if input_.identifier == 'Value_002'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in math_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND_DOT' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False colorramp_1 = node_tree1.nodes.new('ShaderNodeValToRGB') if hasattr(colorramp_1, 'color'): colorramp_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(colorramp_1, 'color_ramp'): if hasattr(colorramp_1.color_ramp, 'color_mode'): colorramp_1.color_ramp.color_mode = 'RGB' if hasattr(colorramp_1.color_ramp, 'elements'): if 0 >= len(colorramp_1.color_ramp.elements): colorramp_1.color_ramp.elements.new(0.0) if hasattr(colorramp_1.color_ramp.elements[0], 'alpha'): colorramp_1.color_ramp.elements[0].alpha = 1.0 if hasattr(colorramp_1.color_ramp.elements[0], 'color'): colorramp_1.color_ramp.elements[0].color = (0.0, 0.0, 0.0, 1.0) if hasattr(colorramp_1.color_ramp.elements[0], 'position'): colorramp_1.color_ramp.elements[0].position = 0.0 if 1 >= len(colorramp_1.color_ramp.elements): colorramp_1.color_ramp.elements.new(1.0) if hasattr(colorramp_1.color_ramp.elements[1], 'alpha'): colorramp_1.color_ramp.elements[1].alpha = 1.0 if hasattr(colorramp_1.color_ramp.elements[1], 'color'): colorramp_1.color_ramp.elements[1].color = (1.0, 1.0, 1.0, 1.0) if hasattr(colorramp_1.color_ramp.elements[1], 'position'): colorramp_1.color_ramp.elements[1].position = 1.0 if hasattr(colorramp_1.color_ramp, 'hue_interpolation'): colorramp_1.color_ramp.hue_interpolation = 'NEAR' if hasattr(colorramp_1.color_ramp, 'interpolation'): colorramp_1.color_ramp.interpolation = 'LINEAR' if hasattr(colorramp_1, 'hide'): colorramp_1.hide = False if hasattr(colorramp_1, 'location'): colorramp_1.location = (-1057.744140625, -89.62713623046875) if hasattr(colorramp_1, 'mute'): colorramp_1.mute = False if hasattr(colorramp_1, 'name'): colorramp_1.name = 'ColorRamp' if hasattr(colorramp_1, 'use_custom_color'): colorramp_1.use_custom_color = False if hasattr(colorramp_1, 'width'): colorramp_1.width = 240.0 input_ = next( (input_ for input_ in colorramp_1.inputs if input_.identifier == 'Fac'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Fac' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in colorramp_1.outputs if output.identifier == 'Color'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Color' if hasattr(output, 'show_expanded'): output.show_expanded = False output = next( (output for output in colorramp_1.outputs if output.identifier == 'Alpha'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Alpha' if hasattr(output, 'show_expanded'): output.show_expanded = False vector_math_001_1 = node_tree1.nodes.new('ShaderNodeVectorMath') if hasattr(vector_math_001_1, 'color'): vector_math_001_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(vector_math_001_1, 'hide'): vector_math_001_1.hide = False if hasattr(vector_math_001_1, 'location'): vector_math_001_1.location = (-1266.610107421875, -412.4996032714844) if hasattr(vector_math_001_1, 'mute'): vector_math_001_1.mute = False if hasattr(vector_math_001_1, 'name'): vector_math_001_1.name = 'Vector Math.001' if hasattr(vector_math_001_1, 'operation'): vector_math_001_1.operation = 'MULTIPLY' if hasattr(vector_math_001_1, 'use_custom_color'): vector_math_001_1.use_custom_color = False if hasattr(vector_math_001_1, 'width'): vector_math_001_1.width = 140.0 input_ = next( (input_ for input_ in vector_math_001_1.inputs if input_.identifier == 'Vector'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in vector_math_001_1.inputs if input_.identifier == 'Vector_001'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = ( 0.004000000189989805, 0.004000000189989805, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in vector_math_001_1.inputs if input_.identifier == 'Vector_002'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in vector_math_001_1.inputs if input_.identifier == 'Scale'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 1.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Scale' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in vector_math_001_1.outputs if output.identifier == 'Vector'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Vector' if hasattr(output, 'show_expanded'): output.show_expanded = False output = next( (output for output in vector_math_001_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = False if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False colorramp_001_1 = node_tree1.nodes.new('ShaderNodeValToRGB') if hasattr(colorramp_001_1, 'color'): colorramp_001_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(colorramp_001_1, 'color_ramp'): if hasattr(colorramp_001_1.color_ramp, 'color_mode'): colorramp_001_1.color_ramp.color_mode = 'RGB' if hasattr(colorramp_001_1.color_ramp, 'elements'): if 0 >= len(colorramp_001_1.color_ramp.elements): colorramp_001_1.color_ramp.elements.new(0.468181848526001) if hasattr(colorramp_001_1.color_ramp.elements[0], 'alpha'): colorramp_001_1.color_ramp.elements[0].alpha = 1.0 if hasattr(colorramp_001_1.color_ramp.elements[0], 'color'): colorramp_001_1.color_ramp.elements[0].color = ( 1.0, 1.0, 1.0, 1.0) if hasattr(colorramp_001_1.color_ramp.elements[0], 'position'): colorramp_001_1.color_ramp.elements[0].position = 0.468181848526001 if 1 >= len(colorramp_001_1.color_ramp.elements): colorramp_001_1.color_ramp.elements.new(0.6454545259475708) if hasattr(colorramp_001_1.color_ramp.elements[1], 'alpha'): colorramp_001_1.color_ramp.elements[1].alpha = 1.0 if hasattr(colorramp_001_1.color_ramp.elements[1], 'color'): colorramp_001_1.color_ramp.elements[1].color = ( 0.05730096995830536, 0.05730096995830536, 0.05730096995830536, 1.0) if hasattr(colorramp_001_1.color_ramp.elements[1], 'position'): colorramp_001_1.color_ramp.elements[1].position = 0.6454545259475708 if hasattr(colorramp_001_1.color_ramp, 'hue_interpolation'): colorramp_001_1.color_ramp.hue_interpolation = 'NEAR' if hasattr(colorramp_001_1.color_ramp, 'interpolation'): colorramp_001_1.color_ramp.interpolation = 'EASE' if hasattr(colorramp_001_1, 'hide'): colorramp_001_1.hide = False if hasattr(colorramp_001_1, 'location'): colorramp_001_1.location = (-784.2443237304688, -350.30657958984375) if hasattr(colorramp_001_1, 'mute'): colorramp_001_1.mute = False if hasattr(colorramp_001_1, 'name'): colorramp_001_1.name = 'ColorRamp.001' if hasattr(colorramp_001_1, 'use_custom_color'): colorramp_001_1.use_custom_color = False if hasattr(colorramp_001_1, 'width'): colorramp_001_1.width = 240.0 input_ = next( (input_ for input_ in colorramp_001_1.inputs if input_.identifier == 'Fac'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Fac' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in colorramp_001_1.outputs if output.identifier == 'Color'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Color' if hasattr(output, 'show_expanded'): output.show_expanded = False output = next( (output for output in colorramp_001_1.outputs if output.identifier == 'Alpha'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Alpha' if hasattr(output, 'show_expanded'): output.show_expanded = False colorramp_002_1 = node_tree1.nodes.new('ShaderNodeValToRGB') if hasattr(colorramp_002_1, 'color'): colorramp_002_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(colorramp_002_1, 'color_ramp'): if hasattr(colorramp_002_1.color_ramp, 'color_mode'): colorramp_002_1.color_ramp.color_mode = 'RGB' if hasattr(colorramp_002_1.color_ramp, 'elements'): if 0 >= len(colorramp_002_1.color_ramp.elements): colorramp_002_1.color_ramp.elements.new(0.0) if hasattr(colorramp_002_1.color_ramp.elements[0], 'alpha'): colorramp_002_1.color_ramp.elements[0].alpha = 1.0 if hasattr(colorramp_002_1.color_ramp.elements[0], 'color'): colorramp_002_1.color_ramp.elements[0].color = ( 1.0, 1.0, 1.0, 1.0) if hasattr(colorramp_002_1.color_ramp.elements[0], 'position'): colorramp_002_1.color_ramp.elements[0].position = 0.0 if 1 >= len(colorramp_002_1.color_ramp.elements): colorramp_002_1.color_ramp.elements.new(1.0) if hasattr(colorramp_002_1.color_ramp.elements[1], 'alpha'): colorramp_002_1.color_ramp.elements[1].alpha = 1.0 if hasattr(colorramp_002_1.color_ramp.elements[1], 'color'): colorramp_002_1.color_ramp.elements[1].color = ( 0.0, 0.0, 0.0, 1.0) if hasattr(colorramp_002_1.color_ramp.elements[1], 'position'): colorramp_002_1.color_ramp.elements[1].position = 1.0 if hasattr(colorramp_002_1.color_ramp, 'hue_interpolation'): colorramp_002_1.color_ramp.hue_interpolation = 'NEAR' if hasattr(colorramp_002_1.color_ramp, 'interpolation'): colorramp_002_1.color_ramp.interpolation = 'EASE' if hasattr(colorramp_002_1, 'hide'): colorramp_002_1.hide = False if hasattr(colorramp_002_1, 'location'): colorramp_002_1.location = (-794.784423828125, -639.2159423828125) if hasattr(colorramp_002_1, 'mute'): colorramp_002_1.mute = False if hasattr(colorramp_002_1, 'name'): colorramp_002_1.name = 'ColorRamp.002' if hasattr(colorramp_002_1, 'use_custom_color'): colorramp_002_1.use_custom_color = False if hasattr(colorramp_002_1, 'width'): colorramp_002_1.width = 240.0 input_ = next( (input_ for input_ in colorramp_002_1.inputs if input_.identifier == 'Fac'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Fac' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in colorramp_002_1.outputs if output.identifier == 'Color'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Color' if hasattr(output, 'show_expanded'): output.show_expanded = False output = next( (output for output in colorramp_002_1.outputs if output.identifier == 'Alpha'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Alpha' if hasattr(output, 'show_expanded'): output.show_expanded = False math_006_1 = node_tree1.nodes.new('ShaderNodeMath') if hasattr(math_006_1, 'color'): math_006_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(math_006_1, 'hide'): math_006_1.hide = False if hasattr(math_006_1, 'location'): math_006_1.location = (-397.509033203125, -615.8211669921875) if hasattr(math_006_1, 'mute'): math_006_1.mute = False if hasattr(math_006_1, 'name'): math_006_1.name = 'Math.006' if hasattr(math_006_1, 'operation'): math_006_1.operation = 'MULTIPLY' if hasattr(math_006_1, 'use_clamp'): math_006_1.use_clamp = False if hasattr(math_006_1, 'use_custom_color'): math_006_1.use_custom_color = False if hasattr(math_006_1, 'width'): math_006_1.width = 140.0 input_ = next( (input_ for input_ in math_006_1.inputs if input_.identifier == 'Value'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_006_1.inputs if input_.identifier == 'Value_001'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = randint(0, 9) + 1 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_006_1.inputs if input_.identifier == 'Value_002'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in math_006_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False math_004_1 = node_tree1.nodes.new('ShaderNodeMath') if hasattr(math_004_1, 'color'): math_004_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(math_004_1, 'hide'): math_004_1.hide = False if hasattr(math_004_1, 'location'): math_004_1.location = (-386.968994140625, -326.9117431640625) if hasattr(math_004_1, 'mute'): math_004_1.mute = False if hasattr(math_004_1, 'name'): math_004_1.name = 'Math.004' if hasattr(math_004_1, 'operation'): math_004_1.operation = 'MULTIPLY' if hasattr(math_004_1, 'use_clamp'): math_004_1.use_clamp = False if hasattr(math_004_1, 'use_custom_color'): math_004_1.use_custom_color = False if hasattr(math_004_1, 'width'): math_004_1.width = 140.0 input_ = next( (input_ for input_ in math_004_1.inputs if input_.identifier == 'Value'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_004_1.inputs if input_.identifier == 'Value_001'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 10.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_004_1.inputs if input_.identifier == 'Value_002'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in math_004_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False wave_texture_1 = node_tree1.nodes.new('ShaderNodeTexWave') if hasattr(wave_texture_1, 'bands_direction'): wave_texture_1.bands_direction = 'X' if hasattr(wave_texture_1, 'color'): wave_texture_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(wave_texture_1, 'hide'): wave_texture_1.hide = False if hasattr(wave_texture_1, 'location'): wave_texture_1.location = (-1065.7056884765625, -631.5020141601562) if hasattr(wave_texture_1, 'mute'): wave_texture_1.mute = False if hasattr(wave_texture_1, 'name'): wave_texture_1.name = 'Wave Texture' if hasattr(wave_texture_1, 'rings_direction'): wave_texture_1.rings_direction = 'X' if hasattr(wave_texture_1, 'use_custom_color'): wave_texture_1.use_custom_color = False if hasattr(wave_texture_1, 'wave_profile'): wave_texture_1.wave_profile = 'TRI' if hasattr(wave_texture_1, 'wave_type'): wave_texture_1.wave_type = 'BANDS' if hasattr(wave_texture_1, 'width'): wave_texture_1.width = 150.0 input_ = next( (input_ for input_ in wave_texture_1.inputs if input_.identifier == 'Vector'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = True if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in wave_texture_1.inputs if input_.identifier == 'Scale'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.00800000037997961 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Scale' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in wave_texture_1.inputs if input_.identifier == 'Distortion'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 14.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Distortion' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in wave_texture_1.inputs if input_.identifier == 'Detail'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 10.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Detail' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in wave_texture_1.inputs if input_.identifier == 'Detail Scale'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 1.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Detail Scale' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in wave_texture_1.inputs if input_.identifier == 'Detail Roughness'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Detail Roughness' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in wave_texture_1.inputs if input_.identifier == 'Phase Offset'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 10.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Phase Offset' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in wave_texture_1.outputs if output.identifier == 'Color'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Color' if hasattr(output, 'show_expanded'): output.show_expanded = False output = next( (output for output in wave_texture_1.outputs if output.identifier == 'Fac'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Fac' if hasattr(output, 'show_expanded'): output.show_expanded = False math_005_1 = node_tree1.nodes.new('ShaderNodeMath') if hasattr(math_005_1, 'color'): math_005_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(math_005_1, 'hide'): math_005_1.hide = False if hasattr(math_005_1, 'location'): math_005_1.location = (-195.2022705078125, -56.4422607421875) if hasattr(math_005_1, 'mute'): math_005_1.mute = False if hasattr(math_005_1, 'name'): math_005_1.name = 'Math.005' if hasattr(math_005_1, 'operation'): math_005_1.operation = 'MULTIPLY' if hasattr(math_005_1, 'use_clamp'): math_005_1.use_clamp = False if hasattr(math_005_1, 'use_custom_color'): math_005_1.use_custom_color = False if hasattr(math_005_1, 'width'): math_005_1.width = 140.0 input_ = next( (input_ for input_ in math_005_1.inputs if input_.identifier == 'Value'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_005_1.inputs if input_.identifier == 'Value_001'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_005_1.inputs if input_.identifier == 'Value_002'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in math_005_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False math_007_1 = node_tree1.nodes.new('ShaderNodeMath') if hasattr(math_007_1, 'color'): math_007_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(math_007_1, 'hide'): math_007_1.hide = False if hasattr(math_007_1, 'location'): math_007_1.location = (12.68963623046875, -68.28890991210938) if hasattr(math_007_1, 'mute'): math_007_1.mute = False if hasattr(math_007_1, 'name'): math_007_1.name = 'Math.007' if hasattr(math_007_1, 'operation'): math_007_1.operation = 'MULTIPLY' if hasattr(math_007_1, 'use_clamp'): math_007_1.use_clamp = False if hasattr(math_007_1, 'use_custom_color'): math_007_1.use_custom_color = False if hasattr(math_007_1, 'width'): math_007_1.width = 140.0 input_ = next( (input_ for input_ in math_007_1.inputs if input_.identifier == 'Value'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_007_1.inputs if input_.identifier == 'Value_001'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_007_1.inputs if input_.identifier == 'Value_002'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in math_007_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False math_008_1 = node_tree1.nodes.new('ShaderNodeMath') if hasattr(math_008_1, 'color'): math_008_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(math_008_1, 'hide'): math_008_1.hide = False if hasattr(math_008_1, 'location'): math_008_1.location = (236.2149658203125, -64.6226806640625) if hasattr(math_008_1, 'mute'): math_008_1.mute = False if hasattr(math_008_1, 'name'): math_008_1.name = 'Math.008' if hasattr(math_008_1, 'operation'): math_008_1.operation = 'DIVIDE' if hasattr(math_008_1, 'use_clamp'): math_008_1.use_clamp = False if hasattr(math_008_1, 'use_custom_color'): math_008_1.use_custom_color = False if hasattr(math_008_1, 'width'): math_008_1.width = 140.0 input_ = next( (input_ for input_ in math_008_1.inputs if input_.identifier == 'Value'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_008_1.inputs if input_.identifier == 'Value_001'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 5.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_008_1.inputs if input_.identifier == 'Value_002'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in math_008_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False combine_xyz_1 = node_tree1.nodes.new('ShaderNodeCombineXYZ') if hasattr(combine_xyz_1, 'color'): combine_xyz_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(combine_xyz_1, 'hide'): combine_xyz_1.hide = False if hasattr(combine_xyz_1, 'location'): combine_xyz_1.location = (466.69677734375, 18.8077392578125) if hasattr(combine_xyz_1, 'mute'): combine_xyz_1.mute = False if hasattr(combine_xyz_1, 'name'): combine_xyz_1.name = 'Combine XYZ' if hasattr(combine_xyz_1, 'use_custom_color'): combine_xyz_1.use_custom_color = False if hasattr(combine_xyz_1, 'width'): combine_xyz_1.width = 140.0 input_ = next( (input_ for input_ in combine_xyz_1.inputs if input_.identifier == 'X'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'X' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in combine_xyz_1.inputs if input_.identifier == 'Y'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Y' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in combine_xyz_1.inputs if input_.identifier == 'Z'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Z' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in combine_xyz_1.outputs if output.identifier == 'Vector'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Vector' if hasattr(output, 'show_expanded'): output.show_expanded = False set_position_1 = node_tree1.nodes.new('GeometryNodeSetPosition') if hasattr(set_position_1, 'color'): set_position_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(set_position_1, 'hide'): set_position_1.hide = False if hasattr(set_position_1, 'location'): set_position_1.location = (732.45654296875, 177.203369140625) if hasattr(set_position_1, 'mute'): set_position_1.mute = False if hasattr(set_position_1, 'name'): set_position_1.name = 'Set Position' if hasattr(set_position_1, 'use_custom_color'): set_position_1.use_custom_color = False if hasattr(set_position_1, 'width'): set_position_1.width = 138.1842041015625 input_ = next( (input_ for input_ in set_position_1.inputs if input_.identifier == 'Selection'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = True if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = True if hasattr(input_, 'name'): input_.name = 'Selection' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in set_position_1.inputs if input_.identifier == 'Position'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = True if hasattr(input_, 'name'): input_.name = 'Position' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in set_position_1.inputs if input_.identifier == 'Offset'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Offset' if hasattr(input_, 'show_expanded'): input_.show_expanded = False position_002_1 = node_tree1.nodes.new('GeometryNodeInputPosition') if hasattr(position_002_1, 'color'): position_002_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(position_002_1, 'hide'): position_002_1.hide = False if hasattr(position_002_1, 'location'): position_002_1.location = (-1444.07763671875, -385.03790283203125) if hasattr(position_002_1, 'mute'): position_002_1.mute = False if hasattr(position_002_1, 'name'): position_002_1.name = 'Position.002' if hasattr(position_002_1, 'use_custom_color'): position_002_1.use_custom_color = False if hasattr(position_002_1, 'width'): position_002_1.width = 100.0 output = next( (output for output in position_002_1.outputs if output.identifier == 'Position'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Position' if hasattr(output, 'show_expanded'): output.show_expanded = False gradient_texture_1 = node_tree1.nodes.new('ShaderNodeTexGradient') if hasattr(gradient_texture_1, 'color'): gradient_texture_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(gradient_texture_1, 'gradient_type'): gradient_texture_1.gradient_type = 'SPHERICAL' if hasattr(gradient_texture_1, 'hide'): gradient_texture_1.hide = False if hasattr(gradient_texture_1, 'location'): gradient_texture_1.location = (-1032.1865234375, -399.82275390625) if hasattr(gradient_texture_1, 'mute'): gradient_texture_1.mute = False if hasattr(gradient_texture_1, 'name'): gradient_texture_1.name = 'Gradient Texture' if hasattr(gradient_texture_1, 'use_custom_color'): gradient_texture_1.use_custom_color = False if hasattr(gradient_texture_1, 'width'): gradient_texture_1.width = 140.0 input_ = next( (input_ for input_ in gradient_texture_1.inputs if input_.identifier == 'Vector'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = True if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in gradient_texture_1.outputs if output.identifier == 'Color'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Color' if hasattr(output, 'show_expanded'): output.show_expanded = False output = next( (output for output in gradient_texture_1.outputs if output.identifier == 'Fac'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Fac' if hasattr(output, 'show_expanded'): output.show_expanded = False position_001_1 = node_tree1.nodes.new('GeometryNodeInputPosition') if hasattr(position_001_1, 'color'): position_001_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(position_001_1, 'hide'): position_001_1.hide = False if hasattr(position_001_1, 'location'): position_001_1.location = (-1674.4951171875, -450.0364685058594) if hasattr(position_001_1, 'mute'): position_001_1.mute = False if hasattr(position_001_1, 'name'): position_001_1.name = 'Position.001' if hasattr(position_001_1, 'use_custom_color'): position_001_1.use_custom_color = False if hasattr(position_001_1, 'width'): position_001_1.width = 140.0 output = next( (output for output in position_001_1.outputs if output.identifier == 'Position'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Position' if hasattr(output, 'show_expanded'): output.show_expanded = False vector_math_1 = node_tree1.nodes.new('ShaderNodeVectorMath') if hasattr(vector_math_1, 'color'): vector_math_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(vector_math_1, 'hide'): vector_math_1.hide = False if hasattr(vector_math_1, 'location'): vector_math_1.location = (-1458.2401123046875, -68.27154541015625) if hasattr(vector_math_1, 'mute'): vector_math_1.mute = False if hasattr(vector_math_1, 'name'): vector_math_1.name = 'Vector Math' if hasattr(vector_math_1, 'operation'): vector_math_1.operation = 'ADD' if hasattr(vector_math_1, 'use_custom_color'): vector_math_1.use_custom_color = False if hasattr(vector_math_1, 'width'): vector_math_1.width = 140.0 input_ = next( (input_ for input_ in vector_math_1.inputs if input_.identifier == 'Vector'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in vector_math_1.inputs if input_.identifier == 'Vector_001'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in vector_math_1.inputs if input_.identifier == 'Vector_002'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in vector_math_1.inputs if input_.identifier == 'Scale'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 1.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Scale' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in vector_math_1.outputs if output.identifier == 'Vector'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Vector' if hasattr(output, 'show_expanded'): output.show_expanded = False output = next( (output for output in vector_math_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = False if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False combine_xyz_001_1 = node_tree1.nodes.new('ShaderNodeCombineXYZ') if hasattr(combine_xyz_001_1, 'color'): combine_xyz_001_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(combine_xyz_001_1, 'hide'): combine_xyz_001_1.hide = False if hasattr(combine_xyz_001_1, 'location'): combine_xyz_001_1.location = (-1675.7265625, -680.0128173828125) if hasattr(combine_xyz_001_1, 'mute'): combine_xyz_001_1.mute = False if hasattr(combine_xyz_001_1, 'name'): combine_xyz_001_1.name = 'Combine XYZ.001' if hasattr(combine_xyz_001_1, 'use_custom_color'): combine_xyz_001_1.use_custom_color = False if hasattr(combine_xyz_001_1, 'width'): combine_xyz_001_1.width = 140.0 input_ = next( (input_ for input_ in combine_xyz_001_1.inputs if input_.identifier == 'X'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'X' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in combine_xyz_001_1.inputs if input_.identifier == 'Y'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Y' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in combine_xyz_001_1.inputs if input_.identifier == 'Z'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Z' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in combine_xyz_001_1.outputs if output.identifier == 'Vector'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND_DOT' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Vector' if hasattr(output, 'show_expanded'): output.show_expanded = False vector_math_002_1 = node_tree1.nodes.new('ShaderNodeVectorMath') if hasattr(vector_math_002_1, 'color'): vector_math_002_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(vector_math_002_1, 'hide'): vector_math_002_1.hide = False if hasattr(vector_math_002_1, 'location'): vector_math_002_1.location = (-1418.8975830078125, -645.041015625) if hasattr(vector_math_002_1, 'mute'): vector_math_002_1.mute = False if hasattr(vector_math_002_1, 'name'): vector_math_002_1.name = 'Vector Math.002' if hasattr(vector_math_002_1, 'operation'): vector_math_002_1.operation = 'ADD' if hasattr(vector_math_002_1, 'use_custom_color'): vector_math_002_1.use_custom_color = False if hasattr(vector_math_002_1, 'width'): vector_math_002_1.width = 140.0 input_ = next( (input_ for input_ in vector_math_002_1.inputs if input_.identifier == 'Vector'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in vector_math_002_1.inputs if input_.identifier == 'Vector_001'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in vector_math_002_1.inputs if input_.identifier == 'Vector_002'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in vector_math_002_1.inputs if input_.identifier == 'Scale'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 1.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Scale' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in vector_math_002_1.outputs if output.identifier == 'Vector'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Vector' if hasattr(output, 'show_expanded'): output.show_expanded = False output = next( (output for output in vector_math_002_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = False if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False value_1 = node_tree1.nodes.new('ShaderNodeValue') if hasattr(value_1, 'color'): value_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(value_1, 'hide'): value_1.hide = False if hasattr(value_1, 'location'): value_1.location = (-1039.0345458984375, 128.6600341796875) if hasattr(value_1, 'mute'): value_1.mute = False if hasattr(value_1, 'name'): value_1.name = 'Value' if hasattr(value_1, 'use_custom_color'): value_1.use_custom_color = False if hasattr(value_1, 'width'): value_1.width = 140.0 output = next( (output for output in value_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 30.12345 if hasattr(output, 'display_shape'): output.display_shape = 'CIRCLE' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False math_003_1 = node_tree1.nodes.new('ShaderNodeMath') if hasattr(math_003_1, 'color'): math_003_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(math_003_1, 'hide'): math_003_1.hide = False if hasattr(math_003_1, 'location'): math_003_1.location = (-2056.113525390625, -80.286865234375) if hasattr(math_003_1, 'mute'): math_003_1.mute = False if hasattr(math_003_1, 'name'): math_003_1.name = 'Math.003' if hasattr(math_003_1, 'operation'): math_003_1.operation = 'MULTIPLY_ADD' if hasattr(math_003_1, 'use_clamp'): math_003_1.use_clamp = False if hasattr(math_003_1, 'use_custom_color'): math_003_1.use_custom_color = False if hasattr(math_003_1, 'width'): math_003_1.width = 140.0 input_ = next( (input_ for input_ in math_003_1.inputs if input_.identifier == 'Value'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.5 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_003_1.inputs if input_.identifier == 'Value_001'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 100000.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in math_003_1.inputs if input_.identifier == 'Value_002'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 10000.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Value' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in math_003_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND_DOT' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False group_input_1 = node_tree1.nodes.new('NodeGroupInput') if hasattr(group_input_1, 'color'): group_input_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(group_input_1, 'hide'): group_input_1.hide = False if hasattr(group_input_1, 'location'): group_input_1.location = (-2557.44189453125, 79.42236328125) if hasattr(group_input_1, 'mute'): group_input_1.mute = False if hasattr(group_input_1, 'name'): group_input_1.name = 'Group Input' if hasattr(group_input_1, 'use_custom_color'): group_input_1.use_custom_color = False if hasattr(group_input_1, 'width'): group_input_1.width = 140.0 value_001_1 = node_tree1.nodes.new('ShaderNodeValue') if hasattr(value_001_1, 'color'): value_001_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(value_001_1, 'hide'): value_001_1.hide = False if hasattr(value_001_1, 'location'): value_001_1.location = (-2328.45849609375, -130.68389892578125) if hasattr(value_001_1, 'mute'): value_001_1.mute = False if hasattr(value_001_1, 'name'): value_001_1.name = 'Value.001' if hasattr(value_001_1, 'use_custom_color'): value_001_1.use_custom_color = False if hasattr(value_001_1, 'width'): value_001_1.width = 140.0 output = next( (output for output in value_001_1.outputs if output.identifier == 'Value'), None) if output: if hasattr(output, 'default_value'): output.default_value = uniform(0, 10.12345) if hasattr(output, 'display_shape'): output.display_shape = 'CIRCLE' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Value' if hasattr(output, 'show_expanded'): output.show_expanded = False noise_texture_1 = node_tree1.nodes.new('ShaderNodeTexNoise') if hasattr(noise_texture_1, 'color'): noise_texture_1.color = ( 0.6079999804496765, 0.6079999804496765, 0.6079999804496765) if hasattr(noise_texture_1, 'hide'): noise_texture_1.hide = False if hasattr(noise_texture_1, 'location'): noise_texture_1.location = (-1280.82421875, -97.9427490234375) if hasattr(noise_texture_1, 'mute'): noise_texture_1.mute = False if hasattr(noise_texture_1, 'name'): noise_texture_1.name = 'Noise Texture' if hasattr(noise_texture_1, 'noise_dimensions'): noise_texture_1.noise_dimensions = '3D' if hasattr(noise_texture_1, 'use_custom_color'): noise_texture_1.use_custom_color = False if hasattr(noise_texture_1, 'width'): noise_texture_1.width = 140.0 input_ = next( (input_ for input_ in noise_texture_1.inputs if input_.identifier == 'Vector'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = (0.0, 0.0, 0.0) if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = True if hasattr(input_, 'name'): input_.name = 'Vector' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in noise_texture_1.inputs if input_.identifier == 'W'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = False if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'W' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in noise_texture_1.inputs if input_.identifier == 'Scale'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.03999999910593033 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Scale' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in noise_texture_1.inputs if input_.identifier == 'Detail'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 10.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Detail' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in noise_texture_1.inputs if input_.identifier == 'Roughness'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.4000000059604645 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Roughness' if hasattr(input_, 'show_expanded'): input_.show_expanded = False input_ = next( (input_ for input_ in noise_texture_1.inputs if input_.identifier == 'Distortion'), None) if input_: if hasattr(input_, 'default_value'): input_.default_value = 0.0 if hasattr(input_, 'display_shape'): input_.display_shape = 'DIAMOND_DOT' if hasattr(input_, 'enabled'): input_.enabled = True if hasattr(input_, 'hide'): input_.hide = False if hasattr(input_, 'hide_value'): input_.hide_value = False if hasattr(input_, 'name'): input_.name = 'Distortion' if hasattr(input_, 'show_expanded'): input_.show_expanded = False output = next( (output for output in noise_texture_1.outputs if output.identifier == 'Fac'), None) if output: if hasattr(output, 'default_value'): output.default_value = 0.0 if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Fac' if hasattr(output, 'show_expanded'): output.show_expanded = False output = next( (output for output in noise_texture_1.outputs if output.identifier == 'Color'), None) if output: if hasattr(output, 'default_value'): output.default_value = (0.0, 0.0, 0.0, 0.0) if hasattr(output, 'display_shape'): output.display_shape = 'DIAMOND' if hasattr(output, 'enabled'): output.enabled = True if hasattr(output, 'hide'): output.hide = False if hasattr(output, 'hide_value'): output.hide_value = False if hasattr(output, 'name'): output.name = 'Color' if hasattr(output, 'show_expanded'): output.show_expanded = False # LINKS node_tree1.links.new(subdivide_mesh_1.outputs[0], set_position_1.inputs[0]) node_tree1.links.new(noise_texture_1.outputs[0], colorramp_1.inputs[0]) node_tree1.links.new(position_1.outputs[0], set_position_1.inputs[2]) node_tree1.links.new(position_001_1.outputs[0], vector_math_1.inputs[0]) node_tree1.links.new(vector_math_1.outputs[0], noise_texture_1.inputs[0]) node_tree1.links.new(combine_xyz_001_1.outputs[0], vector_math_1.inputs[1]) node_tree1.links.new(math_1.outputs[0], combine_xyz_001_1.inputs[0]) node_tree1.links.new(math_002_1.outputs[0], combine_xyz_001_1.inputs[1]) node_tree1.links.new(math_003_1.outputs[0], combine_xyz_001_1.inputs[2]) node_tree1.links.new(math_003_1.outputs[0], math_1.inputs[0]) node_tree1.links.new(math_003_1.outputs[0], math_002_1.inputs[0]) node_tree1.links.new( position_002_1.outputs[0], vector_math_001_1.inputs[0]) node_tree1.links.new( vector_math_001_1.outputs[0], gradient_texture_1.inputs[0]) node_tree1.links.new( gradient_texture_1.outputs[0], colorramp_001_1.inputs[0]) node_tree1.links.new(colorramp_001_1.outputs[0], math_004_1.inputs[0]) node_tree1.links.new(math_004_1.outputs[0], math_005_1.inputs[1]) node_tree1.links.new(combine_xyz_1.outputs[0], set_position_1.inputs[3]) node_tree1.links.new(math_005_1.outputs[0], math_007_1.inputs[0]) node_tree1.links.new(colorramp_002_1.outputs[0], math_006_1.inputs[0]) node_tree1.links.new(colorramp_1.outputs[0], math_005_1.inputs[0]) node_tree1.links.new(math_006_1.outputs[0], math_007_1.inputs[1]) node_tree1.links.new(wave_texture_1.outputs[0], colorramp_002_1.inputs[0]) node_tree1.links.new(math_007_1.outputs[0], math_008_1.inputs[0]) node_tree1.links.new(math_008_1.outputs[0], combine_xyz_1.inputs[2]) node_tree1.links.new( position_001_1.outputs[0], vector_math_002_1.inputs[0]) node_tree1.links.new( vector_math_002_1.outputs[0], wave_texture_1.inputs[0]) node_tree1.links.new( combine_xyz_001_1.outputs[0], vector_math_002_1.inputs[1]) node_tree1.links.new(value_1.outputs[0], subdivide_mesh_1.inputs[1]) node_tree1.links.new(group_input_1.outputs[0], subdivide_mesh_1.inputs[0]) node_tree1.links.new(set_position_1.outputs[0], group_output_1.inputs[0]) node_tree1.links.new(value_001_1.outputs[0], math_003_1.inputs[0]) if __name__ == "__main__": start_checkpoint = time() run_ops_without_view_layer_update(main) if RENDER: print("Rendering...") checkpoint = time() working_dir = getcwd() bpy.context.scene.render.filepath = (working_dir + "/output/output_" + argv[7]) bpy.context.scene.cycles.samples = int(256 * RENDER_SAMPLE_FACTOR) bpy.context.scene.render.resolution_x = 3840 * RENDER_SIZE_FACTOR bpy.context.scene.render.resolution_y = 1644 * RENDER_SIZE_FACTOR bpy.context.scene.cycles.device = 'GPU' bpy.ops.render.render('INVOKE_DEFAULT', write_still=True) print("--- %s seconds ---\n" % (time() - checkpoint)) print("Total Time: %s seconds \n" % (time() - start_checkpoint))
39.103622
100
0.598644
15,033
124,154
4.656423
0.044968
0.119957
0.0888
0.037457
0.839286
0.798629
0.737271
0.708571
0.674743
0.642686
0
0.064077
0.290422
124,154
3,174
101
39.115942
0.730502
0.027812
0
0.638364
0
0
0.102274
0.002571
0
0
0
0
0
1
0.006531
false
0.002406
0.003094
0
0.013063
0.007907
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
ffbc090d2a8e8a9ba48ccacd3122b93d577ee955
122
py
Python
sistemas/admin.py
luisfarfan/django_intranetapp
bb7e0c08706d8fdf9b1eae437baa1f5850dbd0bd
[ "Apache-2.0" ]
null
null
null
sistemas/admin.py
luisfarfan/django_intranetapp
bb7e0c08706d8fdf9b1eae437baa1f5850dbd0bd
[ "Apache-2.0" ]
null
null
null
sistemas/admin.py
luisfarfan/django_intranetapp
bb7e0c08706d8fdf9b1eae437baa1f5850dbd0bd
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin from .models import Sistema # Register your models here. #admin.site.register(Sistema)
17.428571
32
0.795082
17
122
5.705882
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.131148
122
6
33
20.333333
0.915094
0.442623
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
ffc592bb5786f5c5f46ff5eaac75c00a2772bb7a
18,121
py
Python
context_free/tests/test_grammar.py
alekfrohlich/cfg
44c671a4eb0699f7ff86070b2c29bab76d1c981e
[ "MIT" ]
1
2021-03-23T13:30:29.000Z
2021-03-23T13:30:29.000Z
context_free/tests/test_grammar.py
alekfrohlich/cfg
44c671a4eb0699f7ff86070b2c29bab76d1c981e
[ "MIT" ]
null
null
null
context_free/tests/test_grammar.py
alekfrohlich/cfg
44c671a4eb0699f7ff86070b2c29bab76d1c981e
[ "MIT" ]
null
null
null
"""ContextFreeGrammar unit tests.""" import os import filecmp import unittest from context_free.grammar import CFGS_DIR, ContextFreeGrammar, OrderedSet from context_free.parser import PredictiveParser class TestContextFreeGrammar(unittest.TestCase): def test_constructor(self): cfg = ContextFreeGrammar("test_constructorA.cfg") # Test well tokenized self.assertEqual(cfg.rules["S"] , OrderedSet([("B", "d"), ("&",)])) self.assertEqual(cfg.rules["B"] , OrderedSet([("A", "b", "❬B'❭")])) self.assertEqual(cfg.rules["❬B'❭"], OrderedSet([("c", "❬B'❭"), ("&",)])) self.assertEqual(cfg.rules["A"] , OrderedSet([("a", "❬A'❭"), ("❬A'❭",)])) self.assertEqual(cfg.rules["❬A'❭"], OrderedSet([("b", "❬B'❭", "d", "a", "❬A'❭"), ("&",)])) cfg.save_to_file("test_constructorT.cfg") test_path = os.path.join(CFGS_DIR, "test_constructorT.cfg") ref_path = os.path.join(CFGS_DIR, "test_constructorA.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) cfg2 = ContextFreeGrammar("test_constructorA.cfg") self.assertEqual(cfg2.rules["S"] , OrderedSet([("B", "d"), ("&",)])) self.assertEqual(cfg2.rules["B"] , OrderedSet([("A", "b", "❬B'❭")])) self.assertEqual(cfg2.rules["❬B'❭"], OrderedSet([("c", "❬B'❭"), ("&",)])) self.assertEqual(cfg2.rules["A"] , OrderedSet([("a", "❬A'❭"), ("❬A'❭",)])) self.assertEqual(cfg2.rules["❬A'❭"], OrderedSet([("b", "❬B'❭", "d", "a", "❬A'❭"), ("&",)])) # print(cfg) # print(cfg2) def test_escape_chars(self): """ Notes ----- read().split('\n')[i].split() produces \\n and \\t, which are considered two distinct symbols. """ cfg = ContextFreeGrammar("test_escape_chars.cfg") self.assertNotEqual(cfg.rules["S"], OrderedSet([("\n",), ("\t",)])) # print(cfg) def test_spec(self): with self.assertRaises(RuntimeError): ContextFreeGrammar("test_spec_1.cfg") def test_rlr(self): cfg = ContextFreeGrammar("test_rlr_1.cfg") cfg.remove_left_recursion() cfg.save_to_file("test_rlr_1T.cfg") test_path = os.path.join(CFGS_DIR, "test_rlr_1T.cfg") ref_path = os.path.join(CFGS_DIR, "test_rlr_1A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_rlr_1A.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_rlr_2.cfg") cfg.remove_left_recursion() cfg.save_to_file("test_rlr_2T.cfg") test_path = os.path.join(CFGS_DIR, "test_rlr_2T.cfg") ref_path = os.path.join(CFGS_DIR, "test_rlr_2A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_rlr_2A.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_rlr_exs_3a.cfg") cfg.remove_left_recursion() cfg.save_to_file("test_rlr_exs_3aT.cfg") test_path = os.path.join(CFGS_DIR, "test_rlr_exs_3aT.cfg") ref_path = os.path.join(CFGS_DIR, "test_rlr_exs_3aA.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_rlr_exs_3aA.cfg") # TEST .CFG CONFORMATION def test_ru(self): cfg = ContextFreeGrammar("test_ru_1.cfg") cfg.remove_unit() cfg.save_to_file("test_ru_1T.cfg") test_path = os.path.join(CFGS_DIR, "test_ru_1T.cfg") ref_path = os.path.join(CFGS_DIR, "test_ru_1A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_ru_1A.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_ru_2.cfg") cfg.remove_unit() cfg.save_to_file("test_ru_2T.cfg") test_path = os.path.join(CFGS_DIR, "test_ru_2T.cfg") ref_path = os.path.join(CFGS_DIR, "test_ru_2A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_ru_2A.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_ru_3.cfg") cfg.remove_unit() cfg.save_to_file("test_ru_3T.cfg") test_path = os.path.join(CFGS_DIR, "test_ru_3T.cfg") ref_path = os.path.join(CFGS_DIR, "test_ru_3A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_ru_3A.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_ru_4.cfg") cfg.remove_unit() cfg.save_to_file("test_ru_4T.cfg") test_path = os.path.join(CFGS_DIR, "test_ru_4T.cfg") ref_path = os.path.join(CFGS_DIR, "test_ru_4A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_ru_4A.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_ru_5.cfg") cfg.remove_unit() cfg.save_to_file("test_ru_5T.cfg") test_path = os.path.join(CFGS_DIR, "test_ru_5T.cfg") ref_path = os.path.join(CFGS_DIR, "test_ru_5A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_ru_5A.cfg") # TEST .CFG CONFORMATION def test_re(self): cfg = ContextFreeGrammar("test_re_1.cfg") cfg.remove_epsilon() cfg.save_to_file("test_re_1T.cfg") test_path = os.path.join(CFGS_DIR, "test_re_1T.cfg") ref_path = os.path.join(CFGS_DIR, "test_re_1A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) cfg = ContextFreeGrammar("test_re_2.cfg") cfg.remove_epsilon() cfg.save_to_file("test_re_2T.cfg") test_path = os.path.join(CFGS_DIR, "test_re_2T.cfg") ref_path = os.path.join(CFGS_DIR, "test_re_2A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) cfg = ContextFreeGrammar("test_re_3.cfg") cfg.remove_epsilon() cfg.save_to_file("test_re_3T.cfg") test_path = os.path.join(CFGS_DIR, "test_re_3T.cfg") ref_path = os.path.join(CFGS_DIR, "test_re_3A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) def test_rup(self): cfg = ContextFreeGrammar("test_rup_1.cfg") cfg.remove_unproductives() cfg.save_to_file("test_rup_1T.cfg") test_path = os.path.join(CFGS_DIR, "test_rup_1T.cfg") ref_path = os.path.join(CFGS_DIR, "test_rup_1A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) cfg = ContextFreeGrammar("test_rup_2.cfg") cfg.remove_unproductives() cfg.save_to_file("test_rup_2T.cfg") test_path = os.path.join(CFGS_DIR, "test_rup_2T.cfg") ref_path = os.path.join(CFGS_DIR, "test_rup_2A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) def test_rur(self): cfg = ContextFreeGrammar("test_rur_1.cfg") cfg.remove_unreachables() cfg.save_to_file("test_rur_1T.cfg") test_path = os.path.join(CFGS_DIR, "test_rur_1T.cfg") ref_path = os.path.join(CFGS_DIR, "test_rur_1A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) def test_rt(self): cfg = ContextFreeGrammar("test_rt_1.cfg") cfg.replace_terminals() cfg.save_to_file("test_rt_1T.cfg") test_path = os.path.join(CFGS_DIR, "test_rt_1T.cfg") ref_path = os.path.join(CFGS_DIR, "test_rt_1A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) def test_rs(self): cfg = ContextFreeGrammar("test_rs_1.cfg") cfg.reduce_size() cfg.save_to_file("test_rs_1T.cfg") test_path = os.path.join(CFGS_DIR, "test_rs_1T.cfg") ref_path = os.path.join(CFGS_DIR, "test_rs_1A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) cfg = ContextFreeGrammar("test_rs_2.cfg") cfg.reduce_size() cfg.save_to_file("test_rs_2T.cfg") test_path = os.path.join(CFGS_DIR, "test_rs_2T.cfg") ref_path = os.path.join(CFGS_DIR, "test_rs_2A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) def test_fnc(self): cfg = ContextFreeGrammar("test_fnc_1.cfg") cfg.convert_to_cnf() cfg.save_to_file("test_fnc_1T.cfg") test_path = os.path.join(CFGS_DIR, "test_fnc_1T.cfg") ref_path = os.path.join(CFGS_DIR, "test_fnc_1A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_fnc_1.cfg") # TEST .CFG CONFORMATION def test_hlr(self): cfg = ContextFreeGrammar("test_rlr_1.cfg") self.assertTrue(cfg.has_left_recursion()) cfg = ContextFreeGrammar("test_rlr_2.cfg") self.assertTrue(cfg.has_left_recursion()) cfg = ContextFreeGrammar("test_rlr_exs_3a.cfg") self.assertTrue(cfg.has_left_recursion()) cfg = ContextFreeGrammar("test_rlr_1A.cfg") self.assertFalse(cfg.has_left_recursion()) cfg = ContextFreeGrammar("test_rlr_2A.cfg") self.assertFalse(cfg.has_left_recursion()) cfg = ContextFreeGrammar("test_rlr_exs_3aA.cfg") self.assertFalse(cfg.has_left_recursion()) cfg = ContextFreeGrammar("test_ll1_1.cfg") self.assertFalse(cfg.has_left_recursion()) cfg = ContextFreeGrammar("test_ll1_2.cfg") self.assertFalse(cfg.has_left_recursion()) cfg = ContextFreeGrammar("test_ll1_3.cfg") self.assertFalse(cfg.has_left_recursion()) def test_he(self): cfg = ContextFreeGrammar("test_re_1.cfg") self.assertTrue(cfg.has_e()) cfg = ContextFreeGrammar("test_re_2.cfg") self.assertTrue(cfg.has_e()) cfg = ContextFreeGrammar("test_re_3.cfg") self.assertTrue(cfg.has_e()) cfg = ContextFreeGrammar("test_re_1A.cfg") self.assertFalse(cfg.has_e()) cfg = ContextFreeGrammar("test_re_2A.cfg") self.assertFalse(cfg.has_e()) cfg = ContextFreeGrammar("test_re_3A.cfg") self.assertFalse(cfg.has_e()) cfg = ContextFreeGrammar("test_rlr_exs_3aA.cfg") self.assertTrue(cfg.has_e()) cfg = ContextFreeGrammar("test_rlr_exs_3aA.cfg") cfg.remove_epsilon() self.assertFalse(cfg.has_e()) def test_hc(self): cfg = ContextFreeGrammar("test_hc_1.cfg") self.assertTrue(cfg.has_cycle()) cfg = ContextFreeGrammar("test_hc_2.cfg") self.assertTrue(cfg.has_cycle()) cfg = ContextFreeGrammar("test_hc_3.cfg") self.assertTrue(cfg.has_cycle()) cfg = ContextFreeGrammar("test_hc_4.cfg") self.assertTrue(cfg.has_cycle()) cfg = ContextFreeGrammar("test_hc_1.cfg") cfg.remove_unit() self.assertFalse(cfg.has_cycle()) cfg = ContextFreeGrammar("test_hc_2.cfg") cfg.remove_unit() self.assertFalse(cfg.has_cycle()) cfg = ContextFreeGrammar("test_hc_3.cfg") cfg.remove_unit() self.assertFalse(cfg.has_cycle()) cfg = ContextFreeGrammar("test_hc_4.cfg") cfg.remove_unit() self.assertFalse(cfg.has_cycle()) cfg = ContextFreeGrammar("test_fnc_1.cfg") self.assertFalse(cfg.has_cycle()) def test_lf(self): cfg = ContextFreeGrammar("test_lf_1.cfg") cfg.left_factoring() cfg.save_to_file("test_lf_1T.cfg") test_path = os.path.join(CFGS_DIR, "test_lf_1T.cfg") ref_path = os.path.join(CFGS_DIR, "test_lf_1A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_lf_1A.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_lf_2.cfg") cfg.left_factoring() cfg.save_to_file("test_lf_2T.cfg") test_path = os.path.join(CFGS_DIR, "test_lf_2T.cfg") ref_path = os.path.join(CFGS_DIR, "test_lf_2A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_lf_2A.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_lf_3.cfg") cfg.left_factoring() cfg.save_to_file("test_lf_3T.cfg") test_path = os.path.join(CFGS_DIR, "test_lf_3T.cfg") ref_path = os.path.join(CFGS_DIR, "test_lf_3A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_lf_3A.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_lf_4.cfg") self.assertFalse(cfg.left_factoring()) cfg = ContextFreeGrammar("test_lf_5.cfg") self.assertFalse(cfg.left_factoring()) cfg = ContextFreeGrammar("test_lf_6.cfg") cfg.left_factoring() cfg.save_to_file("test_lf_6T.cfg") test_path = os.path.join(CFGS_DIR, "test_lf_6T.cfg") ref_path = os.path.join(CFGS_DIR, "test_lf_6A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_lf_6A.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_lf_exs_4c.cfg") cfg.left_factoring() cfg.save_to_file("test_lf_exs_4cT.cfg") test_path = os.path.join(CFGS_DIR, "test_lf_exs_4cT.cfg") ref_path = os.path.join(CFGS_DIR, "test_lf_exs_4cA.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_lf_exs_4cA.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_lf_follow_1.cfg") cfg.left_factoring() cfg.save_to_file("test_lf_follow_1T.cfg") test_path = os.path.join(CFGS_DIR, "test_lf_follow_1T.cfg") ref_path = os.path.join(CFGS_DIR, "test_lf_follow_1A.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_lf_follow_1A.cfg") # TEST .CFG CONFORMATION cfg = ContextFreeGrammar("test_lf_1e.cfg") cfg.left_factoring() cfg.save_to_file("test_lf_1eT.cfg") test_path = os.path.join(CFGS_DIR, "test_lf_1eT.cfg") ref_path = os.path.join(CFGS_DIR, "test_lf_1eA.cfg") self.assertTrue(filecmp.cmp(test_path, ref_path)) ContextFreeGrammar("test_lf_1eA.cfg") # TEST .CFG CONFORMATION def test_firsts(self): cfg = ContextFreeGrammar("test_ll1_1.cfg") firsts = {t:OrderedSet([t]) for t in OrderedSet(['&']) | cfg.terminals} firsts.update({ 'P': OrderedSet(['c', '&', 'v', 'f', 'b', 'k']), 'K': OrderedSet(['c', '&']), 'V': OrderedSet(['v', 'f', '&']), 'F': OrderedSet(['f', '&']), 'C': OrderedSet(['b', 'k', '&']), }) self.assertEqual(firsts, cfg.firsts()) cfg = ContextFreeGrammar("test_ll1_2.cfg") firsts = {t:OrderedSet([t]) for t in OrderedSet(['&']) | cfg.terminals} # NOTE: dict equality doesn't consider its order firsts.update({ 'A':OrderedSet(['a', '&']), 'B':OrderedSet(['b', 'a', 'd', '&']), 'S':OrderedSet(['a', 'b', 'd', 'c']), }) self.assertEqual(firsts, cfg.firsts()) cfg = ContextFreeGrammar("test_ll1_3.cfg") firsts = {t:OrderedSet([t]) for t in OrderedSet(['&']) | cfg.terminals} firsts.update({ 'S':OrderedSet(['a', 'b', 'c', 'd']), 'A':OrderedSet(['a', '&' ]), 'B':OrderedSet(['b', 'a', 'c', 'd']), 'C':OrderedSet(['c', '&' ]), }) self.assertEqual(firsts, cfg.firsts()) def test_follows(self): cfg = ContextFreeGrammar("test_ll1_1.cfg") follows = { 'P': OrderedSet(['$', ';']), 'K': OrderedSet(['v', 'f', 'b', 'k', '$', ';']), 'V': OrderedSet(['b', 'k', '$', 'e', ';']), 'F': OrderedSet(['b', 'k', '$', 'e', ';']), 'C': OrderedSet(['$', 'e', ';']), } self.assertEqual(follows, cfg.follows()) cfg = ContextFreeGrammar("test_ll1_2.cfg") follows = { 'S':OrderedSet(['$']), 'B':OrderedSet(['c']), 'A':OrderedSet(['b', 'a', 'd', 'c']), } self.assertEqual(follows, cfg.follows()) cfg = ContextFreeGrammar("test_ll1_3.cfg") follows = { 'S':OrderedSet(['$']), 'A':OrderedSet(['b', 'a', 'c', 'd']), 'B':OrderedSet(['c', '$']), 'C':OrderedSet(['$', 'd']), } self.assertEqual(follows, cfg.follows()) def test_make_LL1_table(self): cfg = ContextFreeGrammar("test_ll1_1.cfg") prods = ['STARTS AT 1', ('K', 'V', 'C'), ('c', 'K'), ('&',), ('v', 'V'), ('F',), ('f', 'P', ';', 'F'), ('&',), ('b', 'V', 'C', 'e'), ('k', ';', 'C'), ('&',)] table = { ('P', 'b'): prods[1], ('P', 'k'): prods[1], ('P', 'c'): prods[1], ('P', 'f'): prods[1], ('P', 'v'): prods[1], ('P', '$'): prods[1], ('P', ';'): prods[1], ('K', 'b'): prods[3], ('K', 'k'): prods[3], ('K', 'c'): prods[2], ('K', 'f'): prods[3], ('K', 'v'): prods[3], ('K', '$'): prods[3], ('K', ';'): prods[3], ('V', 'b'): prods[5], ('V', 'k'): prods[5], ('V', 'e'): prods[5], ('V', 'f'): prods[5], ('V', 'v'): prods[4], ('V', '$'): prods[5], ('V', ';'): prods[5], ('F', 'b'): prods[7], ('F', 'k'): prods[7], ('F', 'e'): prods[7], ('F', 'f'): prods[6], ('F', '$'): prods[7], ('F', ';'): prods[7], ('C', 'b'): prods[8], ('C', 'k'): prods[9], ('C', 'e'): prods[10], ('C', '$'): prods[10], ('C', ';'): prods[10], } self.assertEqual(table, cfg.make_LL1_table()) cfg = ContextFreeGrammar("test_ll1_4.cfg") prods = ['STARTS AT 1', ('T', 'R'), ('o', 'T', 'R'), ('&',), ('F', 'U'), ('a', 'F', 'U'), ('&', ), ('n','F'), ('i',)] table = { ('E', 'i'): prods[1], ('E', 'n'): prods[1], ('R', 'o'): prods[2], ('R', '$'): prods[3], ('T', 'i'): prods[4], ('T', 'n'): prods[4], ('U', 'o'): prods[6], ('U', 'a'): prods[5], ('U', '$'): prods[6], ('F', 'i'): prods[8], ('F', 'n'): prods[7] } self.assertEqual(table, cfg.make_LL1_table()) def test_make_LL1_parser(self): cfg = ContextFreeGrammar("test_ll1_1.cfg") parser = cfg.make_LL1_parser() self.assertTrue(parser.parse("cvfbe;")) self.assertFalse(parser.parse("&"))
41.466819
165
0.593345
2,440
18,121
4.154918
0.064344
0.177944
0.157822
0.071809
0.814263
0.786052
0.75873
0.707635
0.655849
0.605445
0
0.016119
0.226257
18,121
436
166
41.561927
0.704657
0.035649
0
0.412104
0
0
0.157354
0.012047
0
0
0
0
0.21902
1
0.054755
false
0
0.014409
0
0.072046
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
ffcbe7d5edd06f00e49a052c4b179a2d0e7737b8
24
py
Python
JDjango/dialogs/dialogORM/__init__.py
JIYANG-PLUS/JDjango
57cbb13b2b4c07f34d546c0c637c22f60c1e692a
[ "MIT" ]
3
2020-12-28T05:09:02.000Z
2021-06-23T10:02:03.000Z
JDjango/dialogs/dialogORM/__init__.py
JIYANG-PLUS/JDjango
57cbb13b2b4c07f34d546c0c637c22f60c1e692a
[ "MIT" ]
null
null
null
JDjango/dialogs/dialogORM/__init__.py
JIYANG-PLUS/JDjango
57cbb13b2b4c07f34d546c0c637c22f60c1e692a
[ "MIT" ]
null
null
null
from .dialogORM import *
24
24
0.791667
3
24
6.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.125
24
1
24
24
0.904762
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
4b8bb9d3b6f55ce971a9f1c428c8d726b07d9b13
85
py
Python
src/openapi_dataclasses/types/openapi/requestbody.py
cal-pratt/openapi-dataclasses
106a0c7466dfd29beed1fa1734182f59d9c94393
[ "MIT" ]
null
null
null
src/openapi_dataclasses/types/openapi/requestbody.py
cal-pratt/openapi-dataclasses
106a0c7466dfd29beed1fa1734182f59d9c94393
[ "MIT" ]
null
null
null
src/openapi_dataclasses/types/openapi/requestbody.py
cal-pratt/openapi-dataclasses
106a0c7466dfd29beed1fa1734182f59d9c94393
[ "MIT" ]
null
null
null
from dataclasses import dataclass @dataclass class OpenApiRequestBody: """ """
12.142857
33
0.729412
7
85
8.857143
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.176471
85
6
34
14.166667
0.885714
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
4b8e7829a905a65f4a1199b1e14adf38cac40ccc
14,465
py
Python
clients/python/generated/pyaemcloudmanagerapi/models/pipeline_execution_step_state_links.py
shinesolutions/cloudmanager-api-clients
d73a25878f6cc57af954362ba8dccc90d54e6131
[ "Apache-2.0" ]
3
2020-06-23T05:31:52.000Z
2020-11-26T05:34:57.000Z
clients/python/generated/pyaemcloudmanagerapi/models/pipeline_execution_step_state_links.py
shinesolutions/cloudmanager-api-clients
d73a25878f6cc57af954362ba8dccc90d54e6131
[ "Apache-2.0" ]
2
2021-01-21T01:19:54.000Z
2021-12-09T22:30:22.000Z
clients/python/generated/pyaemcloudmanagerapi/models/pipeline_execution_step_state_links.py
shinesolutions/cloudmanager-api-clients
d73a25878f6cc57af954362ba8dccc90d54e6131
[ "Apache-2.0" ]
1
2020-11-18T11:48:13.000Z
2020-11-18T11:48:13.000Z
# coding: utf-8 """ Cloud Manager API This API allows access to Cloud Manager programs, pipelines, and environments by an authorized technical account created through the Adobe I/O Console. The base url for this API is https://cloudmanager.adobe.io, e.g. to get the list of programs for an organization, you would make a GET request to https://cloudmanager.adobe.io/api/programs (with the correct set of headers as described below). This swagger file can be downloaded from https://raw.githubusercontent.com/AdobeDocs/cloudmanager-api-docs/master/swagger-specs/api.yaml. # noqa: E501 The version of the OpenAPI document: 1.0.0 Contact: opensource@shinesolutions.com Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from pyaemcloudmanagerapi.configuration import Configuration class PipelineExecutionStepStateLinks(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ openapi_types = { 'http__ns_adobe_com_adobecloud_rel_execution': 'HalLink', 'http__ns_adobe_com_adobecloud_rel_pipeline': 'HalLink', 'http__ns_adobe_com_adobecloud_rel_pipeline_logs': 'HalLink', 'http__ns_adobe_com_adobecloud_rel_pipeline_metrics': 'HalLink', 'http__ns_adobe_com_adobecloud_rel_pipeline_advance': 'HalLink', 'http__ns_adobe_com_adobecloud_rel_pipeline_cancel': 'HalLink', 'http__ns_adobe_com_adobecloud_rel_program': 'HalLink', '_self': 'HalLink' } attribute_map = { 'http__ns_adobe_com_adobecloud_rel_execution': 'http://ns.adobe.com/adobecloud/rel/execution', 'http__ns_adobe_com_adobecloud_rel_pipeline': 'http://ns.adobe.com/adobecloud/rel/pipeline', 'http__ns_adobe_com_adobecloud_rel_pipeline_logs': 'http://ns.adobe.com/adobecloud/rel/pipeline/logs', 'http__ns_adobe_com_adobecloud_rel_pipeline_metrics': 'http://ns.adobe.com/adobecloud/rel/pipeline/metrics', 'http__ns_adobe_com_adobecloud_rel_pipeline_advance': 'http://ns.adobe.com/adobecloud/rel/pipeline/advance', 'http__ns_adobe_com_adobecloud_rel_pipeline_cancel': 'http://ns.adobe.com/adobecloud/rel/pipeline/cancel', 'http__ns_adobe_com_adobecloud_rel_program': 'http://ns.adobe.com/adobecloud/rel/program', '_self': 'self' } def __init__(self, http__ns_adobe_com_adobecloud_rel_execution=None, http__ns_adobe_com_adobecloud_rel_pipeline=None, http__ns_adobe_com_adobecloud_rel_pipeline_logs=None, http__ns_adobe_com_adobecloud_rel_pipeline_metrics=None, http__ns_adobe_com_adobecloud_rel_pipeline_advance=None, http__ns_adobe_com_adobecloud_rel_pipeline_cancel=None, http__ns_adobe_com_adobecloud_rel_program=None, _self=None, local_vars_configuration=None): # noqa: E501 """PipelineExecutionStepStateLinks - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() self.local_vars_configuration = local_vars_configuration self._http__ns_adobe_com_adobecloud_rel_execution = None self._http__ns_adobe_com_adobecloud_rel_pipeline = None self._http__ns_adobe_com_adobecloud_rel_pipeline_logs = None self._http__ns_adobe_com_adobecloud_rel_pipeline_metrics = None self._http__ns_adobe_com_adobecloud_rel_pipeline_advance = None self._http__ns_adobe_com_adobecloud_rel_pipeline_cancel = None self._http__ns_adobe_com_adobecloud_rel_program = None self.__self = None self.discriminator = None if http__ns_adobe_com_adobecloud_rel_execution is not None: self.http__ns_adobe_com_adobecloud_rel_execution = http__ns_adobe_com_adobecloud_rel_execution if http__ns_adobe_com_adobecloud_rel_pipeline is not None: self.http__ns_adobe_com_adobecloud_rel_pipeline = http__ns_adobe_com_adobecloud_rel_pipeline if http__ns_adobe_com_adobecloud_rel_pipeline_logs is not None: self.http__ns_adobe_com_adobecloud_rel_pipeline_logs = http__ns_adobe_com_adobecloud_rel_pipeline_logs if http__ns_adobe_com_adobecloud_rel_pipeline_metrics is not None: self.http__ns_adobe_com_adobecloud_rel_pipeline_metrics = http__ns_adobe_com_adobecloud_rel_pipeline_metrics if http__ns_adobe_com_adobecloud_rel_pipeline_advance is not None: self.http__ns_adobe_com_adobecloud_rel_pipeline_advance = http__ns_adobe_com_adobecloud_rel_pipeline_advance if http__ns_adobe_com_adobecloud_rel_pipeline_cancel is not None: self.http__ns_adobe_com_adobecloud_rel_pipeline_cancel = http__ns_adobe_com_adobecloud_rel_pipeline_cancel if http__ns_adobe_com_adobecloud_rel_program is not None: self.http__ns_adobe_com_adobecloud_rel_program = http__ns_adobe_com_adobecloud_rel_program if _self is not None: self._self = _self @property def http__ns_adobe_com_adobecloud_rel_execution(self): """Gets the http__ns_adobe_com_adobecloud_rel_execution of this PipelineExecutionStepStateLinks. # noqa: E501 :return: The http__ns_adobe_com_adobecloud_rel_execution of this PipelineExecutionStepStateLinks. # noqa: E501 :rtype: HalLink """ return self._http__ns_adobe_com_adobecloud_rel_execution @http__ns_adobe_com_adobecloud_rel_execution.setter def http__ns_adobe_com_adobecloud_rel_execution(self, http__ns_adobe_com_adobecloud_rel_execution): """Sets the http__ns_adobe_com_adobecloud_rel_execution of this PipelineExecutionStepStateLinks. :param http__ns_adobe_com_adobecloud_rel_execution: The http__ns_adobe_com_adobecloud_rel_execution of this PipelineExecutionStepStateLinks. # noqa: E501 :type: HalLink """ self._http__ns_adobe_com_adobecloud_rel_execution = http__ns_adobe_com_adobecloud_rel_execution @property def http__ns_adobe_com_adobecloud_rel_pipeline(self): """Gets the http__ns_adobe_com_adobecloud_rel_pipeline of this PipelineExecutionStepStateLinks. # noqa: E501 :return: The http__ns_adobe_com_adobecloud_rel_pipeline of this PipelineExecutionStepStateLinks. # noqa: E501 :rtype: HalLink """ return self._http__ns_adobe_com_adobecloud_rel_pipeline @http__ns_adobe_com_adobecloud_rel_pipeline.setter def http__ns_adobe_com_adobecloud_rel_pipeline(self, http__ns_adobe_com_adobecloud_rel_pipeline): """Sets the http__ns_adobe_com_adobecloud_rel_pipeline of this PipelineExecutionStepStateLinks. :param http__ns_adobe_com_adobecloud_rel_pipeline: The http__ns_adobe_com_adobecloud_rel_pipeline of this PipelineExecutionStepStateLinks. # noqa: E501 :type: HalLink """ self._http__ns_adobe_com_adobecloud_rel_pipeline = http__ns_adobe_com_adobecloud_rel_pipeline @property def http__ns_adobe_com_adobecloud_rel_pipeline_logs(self): """Gets the http__ns_adobe_com_adobecloud_rel_pipeline_logs of this PipelineExecutionStepStateLinks. # noqa: E501 :return: The http__ns_adobe_com_adobecloud_rel_pipeline_logs of this PipelineExecutionStepStateLinks. # noqa: E501 :rtype: HalLink """ return self._http__ns_adobe_com_adobecloud_rel_pipeline_logs @http__ns_adobe_com_adobecloud_rel_pipeline_logs.setter def http__ns_adobe_com_adobecloud_rel_pipeline_logs(self, http__ns_adobe_com_adobecloud_rel_pipeline_logs): """Sets the http__ns_adobe_com_adobecloud_rel_pipeline_logs of this PipelineExecutionStepStateLinks. :param http__ns_adobe_com_adobecloud_rel_pipeline_logs: The http__ns_adobe_com_adobecloud_rel_pipeline_logs of this PipelineExecutionStepStateLinks. # noqa: E501 :type: HalLink """ self._http__ns_adobe_com_adobecloud_rel_pipeline_logs = http__ns_adobe_com_adobecloud_rel_pipeline_logs @property def http__ns_adobe_com_adobecloud_rel_pipeline_metrics(self): """Gets the http__ns_adobe_com_adobecloud_rel_pipeline_metrics of this PipelineExecutionStepStateLinks. # noqa: E501 :return: The http__ns_adobe_com_adobecloud_rel_pipeline_metrics of this PipelineExecutionStepStateLinks. # noqa: E501 :rtype: HalLink """ return self._http__ns_adobe_com_adobecloud_rel_pipeline_metrics @http__ns_adobe_com_adobecloud_rel_pipeline_metrics.setter def http__ns_adobe_com_adobecloud_rel_pipeline_metrics(self, http__ns_adobe_com_adobecloud_rel_pipeline_metrics): """Sets the http__ns_adobe_com_adobecloud_rel_pipeline_metrics of this PipelineExecutionStepStateLinks. :param http__ns_adobe_com_adobecloud_rel_pipeline_metrics: The http__ns_adobe_com_adobecloud_rel_pipeline_metrics of this PipelineExecutionStepStateLinks. # noqa: E501 :type: HalLink """ self._http__ns_adobe_com_adobecloud_rel_pipeline_metrics = http__ns_adobe_com_adobecloud_rel_pipeline_metrics @property def http__ns_adobe_com_adobecloud_rel_pipeline_advance(self): """Gets the http__ns_adobe_com_adobecloud_rel_pipeline_advance of this PipelineExecutionStepStateLinks. # noqa: E501 :return: The http__ns_adobe_com_adobecloud_rel_pipeline_advance of this PipelineExecutionStepStateLinks. # noqa: E501 :rtype: HalLink """ return self._http__ns_adobe_com_adobecloud_rel_pipeline_advance @http__ns_adobe_com_adobecloud_rel_pipeline_advance.setter def http__ns_adobe_com_adobecloud_rel_pipeline_advance(self, http__ns_adobe_com_adobecloud_rel_pipeline_advance): """Sets the http__ns_adobe_com_adobecloud_rel_pipeline_advance of this PipelineExecutionStepStateLinks. :param http__ns_adobe_com_adobecloud_rel_pipeline_advance: The http__ns_adobe_com_adobecloud_rel_pipeline_advance of this PipelineExecutionStepStateLinks. # noqa: E501 :type: HalLink """ self._http__ns_adobe_com_adobecloud_rel_pipeline_advance = http__ns_adobe_com_adobecloud_rel_pipeline_advance @property def http__ns_adobe_com_adobecloud_rel_pipeline_cancel(self): """Gets the http__ns_adobe_com_adobecloud_rel_pipeline_cancel of this PipelineExecutionStepStateLinks. # noqa: E501 :return: The http__ns_adobe_com_adobecloud_rel_pipeline_cancel of this PipelineExecutionStepStateLinks. # noqa: E501 :rtype: HalLink """ return self._http__ns_adobe_com_adobecloud_rel_pipeline_cancel @http__ns_adobe_com_adobecloud_rel_pipeline_cancel.setter def http__ns_adobe_com_adobecloud_rel_pipeline_cancel(self, http__ns_adobe_com_adobecloud_rel_pipeline_cancel): """Sets the http__ns_adobe_com_adobecloud_rel_pipeline_cancel of this PipelineExecutionStepStateLinks. :param http__ns_adobe_com_adobecloud_rel_pipeline_cancel: The http__ns_adobe_com_adobecloud_rel_pipeline_cancel of this PipelineExecutionStepStateLinks. # noqa: E501 :type: HalLink """ self._http__ns_adobe_com_adobecloud_rel_pipeline_cancel = http__ns_adobe_com_adobecloud_rel_pipeline_cancel @property def http__ns_adobe_com_adobecloud_rel_program(self): """Gets the http__ns_adobe_com_adobecloud_rel_program of this PipelineExecutionStepStateLinks. # noqa: E501 :return: The http__ns_adobe_com_adobecloud_rel_program of this PipelineExecutionStepStateLinks. # noqa: E501 :rtype: HalLink """ return self._http__ns_adobe_com_adobecloud_rel_program @http__ns_adobe_com_adobecloud_rel_program.setter def http__ns_adobe_com_adobecloud_rel_program(self, http__ns_adobe_com_adobecloud_rel_program): """Sets the http__ns_adobe_com_adobecloud_rel_program of this PipelineExecutionStepStateLinks. :param http__ns_adobe_com_adobecloud_rel_program: The http__ns_adobe_com_adobecloud_rel_program of this PipelineExecutionStepStateLinks. # noqa: E501 :type: HalLink """ self._http__ns_adobe_com_adobecloud_rel_program = http__ns_adobe_com_adobecloud_rel_program @property def _self(self): """Gets the _self of this PipelineExecutionStepStateLinks. # noqa: E501 :return: The _self of this PipelineExecutionStepStateLinks. # noqa: E501 :rtype: HalLink """ return self.__self @_self.setter def _self(self, _self): """Sets the _self of this PipelineExecutionStepStateLinks. :param _self: The _self of this PipelineExecutionStepStateLinks. # noqa: E501 :type: HalLink """ self.__self = _self def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, PipelineExecutionStepStateLinks): return False return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, PipelineExecutionStepStateLinks): return True return self.to_dict() != other.to_dict()
47.582237
550
0.75617
1,852
14,465
5.314255
0.089093
0.085349
0.156472
0.199147
0.820159
0.815688
0.815688
0.773318
0.693761
0.594595
0
0.007721
0.185206
14,465
303
551
47.739274
0.827338
0.350363
0
0.089552
0
0
0.124111
0.07512
0
0
0
0
0
1
0.164179
false
0
0.029851
0
0.328358
0.014925
0
0
0
null
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
4bb2234c01d06e3332f2e800db9cab21d477b4be
180
py
Python
opus/exceptions.py
svartalf/python-opus
a3c1d556d2772b5be659ddd08c033ddd4d566b3a
[ "BSD-3-Clause" ]
22
2015-01-12T21:18:41.000Z
2021-08-10T04:07:15.000Z
opus/exceptions.py
svartalf/python-opus
a3c1d556d2772b5be659ddd08c033ddd4d566b3a
[ "BSD-3-Clause" ]
3
2015-12-21T08:14:39.000Z
2020-12-08T15:36:17.000Z
opus/exceptions.py
svartalf/python-opus
a3c1d556d2772b5be659ddd08c033ddd4d566b3a
[ "BSD-3-Clause" ]
21
2015-01-02T22:18:53.000Z
2021-02-03T15:44:43.000Z
from opus.api.info import strerror class OpusError(Exception): def __init__(self, code): self.code = code def __str__(self): return strerror(self.code)
16.363636
34
0.661111
23
180
4.826087
0.652174
0.216216
0
0
0
0
0
0
0
0
0
0
0.244444
180
10
35
18
0.816176
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0.166667
0.833333
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
1
0
0
0
1
1
0
0
5
29c9943bd38b6960265abbd735174821fdf6cf30
36
py
Python
create_component/errorManager.py
isaacismaelx14/Project-Manager-CLI
2439334d20e75931d6023a123d4ee8069d936ac2
[ "MIT" ]
null
null
null
create_component/errorManager.py
isaacismaelx14/Project-Manager-CLI
2439334d20e75931d6023a123d4ee8069d936ac2
[ "MIT" ]
null
null
null
create_component/errorManager.py
isaacismaelx14/Project-Manager-CLI
2439334d20e75931d6023a123d4ee8069d936ac2
[ "MIT" ]
null
null
null
class ErrorExp(Exception): pass
12
26
0.722222
4
36
6.5
1
0
0
0
0
0
0
0
0
0
0
0
0.194444
36
2
27
18
0.896552
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
29ddd86d0866f3749bc95cce7beca82308e83e2b
54
py
Python
tests/bytecode/mp-tests/tuple3.py
LabAixBidouille/micropython
11aa6ba456287d6c80598a7ebbebd2887ce8f5a2
[ "MIT" ]
303
2015-07-11T17:12:55.000Z
2018-01-08T03:02:37.000Z
tests/bytecode/mp-tests/tuple3.py
LabAixBidouille/micropython
11aa6ba456287d6c80598a7ebbebd2887ce8f5a2
[ "MIT" ]
13
2016-05-12T16:51:22.000Z
2018-01-10T22:33:25.000Z
tests/bytecode/mp-tests/tuple3.py
LabAixBidouille/micropython
11aa6ba456287d6c80598a7ebbebd2887ce8f5a2
[ "MIT" ]
26
2018-01-18T09:15:33.000Z
2022-02-07T13:09:14.000Z
def f(x): return x, x + 1 for a in b, c: f(a)
10.8
19
0.444444
14
54
1.714286
0.714286
0
0
0
0
0
0
0
0
0
0
0.030303
0.388889
54
4
20
13.5
0.69697
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0.25
0.5
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
1
0
0
0
1
0
0
0
5
29e2e21adda9d6306c24fa4f31b723f9989914e7
189
py
Python
core/src/apps/management/apply_flags.py
Kayuii/trezor-crypto
6556616681a4e2d7e18817e8692d4f6e041dee01
[ "MIT" ]
null
null
null
core/src/apps/management/apply_flags.py
Kayuii/trezor-crypto
6556616681a4e2d7e18817e8692d4f6e041dee01
[ "MIT" ]
1
2019-02-08T00:22:42.000Z
2019-02-13T09:41:54.000Z
core/src/apps/management/apply_flags.py
Kayuii/trezor-crypto
6556616681a4e2d7e18817e8692d4f6e041dee01
[ "MIT" ]
2
2019-02-07T23:57:09.000Z
2020-10-21T07:07:27.000Z
from trezor.messages.Success import Success from apps.common import storage async def apply_flags(ctx, msg): storage.set_flags(msg.flags) return Success(message="Flags applied")
21
43
0.772487
27
189
5.333333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.142857
189
8
44
23.625
0.888889
0
0
0
0
0
0.068783
0
0
0
0
0
0
1
0
true
0
0.4
0
0.6
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
29e71e7b895c91779a8dac45da12565a0782dd67
3,742
py
Python
SpaceHabitRPG/Tests/Frontend/LoginPageRequests.py
joelliusp/SpaceHabit
5656ef4d9c57f3e58d0ed756a3aa754c8a7dd6a5
[ "MIT" ]
null
null
null
SpaceHabitRPG/Tests/Frontend/LoginPageRequests.py
joelliusp/SpaceHabit
5656ef4d9c57f3e58d0ed756a3aa754c8a7dd6a5
[ "MIT" ]
13
2016-07-19T04:13:20.000Z
2016-08-17T06:06:47.000Z
SpaceHabitRPG/Tests/Frontend/LoginPageRequests.py
joelliusp/SpaceHabit
5656ef4d9c57f3e58d0ed756a3aa754c8a7dd6a5
[ "MIT" ]
null
null
null
from SpaceUnitTest import SpaceUnitTest import SpaceHabitServer import DatabaseLayer import threading import cherrypy import time import requests import json import DatabaseTestSetupCleanup as dbHelp class Test_LoginSaveNewUserWithRequests(SpaceUnitTest): @classmethod def setUpClass(cls): DatabaseLayer.isUnitTestMode = True cls.server = SpaceHabitServer.HabitServer() cls.server.start() ticks = 0 while cherrypy.engine.state != cherrypy.engine.states.STARTED: time.sleep(1) ticks += 1 if ticks >= 10: raise TimeoutError("ran out of time") return super().setUpClass() @classmethod def tearDownClass(cls): dbHelp.clean_up() cls.server.stop() ticks = 0 while cherrypy.engine.state != cherrypy.engine.states.STOPPED: time.sleep(1) ticks += 1 if ticks >= 10: raise TimeoutError("ran out of time") return super().tearDownClass() def test_send_success(self): s = requests.Session() r = s.post("http://127.0.0.1:8080/login/save_new_user/",params={'email1':"a@b.c", 'email2':"a@b.c",'pw1':"123456",'pw2':"123456",'shipName':"USS Enterprise"}) self.assertEqual(r.status_code,200) data = json.loads(r.text) self.assertEqual(data['success'], True) def test_insert_user_missing_param(self): s = requests.Session() r = s.post("http://127.0.0.1:8080/login/save_new_user/",params={'email1':"a@b.c", 'email2':"a@b.c",'pw1':"123456",'pw2':"123456"}) self.assertEqual(r.status_code,404) def test_send_missing_input2_pw1_pw2(self): s = requests.Session() r = s.post("http://127.0.0.1:8080/login/save_new_user/",params={'email1':"a@b.c", 'email2':"",'pw1':"",'pw2':"",'shipName':""}) self.assertEqual(r.status_code,200) data = json.loads(r.text) self.assertEqual(data['success'], False) def test_send_missing_pw(self): s = requests.Session() r = s.post("http://127.0.0.1:8080/login/save_new_user/",params={'email1':"a@b.c", 'email2':"a@b.c",'pw1':"",'pw2':"",'shipName':""}) self.assertEqual(r.status_code,200) data = json.loads(r.text) self.assertEqual(data['success'], False) def test_send_taken_email(self): dbHelp.create_login_using_test_values() s = requests.Session() r = s.post("http://127.0.0.1:8080/login/save_new_user/",params={'email1':"a@b.c", 'email2':"a@b.c",'pw1':"123456",'pw2':"123456",'shipName':""}) self.assertEqual(r.status_code,200) data = json.loads(r.text) self.assertEqual(data['success'], False) def test_send_mismatched_email(self): s = requests.Session() r = s.post("http://127.0.0.1:8080/login/save_new_user/",params={'email1':"a@b.c", 'email2':"b@c.d",'pw1':"123456",'pw2':"123456",'shipName':""}) self.assertEqual(r.status_code,200) data = json.loads(r.text) self.assertEqual(data['success'], False) def test_send_bad_pw(self): s = requests.Session() r = s.post("http://127.0.0.1:8080/login/save_new_user/",params={'email1':"a@b.c", 'email2':"b@c.d",'pw1':"123",'pw2':"123",'shipName':""}) self.assertEqual(r.status_code,200) data = json.loads(r.text) self.assertEqual(data['success'], False) def test_send_mismatched_pw(self): s = requests.Session() r = s.post("http://127.0.0.1:8080/login/save_new_user/",params={'email1':"a@b.c", 'email2':"b@c.d",'pw1':"123456",'pw2':"abcdef",'shipName':""}) self.assertEqual(r.status_code,200) data = json.loads(r.text) self.assertEqual(data['success'], False) if __name__ == '__main__': unittest.main()
34.330275
87
0.629075
517
3,742
4.4294
0.195358
0.0131
0.015721
0.059389
0.727511
0.716157
0.716157
0.716157
0.716157
0.672489
0
0.068547
0.185195
3,742
108
88
34.648148
0.682519
0
0
0.533333
0
0
0.214089
0
0
0
0
0
0.166667
1
0.111111
false
0
0.1
0
0.244444
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
29fa8ab11b6ff634c6e14e128d8e905e829b28da
212
py
Python
condo_app/tennis_app/views.py
amateur-dev/django_condo_facility_booking_app
ec3fd076ae2d459a2c0590c944755c7154dc2335
[ "BSD-3-Clause" ]
null
null
null
condo_app/tennis_app/views.py
amateur-dev/django_condo_facility_booking_app
ec3fd076ae2d459a2c0590c944755c7154dc2335
[ "BSD-3-Clause" ]
null
null
null
condo_app/tennis_app/views.py
amateur-dev/django_condo_facility_booking_app
ec3fd076ae2d459a2c0590c944755c7154dc2335
[ "BSD-3-Clause" ]
null
null
null
from django.shortcuts import render from django.http import HttpRequest, HttpResponse # Create your views here. def index(request): return HttpResponse("Hello you are in the landing page of the tennis_app")
30.285714
78
0.792453
31
212
5.387097
0.83871
0.11976
0
0
0
0
0
0
0
0
0
0
0.150943
212
7
78
30.285714
0.927778
0.108491
0
0
0
0
0.271277
0
0
0
0
0
0
1
0.25
false
0
0.5
0.25
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
1
0
0
5
4b13d9e22a556375856b1d5e79c2e0ff97ad2112
353
py
Python
lib/googlecloudapis/sqladmin/v1beta3/__init__.py
IsaacHuang/google-cloud-sdk
52afa5d1a75dff08f4f5380c5cccc015bf796ca5
[ "Apache-2.0" ]
null
null
null
lib/googlecloudapis/sqladmin/v1beta3/__init__.py
IsaacHuang/google-cloud-sdk
52afa5d1a75dff08f4f5380c5cccc015bf796ca5
[ "Apache-2.0" ]
null
null
null
lib/googlecloudapis/sqladmin/v1beta3/__init__.py
IsaacHuang/google-cloud-sdk
52afa5d1a75dff08f4f5380c5cccc015bf796ca5
[ "Apache-2.0" ]
2
2020-07-25T05:03:06.000Z
2020-11-04T04:55:57.000Z
"""Common imports for generated sqladmin client library.""" # pylint:disable=wildcard-import import pkgutil from googlecloudapis.apitools.base.py import * from googlecloudapis.sqladmin.v1beta3.sqladmin_v1beta3_client import * from googlecloudapis.sqladmin.v1beta3.sqladmin_v1beta3_messages import * __path__ = pkgutil.extend_path(__path__, __name__)
32.090909
72
0.835694
41
353
6.780488
0.536585
0.215827
0.179856
0.23741
0.395683
0.395683
0.395683
0
0
0
0
0.024768
0.084986
353
10
73
35.3
0.835913
0.240793
0
0
1
0
0
0
0
0
0
0
0
1
0
false
0
0.8
0
0.8
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
d9c3c9d3cf3dae5bc821e6c09098e26495ba10fd
20
py
Python
register.py
tao-sang/test
152c5bdf76af4ae148d8018132590afac3cdebda
[ "MIT" ]
null
null
null
register.py
tao-sang/test
152c5bdf76af4ae148d8018132590afac3cdebda
[ "MIT" ]
null
null
null
register.py
tao-sang/test
152c5bdf76af4ae148d8018132590afac3cdebda
[ "MIT" ]
null
null
null
num = 100 num = 200
6.666667
9
0.6
4
20
3
0.75
0
0
0
0
0
0
0
0
0
0
0.428571
0.3
20
3
10
6.666667
0.428571
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
d9c9ee13d44f44d889c445b7737c4013ad81a8ea
107
py
Python
evm_trace/__init__.py
NotPeopling2day/evm-trace
f344d29af17bf565e0b740faf62933ba0d5bff66
[ "Apache-2.0" ]
null
null
null
evm_trace/__init__.py
NotPeopling2day/evm-trace
f344d29af17bf565e0b740faf62933ba0d5bff66
[ "Apache-2.0" ]
null
null
null
evm_trace/__init__.py
NotPeopling2day/evm-trace
f344d29af17bf565e0b740faf62933ba0d5bff66
[ "Apache-2.0" ]
null
null
null
from .base import CallTreeNode, CallType, TraceFrame __all__ = ["CallTreeNode", "CallType", "TraceFrame"]
26.75
52
0.757009
10
107
7.7
0.7
0.519481
0.779221
0
0
0
0
0
0
0
0
0
0.11215
107
3
53
35.666667
0.810526
0
0
0
0
0
0.280374
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
d9ccecd6dcd612a79203dc54e91832c7a341e260
1,007
py
Python
setup.py
DeflatedPickle/MenuMaker
05038896fdda78cfbc3b9d696bd19e2d1bff60ff
[ "MIT" ]
4
2017-10-06T19:32:41.000Z
2018-02-26T13:02:21.000Z
setup.py
DeflatedPickle/menumaker
05038896fdda78cfbc3b9d696bd19e2d1bff60ff
[ "MIT" ]
8
2017-10-06T18:58:59.000Z
2017-12-11T23:28:52.000Z
setup.py
DeflatedPickle/menumaker
05038896fdda78cfbc3b9d696bd19e2d1bff60ff
[ "MIT" ]
null
null
null
from setuptools import setup setup(name="menumaker", version="1.4.1", description="An easy solution for creating menus for TkInter applications in just a few lines.", author="DeflatedPickle", author_email="DeflatedPickle@gmail.com", url="https://github.com/DeflatedPickle/MenuMaker", license="MIT", classifiers=[ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.0", "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", ], keywords=["menumaker", "tkinter", "GUI", "menu"], packages=["menumaker"])
40.28
102
0.586892
102
1,007
5.784314
0.509804
0.289831
0.381356
0.308475
0
0
0
0
0
0
0
0.028378
0.265144
1,007
24
103
41.958333
0.768919
0
0
0
0
0
0.608739
0.023833
0
0
0
0
0
1
0
true
0
0.043478
0
0.043478
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
d9ea1aef9f6ac544c65c9d689289689695e1edeb
3,151
py
Python
jumodjango/lib/bebop/model.py
jumoconnect/openjumo
828d993bfbb83777d10a68de6964c7d5bb2c7bd0
[ "MIT" ]
5
2015-03-11T18:59:46.000Z
2018-08-17T17:49:45.000Z
jumodjango/lib/bebop/model.py
kmrifat/openjumo
828d993bfbb83777d10a68de6964c7d5bb2c7bd0
[ "MIT" ]
2
2020-06-05T16:52:17.000Z
2021-02-08T20:24:26.000Z
jumodjango/lib/bebop/model.py
kmrifat/openjumo
828d993bfbb83777d10a68de6964c7d5bb2c7bd0
[ "MIT" ]
6
2016-02-04T00:45:30.000Z
2021-07-07T17:14:50.000Z
''' Created on Jan 21, 2011 @author: al ''' from connection import * from schema import * from config import * def SearchIndex(name, config=StandardSolrConfig, generate_schema=True): def _Index(cls): cls.__index__ = name if not hasattr(cls, '_target') or cls._target is None: raise Exception('Class "%s" must have attribute _target' % cls.__name__) fields = filter(lambda attr: isinstance(getattr(cls,attr), Field), dir(cls)) cls._fields = fields cls._models_to_solr = dict([(field, getattr(cls, field).name) for field in fields]) cls._solr_to_models = dict([(v,k) for k,v in cls._models_to_solr.iteritems()]) cls.schema=None if generate_schema: field_types=set() schema_fields=[] for attr in fields: schema_fields.append(getattr(cls, attr)) field_types.add(getattr(cls,attr)._type) cls.schema=SolrSchema(name=name, fields=SolrSchemaFields(*schema_fields), field_types=SolrFieldTypes(*field_types) ) cls.config=config return cls return _Index class SearchableModel(object): _target = None @classmethod def _to_solr_doc(cls, obj): return dict([(v, getattr(obj, k)) for k, v in cls._models_to_solr.iteritems()]) @classmethod def _create_target(cls, doc): return cls._target(**dict([(k, v) for k,v in cls._solr_to_models.iteritems()])) class Field(SolrSchemaField): def __init__(self, name, type, multi_valued=None, indexed=None, stored=None, model_attr=None): super(Field, self).__init__(name=name, type=type) self._type = type if indexed is not None: self.indexed = indexed if stored is not None: self.stored = stored if multi_valued is not None: self.multi_valued = multi_valued if model_attr: self._model_attr = model_attr def _op(self, *components): # TODO: probably need some serialization crap in here components = [self.name,':'] + [unicode(component) for component in components] return ''.join(components) def __gt__(self, other): return self._op('[',other,' TO *]') def __lt__(self, other): return self._op('[* TO ',other,']') def __gte__(self, other): return self.__gt__(self, other) def __lte__(self, other): return self.__lt__(other) def __eq__(self, other): return self._op(other) def between(self, lower, upper): return self._op('[', lower, ' TO ', upper, ']') def exists(self): return self._op('[* TO *]') def and_(*args): return '(' + ' AND '.join(args) + ')' def or_(*args): return '(' + ' OR '.join(args) + ')' class DocumentId(Field): def __init__(self, name, type, model_attr=None): self.unique_key = UniqueKey(name) return super(DocumentId, self).__init__(name, type, model_attr=model_attr)
32.822917
103
0.590924
381
3,151
4.593176
0.270341
0.036
0.042857
0.054286
0.105714
0.066286
0.036571
0.036571
0.036571
0.036571
0
0.002682
0.290067
3,151
96
104
32.822917
0.779616
0.028245
0
0.028169
1
0
0.028478
0
0
0
0
0.010417
0
1
0.225352
false
0
0.042254
0.15493
0.535211
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
1
0
0
1
0
0
0
1
1
0
0
5
d9f06669960ef8b681ee04be0971b0a6430fbf83
508
py
Python
droxi/drox/omcdbase/relation1/models.py
andydude/droxtools
d608ceb715908fb00398c0d28eee74286fef3750
[ "MIT" ]
null
null
null
droxi/drox/omcdbase/relation1/models.py
andydude/droxtools
d608ceb715908fb00398c0d28eee74286fef3750
[ "MIT" ]
null
null
null
droxi/drox/omcdbase/relation1/models.py
andydude/droxtools
d608ceb715908fb00398c0d28eee74286fef3750
[ "MIT" ]
null
null
null
''' Created on Mar 31, 2014 @author: ajr ''' from ..models import OMSym @OMSym.called("relation1", "approx") class Approx(OMSym): pass @OMSym.called("relation1", "eq") class Eq(OMSym): pass @OMSym.called("relation1", "geq") class Geq(OMSym): pass @OMSym.called("relation1", "gt") class Gt(OMSym): pass @OMSym.called("relation1", "leq") class Leq(OMSym): pass @OMSym.called("relation1", "lt") class Lt(OMSym): pass @OMSym.called("relation1", "neq") class Neq(OMSym): pass
14.111111
36
0.645669
67
508
4.895522
0.328358
0.234756
0.426829
0.365854
0.530488
0
0
0
0
0
0
0.030733
0.167323
508
35
37
14.514286
0.744681
0.072835
0
0.318182
0
0
0.181425
0
0
0
0
0
0
1
0
true
0.318182
0.045455
0
0.363636
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
8a25470edc99a25db17254a644a7afebd348f331
48
py
Python
app-testing/src/resources/__init__.py
anuwrag/opentrons
28c8d76a19e367c6bd38f5290faaa32abf378715
[ "Apache-2.0" ]
235
2017-10-27T20:37:27.000Z
2022-03-30T14:09:49.000Z
app-testing/src/resources/__init__.py
anuwrag/opentrons
28c8d76a19e367c6bd38f5290faaa32abf378715
[ "Apache-2.0" ]
8,425
2017-10-26T15:25:43.000Z
2022-03-31T23:54:26.000Z
app-testing/src/resources/__init__.py
anuwrag/opentrons
28c8d76a19e367c6bd38f5290faaa32abf378715
[ "Apache-2.0" ]
130
2017-11-09T21:02:37.000Z
2022-03-15T18:01:24.000Z
"""Definitions of resources needed in tests."""
24
47
0.729167
6
48
5.833333
1
0
0
0
0
0
0
0
0
0
0
0
0.125
48
1
48
48
0.833333
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
8a3f9237fb5944982dffae4cb1f1a1fddcb406fe
96
py
Python
py_src/ethers/providers/__init__.py
elyase/ethers-py
06d3162c23c68a42cef3f81b72ce8ae842be7a6b
[ "MIT" ]
null
null
null
py_src/ethers/providers/__init__.py
elyase/ethers-py
06d3162c23c68a42cef3f81b72ce8ae842be7a6b
[ "MIT" ]
null
null
null
py_src/ethers/providers/__init__.py
elyase/ethers-py
06d3162c23c68a42cef3f81b72ce8ae842be7a6b
[ "MIT" ]
null
null
null
# Generated content DO NOT EDIT from .. import providers HTTPProvider = providers.HTTPProvider
19.2
37
0.802083
11
96
7
0.818182
0.545455
0
0
0
0
0
0
0
0
0
0
0.145833
96
4
38
24
0.939024
0.302083
0
0
1
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
8a4866b89c039cbf316507eab6f408cc3d6d5e71
14,928
py
Python
tests/test_defaults.py
StefanBrand/prometheus_flask_exporter
2b8c5fd42b721576a69bf29587d7b5fdc19a5fe6
[ "MIT" ]
null
null
null
tests/test_defaults.py
StefanBrand/prometheus_flask_exporter
2b8c5fd42b721576a69bf29587d7b5fdc19a5fe6
[ "MIT" ]
null
null
null
tests/test_defaults.py
StefanBrand/prometheus_flask_exporter
2b8c5fd42b721576a69bf29587d7b5fdc19a5fe6
[ "MIT" ]
null
null
null
from unittest_helper import BaseTestCase from prometheus_flask_exporter import NO_PREFIX from flask import make_response class DefaultsTest(BaseTestCase): def test_simple(self): metrics = self.metrics() self.assertMetric( 'flask_exporter_info', '1.0', ('version', metrics.version) ) @self.app.route('/test') def test(): return 'OK' self.client.get('/test') self.client.get('/test') self.assertMetric( 'flask_http_request_total', '2.0', ('method', 'GET'), ('status', 200) ) self.assertMetric( 'flask_http_request_duration_seconds_count', '2.0', ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertAbsent( 'flask_http_request_duration_seconds_count', ('method', 'GET'), ('path', '/metrics'), ('status', 200) ) self.assertMetric( 'flask_http_request_duration_seconds_bucket', '2.0', ('le', '0.1'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertMetric( 'flask_http_request_duration_seconds_bucket', '2.0', ('le', '0.5'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertMetric( 'flask_http_request_duration_seconds_bucket', '2.0', ('le', '1.0'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertMetric( 'flask_http_request_duration_seconds_bucket', '2.0', ('le', '5.0'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertMetric( 'flask_http_request_duration_seconds_bucket', '2.0', ('le', '+Inf'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.client.get('/test') self.assertMetric( 'flask_http_request_total', '3.0', ('method', 'GET'), ('status', 200) ) self.assertMetric( 'flask_http_request_duration_seconds_count', '3.0', ('method', 'GET'), ('path', '/test'), ('status', 200) ) def test_response_object(self): metrics = self.metrics() @metrics.counter('success_invocation', 'Successful invocation') def success(): return 200 @self.app.route('/test') def test(): return make_response('OK', success()) self.client.get('/test') self.client.get('/test') self.assertMetric( 'flask_http_request_total', '2.0', ('method', 'GET'), ('status', 200) ) self.assertMetric( 'flask_http_request_duration_seconds_count', '2.0', ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertMetric('success_invocation_total', '2.0') def test_skip(self): metrics = self.metrics() @self.app.route('/skip') @metrics.do_not_track() def test(): return 'OK' self.client.get('/skip') self.client.get('/skip') self.assertAbsent( 'flask_http_request_total', ('method', 'GET'), ('status', 200) ) self.assertAbsent( 'flask_http_request_duration_seconds_count', ('method', 'GET'), ('path', '/skip'), ('status', 200) ) def test_do_not_track_only_excludes_defaults(self): metrics = self.metrics() @self.app.route('/skip/defaults') @metrics.counter('cnt_before', 'Counter before') @metrics.do_not_track() @metrics.counter('cnt_after', 'Counter after') def test(): return 'OK' self.client.get('/skip/defaults') self.client.get('/skip/defaults') self.assertAbsent( 'flask_http_request_total', ('method', 'GET'), ('status', 200) ) self.assertAbsent( 'flask_http_request_duration_seconds_count', ('method', 'GET'), ('path', '/skip/defaults'), ('status', 200) ) self.assertMetric('cnt_before_total', 2.0) self.assertMetric('cnt_after_total', 2.0) def test_exclude_all_wrapping(self): metrics = self.metrics() @self.app.route('/skip') @metrics.gauge('gauge_before', 'Gauge before') @metrics.counter('cnt_before', 'Counter before') @metrics.exclude_all_metrics() @metrics.counter('cnt_after', 'Counter after') @metrics.gauge('gauge_after', 'Gauge after') def test(): return 'OK' self.client.get('/skip') self.client.get('/skip') self.assertAbsent( 'flask_http_request_total', ('method', 'GET'), ('status', 200) ) self.assertMetric('cnt_before_total', 0.0) self.assertMetric('cnt_after_total', 0.0) self.assertMetric('gauge_before', 0.0) self.assertMetric('gauge_after', 0.0) def test_custom_path(self): self.metrics(path='/my-metrics') @self.app.route('/test') def test(): return 'OK' self.client.get('/test') self.assertMetric( 'flask_http_request_total', '1.0', ('method', 'GET'), ('status', 200), endpoint='/my-metrics' ) self.assertMetric( 'flask_http_request_duration_seconds_count', '1.0', ('method', 'GET'), ('path', '/test'), ('status', 200), endpoint='/my-metrics' ) def test_no_default_export(self): self.metrics(export_defaults=False) @self.app.route('/test') def test(): return 'OK' self.client.get('/test') self.assertAbsent( 'flask_http_request_total', ('method', 'GET'), ('status', 200), endpoint='/metrics' ) self.assertAbsent( 'flask_http_request_duration_seconds_count', ('method', 'GET'), ('path', '/test'), ('status', 200), endpoint='/metrics' ) def test_custom_defaults_prefix(self): metrics = self.metrics(defaults_prefix='www') self.assertAbsent( 'flask_exporter_info', ('version', metrics.version) ) self.assertMetric( 'www_exporter_info', '1.0', ('version', metrics.version) ) @self.app.route('/test') def test(): return 'OK' self.client.get('/test') self.client.get('/test') self.assertAbsent( 'flask_http_request_total', ('method', 'GET'), ('status', 200) ) self.assertMetric( 'www_http_request_total', '2.0', ('method', 'GET'), ('status', 200) ) self.assertMetric( 'www_http_request_duration_seconds_count', '2.0', ('method', 'GET'), ('path', '/test'), ('status', 200) ) def test_no_defaults_prefix(self): metrics = self.metrics(defaults_prefix=NO_PREFIX) self.assertAbsent( 'flask_exporter_info', ('version', metrics.version) ) self.assertMetric( 'exporter_info', '1.0', ('version', metrics.version) ) @self.app.route('/test') def test(): return 'OK' self.client.get('/test') self.client.get('/test') self.client.get('/test') self.assertAbsent( 'flask_http_request_total', ('method', 'GET'), ('status', 200) ) self.assertMetric( 'http_request_total', '3.0', ('method', 'GET'), ('status', 200) ) self.assertMetric( 'http_request_duration_seconds_count', '3.0', ('method', 'GET'), ('path', '/test'), ('status', 200) ) def test_late_defaults_export(self): metrics = self.metrics(export_defaults=False) @self.app.route('/test') def test(): return 'OK' self.client.get('/test') self.client.get('/test') self.assertAbsent( 'flask_exporter_info', ('version', metrics.version) ) self.assertAbsent( 'late_exporter_info', ('version', metrics.version) ) self.assertAbsent( 'flask_http_request_total', ('method', 'GET'), ('status', 200) ) self.assertAbsent( 'late_http_request_total', ('method', 'GET'), ('status', 200) ) metrics.export_defaults(prefix='late') self.assertMetric( 'late_exporter_info', '1.0', ('version', metrics.version) ) self.client.get('/test') self.client.get('/test') self.client.get('/test') self.assertMetric( 'late_http_request_total', '3.0', ('method', 'GET'), ('status', 200) ) self.assertMetric( 'late_http_request_duration_seconds_count', '3.0', ('method', 'GET'), ('path', '/test'), ('status', 200) ) def test_non_automatic_endpoint_registration(self): metrics = self.metrics(path=None) @self.app.route('/test') def test(): return 'OK' self.client.get('/test') no_metrics_response = self.client.get('/metrics') self.assertEqual(no_metrics_response.status_code, 404) metrics.register_endpoint('/manual/metrics') self.client.get('/test') self.assertMetric( 'flask_http_request_total', '2.0', ('method', 'GET'), ('status', 200), endpoint='/manual/metrics' ) def test_custom_buckets(self): self.metrics(buckets=(0.2, 2, 4)) @self.app.route('/test') def test(): return 'OK' self.client.get('/test') self.client.get('/test') self.assertMetric( 'flask_http_request_duration_seconds_bucket', '2.0', ('le', '0.2'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertMetric( 'flask_http_request_duration_seconds_bucket', '2.0', ('le', '2.0'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertMetric( 'flask_http_request_duration_seconds_bucket', '2.0', ('le', '4.0'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertMetric( 'flask_http_request_duration_seconds_bucket', '2.0', ('le', '+Inf'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertAbsent( 'flask_http_request_duration_seconds_bucket', ('le', '0.1'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertAbsent( 'flask_http_request_duration_seconds_bucket', ('le', '0.3'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertAbsent( 'flask_http_request_duration_seconds_bucket', ('le', '1.2'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) self.assertAbsent( 'flask_http_request_duration_seconds_bucket', ('le', '5.0'), ('method', 'GET'), ('path', '/test'), ('status', 200) ) def test_invalid_labels(self): metrics = self.metrics() self.assertRaises( TypeError, metrics.counter, 'invalid_counter', 'Counter with invalid labels', labels=('name', 'value') ) def test_info(self): metrics = self.metrics() metrics.info('info', 'Info', x=1, y=2) self.assertMetric('info', '1.0', ('x', 1), ('y', 2)) sample = metrics.info( 'sample', 'Sample', ('key',), ('value',) ) sample.set(5) self.assertMetric('sample', '5.0', ('key', 'value')) self.assertRaises( ValueError, metrics.info, 'invalid', 'Invalid', ('both', 'names'), ('and', 'values'), are='defined' ) metrics.info('no_labels', 'Without labels') self.assertMetric('no_labels', '1.0') def test_static_labels(self): metrics = self.metrics(static_labels={ 'app_name': 'Test-App', 'api_version': 1 }) @self.app.route('/test') @metrics.counter('test_counter', 'Test Counter', labels={'code': lambda r: r.status_code}) def test(): return 'OK' self.client.get('/test') self.client.get('/test') self.assertMetric( 'flask_http_request_total', '2.0', ('method', 'GET'), ('status', 200), ('app_name', 'Test-App'), ('api_version', 1) ) self.assertMetric( 'flask_http_request_duration_seconds_count', '2.0', ('method', 'GET'), ('path', '/test'), ('status', 200), ('app_name', 'Test-App'), ('api_version', 1) ) self.assertMetric( 'test_counter_total', '2.0', ('code', 200), ('app_name', 'Test-App'), ('api_version', 1) ) self.assertMetric( 'test_counter_created', '.', ('code', 200), ('app_name', 'Test-App'), ('api_version', 1) ) self.assertMetric( 'flask_exporter_info', '', ('version', metrics.version), ('app_name', 'Test-App'), ('api_version', 1) ) def test_static_labels_without_metric_labels(self): metrics = self.metrics(static_labels={ 'app_name': 'Test-App', 'api_version': 1 }) @self.app.route('/test') @metrics.counter('test_counter', 'Test Counter') def test(): return 'OK' self.client.get('/test') self.client.get('/test') self.assertMetric( 'flask_http_request_total', '2.0', ('method', 'GET'), ('status', 200), ('app_name', 'Test-App'), ('api_version', 1) ) self.assertMetric( 'flask_http_request_duration_seconds_count', '2.0', ('method', 'GET'), ('path', '/test'), ('status', 200), ('app_name', 'Test-App'), ('api_version', 1) ) self.assertMetric( 'test_counter_total', '2.0', ('app_name', 'Test-App'), ('api_version', 1) ) self.assertMetric( 'test_counter_created', '.', ('app_name', 'Test-App'), ('api_version', 1) ) self.assertMetric( 'flask_exporter_info', '', ('version', metrics.version), ('app_name', 'Test-App'), ('api_version', 1) )
30.157576
81
0.513666
1,495
14,928
4.910368
0.074247
0.104618
0.080643
0.092086
0.817464
0.785179
0.759161
0.721564
0.686691
0.656995
0
0.0269
0.31518
14,928
494
82
30.218623
0.691187
0
0
0.628713
0
0
0.276058
0.100348
0
0
0
0
0.175743
1
0.076733
false
0
0.007426
0.037129
0.123762
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
8a9e0097cd2455da6c26d2fb7ec80bca1b000590
6,493
py
Python
tests/test_agent.py
SharifElfouly/Tic-Tac-Toe-Reinforcement-Learning
06b824d5622950fbcaa2f72dd0f24ccd064cf5d7
[ "MIT" ]
3
2017-12-19T07:12:12.000Z
2019-09-15T23:47:10.000Z
tests/test_agent.py
SharifElfouly/Tic-Tac-Toe-Reinforcement-Learning
06b824d5622950fbcaa2f72dd0f24ccd064cf5d7
[ "MIT" ]
null
null
null
tests/test_agent.py
SharifElfouly/Tic-Tac-Toe-Reinforcement-Learning
06b824d5622950fbcaa2f72dd0f24ccd064cf5d7
[ "MIT" ]
1
2019-09-15T23:47:21.000Z
2019-09-15T23:47:21.000Z
import unittest from training.agent import Agent class TestAgent(unittest.TestCase): def test_add_state(self): state1 = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0.5]] state2 = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0.75]] state3 = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0.5]] state4 = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0.8]] state5 = [[0, 0, 0, 0, 0, -1, 0, 0, 0], [0.5]] agent = Agent(1) agent.add_state(state1) agent.add_state(state2) agent.add_state(state3) agent.add_state(state4) agent.add_state(state5) self.assertEqual(len(agent.states), 5) def test_next_states(self): board = [1, 0, 0, 0, 0, -1, 0, 0, 0] state1 = [[1, 0, 0, 1, 0, -1, 0, 0, 0], [0.5]] state2 = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0.75]] state3 = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0.5]] state4 = [[1, 0, 0, 0, 0, -1, 0, 1, 0], [0.8]] agent = Agent(1) agent.add_state(state1) agent.add_state(state2) agent.add_state(state3) agent.add_state(state4) self.assertEqual(agent.next_states(board), [[[1, 0, 0, 1, 0, -1, 0, 0, 0], [0.5]], [[1, 0, 0, 0, 0, -1, 0, 1, 0], [0.8]]]) board = [1, 0, 0, 1, 0, -1, 0, -1, 0] state5 = [[1, 0, 0, 1, 0, -1, 0, 0, 0], [0.5]] state6 = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0.75]] state7 = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0.5]] state8 = [[1, 0, 0, 0, 0, -1, 0, 1, 0], [0.8]] state9 = [[1, 0, 1, 1, 0, -1, 0, -1, 0], [0.8]] state10 = [[1, 0, -1, 1, 0, -1, 0, -1, 0], [0.8]] state11 = [[1, 0, 0, 1, 0, -1, 0, -1, 1], [0.9]] agent.add_state(state5) agent.add_state(state6) agent.add_state(state7) agent.add_state(state8) agent.add_state(state9) agent.add_state(state10) agent.add_state(state11) self.assertEqual(agent.next_states(board), [[[1, 0, 1, 1, 0, -1, 0, -1, 0], [0.8]], [[1, 0, 0, 1, 0, -1, 0, -1, 1], [0.9]]]) agent = Agent(-1) board = [1, 1, 0, 1, 0, -1, 0, -1, 0] state1 = [[1, 1, 0, 1, 0, -1, 0, -1, -1], [0.5]] state2 = [[1, 1, 0, 1, 0, -1, 0, -1, 0], [0.75]] agent.add_state(state1) agent.add_state(state2) self.assertEqual(agent.next_states(board), [[[1, 1, 0, 1, 0, -1, 0, -1, -1], [0.5]]]) agent = Agent(-1) board = [1, 1, 0, 1, 0, -1, 0, -1, 0] state1 = [[1, 1, 1, 1, 0, -1, 0, -1, -1], [0.5]] state2 = [[1, 1, 0, 1, 0, -1, 1, -1, 0], [0.75]] agent.add_state(state1) agent.add_state(state2) self.assertEqual(agent.next_states(board), []) def test_greedy(self): agent = Agent(1) board = [1, 0, 0, 0, 0, -1, 0, 0, 0] state1 = [[1, 0, 1, 0, 0, -1, 0, 0, 0], [0.5]] state2 = [[1, 0, 0, 0, 1, -1, 0, 0, 0], [0.95]] state3 = [[1, 1, 0, 0, 0, -1, 0, 0, 0], [0.5]] state4 = [[1, 0, 0, 0, 0, -1, 0, 0, 1], [0.8]] agent.add_state(state1) agent.add_state(state2) agent.add_state(state3) agent.add_state(state4) self.assertEqual(agent.greedy(board), [[1, 0, 0, 0, 1, -1, 0, 0, 0], [0.95]]) agent = Agent(-1) board = [1, 0, 0, 0, 0, -1, 0, 1, 0] state1 = [[1, 0, 0, 0, 0, -1, 0, 1, -1], [0.5]] state2 = [[1, 0, 0, 0, 0, -1, 0, 1, 0], [0.95]] state3 = [[1, 0, 0, -1, 0, -1, 0, 1, 0], [0.75]] state4 = [[1, 0, 0, 0, 0, -1, 0, 1, 0], [0.8]] agent.add_state(state1) agent.add_state(state2) agent.add_state(state3) agent.add_state(state4) self.assertEqual(agent.greedy(board), [[1, 0, 0, -1, 0, -1, 0, 1, 0], [0.75]]) agent = Agent(-1) board = [1, 1, 0, 1, 0, -1, 0, -1, 0] state1 = [[1, 1, 1, 1, 0, -1, 0, -1, -1], [0.5]] state2 = [[1, 1, 0, 1, 0, -1, 1, -1, 0], [0.75]] agent.add_state(state1) agent.add_state(state2) self.assertEqual(agent.greedy(board), [[], [0]]) # contains randomness def test_backprop_state_value(self): state1 = [[1, 1, 0, 1, 1, -1, -1, -1, 0], [0.5]] state2 = [[1, 1, 0, 1, 1, -1, -1, -1, 0], [0.7]] agent = Agent(1) agent.add_state(state1) agent.add_state(state2) board = [1, 1, 0, 1, 0, -1, -1, -1, 0] agent.turn(board) self.assertEqual(agent.pre_state[1], [0.7]) self.assertEqual(agent.current_state[1], [0.7]) # not used def test_update_state(self): agent = Agent(1) state1 = [[1, 0, 0, 1, 0, -1, 0, 0, 0], [0.5]] state2 = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0.75]] state3 = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [0.5]] state4 = [[1, 0, 0, 0, 0, -1, 0, 1, 0], [0.8]] agent.add_state(state1) agent.add_state(state2) agent.add_state(state3) agent.add_state(state4) new_state_2 = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0.75]] new_state_4 = [[1, 0, 0, 0, 0, -1, 0, 1, 0], [0.15]] agent.update_state(new_state_2) agent.update_state(new_state_4) self.assertEqual(agent.states[1], new_state_2) self.assertEqual(agent.states[3], new_state_4) def test_is_state_in_states(self): agent = Agent(1) state1 = [[1, 0, 0, 1, 0, -1, 0, 0, 0], [0.5]] state2 = [[1, 0, 0, 0, 0, 0, 0, 0, 0], [0.75]] state3 = [[1, 0, 0, 1, 0, -1, 0, 0, 0], [0.5]] state4 = [[1, 0, 0, 0, 0, -1, 0, 1, 0], [0.8]] state5 = [[1, -1, 0, 0, 0, -1, 0, 1, 0], [0.8]] agent.add_state(state1) agent.add_state(state2) agent.add_state(state3) agent.add_state(state4) self.assertEqual(agent.is_state_in_states(state3), True) self.assertEqual(agent.is_state_in_states(state5), False) # contains randomness def test_turn(self): agent = Agent(1) board = [1, 0, 0, 1, 0, -1, 0, -1, 0] state1 = [[1, 1, 0, 1, 0, -1, 0, -1, 0], [0.5]] state2 = [[1, 1, 0, 1, 0, -1, 0, -1, 0], [0.75]] state3 = [[1, 1, 0, 1, 0, -1, 0, -1, 0], [0.95]] state4 = [[1, 1, 0, 1, 0, -1, 0, -1, 0], [0.8]] agent.add_state(state1) agent.add_state(state2) agent.add_state(state3) agent.add_state(state4) self.assertEqual(agent.turn(board), [1, 1, 0, 1, 0, -1, 0, -1, 0])
30.919048
93
0.451255
1,122
6,493
2.535651
0.050802
0.159578
0.155009
0.146221
0.755009
0.727592
0.726889
0.702636
0.673814
0.659051
0
0.188157
0.326351
6,493
209
94
31.066986
0.462277
0.007393
0
0.539007
0
0
0
0
0
0
0
0
0.106383
1
0.049645
false
0
0.014184
0
0.070922
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
0a1f435c8d9b28a3f2743ecb501279a00fc8f72c
6,578
py
Python
nimbleclient/v1/client.py
datamattsson/nimble-python-sdk
0d57d1de92e450332f483243140d29eeb18ad903
[ "Apache-2.0" ]
null
null
null
nimbleclient/v1/client.py
datamattsson/nimble-python-sdk
0d57d1de92e450332f483243140d29eeb18ad903
[ "Apache-2.0" ]
null
null
null
nimbleclient/v1/client.py
datamattsson/nimble-python-sdk
0d57d1de92e450332f483243140d29eeb18ad903
[ "Apache-2.0" ]
null
null
null
# # © Copyright 2020 Hewlett Packard Enterprise Development LP # # This file was auto-generated by the Python SDK generator; DO NOT EDIT. # from .restclient import NimOSAPIClient from .api.versions import VersionList from .api.application_categories import ApplicationCategoryList from .api.chap_users import ChapUserList from .api.master_key import MasterKeyList from .api.alarms import AlarmList from .api.volumes import VolumeList from .api.shelves import ShelfList from .api.key_managers import KeyManagerList from .api.protection_templates import ProtectionTemplateList from .api.folders import FolderList from .api.tokens import TokenList from .api.fibre_channel_interfaces import FibreChannelInterfaceList from .api.network_interfaces import NetworkInterfaceList from .api.arrays import ArrayList from .api.fibre_channel_configs import FibreChannelConfigList from .api.initiators import InitiatorList from .api.performance_policies import PerformancePolicyList from .api.space_domains import SpaceDomainList from .api.snapshot_collections import SnapshotCollectionList from .api.replication_partners import ReplicationPartnerList from .api.events import EventList from .api.snapshots import SnapshotList from .api.application_servers import ApplicationServerList from .api.user_policies import UserPolicyList from .api.user_groups import UserGroupList from .api.subnets import SubnetList from .api.controllers import ControllerList from .api.fibre_channel_sessions import FibreChannelSessionList from .api.users import UserList from .api.protection_schedules import ProtectionScheduleList from .api.initiator_groups import InitiatorGroupList from .api.access_control_records import AccessControlRecordList from .api.active_directory_memberships import ActiveDirectoryMembershipList from .api.fibre_channel_ports import FibreChannelPortList from .api.protocol_endpoints import ProtocolEndpointList from .api.witnesses import WitnessList from .api.jobs import JobList from .api.audit_log import AuditLogList from .api.pools import PoolList from .api.volume_collections import VolumeCollectionList from .api.disks import DiskList from .api.fibre_channel_initiator_aliases import FibreChannelInitiatorAliasList from .api.groups import GroupList from .api.software_versions import SoftwareVersionList from .api.network_configs import NetworkConfigList class Client: def __init__(self, hostname, username, password, port=5392): self._client = NimOSAPIClient(hostname, username, password, port) @property def versions(self): return VersionList(self._client) @property def application_categories(self): return ApplicationCategoryList(self._client) @property def chap_users(self): return ChapUserList(self._client) @property def master_key(self): return MasterKeyList(self._client) @property def alarms(self): return AlarmList(self._client) @property def volumes(self): return VolumeList(self._client) @property def shelves(self): return ShelfList(self._client) @property def key_managers(self): return KeyManagerList(self._client) @property def protection_templates(self): return ProtectionTemplateList(self._client) @property def folders(self): return FolderList(self._client) @property def tokens(self): return TokenList(self._client) @property def fibre_channel_interfaces(self): return FibreChannelInterfaceList(self._client) @property def network_interfaces(self): return NetworkInterfaceList(self._client) @property def arrays(self): return ArrayList(self._client) @property def fibre_channel_configs(self): return FibreChannelConfigList(self._client) @property def initiators(self): return InitiatorList(self._client) @property def performance_policies(self): return PerformancePolicyList(self._client) @property def space_domains(self): return SpaceDomainList(self._client) @property def snapshot_collections(self): return SnapshotCollectionList(self._client) @property def replication_partners(self): return ReplicationPartnerList(self._client) @property def events(self): return EventList(self._client) @property def snapshots(self): return SnapshotList(self._client) @property def application_servers(self): return ApplicationServerList(self._client) @property def user_policies(self): return UserPolicyList(self._client) @property def user_groups(self): return UserGroupList(self._client) @property def subnets(self): return SubnetList(self._client) @property def controllers(self): return ControllerList(self._client) @property def fibre_channel_sessions(self): return FibreChannelSessionList(self._client) @property def users(self): return UserList(self._client) @property def protection_schedules(self): return ProtectionScheduleList(self._client) @property def initiator_groups(self): return InitiatorGroupList(self._client) @property def access_control_records(self): return AccessControlRecordList(self._client) @property def active_directory_memberships(self): return ActiveDirectoryMembershipList(self._client) @property def fibre_channel_ports(self): return FibreChannelPortList(self._client) @property def protocol_endpoints(self): return ProtocolEndpointList(self._client) @property def witnesses(self): return WitnessList(self._client) @property def jobs(self): return JobList(self._client) @property def audit_log(self): return AuditLogList(self._client) @property def pools(self): return PoolList(self._client) @property def volume_collections(self): return VolumeCollectionList(self._client) @property def disks(self): return DiskList(self._client) @property def fibre_channel_initiator_aliases(self): return FibreChannelInitiatorAliasList(self._client) @property def groups(self): return GroupList(self._client) @property def software_versions(self): return SoftwareVersionList(self._client) @property def network_configs(self): return NetworkConfigList(self._client)
27.755274
79
0.74734
697
6,578
6.882353
0.202296
0.095893
0.165103
0.19262
0.08276
0.034397
0
0
0
0
0
0.001496
0.187139
6,578
236
80
27.872881
0.895455
0.019915
0
0.244565
1
0
0
0
0
0
0
0
0
1
0.25
false
0.01087
0.25
0.244565
0.75
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
0a328ff98106bbbaa1644a6c65e3564c33569899
301
py
Python
dbaas_credentials/admin/__init__.py
globocom/dbaas-credentials
0ddecadacbf98ee05917167006190a7b7613d219
[ "BSD-3-Clause" ]
7
2015-05-23T20:27:32.000Z
2021-07-05T16:42:01.000Z
dbaas_credentials/admin/__init__.py
globocom/dbaas-credentials
0ddecadacbf98ee05917167006190a7b7613d219
[ "BSD-3-Clause" ]
5
2017-09-03T23:54:01.000Z
2021-12-10T20:33:22.000Z
dbaas_credentials/admin/__init__.py
globocom/dbaas-credentials
0ddecadacbf98ee05917167006190a7b7613d219
[ "BSD-3-Clause" ]
1
2016-09-12T07:38:29.000Z
2016-09-12T07:38:29.000Z
# -*- coding:utf-8 -*- from django.contrib import admin from .integration_credential import CredentialAdmin from .integration_type import CredentialTypeAdmin from .. import models admin.site.register(models.CredentialType, CredentialTypeAdmin) admin.site.register(models.Credential, CredentialAdmin)
33.444444
63
0.830565
33
301
7.515152
0.515152
0.120968
0.137097
0.185484
0
0
0
0
0
0
0
0.003623
0.083056
301
8
64
37.625
0.894928
0.066445
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
0a601452393abd3a20b12f43faf8e8a2150214b5
17,259
py
Python
tests/components/automation/test_init.py
gwendalg/home-assistant
fb94aaa5a1a1e125dafb681e50c18be45dfe1b19
[ "MIT" ]
1
2017-02-12T18:44:18.000Z
2017-02-12T18:44:18.000Z
tests/components/automation/test_init.py
gwendalg/home-assistant
fb94aaa5a1a1e125dafb681e50c18be45dfe1b19
[ "MIT" ]
null
null
null
tests/components/automation/test_init.py
gwendalg/home-assistant
fb94aaa5a1a1e125dafb681e50c18be45dfe1b19
[ "MIT" ]
null
null
null
"""The tests for the automation component.""" import unittest from unittest.mock import patch from homeassistant.bootstrap import setup_component import homeassistant.components.automation as automation from homeassistant.const import ATTR_ENTITY_ID from homeassistant.exceptions import HomeAssistantError import homeassistant.util.dt as dt_util from tests.common import get_test_home_assistant class TestAutomation(unittest.TestCase): """Test the event automation.""" def setUp(self): # pylint: disable=invalid-name """Setup things to be run when tests are started.""" self.hass = get_test_home_assistant() self.hass.config.components.append('group') self.calls = [] def record_call(service): self.calls.append(service) self.hass.services.register('test', 'automation', record_call) def tearDown(self): # pylint: disable=invalid-name """Stop everything that was started.""" self.hass.stop() def test_service_data_not_a_dict(self): """Test service data not dict.""" assert not setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': { 'service': 'test.automation', 'data': 100, } } }) def test_service_specify_data(self): """Test service data.""" assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'alias': 'hello', 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': { 'service': 'test.automation', 'data_template': { 'some': '{{ trigger.platform }} - ' '{{ trigger.event.event_type }}' }, } } }) time = dt_util.utcnow() with patch('homeassistant.components.automation.utcnow', return_value=time): self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 1 assert 'event - test_event' == self.calls[0].data['some'] state = self.hass.states.get('automation.hello') assert state is not None assert state.attributes.get('last_triggered') == time state = self.hass.states.get('group.all_automations') assert state is not None assert state.attributes.get('entity_id') == ('automation.hello',) def test_service_specify_entity_id(self): """Test service data.""" assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': { 'service': 'test.automation', 'entity_id': 'hello.world' } } }) self.hass.bus.fire('test_event') self.hass.block_till_done() self.assertEqual(1, len(self.calls)) self.assertEqual(['hello.world'], self.calls[0].data.get(ATTR_ENTITY_ID)) def test_service_initial_value_off(self): """Test initial value off.""" entity_id = 'automation.hello' assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'alias': 'hello', 'initial_state': 'off', 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': { 'service': 'test.automation', 'entity_id': ['hello.world', 'hello.world2'] } } }) assert not automation.is_on(self.hass, entity_id) def test_service_initial_value_on(self): """Test initial value on.""" entity_id = 'automation.hello' assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'alias': 'hello', 'initial_state': 'on', 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': { 'service': 'test.automation', 'entity_id': ['hello.world', 'hello.world2'] } } }) assert automation.is_on(self.hass, entity_id) def test_service_specify_entity_id_list(self): """Test service data.""" assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': { 'service': 'test.automation', 'entity_id': ['hello.world', 'hello.world2'] } } }) self.hass.bus.fire('test_event') self.hass.block_till_done() self.assertEqual(1, len(self.calls)) self.assertEqual(['hello.world', 'hello.world2'], self.calls[0].data.get(ATTR_ENTITY_ID)) def test_two_triggers(self): """Test triggers.""" assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'trigger': [ { 'platform': 'event', 'event_type': 'test_event', }, { 'platform': 'state', 'entity_id': 'test.entity', } ], 'action': { 'service': 'test.automation', } } }) self.hass.bus.fire('test_event') self.hass.block_till_done() self.assertEqual(1, len(self.calls)) self.hass.states.set('test.entity', 'hello') self.hass.block_till_done() self.assertEqual(2, len(self.calls)) def test_trigger_service_ignoring_condition(self): """Test triggers.""" assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'trigger': [ { 'platform': 'event', 'event_type': 'test_event', }, ], 'condition': { 'condition': 'state', 'entity_id': 'non.existing', 'state': 'beer', }, 'action': { 'service': 'test.automation', } } }) self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 0 self.hass.services.call('automation', 'trigger', blocking=True) self.hass.block_till_done() assert len(self.calls) == 1 def test_two_conditions_with_and(self): """Test two and conditions.""" entity_id = 'test.entity' assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'trigger': [ { 'platform': 'event', 'event_type': 'test_event', }, ], 'condition': [ { 'condition': 'state', 'entity_id': entity_id, 'state': '100' }, { 'condition': 'numeric_state', 'entity_id': entity_id, 'below': 150 } ], 'action': { 'service': 'test.automation', } } }) self.hass.states.set(entity_id, 100) self.hass.bus.fire('test_event') self.hass.block_till_done() self.assertEqual(1, len(self.calls)) self.hass.states.set(entity_id, 101) self.hass.bus.fire('test_event') self.hass.block_till_done() self.assertEqual(1, len(self.calls)) self.hass.states.set(entity_id, 151) self.hass.bus.fire('test_event') self.hass.block_till_done() self.assertEqual(1, len(self.calls)) def test_automation_list_setting(self): """Event is not a valid condition.""" self.assertTrue(setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: [{ 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': { 'service': 'test.automation', } }, { 'trigger': { 'platform': 'event', 'event_type': 'test_event_2', }, 'action': { 'service': 'test.automation', } }] })) self.hass.bus.fire('test_event') self.hass.block_till_done() self.assertEqual(1, len(self.calls)) self.hass.bus.fire('test_event_2') self.hass.block_till_done() self.assertEqual(2, len(self.calls)) def test_automation_calling_two_actions(self): """Test if we can call two actions from automation definition.""" self.assertTrue(setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': [{ 'service': 'test.automation', 'data': {'position': 0}, }, { 'service': 'test.automation', 'data': {'position': 1}, }], } })) self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 2 assert self.calls[0].data['position'] == 0 assert self.calls[1].data['position'] == 1 def test_services(self): """Test the automation services for turning entities on/off.""" entity_id = 'automation.hello' assert self.hass.states.get(entity_id) is None assert not automation.is_on(self.hass, entity_id) assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'alias': 'hello', 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': { 'service': 'test.automation', } } }) assert self.hass.states.get(entity_id) is not None assert automation.is_on(self.hass, entity_id) self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 1 automation.turn_off(self.hass, entity_id) self.hass.block_till_done() assert not automation.is_on(self.hass, entity_id) self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 1 automation.toggle(self.hass, entity_id) self.hass.block_till_done() assert automation.is_on(self.hass, entity_id) self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 2 automation.trigger(self.hass, entity_id) self.hass.block_till_done() assert len(self.calls) == 3 automation.turn_off(self.hass, entity_id) self.hass.block_till_done() automation.trigger(self.hass, entity_id) self.hass.block_till_done() assert len(self.calls) == 4 automation.turn_on(self.hass, entity_id) self.hass.block_till_done() assert automation.is_on(self.hass, entity_id) @patch('homeassistant.config.load_yaml_config_file', return_value={ automation.DOMAIN: { 'alias': 'bye', 'trigger': { 'platform': 'event', 'event_type': 'test_event2', }, 'action': { 'service': 'test.automation', 'data_template': { 'event': '{{ trigger.event.event_type }}' } } } }) def test_reload_config_service(self, mock_load_yaml): """Test the reload config service.""" assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'alias': 'hello', 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': { 'service': 'test.automation', 'data_template': { 'event': '{{ trigger.event.event_type }}' } } } }) assert self.hass.states.get('automation.hello') is not None assert self.hass.states.get('automation.bye') is None listeners = self.hass.bus.listeners assert listeners.get('test_event') == 1 assert listeners.get('test_event2') is None self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 1 assert self.calls[0].data.get('event') == 'test_event' automation.reload(self.hass) self.hass.block_till_done() # De-flake ?! self.hass.block_till_done() assert self.hass.states.get('automation.hello') is None assert self.hass.states.get('automation.bye') is not None listeners = self.hass.bus.listeners assert listeners.get('test_event') is None assert listeners.get('test_event2') == 1 self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 1 self.hass.bus.fire('test_event2') self.hass.block_till_done() assert len(self.calls) == 2 assert self.calls[1].data.get('event') == 'test_event2' @patch('homeassistant.config.load_yaml_config_file', return_value={ automation.DOMAIN: 'not valid', }) def test_reload_config_when_invalid_config(self, mock_load_yaml): """Test the reload config service handling invalid config.""" assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'alias': 'hello', 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': { 'service': 'test.automation', 'data_template': { 'event': '{{ trigger.event.event_type }}' } } } }) assert self.hass.states.get('automation.hello') is not None self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 1 assert self.calls[0].data.get('event') == 'test_event' automation.reload(self.hass) self.hass.block_till_done() assert self.hass.states.get('automation.hello') is not None self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 2 def test_reload_config_handles_load_fails(self): """Test the reload config service.""" assert setup_component(self.hass, automation.DOMAIN, { automation.DOMAIN: { 'alias': 'hello', 'trigger': { 'platform': 'event', 'event_type': 'test_event', }, 'action': { 'service': 'test.automation', 'data_template': { 'event': '{{ trigger.event.event_type }}' } } } }) assert self.hass.states.get('automation.hello') is not None self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 1 assert self.calls[0].data.get('event') == 'test_event' with patch('homeassistant.config.load_yaml_config_file', side_effect=HomeAssistantError('bla')): automation.reload(self.hass) self.hass.block_till_done() assert self.hass.states.get('automation.hello') is not None self.hass.bus.fire('test_event') self.hass.block_till_done() assert len(self.calls) == 2
33.577821
73
0.497827
1,649
17,259
5.031534
0.09339
0.104134
0.051705
0.067615
0.792214
0.762083
0.73171
0.718091
0.710136
0.677474
0
0.006426
0.377832
17,259
513
74
33.643275
0.766251
0.03911
0
0.625
0
0
0.166141
0.018743
0
0
0
0
0.174528
1
0.042453
false
0
0.018868
0
0.063679
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
6a4ff4e921a7092acf678b87aa309a02845e7f8c
118
py
Python
webapps/experimental/fastapi-example/app/dependencies.py
mandarup/lab140
fe235e8068793b74b7c5ca5d129dad09485dc5d3
[ "MIT" ]
null
null
null
webapps/experimental/fastapi-example/app/dependencies.py
mandarup/lab140
fe235e8068793b74b7c5ca5d129dad09485dc5d3
[ "MIT" ]
4
2021-06-02T00:31:05.000Z
2022-03-12T00:03:01.000Z
webapps/experimental/fastapi-example/app/dependencies.py
mandarup/lab140
fe235e8068793b74b7c5ca5d129dad09485dc5d3
[ "MIT" ]
null
null
null
from starlette.requests import Request # Dependency async def get_db(request: Request): return request.state.db
16.857143
38
0.779661
16
118
5.6875
0.75
0
0
0
0
0
0
0
0
0
0
0
0.152542
118
6
39
19.666667
0.91
0.084746
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
6a6b61c835220061fb1972c4cd894e71548590c1
67
py
Python
scripts/test/test/__init__.py
cedar101/quepy-ko
532744e50d9754befeea2eff6a261fa9cd095473
[ "BSD-3-Clause" ]
null
null
null
scripts/test/test/__init__.py
cedar101/quepy-ko
532744e50d9754befeea2eff6a261fa9cd095473
[ "BSD-3-Clause" ]
null
null
null
scripts/test/test/__init__.py
cedar101/quepy-ko
532744e50d9754befeea2eff6a261fa9cd095473
[ "BSD-3-Clause" ]
null
null
null
# coding: utf-8 """ Init for test quepy. """ from basic import *
8.375
20
0.61194
10
67
4.1
1
0
0
0
0
0
0
0
0
0
0
0.019231
0.223881
67
7
21
9.571429
0.769231
0.522388
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
6adee711283eb350b34e3371779770e0ada8e606
6,765
py
Python
test/test_snc_api_fields.py
ServiceNow/PySNC
4be8fa19e1a15fa2d0cc1b1e5d4c96ed4857b735
[ "MIT" ]
22
2020-10-22T23:44:50.000Z
2022-03-26T11:21:39.000Z
test/test_snc_api_fields.py
vetsin/PySNC
c44558ad0ca118861183d304369600d7fb5e45f3
[ "MIT" ]
15
2020-11-09T23:27:05.000Z
2021-05-20T02:47:55.000Z
test/test_snc_api_fields.py
vetsin/PySNC
c44558ad0ca118861183d304369600d7fb5e45f3
[ "MIT" ]
9
2020-10-23T01:58:13.000Z
2022-03-22T22:32:03.000Z
from unittest import TestCase from pysnc import ServiceNowClient from constants import Constants class TestRecordFields(TestCase): c = Constants() def test_field_limit(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') gr.fields = 'sys_id,name' r = gr.get('6816f79cc0a8016401c5a33be04be441') print(gr.serialize()) self.assertEqual(r, True) sobj = gr.serialize() self.assertTrue('sys_id' in sobj) self.assertFalse('sys_created_on' in sobj) client.session.close() def test_field_limit_query(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') gr.limit = 1 gr.fields = 'sys_id,name' gr.query() gr.next() print(gr.serialize()) sobj = gr.serialize() self.assertTrue('sys_id' in sobj) self.assertFalse('sys_created_on' in sobj) client.session.close() def test_field_bool(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') gr.fields = 'sys_id,active' gr.get('6816f79cc0a8016401c5a33be04be441') print(gr.serialize()) self.assertEqual(gr.active, 'true') client.session.close() def test_field_access(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') gr.fields = 'sys_id,name' gr.get('6816f79cc0a8016401c5a33be04be441') print(gr.serialize()) name = 'System Administrator' self.assertEqual(gr.name, name) self.assertEqual(gr.get_value('name'), name) self.assertEqual(gr.get_display_value('name'), name) client.session.close() def test_field_contains(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') gr.fields = 'sys_id,name' gr.get('6816f79cc0a8016401c5a33be04be441') print(gr.serialize()) self.assertTrue('name' in gr) self.assertFalse('whatever' in gr) client.session.close() def test_field_set(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') gr.fields = 'sys_id,name' gr.get('6816f79cc0a8016401c5a33be04be441') print(gr.serialize()) name = 'System Administrator' self.assertEqual(gr.name, name) gr.name = 'Whatever' self.assertEqual(gr.name, 'Whatever') gr.set_value('name', 'Test') self.assertEqual(gr.name, 'Test') self.assertEqual(gr.get_value('name'), 'Test') client.session.close() def test_field_set_init(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') gr.initialize() name = 'System Administrator' gr.name = name self.assertEqual(gr.name, name) gr.set_value('name', 'Test') self.assertEqual(gr.name, 'Test') self.assertEqual(gr.get_value('name'), 'Test') client.session.close() def test_fields(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') gr.fields = ['sys_id'] gr.limit = 4 gr.query() count = 0 while gr.next(): count = count + 1 assert len(gr._current().keys()) == 1 self.assertEqual(count, 4) client.session.close() def test_field_getter(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') gr.fields = ['sys_id'] self.assertEqual(gr.fields, ['sys_id']) client.session.close() def test_field_all(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') self.assertIsNone(gr.fields) gr.query() self.assertIsNotNone(gr.fields) client.session.close() def test_field_getter_query(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') self.assertEqual(gr.fields, None) gr.limit = 1 gr.query() self.assertIsNotNone(gr.fields) self.assertGreater(len(gr.fields), 10) gr.next() print(gr.fields) self.assertGreater(len(gr.fields), 10) client.session.close() def test_attrs(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') r = gr.get('6816f79cc0a8016401c5a33be04be441') self.assertEqual(r, True) self.assertEqual(gr.sys_id, '6816f79cc0a8016401c5a33be04be441') self.assertEqual(gr.get_value('sys_id'), '6816f79cc0a8016401c5a33be04be441') self.assertEqual(gr.get_display_value('user_password'), '********') client.session.close() def test_attrs_nil(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') r = gr.get('6816f79cc0a8016401c5a33be04be441') self.assertEqual(r, True) self.assertIsNotNone(gr.get_element('sys_id')) self.assertIsNone(gr.get_element('asdf')) self.assertEqual(gr.get_element('sys_id').nil(), False) gr.sys_id = '' self.assertEqual(gr.get_element('sys_id').nil(), True) client.session.close() def test_attrs_changes(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') r = gr.get('6816f79cc0a8016401c5a33be04be441') self.assertEqual(r, True) self.assertIsNotNone(gr.get_element('sys_id')) self.assertIsNone(gr.get_element('asdf')) self.assertEqual(gr.get_element('sys_id').changes(), False) gr.sys_id = '1234' self.assertEqual(gr.get_element('sys_id').changes(), True) client.session.close() def test_attrs_changes(self): client = ServiceNowClient(self.c.server, self.c.credentials) gr = client.GlideRecord('sys_user') gr.initialize() self.assertTrue(gr.is_new_record()) self.assertIsNone(gr.get_element('sys_id')) gr.sys_id = 'zzzz' # i am not considering a state of nothing to something a change, merely the start of existence self.assertEqual(gr.get_element('sys_id').changes(), False) gr.sys_id = '1234' self.assertEqual(gr.get_element('sys_id').changes(), True) client.session.close()
36.370968
102
0.632816
792
6,765
5.277778
0.122475
0.035885
0.089474
0.107656
0.843301
0.828947
0.745933
0.69067
0.630861
0.630861
0
0.046381
0.238285
6,765
185
103
36.567568
0.764797
0.013599
0
0.7125
0
0
0.12099
0.047976
0
0
0
0
0.28125
1
0.09375
false
0.00625
0.01875
0
0.125
0.04375
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
6ae4ecb2d916c8dfba2415d54ea44254c0564119
209
py
Python
src/auth_session.py
galiarmero/yahoo-login
3415c1c00efc37af87b203b5576435dd823059db
[ "MIT" ]
5
2019-04-11T13:30:35.000Z
2021-11-28T17:05:54.000Z
src/auth_session.py
galiarmero/yahoo-login
3415c1c00efc37af87b203b5576435dd823059db
[ "MIT" ]
null
null
null
src/auth_session.py
galiarmero/yahoo-login
3415c1c00efc37af87b203b5576435dd823059db
[ "MIT" ]
null
null
null
class AuthSession(object): def __init__(self, session): self._session = session def __enter__(self): return self._session def __exit__(self, *args): self._session.close()
20.9
32
0.636364
23
209
5.130435
0.521739
0.372881
0
0
0
0
0
0
0
0
0
0
0.258373
209
10
33
20.9
0.76129
0
0
0
0
0
0
0
0
0
0
0
0
1
0.428571
false
0
0
0.142857
0.714286
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
1
0
0
0
1
1
0
0
5
7c28a72a883e1bed11a0bd7f4f5101284397f670
15,327
py
Python
tests/components/group/test_light.py
alindeman/home-assistant
b274b10f3874c196f0db8f9cfa5f47eb756d1f8e
[ "Apache-2.0" ]
4
2019-07-03T22:36:57.000Z
2019-08-10T15:33:25.000Z
tests/components/group/test_light.py
alindeman/home-assistant
b274b10f3874c196f0db8f9cfa5f47eb756d1f8e
[ "Apache-2.0" ]
7
2019-08-23T05:26:02.000Z
2022-03-11T23:57:18.000Z
tests/components/group/test_light.py
alindeman/home-assistant
b274b10f3874c196f0db8f9cfa5f47eb756d1f8e
[ "Apache-2.0" ]
3
2019-04-28T16:35:45.000Z
2020-05-28T15:21:59.000Z
"""The tests for the Group Light platform.""" from unittest.mock import MagicMock import asynctest import homeassistant.components.group.light as group from homeassistant.setup import async_setup_component from tests.components.light import common async def test_default_state(hass): """Test light group default state.""" await async_setup_component(hass, 'light', {'light': { 'platform': 'group', 'entities': [], 'name': 'Bedroom Group' }}) await hass.async_block_till_done() state = hass.states.get('light.bedroom_group') assert state is not None assert state.state == 'unavailable' assert state.attributes['supported_features'] == 0 assert state.attributes.get('brightness') is None assert state.attributes.get('hs_color') is None assert state.attributes.get('color_temp') is None assert state.attributes.get('white_value') is None assert state.attributes.get('effect_list') is None assert state.attributes.get('effect') is None async def test_state_reporting(hass): """Test the state reporting.""" await async_setup_component(hass, 'light', {'light': { 'platform': 'group', 'entities': ['light.test1', 'light.test2'] }}) hass.states.async_set('light.test1', 'on') hass.states.async_set('light.test2', 'unavailable') await hass.async_block_till_done() assert hass.states.get('light.light_group').state == 'on' hass.states.async_set('light.test1', 'on') hass.states.async_set('light.test2', 'off') await hass.async_block_till_done() assert hass.states.get('light.light_group').state == 'on' hass.states.async_set('light.test1', 'off') hass.states.async_set('light.test2', 'off') await hass.async_block_till_done() assert hass.states.get('light.light_group').state == 'off' hass.states.async_set('light.test1', 'unavailable') hass.states.async_set('light.test2', 'unavailable') await hass.async_block_till_done() assert hass.states.get('light.light_group').state == 'unavailable' async def test_brightness(hass): """Test brightness reporting.""" await async_setup_component(hass, 'light', {'light': { 'platform': 'group', 'entities': ['light.test1', 'light.test2'] }}) hass.states.async_set('light.test1', 'on', {'brightness': 255, 'supported_features': 1}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.state == 'on' assert state.attributes['supported_features'] == 1 assert state.attributes['brightness'] == 255 hass.states.async_set('light.test2', 'on', {'brightness': 100, 'supported_features': 1}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.state == 'on' assert state.attributes['brightness'] == 177 hass.states.async_set('light.test1', 'off', {'brightness': 255, 'supported_features': 1}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.state == 'on' assert state.attributes['supported_features'] == 1 assert state.attributes['brightness'] == 100 async def test_color(hass): """Test RGB reporting.""" await async_setup_component(hass, 'light', {'light': { 'platform': 'group', 'entities': ['light.test1', 'light.test2'] }}) hass.states.async_set('light.test1', 'on', {'hs_color': (0, 100), 'supported_features': 16}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.state == 'on' assert state.attributes['supported_features'] == 16 assert state.attributes['hs_color'] == (0, 100) hass.states.async_set('light.test2', 'on', {'hs_color': (0, 50), 'supported_features': 16}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['hs_color'] == (0, 75) hass.states.async_set('light.test1', 'off', {'hs_color': (0, 0), 'supported_features': 16}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['hs_color'] == (0, 50) async def test_white_value(hass): """Test white value reporting.""" await async_setup_component(hass, 'light', {'light': { 'platform': 'group', 'entities': ['light.test1', 'light.test2'] }}) hass.states.async_set('light.test1', 'on', {'white_value': 255, 'supported_features': 128}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['white_value'] == 255 hass.states.async_set('light.test2', 'on', {'white_value': 100, 'supported_features': 128}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['white_value'] == 177 hass.states.async_set('light.test1', 'off', {'white_value': 255, 'supported_features': 128}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['white_value'] == 100 async def test_color_temp(hass): """Test color temp reporting.""" await async_setup_component(hass, 'light', {'light': { 'platform': 'group', 'entities': ['light.test1', 'light.test2'] }}) hass.states.async_set('light.test1', 'on', {'color_temp': 2, 'supported_features': 2}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['color_temp'] == 2 hass.states.async_set('light.test2', 'on', {'color_temp': 1000, 'supported_features': 2}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['color_temp'] == 501 hass.states.async_set('light.test1', 'off', {'color_temp': 2, 'supported_features': 2}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['color_temp'] == 1000 async def test_min_max_mireds(hass): """Test min/max mireds reporting.""" await async_setup_component(hass, 'light', {'light': { 'platform': 'group', 'entities': ['light.test1', 'light.test2'] }}) hass.states.async_set('light.test1', 'on', {'min_mireds': 2, 'max_mireds': 5, 'supported_features': 2}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['min_mireds'] == 2 assert state.attributes['max_mireds'] == 5 hass.states.async_set('light.test2', 'on', {'min_mireds': 7, 'max_mireds': 1234567890, 'supported_features': 2}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['min_mireds'] == 2 assert state.attributes['max_mireds'] == 1234567890 hass.states.async_set('light.test1', 'off', {'min_mireds': 1, 'max_mireds': 2, 'supported_features': 2}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['min_mireds'] == 1 assert state.attributes['max_mireds'] == 1234567890 async def test_effect_list(hass): """Test effect_list reporting.""" await async_setup_component(hass, 'light', {'light': { 'platform': 'group', 'entities': ['light.test1', 'light.test2'] }}) hass.states.async_set('light.test1', 'on', {'effect_list': ['None', 'Random', 'Colorloop'], 'supported_features': 4}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert set(state.attributes['effect_list']) == { 'None', 'Random', 'Colorloop'} hass.states.async_set('light.test2', 'on', {'effect_list': ['None', 'Random', 'Rainbow'], 'supported_features': 4}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert set(state.attributes['effect_list']) == { 'None', 'Random', 'Colorloop', 'Rainbow'} hass.states.async_set('light.test1', 'off', {'effect_list': ['None', 'Colorloop', 'Seven'], 'supported_features': 4}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert set(state.attributes['effect_list']) == { 'None', 'Random', 'Colorloop', 'Seven', 'Rainbow'} async def test_effect(hass): """Test effect reporting.""" await async_setup_component(hass, 'light', {'light': { 'platform': 'group', 'entities': ['light.test1', 'light.test2', 'light.test3'] }}) hass.states.async_set('light.test1', 'on', {'effect': 'None', 'supported_features': 6}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['effect'] == 'None' hass.states.async_set('light.test2', 'on', {'effect': 'None', 'supported_features': 6}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['effect'] == 'None' hass.states.async_set('light.test3', 'on', {'effect': 'Random', 'supported_features': 6}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['effect'] == 'None' hass.states.async_set('light.test1', 'off', {'effect': 'None', 'supported_features': 6}) hass.states.async_set('light.test2', 'off', {'effect': 'None', 'supported_features': 6}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['effect'] == 'Random' async def test_supported_features(hass): """Test supported features reporting.""" await async_setup_component(hass, 'light', {'light': { 'platform': 'group', 'entities': ['light.test1', 'light.test2'] }}) hass.states.async_set('light.test1', 'on', {'supported_features': 0}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['supported_features'] == 0 hass.states.async_set('light.test2', 'on', {'supported_features': 2}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['supported_features'] == 2 hass.states.async_set('light.test1', 'off', {'supported_features': 41}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['supported_features'] == 43 hass.states.async_set('light.test2', 'off', {'supported_features': 256}) await hass.async_block_till_done() state = hass.states.get('light.light_group') assert state.attributes['supported_features'] == 41 async def test_service_calls(hass): """Test service calls.""" await async_setup_component(hass, 'light', {'light': [ {'platform': 'demo'}, {'platform': 'group', 'entities': ['light.bed_light', 'light.ceiling_lights', 'light.kitchen_lights']} ]}) await hass.async_block_till_done() assert hass.states.get('light.light_group').state == 'on' await common.async_toggle(hass, 'light.light_group') assert hass.states.get('light.bed_light').state == 'off' assert hass.states.get('light.ceiling_lights').state == 'off' assert hass.states.get('light.kitchen_lights').state == 'off' await common.async_turn_on(hass, 'light.light_group') assert hass.states.get('light.bed_light').state == 'on' assert hass.states.get('light.ceiling_lights').state == 'on' assert hass.states.get('light.kitchen_lights').state == 'on' await common.async_turn_off(hass, 'light.light_group') assert hass.states.get('light.bed_light').state == 'off' assert hass.states.get('light.ceiling_lights').state == 'off' assert hass.states.get('light.kitchen_lights').state == 'off' await common.async_turn_on(hass, 'light.light_group', brightness=128, effect='Random', rgb_color=(42, 255, 255)) state = hass.states.get('light.bed_light') assert state.state == 'on' assert state.attributes['brightness'] == 128 assert state.attributes['effect'] == 'Random' assert state.attributes['rgb_color'] == (42, 255, 255) state = hass.states.get('light.ceiling_lights') assert state.state == 'on' assert state.attributes['brightness'] == 128 assert state.attributes['effect'] == 'Random' assert state.attributes['rgb_color'] == (42, 255, 255) state = hass.states.get('light.kitchen_lights') assert state.state == 'on' assert state.attributes['brightness'] == 128 assert state.attributes['effect'] == 'Random' assert state.attributes['rgb_color'] == (42, 255, 255) async def test_invalid_service_calls(hass): """Test invalid service call arguments get discarded.""" add_entities = MagicMock() await group.async_setup_platform(hass, { 'entities': ['light.test1', 'light.test2'] }, add_entities) assert add_entities.call_count == 1 grouped_light = add_entities.call_args[0][0][0] grouped_light.hass = hass with asynctest.patch.object(hass.services, 'async_call') as mock_call: await grouped_light.async_turn_on(brightness=150, four_oh_four='404') data = { 'entity_id': ['light.test1', 'light.test2'], 'brightness': 150 } mock_call.assert_called_once_with('light', 'turn_on', data, blocking=True) mock_call.reset_mock() await grouped_light.async_turn_off(transition=4, four_oh_four='404') data = { 'entity_id': ['light.test1', 'light.test2'], 'transition': 4 } mock_call.assert_called_once_with('light', 'turn_off', data, blocking=True) mock_call.reset_mock() data = { 'brightness': 150, 'xy_color': (0.5, 0.42), 'rgb_color': (80, 120, 50), 'color_temp': 1234, 'white_value': 1, 'effect': 'Sunshine', 'transition': 4, 'flash': 'long' } await grouped_light.async_turn_on(**data) data['entity_id'] = ['light.test1', 'light.test2'] data.pop('rgb_color') data.pop('xy_color') mock_call.assert_called_once_with('light', 'turn_on', data, blocking=True)
39.3
77
0.617342
1,816
15,327
5.007159
0.069934
0.08688
0.103926
0.0871
0.816672
0.797866
0.760255
0.708897
0.660838
0.660838
0
0.025619
0.228355
15,327
389
78
39.401028
0.743215
0.002545
0
0.611842
0
0
0.252454
0
0
0
0
0
0.246711
1
0
false
0
0.016447
0
0.016447
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
7c37df20ee1faccd13333ada0194aec57abd54bc
114
py
Python
bumblebee/bases/__init__.py
Eye-C-U/bumblebee
7c5f41ae719ca75e103c52e5269e25a813720367
[ "MIT" ]
6
2020-12-27T16:13:33.000Z
2021-01-15T15:07:54.000Z
bumblebee/bases/__init__.py
Eye-C-U/bumblebee
7c5f41ae719ca75e103c52e5269e25a813720367
[ "MIT" ]
null
null
null
bumblebee/bases/__init__.py
Eye-C-U/bumblebee
7c5f41ae719ca75e103c52e5269e25a813720367
[ "MIT" ]
null
null
null
from .Dataset import Dataset from .Source import Source from .Effect import Effect from .IManager import IManager
22.8
30
0.824561
16
114
5.875
0.375
0
0
0
0
0
0
0
0
0
0
0
0.140351
114
4
31
28.5
0.959184
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
7c7012ebbf472f676a9a5124871926406910da57
24
py
Python
ml_helpers/__init__.py
zlee406/ml_helpers
2916be71c09639d091d823c2673e7b4fae5e9ce3
[ "MIT" ]
null
null
null
ml_helpers/__init__.py
zlee406/ml_helpers
2916be71c09639d091d823c2673e7b4fae5e9ce3
[ "MIT" ]
null
null
null
ml_helpers/__init__.py
zlee406/ml_helpers
2916be71c09639d091d823c2673e7b4fae5e9ce3
[ "MIT" ]
null
null
null
from . import MLPrograms
24
24
0.833333
3
24
6.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.125
24
1
24
24
0.952381
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
7c7fb8ece5a556c3eec3cc7c8f58087aaa36e6af
315
py
Python
toga/platform/gtk/widgets/passwordinput.py
r1chardj0n3s/toga
76a8aa44854cac31c7c29d96a2717a711411cde0
[ "BSD-3-Clause" ]
null
null
null
toga/platform/gtk/widgets/passwordinput.py
r1chardj0n3s/toga
76a8aa44854cac31c7c29d96a2717a711411cde0
[ "BSD-3-Clause" ]
null
null
null
toga/platform/gtk/widgets/passwordinput.py
r1chardj0n3s/toga
76a8aa44854cac31c7c29d96a2717a711411cde0
[ "BSD-3-Clause" ]
null
null
null
from __future__ import print_function, absolute_import, division from .textinput import TextInput class PasswordInput(TextInput): def __init__(self): super(PasswordInput, self).__init__() def _startup(self): super(PasswordInput, self)._startup() self._impl.set_visibility(False)
24.230769
64
0.730159
34
315
6.235294
0.558824
0.084906
0.207547
0.245283
0
0
0
0
0
0
0
0
0.180952
315
12
65
26.25
0.821705
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0.375
0.25
0
0.625
0.125
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
1
0
0
1
0
0
5
7cbbda508107ac002766265c3acff4a4311b2301
2,284
py
Python
tests/terraform/checks/resource/aws/test_RDSClusterEncrypted.py
jamesholland-uk/checkov
d73fd4bd7096d48ab3434a92a177bcc55605460a
[ "Apache-2.0" ]
4,013
2019-12-09T13:16:54.000Z
2022-03-31T14:31:01.000Z
tests/terraform/checks/resource/aws/test_RDSClusterEncrypted.py
jamesholland-uk/checkov
d73fd4bd7096d48ab3434a92a177bcc55605460a
[ "Apache-2.0" ]
1,258
2019-12-17T09:55:51.000Z
2022-03-31T19:17:17.000Z
tests/terraform/checks/resource/aws/test_RDSClusterEncrypted.py
jamesholland-uk/checkov
d73fd4bd7096d48ab3434a92a177bcc55605460a
[ "Apache-2.0" ]
638
2019-12-19T08:57:38.000Z
2022-03-30T21:38:37.000Z
import unittest import hcl2 from checkov.terraform.checks.resource.aws.RDSClusterEncrypted import check from checkov.common.models.enums import CheckResult class TestRDSClusterEncrypted(unittest.TestCase): def test_failure(self): hcl_res = hcl2.loads(""" resource "aws_rds_global_cluster" "example" { provider = aws.primary global_cluster_identifier = "example" } """) resource_conf = hcl_res['resource'][0]['aws_rds_global_cluster']['example'] scan_result = check.scan_resource_conf(conf=resource_conf) self.assertEqual(CheckResult.FAILED, scan_result) def test_failure_explicit(self): hcl_res = hcl2.loads(""" resource "aws_rds_global_cluster" "example" { provider = aws.primary global_cluster_identifier = "example" storage_encrypted = false } """) resource_conf = hcl_res['resource'][0]['aws_rds_global_cluster']['example'] scan_result = check.scan_resource_conf(conf=resource_conf) self.assertEqual(CheckResult.FAILED, scan_result) def test_success(self): hcl_res = hcl2.loads(""" resource "aws_rds_global_cluster" "example" { provider = aws.primary global_cluster_identifier = "example" storage_encrypted = true } """) resource_conf = hcl_res['resource'][0]['aws_rds_global_cluster']['example'] scan_result = check.scan_resource_conf(conf=resource_conf) self.assertEqual(CheckResult.PASSED, scan_result) def test_success_with_source_db_cluster_identifier(self): hcl_res = hcl2.loads(""" resource "aws_rds_global_cluster" "example" { provider = aws.primary global_cluster_identifier = "example" source_db_cluster_identifier = "some_arn" } """) resource_conf = hcl_res['resource'][0]['aws_rds_global_cluster']['example'] scan_result = check.scan_resource_conf(conf=resource_conf) self.assertEqual(CheckResult.UNKNOWN, scan_result) if __name__ == '__main__': unittest.main()
36.253968
83
0.625657
235
2,284
5.706383
0.229787
0.116331
0.071588
0.113348
0.758389
0.735272
0.735272
0.735272
0.735272
0.735272
0
0.005455
0.277583
2,284
62
84
36.83871
0.807273
0
0
0.6
0
0
0.454904
0.136602
0
0
0
0
0.08
1
0.08
false
0.02
0.08
0
0.18
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
7cc99714418101c12a01b1538a0f4e89e4b68e1b
8,192
py
Python
test/functional/tests/lazy_writes/recovery/test_recovery_flush_reset.py
sirizhou/open-cas-linux
e623c44b3b637238a8c6041f8659d8eb3766b91c
[ "BSD-3-Clause-Clear" ]
null
null
null
test/functional/tests/lazy_writes/recovery/test_recovery_flush_reset.py
sirizhou/open-cas-linux
e623c44b3b637238a8c6041f8659d8eb3766b91c
[ "BSD-3-Clause-Clear" ]
null
null
null
test/functional/tests/lazy_writes/recovery/test_recovery_flush_reset.py
sirizhou/open-cas-linux
e623c44b3b637238a8c6041f8659d8eb3766b91c
[ "BSD-3-Clause-Clear" ]
null
null
null
# # Copyright(c) 2019-2020 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause-Clear # import os import pytest from api.cas import casadm, cli from api.cas.cache_config import CacheMode, CacheModeTrait, CleaningPolicy, SeqCutOffPolicy from core.test_run import TestRun from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan from test_tools.dd import Dd from test_tools.disk_utils import Filesystem from test_utils import os_utils from test_utils.os_utils import Udev from test_utils.output import CmdException from test_utils.size import Size, Unit from tests.lazy_writes.recovery.recovery_tests_methods import create_test_files, copy_file, \ compare_files, power_cycle_dut mount_point = "/mnt" test_file_size = Size(1.5, Unit.GibiByte) @pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand])) @pytest.mark.require_disk("core", DiskTypeLowerThan("cache")) @pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites)) @pytest.mark.require_plugin("power_control") def test_recovery_flush_reset_raw(cache_mode): """ title: Recovery after reset during cache flushing - test on raw device. description: | Verify that unflushed data can be safely recovered, when reset was pressed during data flushing on raw device. pass_criteria: - CAS recovers successfully after reboot - No data corruption """ with TestRun.step("Prepare cache and core devices."): cache_disk = TestRun.disks['cache'] core_disk = TestRun.disks['core'] cache_disk.create_partitions([Size(2, Unit.GibiByte)]) core_disk.create_partitions([Size(16, Unit.GibiByte)] * 2) cache_device = cache_disk.partitions[0] core_device = core_disk.partitions[0] core_device_link = core_device.get_device_link("/dev/disk/by-id") cache_device_link = cache_device.get_device_link("/dev/disk/by-id") with TestRun.step("Create test files."): source_file, target_file = create_test_files(test_file_size) with TestRun.step("Setup cache and add core."): cache = casadm.start_cache(cache_device, cache_mode) core = cache.add_core(core_device) cache.set_cleaning_policy(CleaningPolicy.nop) cache.set_seq_cutoff_policy(SeqCutOffPolicy.never) with TestRun.step("Copy file to CAS."): copy_file(source=source_file.full_path, target=core.path, size=test_file_size, direct="oflag") with TestRun.step("Sync and flush buffers."): os_utils.sync() output = TestRun.executor.run(f"hdparm -f {core.path}") if output.exit_code != 0: raise CmdException("Error during hdparm", output) with TestRun.step("Trigger flush."): TestRun.executor.run_in_background(cli.flush_cache_cmd(f"{cache.cache_id}")) with TestRun.step("Hard reset DUT during data flushing."): power_cycle_dut(wait_for_flush_begin=True, core_device=core_device) cache_device.path = cache_device_link.get_target() core_device.path = core_device_link.get_target() with TestRun.step("Copy file from core and check if current md5sum is different than " "before restart."): copy_file(source=core_device_link.get_target(), target=target_file.full_path, size=test_file_size, direct="iflag") compare_files(source_file, target_file, should_differ=True) with TestRun.step("Load cache."): cache = casadm.load_cache(cache_device) if cache.get_dirty_blocks() == Size.zero(): TestRun.fail("There are no dirty blocks on cache device.") with TestRun.step("Stop cache with dirty data flush."): core_writes_before = core_device.get_io_stats().sectors_written cache.stop() if core_writes_before >= core_device.get_io_stats().sectors_written: TestRun.fail("No data was flushed after stopping cache started with load option.") with TestRun.step("Copy test file from core device to temporary location. " "Compare it with the first version – they should be the same."): copy_file(source=core_device_link.get_target(), target=target_file.full_path, size=test_file_size, direct="iflag") compare_files(source_file, target_file) with TestRun.step("Cleanup core device and remove test files."): target_file.remove() source_file.remove() @pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand])) @pytest.mark.require_disk("core", DiskTypeLowerThan("cache")) @pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites)) @pytest.mark.parametrizex("fs", [Filesystem.xfs, Filesystem.ext4]) @pytest.mark.require_plugin("power_control") def test_recovery_flush_reset_fs(cache_mode, fs): """ title: Recovery after reset during cache flushing - test on filesystem. description: | Verify that unflushed data can be safely recovered, when reset was pressed during data flushing on filesystem. pass_criteria: - CAS recovers successfully after reboot - No data corruption """ with TestRun.step("Prepare cache and core devices."): cache_disk = TestRun.disks['cache'] core_disk = TestRun.disks['core'] cache_disk.create_partitions([Size(2, Unit.GibiByte)]) core_disk.create_partitions([Size(16, Unit.GibiByte)] * 2) cache_device = cache_disk.partitions[0] core_device = core_disk.partitions[0] core_device_link = core_device.get_device_link("/dev/disk/by-id") cache_device_link = cache_device.get_device_link("/dev/disk/by-id") with TestRun.step(f"Create {fs} filesystem on core."): core_device.create_filesystem(fs) with TestRun.step("Create test files."): source_file, target_file = create_test_files(test_file_size) with TestRun.step("Setup cache and add core."): cache = casadm.start_cache(cache_device, cache_mode) Udev.disable() core = cache.add_core(core_device) cache.set_cleaning_policy(CleaningPolicy.nop) cache.set_seq_cutoff_policy(SeqCutOffPolicy.never) with TestRun.step("Mount CAS device."): core.mount(mount_point) with TestRun.step("Copy file to CAS."): copy_file(source=source_file.full_path, target=os.path.join(mount_point, "source_test_file"), size=test_file_size, direct="oflag") with TestRun.step("Unmount CAS device."): core.unmount() with TestRun.step("Trigger flush."): TestRun.executor.run_in_background(cli.flush_cache_cmd(f"{cache.cache_id}")) with TestRun.step("Hard reset DUT during data flushing."): power_cycle_dut(True, core_device) cache_device.path = cache_device_link.get_target() core_device.path = core_device_link.get_target() with TestRun.step("Load cache."): cache = casadm.load_cache(cache_device) if cache.get_dirty_blocks() == Size.zero(): TestRun.fail("There are no dirty blocks on cache device.") with TestRun.step("Stop cache with dirty data flush."): core_writes_before = core_device.get_io_stats().sectors_written cache.stop() if core_writes_before >= core_device.get_io_stats().sectors_written: TestRun.fail("No data was flushed after stopping cache started with load option.") with TestRun.step("Mount core device."): core_device.mount(mount_point) with TestRun.step("Copy test file from core device to temporary location. " "Compare it with the first version – they should be the same."): copy_file(source=os.path.join(mount_point, "source_test_file"), target=target_file.full_path, size=test_file_size, direct="iflag") compare_files(source_file, target_file) with TestRun.step("Unmount core device and remove test files."): core_device.unmount() target_file.remove() source_file.remove() Udev.enable()
43.807487
94
0.69812
1,089
8,192
5.02663
0.182736
0.052978
0.071246
0.020826
0.792656
0.791195
0.768542
0.763062
0.750639
0.717757
0
0.003973
0.201172
8,192
186
95
44.043011
0.832213
0.079468
0
0.634328
0
0
0.185871
0
0
0
0
0
0
1
0.014925
false
0
0.097015
0
0.11194
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
7cd9bf4101235d33dd0851006fb5355fa7094f36
96
py
Python
venv/lib/python3.8/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_console.py
Retraces/UkraineBot
3d5d7f8aaa58fa0cb8b98733b8808e5dfbdb8b71
[ "MIT" ]
2
2022-03-13T01:58:52.000Z
2022-03-31T06:07:54.000Z
venv/lib/python3.8/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_console.py
DesmoSearch/Desmobot
b70b45df3485351f471080deb5c785c4bc5c4beb
[ "MIT" ]
19
2021-11-20T04:09:18.000Z
2022-03-23T15:05:55.000Z
venv/lib/python3.8/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_console.py
DesmoSearch/Desmobot
b70b45df3485351f471080deb5c785c4bc5c4beb
[ "MIT" ]
null
null
null
/home/runner/.cache/pip/pool/1a/0b/a9/7aeda443ffd94fe933beaae28851149219464eb70b6492d03202acdcb2
96
96
0.895833
9
96
9.555556
1
0
0
0
0
0
0
0
0
0
0
0.395833
0
96
1
96
96
0.5
0
0
0
0
0
0
0
0
1
0
0
0
0
null
null
0
0
null
null
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
null
1
0
0
0
1
0
0
0
0
0
0
0
0
5
7ce76a609247df1043721d1381fac454aa1dfdb8
196
py
Python
adv_train/model/cifar/__init__.py
busycalibrating/Adversarial-Training
e1fe4061f72e1379d9920b02c1cc281e1be2606f
[ "MIT" ]
null
null
null
adv_train/model/cifar/__init__.py
busycalibrating/Adversarial-Training
e1fe4061f72e1379d9920b02c1cc281e1be2606f
[ "MIT" ]
null
null
null
adv_train/model/cifar/__init__.py
busycalibrating/Adversarial-Training
e1fe4061f72e1379d9920b02c1cc281e1be2606f
[ "MIT" ]
1
2022-01-31T06:14:41.000Z
2022-01-31T06:14:41.000Z
# from .train import train_cifar as train # from .params import CifarTrainingParams as TrainingParams from .models import CifarModel, load_cifar_classifier from .dataset import load_cifar_dataset
39.2
59
0.846939
26
196
6.192308
0.5
0.111801
0
0
0
0
0
0
0
0
0
0
0.117347
196
4
60
49
0.930636
0.494898
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
8611c0484d4c406329a70127b75ee90eb18f2597
194
py
Python
main/management/commands/listen_for_tweets.py
Aaron1011/texting_wall
c20b421652fbdaef927e9d206fc17d8f1f40ae46
[ "MIT" ]
null
null
null
main/management/commands/listen_for_tweets.py
Aaron1011/texting_wall
c20b421652fbdaef927e9d206fc17d8f1f40ae46
[ "MIT" ]
null
null
null
main/management/commands/listen_for_tweets.py
Aaron1011/texting_wall
c20b421652fbdaef927e9d206fc17d8f1f40ae46
[ "MIT" ]
null
null
null
from django.core.management.base import BaseCommand, CommandError import _listen_for_tweets class Command(BaseCommand): def handle(self, *args, **options): _listen_for_tweets.main()
32.333333
65
0.773196
24
194
6
0.791667
0.125
0.208333
0
0
0
0
0
0
0
0
0
0.134021
194
5
66
38.8
0.857143
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.8
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
8612edf5bc9f01b55c9895af1666687c2dbd1ef7
55
py
Python
hello_world.py
mvndinesh/profiles-rest-api
5dfa11be2a7c1e83e34fcd502ef3b2515d2ef690
[ "MIT" ]
null
null
null
hello_world.py
mvndinesh/profiles-rest-api
5dfa11be2a7c1e83e34fcd502ef3b2515d2ef690
[ "MIT" ]
null
null
null
hello_world.py
mvndinesh/profiles-rest-api
5dfa11be2a7c1e83e34fcd502ef3b2515d2ef690
[ "MIT" ]
null
null
null
print("hello world how are you Dinesh Sruthi Ishan")
55
55
0.745455
9
55
4.555556
1
0
0
0
0
0
0
0
0
0
0
0
0.181818
55
1
55
55
0.911111
0
0
0
0
0
0.821429
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
86260c5a4cb8249a92687577759a3a34cc0eb9c8
131
py
Python
day_1/print_function.py
anishLearnsToCode/python-workshop-7
2d5933be2629600f5f9e8efea58403421737a299
[ "MIT" ]
4
2020-12-22T14:28:22.000Z
2021-09-15T20:28:15.000Z
day_1/print_function.py
anishLearnsToCode/python-workshop-7
2d5933be2629600f5f9e8efea58403421737a299
[ "MIT" ]
null
null
null
day_1/print_function.py
anishLearnsToCode/python-workshop-7
2d5933be2629600f5f9e8efea58403421737a299
[ "MIT" ]
null
null
null
print('i am batman', end='\n') print('hello world', end='\t\t') print('this is cool\n', end=' ----- ') print('i am still here')
26.2
41
0.564885
23
131
3.217391
0.608696
0.162162
0.216216
0
0
0
0
0
0
0
0
0
0.152672
131
4
42
32.75
0.666667
0
0
0
0
0
0.51145
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
862c031004c575cf7c71610f990283c7c3f04324
153
py
Python
caffe2/python/build.py
Hacky-DH/pytorch
80dc4be615854570aa39a7e36495897d8a040ecc
[ "Intel" ]
60,067
2017-01-18T17:21:31.000Z
2022-03-31T21:37:45.000Z
caffe2/python/build.py
Hacky-DH/pytorch
80dc4be615854570aa39a7e36495897d8a040ecc
[ "Intel" ]
66,955
2017-01-18T17:21:38.000Z
2022-03-31T23:56:11.000Z
caffe2/python/build.py
Hacky-DH/pytorch
80dc4be615854570aa39a7e36495897d8a040ecc
[ "Intel" ]
19,210
2017-01-18T17:45:04.000Z
2022-03-31T23:51:56.000Z
import caffe2.python._import_c_extension as C CAFFE2_NO_OPERATOR_SCHEMA = C.define_caffe2_no_operator_schema build_options = C.get_build_options()
15.3
62
0.843137
24
153
4.833333
0.541667
0.137931
0.275862
0.37931
0
0
0
0
0
0
0
0.021898
0.104575
153
9
63
17
0.824818
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
863991457f3e770de9f9fb5c31b7d553f3a1ffb4
494
py
Python
core/src/zeit/content/article/edit/embed.py
rickdg/vivi
16134ac954bf8425646d4ad47bdd1f372e089355
[ "BSD-3-Clause" ]
5
2019-05-16T09:51:29.000Z
2021-05-31T09:30:03.000Z
core/src/zeit/content/article/edit/embed.py
rickdg/vivi
16134ac954bf8425646d4ad47bdd1f372e089355
[ "BSD-3-Clause" ]
107
2019-05-24T12:19:02.000Z
2022-03-23T15:05:56.000Z
core/src/zeit/content/article/edit/embed.py
rickdg/vivi
16134ac954bf8425646d4ad47bdd1f372e089355
[ "BSD-3-Clause" ]
3
2020-08-14T11:01:17.000Z
2022-01-08T17:32:19.000Z
from zeit.cms.i18n import MessageFactory as _ import grokcore.component as grok import zeit.content.article.edit.block import zeit.content.article.edit.interfaces import zeit.content.modules.embed @grok.implementer(zeit.content.article.edit.interfaces.IEmbed) class Embed(zeit.content.modules.embed.Embed, zeit.content.article.edit.block.Block): type = 'embed' class Factory(zeit.content.article.edit.block.BlockFactory): produces = Embed title = _('Embed block')
26
62
0.767206
65
494
5.8
0.384615
0.204244
0.238727
0.291777
0.416446
0
0
0
0
0
0
0.00463
0.125506
494
18
63
27.444444
0.868056
0
0
0
0
0
0.032389
0
0
0
0
0
0
1
0
false
0
0.416667
0
0.833333
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
864f4a703851f6091c5596d05bc946585437b5e4
28
py
Python
terrascript/spotinst/r.py
hugovk/python-terrascript
08fe185904a70246822f5cfbdc9e64e9769ec494
[ "BSD-2-Clause" ]
507
2017-07-26T02:58:38.000Z
2022-01-21T12:35:13.000Z
terrascript/spotinst/r.py
hugovk/python-terrascript
08fe185904a70246822f5cfbdc9e64e9769ec494
[ "BSD-2-Clause" ]
135
2017-07-20T12:01:59.000Z
2021-10-04T22:25:40.000Z
terrascript/spotinst/r.py
hugovk/python-terrascript
08fe185904a70246822f5cfbdc9e64e9769ec494
[ "BSD-2-Clause" ]
81
2018-02-20T17:55:28.000Z
2022-01-31T07:08:40.000Z
# terrascript/spotinst/r.py
14
27
0.785714
4
28
5.5
1
0
0
0
0
0
0
0
0
0
0
0
0.071429
28
1
28
28
0.846154
0.892857
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
8666049d3798740011426e99277a81ec098a6f10
248
py
Python
src/cbapi/psc/threathunter/__init__.py
dewiestr/cbapi-python
e8bac7accd9100b585cd960a14f5eba4a1a57d4f
[ "MIT" ]
null
null
null
src/cbapi/psc/threathunter/__init__.py
dewiestr/cbapi-python
e8bac7accd9100b585cd960a14f5eba4a1a57d4f
[ "MIT" ]
null
null
null
src/cbapi/psc/threathunter/__init__.py
dewiestr/cbapi-python
e8bac7accd9100b585cd960a14f5eba4a1a57d4f
[ "MIT" ]
null
null
null
# Exported public API for the Cb ThreatHunter API from __future__ import absolute_import from .rest_api import CbThreatHunterAPI from cbapi.psc.threathunter.models import Process, Event, Tree from cbapi.psc.threathunter.query import QueryBuilder
31
62
0.842742
34
248
5.970588
0.617647
0.08867
0.118227
0.236453
0
0
0
0
0
0
0
0
0.116935
248
7
63
35.428571
0.926941
0.189516
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
866e855103435a3c6e361d6af64598e0fef2b343
82
py
Python
cupy/functional/__init__.py
mnicely/cupy
9ed1d0db1404e9baa3c139032515d6028078bc91
[ "MIT" ]
1
2020-03-30T20:56:52.000Z
2020-03-30T20:56:52.000Z
cupy/functional/__init__.py
mnicely/cupy
9ed1d0db1404e9baa3c139032515d6028078bc91
[ "MIT" ]
null
null
null
cupy/functional/__init__.py
mnicely/cupy
9ed1d0db1404e9baa3c139032515d6028078bc91
[ "MIT" ]
null
null
null
# "NOQA" to suppress flake8 warning from cupy.functional import piecewise # NOQA
27.333333
45
0.780488
11
82
5.818182
0.909091
0
0
0
0
0
0
0
0
0
0
0.014493
0.158537
82
2
46
41
0.913043
0.463415
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
8671a268eb3fc99a21cbfae2643da4e6a1d0b9a9
25
py
Python
stdlibs/__version__.py
jreese/stdlibs
bec3f977378cd4424b06b9dbb735d4e36d70283d
[ "MIT" ]
5
2021-03-26T03:01:35.000Z
2022-01-21T18:00:46.000Z
stdlibs/__version__.py
jreese/stdlibs
bec3f977378cd4424b06b9dbb735d4e36d70283d
[ "MIT" ]
2
2021-03-29T05:40:09.000Z
2022-03-01T17:05:31.000Z
stdlibs/__version__.py
jreese/stdlibs
bec3f977378cd4424b06b9dbb735d4e36d70283d
[ "MIT" ]
2
2021-03-28T18:29:19.000Z
2022-01-27T13:32:38.000Z
__version__ = "2021.4.1"
12.5
24
0.68
4
25
3.25
1
0
0
0
0
0
0
0
0
0
0
0.272727
0.12
25
1
25
25
0.318182
0
0
0
0
0
0.32
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
868a5ff9c2a599ecc7cb81340b9cedf2738bbb5c
46
py
Python
src/plugins/console/__init__.py
andreaswatch/piTomation
140bff77ad0b84ad17898106c7be7dc48a2d0783
[ "MIT" ]
null
null
null
src/plugins/console/__init__.py
andreaswatch/piTomation
140bff77ad0b84ad17898106c7be7dc48a2d0783
[ "MIT" ]
null
null
null
src/plugins/console/__init__.py
andreaswatch/piTomation
140bff77ad0b84ad17898106c7be7dc48a2d0783
[ "MIT" ]
null
null
null
""" Allows to write to the System Console. """
15.333333
38
0.673913
7
46
4.428571
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.173913
46
3
39
15.333333
0.815789
0.826087
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
86c49c070ff015a40480d44ad48aa68f28b4aa72
148
py
Python
argus/__init__.py
NickVeld/argus
37c1cade3b82a9bffc289894458d80cf1720532d
[ "MIT" ]
null
null
null
argus/__init__.py
NickVeld/argus
37c1cade3b82a9bffc289894458d80cf1720532d
[ "MIT" ]
null
null
null
argus/__init__.py
NickVeld/argus
37c1cade3b82a9bffc289894458d80cf1720532d
[ "MIT" ]
null
null
null
from argus.model import Model, load_model import argus.engine import argus.callbacks import argus.metrics import argus.types __version__ = '0.2.1'
18.5
41
0.810811
23
148
5
0.565217
0.382609
0
0
0
0
0
0
0
0
0
0.022901
0.114865
148
7
42
21.142857
0.854962
0
0
0
0
0
0.033784
0
0
0
0
0
0
1
0
false
0
0.833333
0
0.833333
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
86c56d8c5b867f772d8628fa462736bee17c1d4d
971
py
Python
numpyScratch.py
juliuso/exercises
3c0e997728fe9d4b636cca23bd11db86dc710560
[ "MIT" ]
null
null
null
numpyScratch.py
juliuso/exercises
3c0e997728fe9d4b636cca23bd11db86dc710560
[ "MIT" ]
null
null
null
numpyScratch.py
juliuso/exercises
3c0e997728fe9d4b636cca23bd11db86dc710560
[ "MIT" ]
null
null
null
#!/usr/bin/env python import os import numpy as np puzzle = [ [5, 3, 0, 0, 7, 0, 0, 0, 0], [6, 0, 0, 1, 9, 5, 0, 0, 0], [0, 9, 8, 0, 0, 0, 0, 6, 0], [8, 0, 0, 0, 6, 0, 0, 0, 3], [4, 0, 0, 8, 0, 3, 0, 0, 1], [7, 0, 0, 0, 2, 0, 0, 0, 6], [0, 6, 0, 0, 0, 0, 2, 8, 0], [0, 0, 0, 4, 1, 9, 0, 0, 5], [0, 0, 0, 0, 8, 0, 0, 7, 9], ] if __name__ == "__main__": p = np.array(puzzle) puzzle_groups = [] for split_row_thirds in np.vsplit(p, 3): for split_col_thirds in np.hsplit(split_row_thirds, 3): puzzle_groups.append(split_col_thirds.flatten()) print(puzzle_groups) """ [array([5, 3, 0, 6, 0, 0, 0, 9, 8]), array([0, 7, 0, 1, 9, 5, 0, 0, 0]), array([0, 0, 0, 0, 0, 0, 0, 6, 0]), array([8, 0, 0, 4, 0, 0, 7, 0, 0]), array([0, 6, 0, 8, 0, 3, 0, 2, 0]), array([0, 0, 3, 0, 0, 1, 0, 0, 6]), array([0, 6, 0, 0, 0, 0, 0, 0, 0]), array([0, 0, 0, 4, 1, 9, 0, 8, 0]), array([2, 8, 0, 0, 0, 5, 0, 7, 9])] """
24.275
63
0.445932
221
971
1.873303
0.167421
0.280193
0.217391
0.135266
0.328502
0.193237
0.125604
0
0
0
0
0.236311
0.285273
971
39
64
24.897436
0.360231
0.020597
0
0
0
0
0.012966
0
0
0
0
0
0
1
0
false
0
0.1
0
0.1
0.05
0
0
1
null
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
86ca7219a9b7170516164fc74a109443f913c4e9
702
py
Python
assets/game_projects/fighter/src/hit_box.py
PineTreePizza/roll-back-engine
fc1fc19f9f8fdff52055064980349024aa1c2324
[ "MIT" ]
null
null
null
assets/game_projects/fighter/src/hit_box.py
PineTreePizza/roll-back-engine
fc1fc19f9f8fdff52055064980349024aa1c2324
[ "MIT" ]
null
null
null
assets/game_projects/fighter/src/hit_box.py
PineTreePizza/roll-back-engine
fc1fc19f9f8fdff52055064980349024aa1c2324
[ "MIT" ]
null
null
null
import roll_engine_api from roll.node import CollisionShape2D from roll.physics import Collision class HitBox(CollisionShape2D): # TODO: Investigate way to make child not have to implement @classmethod def new(cls): return roll_engine_api.node_new( class_path=f"{__name__}", class_name=f"{cls.__name__}", node_type=f"{cls.extract_valid_inheritance_node()}", ) def _start(self) -> None: pass class Attack(HitBox): def _start(self) -> None: self.frame_life_time = 0 self.has_hit = False def has_collided_with_anything(self) -> bool: return len(Collision.get_collided_nodes(node=self)) > 0
25.071429
64
0.662393
91
702
4.791209
0.56044
0.045872
0.059633
0.073395
0
0
0
0
0
0
0
0.007547
0.245014
702
27
65
26
0.815094
0.081197
0
0.105263
0
0
0.096423
0.059098
0
0
0
0.037037
0
1
0.210526
false
0.052632
0.157895
0.105263
0.578947
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
1
0
1
1
0
0
5
86cc15a713e145e16bf973b870a4d858cb257c37
7,688
py
Python
python/paddle/fluid/tests/unittests/ir/inference/test_trt_matmul_quant_dequant.py
wwqgtxx/Paddle
109ca9d250e37e723e364366e8402c307b110169
[ "Apache-2.0" ]
17,085
2016-11-18T06:40:52.000Z
2022-03-31T22:52:32.000Z
python/paddle/fluid/tests/unittests/ir/inference/test_trt_matmul_quant_dequant.py
wwqgtxx/Paddle
109ca9d250e37e723e364366e8402c307b110169
[ "Apache-2.0" ]
29,769
2016-11-18T06:35:22.000Z
2022-03-31T16:46:15.000Z
python/paddle/fluid/tests/unittests/ir/inference/test_trt_matmul_quant_dequant.py
wwqgtxx/Paddle
109ca9d250e37e723e364366e8402c307b110169
[ "Apache-2.0" ]
4,641
2016-11-18T07:43:33.000Z
2022-03-31T15:15:02.000Z
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import unittest import numpy as np from inference_pass_test import InferencePassTest from quant_dequant_test import QuantDequantTest import paddle.fluid as fluid import paddle.fluid.core as core from paddle.fluid.core import PassVersionChecker from paddle.fluid.core import AnalysisConfig class TensorRTMatMulQuantDequantDims3Test(QuantDequantTest): def setUp(self): self.set_params() def network(): self.data = fluid.data( name='data', shape=[1, 28, 28], dtype='float32') self.label = fluid.data(name='label', shape=[1, 1], dtype='int64') matmul_out = fluid.layers.matmul( x=self.data, y=self.data, transpose_x=self.transpose_x, transpose_y=self.transpose_y, alpha=self.alpha) fc_out = fluid.layers.fc(input=matmul_out, size=10, num_flatten_dims=1, bias_attr=False, act=None) result = fluid.layers.relu(fc_out) loss = fluid.layers.cross_entropy(input=result, label=self.label) avg_loss = fluid.layers.mean(loss) return avg_loss, result self.main_program.random_seed = 2 self.startup_program.random_seed = 2 self.test_main_program.random_seed = 2 #self.test_startup_program.random_seed = 2 with fluid.unique_name.guard(): with fluid.program_guard(self.main_program, self.startup_program): self.loss, result = network() opt = fluid.optimizer.Adam(learning_rate=0.0001) opt.minimize(self.loss) with fluid.unique_name.guard(): with fluid.program_guard(self.test_main_program, self.startup_program): network() self.feeds = {"data": np.random.random([1, 28, 28]).astype("float32")} self.fetch_list = [result] self.enable_trt = True self.trt_parameters = TensorRTMatMulQuantDequantDims3Test.TensorRTParam( 1 << 30, 32, 0, AnalysisConfig.Precision.Int8, False, False) self.activation_quantize_type = 'moving_average_abs_max' self.weight_quantize_type = 'channel_wise_abs_max' def set_params(self): self.transpose_x = False self.transpose_y = False self.alpha = 1.0 def test_check_output(self): #self.quant_dequant() if core.is_compiled_with_cuda(): use_gpu = True self.check_output_with_option( use_gpu, atol=1e-1, flatten=False, rtol=1e-1) self.assertTrue( PassVersionChecker.IsCompatible('tensorrt_subgraph_pass')) class TensorRTMatMulQuantDequantDims3TransposeXTest( TensorRTMatMulQuantDequantDims3Test): def set_params(self): self.transpose_x = True self.transpose_y = False self.alpha = 1.0 class TensorRTMatMulQuantDequantDims3TransposeYTest( TensorRTMatMulQuantDequantDims3Test): def set_params(self): self.transpose_x = False self.transpose_y = True self.alpha = 1.0 class TensorRTMatMulQuantDequantDims3TransposeXYTest( TensorRTMatMulQuantDequantDims3Test): def set_params(self): self.transpose_x = True self.transpose_y = True self.alpha = 1.0 class TensorRTMatMulQuantDequantDims4Test(QuantDequantTest): def setUp(self): self.set_params() def network(): self.data = fluid.data( name='data', shape=[1, 28, 28], dtype='float32') self.label = fluid.data(name='label', shape=[1, 1], dtype='int64') reshape_out = fluid.layers.reshape(self.data, shape=[1, 4, 14, 14]) matmul_out = fluid.layers.matmul( x=reshape_out, y=reshape_out, transpose_x=self.transpose_x, transpose_y=self.transpose_y, alpha=self.alpha) out = fluid.layers.batch_norm(matmul_out, is_test=True) fc_out = fluid.layers.fc(input=matmul_out, size=10, num_flatten_dims=1, bias_attr=False, act=None) result = fluid.layers.relu(fc_out) loss = fluid.layers.cross_entropy(input=result, label=self.label) avg_loss = fluid.layers.mean(loss) return avg_loss, result self.main_program.random_seed = 2 self.startup_program.random_seed = 2 self.test_main_program.random_seed = 2 #self.test_startup_program.random_seed = 2 with fluid.unique_name.guard(): with fluid.program_guard(self.main_program, self.startup_program): self.loss, result = network() opt = fluid.optimizer.Adam(learning_rate=0.0001) opt.minimize(self.loss) with fluid.unique_name.guard(): with fluid.program_guard(self.test_main_program, self.startup_program): network() self.feeds = {"data": np.random.random([1, 28, 28]).astype("float32")} self.fetch_list = [result] self.enable_trt = True self.trt_parameters = TensorRTMatMulQuantDequantDims4Test.TensorRTParam( 1 << 30, 32, 0, AnalysisConfig.Precision.Int8, False, False) self.activation_quantize_type = 'moving_average_abs_max' self.weight_quantize_type = 'channel_wise_abs_max' def set_params(self): self.transpose_x = False self.transpose_y = False self.alpha = 1.0 def test_check_output(self): #self.quant_dequant() if core.is_compiled_with_cuda(): use_gpu = True self.check_output_with_option( use_gpu, atol=1e-1, flatten=False, rtol=1e-1) self.assertTrue( PassVersionChecker.IsCompatible('tensorrt_subgraph_pass')) class TensorRTMatMulQuantDequantDims4TransposeXTest( TensorRTMatMulQuantDequantDims4Test): def set_params(self): self.transpose_x = True self.transpose_y = False self.alpha = 1.0 class TensorRTMatMulQuantDequantDims4TransposeYTest( TensorRTMatMulQuantDequantDims4Test): def set_params(self): self.transpose_x = False self.transpose_y = True self.alpha = 1.0 class TensorRTMatMulQuantDequantDims4TransposeXYTest( TensorRTMatMulQuantDequantDims4Test): def set_params(self): self.transpose_x = True self.transpose_y = True self.alpha = 1.0 class TensorRTMatMulQuantDequantDims4ScaleTest( TensorRTMatMulQuantDequantDims4Test): def set_params(self): self.transpose_x = False self.transpose_y = False self.alpha = 2.0 if __name__ == "__main__": unittest.main()
37.502439
80
0.623179
857
7,688
5.395566
0.224037
0.061851
0.033305
0.031142
0.724913
0.7141
0.702422
0.702422
0.694853
0.694853
0
0.024247
0.291883
7,688
204
81
37.686275
0.825129
0.091701
0
0.822785
0
0
0.028715
0.012635
0
0
0
0
0.012658
1
0.094937
false
0.025316
0.050633
0
0.21519
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
86d39b58700719d2a3819b583f90786b1b326d7e
261
py
Python
rebuild_classifier_table.py
RomeroLaura/Axelrod
5dd874de295a5796c365ce0bb3028f4a532f4377
[ "MIT" ]
596
2015-03-30T17:34:14.000Z
2022-03-21T19:32:38.000Z
rebuild_classifier_table.py
RomeroLaura/Axelrod
5dd874de295a5796c365ce0bb3028f4a532f4377
[ "MIT" ]
1,018
2015-03-30T14:57:33.000Z
2022-03-14T14:57:48.000Z
rebuild_classifier_table.py
Nikoleta-v3/Axelrod
d535a7471ef4565495653d2cfc10e3c5ce04cfc6
[ "MIT" ]
263
2015-03-31T10:26:28.000Z
2022-03-29T09:26:02.000Z
import os from axelrod import all_strategies from axelrod.classifier import all_classifiers, rebuild_classifier_table if __name__ == "__main__": # Change to relative path inside axelrod folder rebuild_classifier_table(all_classifiers, all_strategies)
29
72
0.823755
33
261
6.030303
0.575758
0.110553
0.221106
0
0
0
0
0
0
0
0
0
0.1341
261
8
73
32.625
0.880531
0.172414
0
0
0
0
0.037383
0
0
0
0
0
0
1
0
true
0
0.6
0
0.6
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
86dc500ab51e2404b1e6ae6689b45acb04b03d7e
85
py
Python
napari/components/experimental/monitor/__init__.py
MaksHess/napari
64a144607342c02177fc62fa83a3442ace0a98e7
[ "BSD-3-Clause" ]
1,345
2019-03-03T21:14:14.000Z
2022-03-31T19:46:39.000Z
napari/components/experimental/monitor/__init__.py
MaksHess/napari
64a144607342c02177fc62fa83a3442ace0a98e7
[ "BSD-3-Clause" ]
3,904
2019-03-02T01:30:24.000Z
2022-03-31T20:17:27.000Z
napari/components/experimental/monitor/__init__.py
MaksHess/napari
64a144607342c02177fc62fa83a3442ace0a98e7
[ "BSD-3-Clause" ]
306
2019-03-29T17:09:10.000Z
2022-03-30T09:54:11.000Z
"""Monitor service.""" from ._monitor import monitor from ._utils import numpy_dumps
21.25
31
0.776471
11
85
5.727273
0.636364
0
0
0
0
0
0
0
0
0
0
0
0.117647
85
3
32
28.333333
0.84
0.188235
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
86de83affb4247942b004c1d70a701081aa25779
36
py
Python
hpe3d/filter/__init__.py
dorianhenning/hpe3d
14ea2b0f76145793e2b15ce6fd31736c4be26b5b
[ "MIT" ]
2
2020-05-27T08:21:20.000Z
2021-06-28T15:42:58.000Z
hpe3d/filter/__init__.py
dorianhenning/hpe3d
14ea2b0f76145793e2b15ce6fd31736c4be26b5b
[ "MIT" ]
1
2022-03-22T14:07:05.000Z
2022-03-22T14:07:08.000Z
hpe3d/filter/__init__.py
dorianhenning/hpe3d
14ea2b0f76145793e2b15ce6fd31736c4be26b5b
[ "MIT" ]
4
2020-05-27T08:21:21.000Z
2021-08-08T19:17:13.000Z
from .kalman import filter_variable
18
35
0.861111
5
36
6
1
0
0
0
0
0
0
0
0
0
0
0
0.111111
36
1
36
36
0.9375
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
8122dc4d6d7687ee6f3e719c8338cdcb036a922e
436
py
Python
SNA/analytics/plot.py
deepesch/decentralizedtrustscore
406ac219cfa0eb37efa2bf5add484381fd78eb4a
[ "MIT" ]
null
null
null
SNA/analytics/plot.py
deepesch/decentralizedtrustscore
406ac219cfa0eb37efa2bf5add484381fd78eb4a
[ "MIT" ]
null
null
null
SNA/analytics/plot.py
deepesch/decentralizedtrustscore
406ac219cfa0eb37efa2bf5add484381fd78eb4a
[ "MIT" ]
1
2020-09-06T02:53:47.000Z
2020-09-06T02:53:47.000Z
import matplotlib.pyplot as plt # Bitcoinalpha Results # Bitcoinotc Results # MOI """ modelTime = [13.552489996, 14.1718680859, 14.3160290718, 14.1594519615, 13.8515219688] predictions = [0.774728, 0.742073, 0.752958, 0.766682, 0.770104] labels = [0.722196, 0.724562, 0.724562, 0.732608, 0.723273] accuracy = [0.910317, 0.906058, 0.907714, 0.910080, 0.908940] falsePositive = [0.417376, 0.372852, 0.386598, 0.400000, 0.413675] """
27.25
86
0.715596
65
436
4.8
0.630769
0.044872
0.051282
0
0
0
0
0
0
0
0
0.520942
0.123853
436
15
87
29.066667
0.295812
0.098624
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
d4b918445ff1913f866cfd0f8303c2844df4b920
39
py
Python
better_card_match.py
samdrivendevelopment/matching_monkey
ec42241759fcd9b03584df5265da686362c7b8bd
[ "BSD-2-Clause" ]
null
null
null
better_card_match.py
samdrivendevelopment/matching_monkey
ec42241759fcd9b03584df5265da686362c7b8bd
[ "BSD-2-Clause" ]
null
null
null
better_card_match.py
samdrivendevelopment/matching_monkey
ec42241759fcd9b03584df5265da686362c7b8bd
[ "BSD-2-Clause" ]
null
null
null
def should_quit(user_input): pass
9.75
28
0.717949
6
39
4.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.205128
39
3
29
13
0.83871
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
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
1
0
1
0
0
0
0
0
5
d4dcab8e8fa1a4cdd4d1260d01a3866393ac57b8
416
py
Python
Python/Warmup_2/array_front9.py
RCoon/CodingBat
c5004c03e668c62751dc7f13154c79e25ea34339
[ "MIT" ]
1
2015-11-06T02:26:50.000Z
2015-11-06T02:26:50.000Z
Python/Warmup_2/array_front9.py
RCoon/CodingBat
c5004c03e668c62751dc7f13154c79e25ea34339
[ "MIT" ]
null
null
null
Python/Warmup_2/array_front9.py
RCoon/CodingBat
c5004c03e668c62751dc7f13154c79e25ea34339
[ "MIT" ]
null
null
null
# Given an array of ints, return True if one of the first 4 elements in the # array is a 9. The array length may be less than 4. # array_front9([1, 2, 9, 3, 4]) --> True # array_front9([1, 2, 3, 4, 9]) --> False # array_front9([1, 2, 3, 4, 5]) --> False def array_front9(nums): return 9 in nums[:4] print(array_front9([1, 2, 9, 3, 4])) print(array_front9([1, 2, 3, 4, 9])) print(array_front9([1, 2, 3, 4, 5]))
29.714286
75
0.620192
85
416
2.952941
0.364706
0.306773
0.286853
0.310757
0.446215
0.446215
0.422311
0
0
0
0
0.125373
0.194712
416
13
76
32
0.623881
0.586538
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0.2
0.4
0.6
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
1
0
5
d4fe4faadec3f2478f2e3000c8dfdc4f70dda4d3
51
py
Python
examples/scripts/startup.py
fossabot/django-mirage
814b3f2486af31f9dca42ef4bb0215655fe0aea6
[ "Apache-2.0" ]
4
2019-05-16T09:26:21.000Z
2022-02-14T06:21:40.000Z
examples/scripts/startup.py
fossabot/django-mirage
814b3f2486af31f9dca42ef4bb0215655fe0aea6
[ "Apache-2.0" ]
59
2019-07-01T16:20:22.000Z
2022-02-14T03:36:04.000Z
examples/scripts/startup.py
fossabot/django-mirage
814b3f2486af31f9dca42ef4bb0215655fe0aea6
[ "Apache-2.0" ]
1
2018-12-08T09:57:54.000Z
2018-12-08T09:57:54.000Z
def startUP(): pass def carmDown(): pass
7.285714
15
0.568627
6
51
4.833333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.313725
51
6
16
8.5
0.828571
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0.5
true
0.5
0
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
1
0
0
0
0
0
5
be1c65156fa463c2c9ee1414aa28bf4314c52fea
100
py
Python
enthought/tvtk/pyface/ui/qt4/actor_editor.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
3
2016-12-09T06:05:18.000Z
2018-03-01T13:00:29.000Z
enthought/tvtk/pyface/ui/qt4/actor_editor.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
1
2020-12-02T00:51:32.000Z
2020-12-02T08:48:55.000Z
enthought/tvtk/pyface/ui/qt4/actor_editor.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
null
null
null
# proxy module from __future__ import absolute_import from tvtk.pyface.ui.qt4.actor_editor import *
25
45
0.83
15
100
5.133333
0.8
0
0
0
0
0
0
0
0
0
0
0.011236
0.11
100
3
46
33.333333
0.853933
0.12
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
07ad3360f53fb54a5d7c8b49eb0b1800034b7d79
47
py
Python
test.py
TrungTri/profiles-REST-API
b31407ad4999166bf743b5272003fed94fae0882
[ "MIT" ]
null
null
null
test.py
TrungTri/profiles-REST-API
b31407ad4999166bf743b5272003fed94fae0882
[ "MIT" ]
null
null
null
test.py
TrungTri/profiles-REST-API
b31407ad4999166bf743b5272003fed94fae0882
[ "MIT" ]
null
null
null
print("Hello world") print("hi") print("hi3`")
11.75
20
0.638298
7
47
4.285714
0.714286
0
0
0
0
0
0
0
0
0
0
0.023256
0.085106
47
3
21
15.666667
0.674419
0
0
0
0
0
0.361702
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
07b9512a329d587cefe6ec696e52e2f796c2e976
145
py
Python
argos/apps/common/admin.py
daedafusion/django-argos
f28081be13d450baf8a7eaecef1e71e22a6e8833
[ "Apache-2.0" ]
null
null
null
argos/apps/common/admin.py
daedafusion/django-argos
f28081be13d450baf8a7eaecef1e71e22a6e8833
[ "Apache-2.0" ]
null
null
null
argos/apps/common/admin.py
daedafusion/django-argos
f28081be13d450baf8a7eaecef1e71e22a6e8833
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin # Register your models here. from argos.apps.common.models import UserProfile admin.site.register(UserProfile)
24.166667
48
0.827586
20
145
6
0.7
0
0
0
0
0
0
0
0
0
0
0
0.103448
145
6
49
24.166667
0.923077
0.17931
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
07db4536e8c3a0a469539ed14e4d330f72736054
20,244
py
Python
src/python/AxisAlignedBox_TEST.py
jwnimmer-tri/ign-math
5201e53836a7acf67d6a491387cdb6c244f0c4d1
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
src/python/AxisAlignedBox_TEST.py
jwnimmer-tri/ign-math
5201e53836a7acf67d6a491387cdb6c244f0c4d1
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
src/python/AxisAlignedBox_TEST.py
jwnimmer-tri/ign-math
5201e53836a7acf67d6a491387cdb6c244f0c4d1
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
# Copyright (C) 2021 Open Source Robotics Foundation # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http:#www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import math import unittest from ignition.math import AxisAlignedBox, Line3d, Vector3d from ignition.math import IGN_SQRT2, LOW_D, MAX_D class TestAxisAlignedBox(unittest.TestCase): def test_empty_constructor(self): box = AxisAlignedBox() self.assertEqual(Vector3d(MAX_D, MAX_D, MAX_D), box.min()) self.assertEqual(Vector3d(LOW_D, LOW_D, LOW_D), box.max()) def test_constructor(self): box = AxisAlignedBox(Vector3d(0, -1, 2), Vector3d(1, -2, 3)) self.assertEqual(Vector3d(0, -2, 2), box.min()) self.assertEqual(Vector3d(1, -1, 3), box.max()) box1 = AxisAlignedBox(box) self.assertEqual(box1.min(), box.min()) self.assertEqual(box1.max(), box.max()) def test_manual_set(self): box = AxisAlignedBox(Vector3d(0, -1, 2), Vector3d(1, -2, 3)) box1 = AxisAlignedBox() box1.min().set(-2, 2, 3) box1.max().set(0, 0, 3) box1 += box self.assertEqual(box1.min().x(), -2) self.assertEqual(box1.min().y(), -2) self.assertEqual(box1.min().z(), 2) self.assertEqual(box1.max().x(), 1) self.assertEqual(box1.max().y(), 0) self.assertEqual(box1.max().z(), 3) box2 = AxisAlignedBox() box2.max().set(1, 1, 1) self.assertEqual(box2.size().x(), 0) self.assertEqual(box2.size().y(), 0) self.assertEqual(box2.size().z(), 0) box3 = AxisAlignedBox() box3.min().set(1, 1, 1) self.assertEqual(box3.size().x(), 0) self.assertEqual(box3.size().y(), 0) self.assertEqual(box3.size().z(), 0) def test_length(self): box = AxisAlignedBox(Vector3d(0, -1, 2), Vector3d(1, -2, 3)) self.assertEqual(box.x_length(), 1) self.assertEqual(box.y_length(), 1) self.assertEqual(box.z_length(), 1) def test_size(self): box = AxisAlignedBox(Vector3d(0, -1, 2), Vector3d(1, -2, 3)) self.assertEqual(box.size(), Vector3d(1, 1, 1)) def test_center(self): box = AxisAlignedBox(Vector3d(0, -1, 2), Vector3d(1, -2, 3)) self.assertEqual(box.center(), Vector3d(0.5, -1.5, 2.5)) def test_merge_empty(self): box1 = AxisAlignedBox() box2 = AxisAlignedBox() box1.merge(box2) self.assertEqual(Vector3d(MAX_D, MAX_D, MAX_D), box1.min()) self.assertEqual(Vector3d(LOW_D, LOW_D, LOW_D), box1.max()) def test_default_constructor(self): defaultAxisAlignedBox1 = AxisAlignedBox() defaultAxisAlignedBox2 = AxisAlignedBox() defaultAxisAlignedBox3 = AxisAlignedBox(Vector3d(0, 0, 0), Vector3d(1, 1, 1)) self.assertEqual(defaultAxisAlignedBox1.size(), Vector3d(0, 0, 0)) self.assertEqual(defaultAxisAlignedBox1.x_length(), 0) self.assertEqual(defaultAxisAlignedBox1.y_length(), 0) self.assertEqual(defaultAxisAlignedBox1.z_length(), 0) self.assertEqual(defaultAxisAlignedBox1.center(), Vector3d(0, 0, 0)) self.assertFalse(defaultAxisAlignedBox1.intersects(defaultAxisAlignedBox2)) self.assertFalse(defaultAxisAlignedBox1.intersects(defaultAxisAlignedBox3)) self.assertFalse(defaultAxisAlignedBox1.contains(Vector3d.ZERO)) def test_minus(self): box1 = AxisAlignedBox(1, 2, 3, 4, 5, 6) sub = Vector3d(1, 1, 1) box2 = box1 - sub self.assertEqual(box2.min(), box1.min() - sub) self.assertEqual(box2.max(), box1.max() - sub) def test_plus(self): box1 = AxisAlignedBox(1, 2, 3, 4, 5, 6) add = Vector3d(1, 1, 1) box2 = box1 + add self.assertEqual(box2.min(), box1.min() + add) self.assertEqual(box2.max(), box1.max() + add) def test_plus_empty(self): box1 = AxisAlignedBox() box2 = AxisAlignedBox() box1 += box2 self.assertEqual(Vector3d(MAX_D, MAX_D, MAX_D), box1.min()) self.assertEqual(Vector3d(LOW_D, LOW_D, LOW_D), box1.max()) box3 = box2 + box1 self.assertEqual(Vector3d(MAX_D, MAX_D, MAX_D), box3.min()) self.assertEqual(Vector3d(LOW_D, LOW_D, LOW_D), box3.max()) def test_merge(self): box = AxisAlignedBox(Vector3d(0, -1, 2), Vector3d(1, -2, 3)) box.merge(AxisAlignedBox(Vector3d(-1, -1, -1), Vector3d(2, 2, 2))) self.assertEqual(box, AxisAlignedBox(Vector3d(-1, -2, -1), Vector3d(2, 2, 3))) def test_volume(self): box = AxisAlignedBox(Vector3d(0, -1, 2), Vector3d(1, -2, 3)) self.assertEqual(box.volume(), 1.0) def test_operator_equal(self): box = AxisAlignedBox(Vector3d(1, 1, 1), Vector3d(3, 3, 3)) box2 = AxisAlignedBox(Vector3d(1, 1, 1), Vector3d(1, 3, 3)) box3 = AxisAlignedBox(Vector3d(0, 1, 1), Vector3d(1, 3, 3)) self.assertTrue(box == AxisAlignedBox(Vector3d(1, 1, 1), Vector3d(3, 3, 3))) self.assertFalse(box == box2) self.assertFalse(box3 == box) def test_operator_not_equal(self): box = AxisAlignedBox(Vector3d(1, 1, 1), Vector3d(3, 3, 3)) box2 = AxisAlignedBox(Vector3d(1, 1, 1), Vector3d(1, 3, 3)) box3 = AxisAlignedBox(Vector3d(0, 1, 1), Vector3d(1, 3, 3)) self.assertFalse(box != AxisAlignedBox(Vector3d(1, 1, 1), Vector3d(3, 3, 3))) self.assertTrue(box != box2) self.assertTrue(box3 != box) def test_operator_plus_equal(self): box = AxisAlignedBox(Vector3d(1, 1, 1), Vector3d(3, 3, 3)) box += AxisAlignedBox(Vector3d(2, 2, 2), Vector3d(4, 4, 4)) self.assertTrue(box == AxisAlignedBox(Vector3d(1, 1, 1), Vector3d(4, 4, 4))) def test_operator_plus(self): box = AxisAlignedBox(Vector3d(1, 1, 1), Vector3d(3, 3, 3)) box = box + AxisAlignedBox(Vector3d(-2, -2, -2), Vector3d(4, 4, 4)) self.assertTrue(box == AxisAlignedBox(Vector3d(-2, -2, -2), Vector3d(4, 4, 4))) def test_intersects(self): box = AxisAlignedBox(Vector3d(0, 0, 0), Vector3d(1, 1, 1)) self.assertFalse(box.intersects(AxisAlignedBox( Vector3d(1.1, 0, 0), Vector3d(2, 1, 1)))) self.assertFalse(box.intersects(AxisAlignedBox( Vector3d(0, 1.1, 0), Vector3d(1, 2, 1)))) self.assertFalse(box.intersects(AxisAlignedBox( Vector3d(0, 0, 1.1), Vector3d(1, 1, 2)))) self.assertFalse(box.intersects(AxisAlignedBox( Vector3d(-1, -1, -1), Vector3d(-0.1, 0, 0)))) self.assertFalse(box.intersects(AxisAlignedBox( Vector3d(-1, -1, -1), Vector3d(0, -0.1, 0)))) self.assertFalse(box.intersects(AxisAlignedBox( Vector3d(-1, -1, -1), Vector3d(0, 0, -0.1)))) self.assertTrue(box.intersects(AxisAlignedBox( Vector3d(0, 0, 0), Vector3d(1, 1, 1)))) def test_contains(self): box = AxisAlignedBox(Vector3d(0, 0, 0), Vector3d(1, 1, 1)) self.assertTrue(box.contains(Vector3d(0, 0, 0))) self.assertTrue(box.contains(Vector3d(0, 0, 1))) self.assertTrue(box.contains(Vector3d(0, 1, 1))) self.assertTrue(box.contains(Vector3d(1, 1, 1))) self.assertTrue(box.contains(Vector3d(1, 1, 0))) self.assertTrue(box.contains(Vector3d(1, 0, 0))) self.assertTrue(box.contains(Vector3d(0.5, 0.5, 0.5))) self.assertFalse(box.contains(Vector3d(0, 0, -1))) self.assertFalse(box.contains(Vector3d(0, -1, -1))) self.assertFalse(box.contains(Vector3d(-1, -1, -1))) self.assertFalse(box.contains(Vector3d(-1, -1, 0))) self.assertFalse(box.contains(Vector3d(-1, 0, 0))) self.assertFalse(box.contains(Vector3d(0.5, 0.5, -0.5))) self.assertFalse(box.contains(Vector3d(0.5, -0.5, 0.5))) self.assertFalse(box.contains(Vector3d(-0.5, 0.5, 0.5))) self.assertFalse(box.contains(Vector3d(-0.5, -0.5, 0.5))) self.assertFalse(box.contains(Vector3d(-0.5, -0.5, -0.5))) self.assertFalse(box.contains(Vector3d(0, 0, -0.01))) self.assertFalse(box.contains(Vector3d(0, -0.01, 0))) self.assertFalse(box.contains(Vector3d(-0.01, 0, 0))) def test_volume2(self): box = AxisAlignedBox() self.assertEqual(0.0, box.volume()) box = AxisAlignedBox(Vector3d(-1, -2, -3), Vector3d(1, 2, 3)) self.assertEqual(48.0, box.volume()) def test_intersect(self): b = AxisAlignedBox(0, 0, 0, 1, 1, 1) intersect = False dist = 0 pt = Vector3d() intersect, dist, pt = b.intersect(Vector3d(-1, 0, 0), Vector3d(1, 0, 0), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(-1, 0, 0), Vector3d(1, 0, 0), 0, 1000)) self.assertEqual(dist, 1) self.assertEqual(b.intersect(Vector3d(-1, 0, 0), Vector3d(1, 0, 0), 0, 1000)[1], dist) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(1, 0, 0), Vector3d(-1, 0, 0), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(1, 0, 0), Vector3d(-1, 0, 0), 0, 1000)) self.assertEqual(dist, 0) self.assertEqual(b.intersect_dist(Vector3d(1, 0, 0), Vector3d(-1, 0, 0), 0, 1000)[1], dist) self.assertEqual(pt, Vector3d(1, 0, 0)) (intersect, dist, pt) = b.intersect(Vector3d(2, 2, 0), Vector3d(-1, -1, 0), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(2, 2, 0), Vector3d(-1, -1, 0), 0, 1000)) self.assertEqual(dist, IGN_SQRT2) self.assertEqual(b.intersect_dist(Vector3d(2, 2, 0), Vector3d(-1, -1, 0), 0, 1000)[1], dist) self.assertEqual(pt, Vector3d(1, 1, 0)) (intersect, dist, pt) = b.intersect(Vector3d(-10, -10, 0), Vector3d(1, 1, 0), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(-10, -10, 0), Vector3d(1, 1, 0), 0, 1000)) self.assertEqual(dist, math.sqrt(200)) self.assertEqual(b.intersect_dist(Vector3d(-10, -10, 0), Vector3d(1, 1, 0), 0, 1000)[1], dist) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(-1, -2, 0), Vector3d(1, 1, 0), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(-1, -2, 0), Vector3d(1, 1, 0), 0, 1000)) self.assertEqual(dist, 2*IGN_SQRT2) self.assertEqual(b.intersect_dist(Vector3d(-1, -2, 0), Vector3d(1, 1, 0), 0, 1000)[1], dist) self.assertEqual(pt, Vector3d(1, 0, 0)) (intersect, dist, pt) = b.intersect(Vector3d(2, 1, 0), Vector3d(-1, -1, 0), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(2, 1, 0), Vector3d(-1, -1, 0), 0, 1000)) self.assertEqual(dist, IGN_SQRT2) self.assertEqual(b.intersect_dist(Vector3d(2, 1, 0), Vector3d(-1, -1, 0), 0, 1000)[1], dist) self.assertEqual(pt, Vector3d(1, 0, 0)) (intersect, dist, pt) = b.intersect(Vector3d(0.5, 0.5, 2), Vector3d(0, 0, -1), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(0.5, 0.5, 2), Vector3d(0, 0, -1), 0, 1000)) self.assertEqual(dist, 1) self.assertEqual(b.intersect_dist(Vector3d(0.5, 0.5, 2), Vector3d(0, 0, -1), 0, 1000)[1], dist) self.assertEqual(pt, Vector3d(0.5, 0.5, 1)) (intersect, dist, pt) = b.intersect(Vector3d(0.5, 0.5, 2), Vector3d(0, 0, 1), 0, 1000) self.assertFalse(intersect) self.assertFalse(b.intersect_check(Vector3d(0.5, 0.5, 2), Vector3d(0, 0, 1), 0, 1000)) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(-1, -1, 1), Vector3d(0, 0, -1), 0, 1000) self.assertFalse(intersect) self.assertFalse(b.intersect_check(Vector3d(-1, -1, 1), Vector3d(0, 0, -1), 0, 1000)) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(2, 2, 0), Vector3d(1, 1, 0), 0, 1000) self.assertFalse(intersect) self.assertFalse(b.intersect_check(Vector3d(2, 2, 0), Vector3d(1, 1, 0), 0, 1000)) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(2, 2, 0), Vector3d(0, 1, 0), 0, 1000) self.assertFalse(intersect) self.assertFalse(b.intersect_check(Vector3d(2, 2, 0), Vector3d(0, 1, 0), 0, 1000)) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(0.1, 0.1, 200), Vector3d(0, 0, -1), 0, 100) self.assertFalse(intersect) self.assertFalse(b.intersect_check(Vector3d(0.1, 0.1, 200), Vector3d(0, 0, -1), 0, 100)) self.assertEqual(dist, 0) self.assertEqual(b.intersect_dist(Vector3d(0.1, 0.1, 200), Vector3d(0, 0, -1), 0, 100)[1], dist) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(0.1, 0.1, 1), Vector3d(0, 0, -1), 1.0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(0.1, 0.1, 1), Vector3d(0, 0, -1), 1.0, 1000)) self.assertEqual(dist, 0.0) self.assertEqual(b.intersect_dist(Vector3d(0.1, 0.1, 1), Vector3d(0, 0, -1), 1.0, 1000)[1], dist) self.assertEqual(pt, Vector3d(0.1, 0.1, 0)) (intersect, dist, pt) = b.intersect(Vector3d(0.1, 0.1, 1), Vector3d(0, 0, -1), 1.1, 1000) self.assertFalse(intersect) self.assertFalse(b.intersect_check(Vector3d(0.1, 0.1, 1), Vector3d(0, 0, -1), 1.1, 1000)) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(0.1, 0.1, 10), Vector3d(0, 0, -1), 1.1, 5) self.assertFalse(intersect) self.assertFalse(b.intersect_check(Vector3d(0.1, 0.1, 10), Vector3d(0, 0, -1), 1.1, 5)) self.assertEqual(dist, 0) self.assertEqual(b.intersect_dist(Vector3d(0.1, 0.1, 10), Vector3d(0, 0, -1), 1.1, 5)[1], dist) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect( Line3d(Vector3d(4, 0, 0.5), Vector3d(0, 10, 0.5))) self.assertFalse(intersect) self.assertEqual(dist, 0) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect( Line3d(Vector3d(1, -1, 1.5), Vector3d(0, 1, 1.5))) self.assertFalse(intersect) self.assertEqual(dist, 0) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(0, 0, 1), Vector3d(0, 0, -1), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(0, 0, 1), Vector3d(0, 0, -1), 0, 1000)) self.assertEqual(dist, 0) self.assertEqual(b.intersect_dist(Vector3d(0, 0, 1), Vector3d(0, 0, -1), 0, 1000)[1], dist) self.assertEqual(pt, Vector3d(0, 0, 1)) (intersect, dist, pt) = b.intersect(Vector3d(0, 0, 0), Vector3d(1, 0, 0), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(0, 0, 0), Vector3d(1, 0, 0), 0, 1000)) self.assertEqual(dist, 0) self.assertEqual(b.intersect_dist(Vector3d(0, 0, 0), Vector3d(1, 0, 0), 0, 1000)[1], dist) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(0, 0, 0), Vector3d(-1, 0, 0), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(0, 0, 0), Vector3d(-1, 0, 0), 0, 1000)) self.assertEqual(dist, 0) self.assertEqual(b.intersect_dist(Vector3d(0, 0, 0), Vector3d(-1, 0, 0), 0, 1000)[1], dist) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(0, 0, 0), Vector3d(0, 1, 0), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(0, 0, 0), Vector3d(0, 1, 0), 0, 1000)) self.assertEqual(dist, 0) self.assertEqual(b.intersect_dist(Vector3d(0, 0, 0), Vector3d(0, 1, 0), 0, 1000)[1], dist) self.assertEqual(pt, Vector3d.ZERO) (intersect, dist, pt) = b.intersect(Vector3d(0.5, 0.5, 0.5), Vector3d(-.707107, 0, -0.707107), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(0.5, 0.5, 0.5), Vector3d(-.707107, 0, -0.707107), 0, 1000)) self.assertAlmostEqual(dist, 0, 1e-5) self.assertAlmostEqual(b.intersect(Vector3d(0.5, 0.5, 0.5), Vector3d(-.707107, 0, -0.707107), 0, 1000)[1], dist, 1e-5) self.assertEqual(pt, Vector3d(0.5, 0.5, 0.5)) (intersect, dist, pt) = b.intersect(Vector3d(1.2, 0, 0.5), Vector3d(-0.707107, 0, -0.707107), 0, 1000) self.assertTrue(intersect) self.assertTrue(b.intersect_check(Vector3d(1.2, 0, 0.5), Vector3d(-0.707107, 0, -0.707107), 0, 1000)) self.assertAlmostEqual(dist, 0.28284, delta=1e-5) self.assertAlmostEqual(b.intersect(Vector3d(1.2, 0, 0.5), Vector3d(-0.707107, 0, -0.707107), 0, 1000)[1], dist, 1e-5) self.assertEqual(pt, Vector3d(1, 0, 0.3)) if __name__ == '__main__': unittest.main()
44.886918
90
0.532405
2,514
20,244
4.243437
0.057677
0.026059
0.044994
0.029903
0.828459
0.764154
0.727503
0.693851
0.667604
0.632358
0
0.114877
0.319304
20,244
450
91
44.986667
0.659289
0.028206
0
0.431373
0
0
0.000407
0
0
0
0
0
0.507003
1
0.058824
false
0
0.011204
0
0.072829
0
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
5
07e8393e2f32e5cb0052648ab32c7e63c698a175
49
py
Python
test/tests/fun.py
RangelReale/libpypa
e4b3c359d3d2a9ccbea1cbb0a977af8219dd64ef
[ "Apache-2.0" ]
152
2015-01-01T02:26:21.000Z
2022-03-04T12:18:15.000Z
test/tests/fun.py
kattkieru/libpypa
5e7a4833da515d0cd2d850d51f082000c9e9f651
[ "Apache-2.0" ]
43
2015-01-22T00:49:10.000Z
2019-02-26T22:42:59.000Z
test/tests/fun.py
kattkieru/libpypa
5e7a4833da515d0cd2d850d51f082000c9e9f651
[ "Apache-2.0" ]
42
2015-01-02T11:29:49.000Z
2022-03-04T12:18:17.000Z
def fun(a, b, k=None, *argc, **kwargs): pass
16.333333
39
0.55102
9
49
3
1
0
0
0
0
0
0
0
0
0
0
0
0.22449
49
2
40
24.5
0.710526
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
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
1
0
1
0
0
0
0
0
5
07eb0df310490af6420a7747b9d4fb0e28d599e5
58
py
Python
trinity-external-plugins/examples/peer_count_reporter/peer_count_reporter_plugin/__init__.py
renaynay/trinity
b85f37281b21c00dce91b7c61ba018788467c270
[ "MIT" ]
3
2019-06-17T13:59:20.000Z
2021-05-02T22:09:13.000Z
trinity-external-plugins/examples/peer_count_reporter/peer_count_reporter_plugin/__init__.py
renaynay/trinity
b85f37281b21c00dce91b7c61ba018788467c270
[ "MIT" ]
null
null
null
trinity-external-plugins/examples/peer_count_reporter/peer_count_reporter_plugin/__init__.py
renaynay/trinity
b85f37281b21c00dce91b7c61ba018788467c270
[ "MIT" ]
2
2019-12-14T02:52:32.000Z
2021-02-18T23:04:44.000Z
from .plugin import PeerCountReporterPlugin # noqa: F401
29
57
0.810345
6
58
7.833333
1
0
0
0
0
0
0
0
0
0
0
0.06
0.137931
58
1
58
58
0.88
0.172414
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
ed001d33b7d79b444b92fcd2c8665e40e2298181
115
py
Python
todo_list/admin.py
SumnanAzadi/django-Todo-app
93902cb4f41f5eeda809e16bf1b9e378635e1598
[ "MIT" ]
null
null
null
todo_list/admin.py
SumnanAzadi/django-Todo-app
93902cb4f41f5eeda809e16bf1b9e378635e1598
[ "MIT" ]
null
null
null
todo_list/admin.py
SumnanAzadi/django-Todo-app
93902cb4f41f5eeda809e16bf1b9e378635e1598
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import List # Register your models here. admin.site.register(List)
16.428571
32
0.791304
17
115
5.352941
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.13913
115
6
33
19.166667
0.919192
0.226087
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
ed313ec0eddd3f374e03ed6f238bf3f8ed65effb
42
py
Python
tests/test_client.py
lendingblock/lb-py
56466d1e45013e2817cc0c1db7a20b911a1ac0e4
[ "BSD-3-Clause" ]
1
2018-05-13T18:37:06.000Z
2018-05-13T18:37:06.000Z
tests/test_client.py
lendingblock/lb-py
56466d1e45013e2817cc0c1db7a20b911a1ac0e4
[ "BSD-3-Clause" ]
2
2018-05-14T08:46:33.000Z
2018-05-14T08:52:48.000Z
tests/test_client.py
lendingblock/lb-py
56466d1e45013e2817cc0c1db7a20b911a1ac0e4
[ "BSD-3-Clause" ]
null
null
null
def test_countries(lb): assert lb.url
14
23
0.714286
7
42
4.142857
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.190476
42
2
24
21
0.852941
0
0
0
0
0
0
0
0
0
0
0
0.5
1
0.5
false
0
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
1
0
1
0
0
0
0
0
0
0
5
ed353c45df6d607508b5533c81ec748b2d1194f5
70
py
Python
savecode/threeyears/datacontract/apps/__init__.py
Octoberr/swm0920
8f05a6b91fc205960edd57f9076facec04f49a1a
[ "Apache-2.0" ]
2
2019-05-19T11:54:26.000Z
2019-05-19T12:03:49.000Z
savecode/threeyears/datacontract/apps/__init__.py
Octoberr/swm0920
8f05a6b91fc205960edd57f9076facec04f49a1a
[ "Apache-2.0" ]
1
2020-11-27T07:55:15.000Z
2020-11-27T07:55:15.000Z
savecode/threeyears/datacontract/apps/__init__.py
Octoberr/swm0920
8f05a6b91fc205960edd57f9076facec04f49a1a
[ "Apache-2.0" ]
2
2021-09-06T18:06:12.000Z
2021-12-31T07:44:43.000Z
"""apps""" # -*- coding:utf-8 -*- from .appbase import EAppClassify
11.666667
33
0.614286
8
70
5.375
1
0
0
0
0
0
0
0
0
0
0
0.016949
0.157143
70
5
34
14
0.711864
0.371429
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
ed84fea19a8c88366806a8c8e48f4efce4215953
141
py
Python
siteUpdateNotifier/sun/views.py
k00n/site_update_notifier
05f3614c4976598166d2be899f79c389fc9d5fe5
[ "MIT" ]
null
null
null
siteUpdateNotifier/sun/views.py
k00n/site_update_notifier
05f3614c4976598166d2be899f79c389fc9d5fe5
[ "MIT" ]
null
null
null
siteUpdateNotifier/sun/views.py
k00n/site_update_notifier
05f3614c4976598166d2be899f79c389fc9d5fe5
[ "MIT" ]
null
null
null
from django.shortcuts import render from django.views import View class SiteUpdateNotifier(View): def get(self, request): pass
17.625
35
0.737589
18
141
5.777778
0.777778
0.192308
0
0
0
0
0
0
0
0
0
0
0.198582
141
7
36
20.142857
0.920354
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0.2
0.4
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
5
71ebf3c73b81633d14cd5bf7bd9031122fe94a80
80
py
Python
bravado/compat.py
analogue/swagger-py
ded3a811579ea4e0d1adb3582b90d8d941b7fb17
[ "BSD-3-Clause" ]
null
null
null
bravado/compat.py
analogue/swagger-py
ded3a811579ea4e0d1adb3582b90d8d941b7fb17
[ "BSD-3-Clause" ]
2
2016-12-14T07:33:33.000Z
2017-05-11T13:40:48.000Z
bravado/compat.py
Cloudlock/bravado
bacf49ea9d791ec9f564a3a141c77995d2f395b0
[ "BSD-3-Clause" ]
null
null
null
try: import simplejson as json except ImportError: import json # noqa
13.333333
29
0.7
10
80
5.6
0.8
0
0
0
0
0
0
0
0
0
0
0
0.2625
80
5
30
16
0.949153
0.05
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.75
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
92d40114d3542b872feaf887c44e15a659169772
27
py
Python
local/make_vctk_wav.py
ishine/pytorch-kaldi-neural-speaker-embeddings
dab06a85c3c759fdacd5b90173eb7ba93f356e88
[ "BSD-3-Clause" ]
141
2019-11-13T10:04:00.000Z
2022-03-16T13:28:27.000Z
local/make_vctk_wav.py
swhan9873/pytorch-kaldi-neural-speaker-embeddings
a6196c5c580be0f26cd31ce9394e4aa78a9ed315
[ "BSD-3-Clause" ]
6
2020-02-04T13:10:34.000Z
2021-12-21T13:18:29.000Z
local/make_vctk_wav.py
swhan9873/pytorch-kaldi-neural-speaker-embeddings
a6196c5c580be0f26cd31ce9394e4aa78a9ed315
[ "BSD-3-Clause" ]
30
2019-11-10T06:54:34.000Z
2022-02-13T01:36:48.000Z
import os import sys path
5.4
10
0.777778
5
27
4.2
0.8
0
0
0
0
0
0
0
0
0
0
0
0.222222
27
4
11
6.75
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
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
92fd16e80b9d1ce24accaf81c5836cdd510d048c
452
py
Python
pygromos/files/blocks/__init__.py
SalomeRonja/PyGromosTools
5a17740a0ec634b8b591ef74d8a420e3fd3e38ba
[ "MIT" ]
13
2021-03-17T09:29:37.000Z
2022-01-14T20:42:16.000Z
pygromos/files/blocks/__init__.py
SchroederB/PyGromosTools
c31c38455a849c864241a962efee9e6575f27b06
[ "MIT" ]
185
2021-03-03T14:24:55.000Z
2022-03-31T18:39:29.000Z
pygromos/files/blocks/__init__.py
SchroederB/PyGromosTools
c31c38455a849c864241a962efee9e6575f27b06
[ "MIT" ]
13
2021-03-03T14:18:06.000Z
2022-02-17T09:48:55.000Z
from pygromos.files.blocks import coord_blocks as coords from pygromos.files.blocks import imd_blocks as imd from pygromos.files.blocks import topology_blocks as topo from pygromos.files.blocks import replica_exchange_blocks as repdat from pygromos.files.blocks import energy_blocks as ene from pygromos.files.blocks._general_blocks import TITLE, TIMESTEP, TRAJ # forward declarations TITLE:TITLE = TITLE TIMESTEP:TIMESTEP = TIMESTEP TRAJ:TRAJ = TRAJ
37.666667
71
0.84292
67
452
5.567164
0.328358
0.193029
0.273458
0.369973
0.38874
0
0
0
0
0
0
0
0.108407
452
12
72
37.666667
0.925558
0.044248
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5