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
8ec23c3a9e3c52ff1bcf08e33f1a9c1fcf6ee883
417
py
Python
test_func.py
indofanat/inliner
1dc0cb3da313fc694cf0f09150c488b51d991bd6
[ "MIT" ]
72
2015-01-10T14:35:24.000Z
2022-03-22T14:00:51.000Z
test_func.py
indofanat/inliner
1dc0cb3da313fc694cf0f09150c488b51d991bd6
[ "MIT" ]
2
2015-06-16T20:05:21.000Z
2021-06-16T22:47:26.000Z
test_func.py
indofanat/inliner
1dc0cb3da313fc694cf0f09150c488b51d991bd6
[ "MIT" ]
13
2015-06-08T01:25:50.000Z
2021-11-25T16:02:15.000Z
from inliner import inline class SillyGetterSetter(object): def __init__(self, stuff): self.stuff = stuff @inline def setStuff(self, obj): self.stuff = obj @inline def getStuff(self): return self.stuff @inline def add_stuff(x, y): return x + y def add_lots_of_numbers(): for i in xrange(10): add_stuff(i, i+1) import dis dis.dis(add_lots_of_numbers)
16.68
32
0.640288
61
417
4.180328
0.459016
0.141176
0.109804
0.12549
0
0
0
0
0
0
0
0.009772
0.263789
417
25
33
16.68
0.820847
0
0
0.166667
0
0
0
0
0
0
0
0
0
1
0.277778
false
0
0.111111
0.111111
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
8ec7a763353c8546423b17b99e8982534029f416
861
py
Python
encrypt.py
mtlynch/simple-encrypt
f22efacf0215dd79b2f3de0550460ef98cb44995
[ "MIT" ]
null
null
null
encrypt.py
mtlynch/simple-encrypt
f22efacf0215dd79b2f3de0550460ef98cb44995
[ "MIT" ]
null
null
null
encrypt.py
mtlynch/simple-encrypt
f22efacf0215dd79b2f3de0550460ef98cb44995
[ "MIT" ]
null
null
null
#!/usr/bin/python3 import argparse import base64 from cryptography import fernet from cryptography.hazmat import backends from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.kdf import pbkdf2 import getpass import secrets import sys def _derive_key(password: bytes) -> bytes: kdf = pbkdf2.PBKDF2HMAC( algorithm=hashes.SHA256(), length=32, salt=b'', iterations=pow(10, 7), backend=backends.default_backend()) return base64.urlsafe_b64encode(kdf.derive(password)) def password_encrypt(message: bytes, password: str) -> bytes: key = _derive_key(password.encode()) return fernet.Fernet(key).encrypt(message) if __name__ == '__main__': message = sys.stdin.read() password = getpass.getpass() ciphertext = password_encrypt(message.encode(), password) print(ciphertext.decode())
27.774194
66
0.746806
104
861
6.028846
0.490385
0.102073
0.105263
0.102073
0
0
0
0
0
0
0
0.024457
0.14518
861
30
67
28.7
0.827446
0.019744
0
0
0
0
0.00949
0
0
0
0
0
0
1
0.090909
false
0.318182
0.409091
0
0.590909
0.045455
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
3
d907bd26982f2f0c607670322653cbde97921fee
370
py
Python
pystratis/api/voting/requestmodels/schedulevotewhitelisthashrequest.py
TjadenFroyda/pyStratis
9cc7620d7506637f8a2b84003d931eceb36ac5f2
[ "MIT" ]
8
2021-06-30T20:44:22.000Z
2021-12-07T14:42:22.000Z
pystratis/api/voting/requestmodels/schedulevotewhitelisthashrequest.py
TjadenFroyda/pyStratis
9cc7620d7506637f8a2b84003d931eceb36ac5f2
[ "MIT" ]
2
2021-07-01T11:50:18.000Z
2022-01-25T18:39:49.000Z
pystratis/api/voting/requestmodels/schedulevotewhitelisthashrequest.py
TjadenFroyda/pyStratis
9cc7620d7506637f8a2b84003d931eceb36ac5f2
[ "MIT" ]
4
2021-07-01T04:36:42.000Z
2021-09-17T10:54:19.000Z
from pydantic import Field from pystratis.api import Model from pystratis.core.types import uint256 # noinspection PyUnresolvedReferences class ScheduleVoteWhitelistHashRequest(Model): """A request model for the voting/schedulevote-whitelist endpoint. Args: hash_id (uint256): The hash to whitelist. """ hash_id: uint256 = Field(alias='hash')
26.428571
70
0.754054
43
370
6.44186
0.627907
0.093863
0.093863
0
0
0
0
0
0
0
0
0.029316
0.17027
370
13
71
28.461538
0.872964
0.413514
0
0
0
0
0.020202
0
0
0
0
0
0
1
0
true
0
0.6
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
d911d284c2c65abab19624640b4b1617c8de9f73
225
py
Python
problem0171.py
kmarcini/Project-Euler-Python
d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3
[ "BSD-3-Clause" ]
null
null
null
problem0171.py
kmarcini/Project-Euler-Python
d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3
[ "BSD-3-Clause" ]
null
null
null
problem0171.py
kmarcini/Project-Euler-Python
d644e8e1ec4fac70a9ab407ad5e1f0a75547c8d3
[ "BSD-3-Clause" ]
null
null
null
########################### # # #171 Finding numbers for which the sum of the squares of the digits is a square - Project Euler # https://projecteuler.net/problem=171 # # Code by Kevin Marciniak # ###########################
25
97
0.555556
27
225
4.62963
0.851852
0.08
0
0
0
0
0
0
0
0
0
0.031088
0.142222
225
8
98
28.125
0.61658
0.688889
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
d9218f78cebdd85b76c7f48a2f25369d9d4e7b11
1,161
py
Python
test/test_diaphite_creator.py
graceday/DiaphiteCreator
1a07db1890f1b8ab2ab0b78266ded3c3d023fbe8
[ "MIT" ]
null
null
null
test/test_diaphite_creator.py
graceday/DiaphiteCreator
1a07db1890f1b8ab2ab0b78266ded3c3d023fbe8
[ "MIT" ]
null
null
null
test/test_diaphite_creator.py
graceday/DiaphiteCreator
1a07db1890f1b8ab2ab0b78266ded3c3d023fbe8
[ "MIT" ]
1
2021-01-08T12:07:01.000Z
2021-01-08T12:07:01.000Z
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 6 13:17:19 2021 @author: matthew-bailey """ from layer_utils import verify_layer_sequence import pytest class TestSequenceVerifier: def test_all_same_type(self): """ Test two simple valid sequences. """ seq = [1, 1, 1, 1, 1, 1] assert verify_layer_sequence(seq) seq = [3, 3, 3, 3, 3, 3] assert verify_layer_sequence(seq) def test_one_negative(self): with pytest.raises(ValueError): seq = [1, 1, 1, 1, 5, 1] assert not verify_layer_sequence(seq) def test_one_nonnumeric(self): seq = [1, 1, 1, "a", 1, 1] assert not verify_layer_sequence(seq) def test_valid_pattern(self): seq = [1, 2, 3, 4] assert verify_layer_sequence(seq) def test_invalid_pattern(self): seq = [1, 3, 2, 4] assert not verify_layer_sequence(seq) def test_real_sequence(self): """ This sequence came with the code of unknown provenance """ seq = [1, 1, 1, 2, 3, 3, 3, 3, 3, 4, 1] assert verify_layer_sequence(seq)
24.702128
62
0.589147
167
1,161
3.916168
0.377246
0.039755
0.232416
0.235474
0.422018
0.382263
0.293578
0.17737
0.119266
0
0
0.067237
0.295435
1,161
46
63
25.23913
0.732274
0.165375
0
0.291667
0
0
0.001094
0
0
0
0
0
0.291667
1
0.25
false
0
0.083333
0
0.375
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
d948c452c85779664e4a5dbf95cd9a8458d4f86d
478
py
Python
mezzanine_live_tile/__init__.py
mush42/mezzanine-live-tile
28dd6cb1af43f25c50e724f141b5dd00f4f166e7
[ "MIT" ]
1
2019-08-12T23:38:40.000Z
2019-08-12T23:38:40.000Z
mezzanine_live_tile/__init__.py
mush42/mezzanine-live-tile
28dd6cb1af43f25c50e724f141b5dd00f4f166e7
[ "MIT" ]
null
null
null
mezzanine_live_tile/__init__.py
mush42/mezzanine-live-tile
28dd6cb1af43f25c50e724f141b5dd00f4f166e7
[ "MIT" ]
1
2019-08-12T23:38:43.000Z
2019-08-12T23:38:43.000Z
""" Check that we have a valid class to work upon in our live tile notifications """ from django.core.exceptions import ImproperlyConfigured from mezzanine.utils.importing import import_dotted_path from mezzanine.conf import settings model_class_path, fields = settings.WINDOWS_TILE_MODEL try: import_dotted_path(model_class_path) except ImportError: raise ImproperlyConfigured("The WINDOWS_TILE_MODEL setting contains %s modle which can not be imported" %model_class_path)
34.142857
123
0.83682
69
478
5.594203
0.652174
0.07772
0.108808
0
0
0
0
0
0
0
0
0
0.112971
478
13
124
36.769231
0.910377
0.158996
0
0
0
0
0.187817
0
0
0
0
0
0
1
0
true
0
0.75
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
d9539fb40b1fbcd00d59d600edb3753c72e45338
2,798
py
Python
lime/scripts/graph_boltzmann_generator/test/test_f.py
choderalab/gin
9082431d8b664699a898c1e2fa490a18737d6e2d
[ "MIT" ]
24
2019-07-20T22:37:09.000Z
2021-07-07T07:13:56.000Z
lime/scripts/graph_boltzmann_generator/test/test_f.py
choderalab/gin
9082431d8b664699a898c1e2fa490a18737d6e2d
[ "MIT" ]
3
2021-05-10T05:29:59.000Z
2022-02-10T00:15:05.000Z
lime/scripts/graph_boltzmann_generator/test/test_f.py
kuano-ai/gimlet
9082431d8b664699a898c1e2fa490a18737d6e2d
[ "MIT" ]
8
2019-08-09T17:30:20.000Z
2021-12-01T13:27:46.000Z
import flow import tensorflow as tf import gin import numpy as np import numpy.testing as npt def test_f(): mol = gin.i_o.from_smiles.to_mol('CC') mol = gin.deterministic.hydrogen.add_hydrogen(mol) atoms, adjacency_map = mol chinese_postman_routes = tf.constant( [ [0, 1, 4, 1, 5, 1, 2, 3, 2, 7, 2, 6], [0, 1, 4, 1, 5, 1, 2, 3, 2, 6, 2, 7], [0, 1, 4, 1, 5, 1, 2, 6, 2, 3, 2, 7], [0, 1, 4, 1, 5, 1, 2, 6, 2, 7, 2, 3], [0, 1, 4, 1, 5, 1, 2, 7, 2, 6, 2, 3], [0, 1, 4, 1, 5, 1, 2, 7, 2, 3, 2, 6], [0, 1, 5, 1, 4, 1, 2, 3, 2, 7, 2, 6], [0, 1, 5, 1, 4, 1, 2, 3, 2, 6, 2, 7], [0, 1, 5, 1, 4, 1, 2, 6, 2, 3, 2, 7], [0, 1, 5, 1, 4, 1, 2, 6, 2, 7, 2, 3], [0, 1, 5, 1, 4, 1, 2, 7, 2, 6, 2, 3], [0, 1, 5, 1, 4, 1, 2, 7, 2, 3, 2, 6], [5, 1, 0, 1, 4, 1, 2, 3, 2, 7, 2, 6], [5, 1, 0, 1, 4, 1, 2, 3, 2, 6, 2, 7], [5, 1, 0, 1, 4, 1, 2, 6, 2, 3, 2, 7], [5, 1, 0, 1, 4, 1, 2, 6, 2, 7, 2, 3], [5, 1, 0, 1, 4, 1, 2, 7, 2, 6, 2, 3], [5, 1, 0, 1, 4, 1, 2, 7, 2, 3, 2, 6], [5, 1, 4, 1, 0, 1, 2, 3, 2, 7, 2, 6], [5, 1, 4, 1, 0, 1, 2, 3, 2, 6, 2, 7], [5, 1, 4, 1, 0, 1, 2, 6, 2, 3, 2, 7], [5, 1, 4, 1, 0, 1, 2, 6, 2, 7, 2, 3], [5, 1, 4, 1, 0, 1, 2, 7, 2, 6, 2, 3], [5, 1, 4, 1, 0, 1, 2, 7, 2, 3, 2, 6], [4, 1, 5, 1, 0, 1, 2, 3, 2, 7, 2, 6], [4, 1, 5, 1, 0, 1, 2, 3, 2, 6, 2, 7], [4, 1, 5, 1, 0, 1, 2, 6, 2, 3, 2, 7], [4, 1, 5, 1, 0, 1, 2, 6, 2, 7, 2, 3], [4, 1, 5, 1, 0, 1, 2, 7, 2, 6, 2, 3], [4, 1, 5, 1, 0, 1, 2, 7, 2, 3, 2, 6], [4, 1, 0, 1, 5, 1, 2, 3, 2, 7, 2, 6], [4, 1, 0, 1, 5, 1, 2, 3, 2, 6, 2, 7], [4, 1, 0, 1, 5, 1, 2, 6, 2, 3, 2, 7], [4, 1, 0, 1, 5, 1, 2, 6, 2, 7, 2, 3], [4, 1, 0, 1, 5, 1, 2, 7, 2, 6, 2, 3], [4, 1, 0, 1, 5, 1, 2, 7, 2, 3, 2, 6], ], dtype=tf.int64) graph_flow = flow.GraphFlow(whiten=False) z = tf.random.normal( shape = (36, 6, 3)) x, log_det_zx = graph_flow.f_zx(z, atoms, adjacency_map, chinese_postman_routes) z_, log_det_xz = graph_flow.f_xz(x, atoms, adjacency_map, chinese_postman_routes) npt.assert_almost_equal(to_return_0.numpy(), to_return_1.numpy()) # x_, log_det_zx_ = graph_flow.f_zx(z_, atoms, adjacency_map, chinese_postman_routes) # npt.assert_almost_equal(z_.numpy(), z.numpy()) # npt.assert_almost_equal(z.numpy(), z_.numpy()) # npt.assert_almost_equal(log_det_zx.numpy(), log_det_xz.numpy()) # npt.assert_almost_equal(x.numpy(), x_.numpy())
37.306667
89
0.401716
587
2,798
1.821124
0.098808
0.067353
0.067353
0.044902
0.669785
0.646399
0.646399
0.646399
0.646399
0.595884
0
0.251285
0.374196
2,798
74
90
37.810811
0.359223
0.102931
0
0
0
0
0.000799
0
0
0
0
0
0.018182
1
0.018182
false
0
0.090909
0
0.109091
0
0
0
1
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
0
0
0
0
0
0
0
3
d953c2e4063ac11b890c1e9193a951bcbcffcd89
217
py
Python
api/factories/region.py
IFRCGo/ifrcgo-api
c1c3e0cf1076ab48d03db6aaf7a00f8485ca9e1a
[ "MIT" ]
11
2018-06-11T06:05:12.000Z
2022-03-25T09:31:44.000Z
api/factories/region.py
IFRCGo/ifrcgo-api
c1c3e0cf1076ab48d03db6aaf7a00f8485ca9e1a
[ "MIT" ]
498
2017-11-07T21:20:13.000Z
2022-03-31T14:37:18.000Z
api/factories/region.py
IFRCGo/ifrcgo-api
c1c3e0cf1076ab48d03db6aaf7a00f8485ca9e1a
[ "MIT" ]
6
2018-04-11T13:29:50.000Z
2020-07-16T16:52:11.000Z
import factory from factory import fuzzy from .. import models class RegionFactory(factory.django.DjangoModelFactory): class Meta: model = models.Region name = fuzzy.FuzzyChoice(models.RegionName)
18.083333
55
0.746544
24
217
6.75
0.625
0
0
0
0
0
0
0
0
0
0
0
0.184332
217
11
56
19.727273
0.915254
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.428571
0
0.857143
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
d95778c06dcc32a096bb83d9966d90fde9bdc449
116
py
Python
tests/example/conflict/__init__.py
scbedd/sphinx-docfx-yaml
1330a6621ccda57c016545e36968f07aef07e4db
[ "Apache-2.0" ]
8
2018-07-28T14:18:04.000Z
2021-10-15T08:21:25.000Z
tests/example/conflict/__init__.py
scbedd/sphinx-docfx-yaml
1330a6621ccda57c016545e36968f07aef07e4db
[ "Apache-2.0" ]
12
2018-07-24T09:03:13.000Z
2021-05-04T18:18:05.000Z
tests/example/conflict/__init__.py
scbedd/sphinx-docfx-yaml
1330a6621ccda57c016545e36968f07aef07e4db
[ "Apache-2.0" ]
11
2017-10-30T09:31:32.000Z
2021-03-11T23:20:12.000Z
# coding: utf-8 """ Package used to test YAML file conflicting. """ from .foo import Foo __all__ = ['Foo']
14.5
48
0.62069
16
116
4.25
0.875
0
0
0
0
0
0
0
0
0
0
0.011364
0.241379
116
8
49
14.5
0.761364
0.5
0
0
0
0
0.068182
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
d981521652a415e3782f47b3a5314943e442bb96
122
py
Python
Backend/bike-manager-be/bike/TipoBike.py
jpdarricarrere/Trabalho_Eng_Software
4a4929878890df312aea4c56dc6c2ce4c5532aa6
[ "MIT" ]
null
null
null
Backend/bike-manager-be/bike/TipoBike.py
jpdarricarrere/Trabalho_Eng_Software
4a4929878890df312aea4c56dc6c2ce4c5532aa6
[ "MIT" ]
null
null
null
Backend/bike-manager-be/bike/TipoBike.py
jpdarricarrere/Trabalho_Eng_Software
4a4929878890df312aea4c56dc6c2ce4c5532aa6
[ "MIT" ]
2
2022-03-20T18:16:45.000Z
2022-03-20T18:22:16.000Z
from enum import Enum class TipoBike(Enum): urbana = 'urbana' transporte = 'transporte' corrida = 'corrida'
17.428571
29
0.663934
13
122
6.230769
0.615385
0
0
0
0
0
0
0
0
0
0
0
0.237705
122
6
30
20.333333
0.870968
0
0
0
0
0
0.188525
0
0
0
0
0
0
1
0
false
0
0.2
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
d9853a93187db6bb57dc4f160db304d1c200e02d
372
py
Python
bayesian_framework/inference/stochastic_models/covariance_type.py
AlexeyKonakov/state-space-estimation
ba30243211aded0db5b56ece134ab70d0b27ed03
[ "MIT" ]
null
null
null
bayesian_framework/inference/stochastic_models/covariance_type.py
AlexeyKonakov/state-space-estimation
ba30243211aded0db5b56ece134ab70d0b27ed03
[ "MIT" ]
null
null
null
bayesian_framework/inference/stochastic_models/covariance_type.py
AlexeyKonakov/state-space-estimation
ba30243211aded0db5b56ece134ab70d0b27ed03
[ "MIT" ]
null
null
null
from enum import Enum class CovarianceType(Enum): unknown = 0 full = 1 diag = 2 sqrt = 3 sqrt_diag = 4, svd = 5 def is_sqrt_like(cov_type: CovarianceType): return cov_type in (CovarianceType.sqrt, CovarianceType.sqrt_diag) def is_diag_like(cov_type: CovarianceType): return cov_type in (CovarianceType.diag, CovarianceType.sqrt_diag)
19.578947
70
0.715054
52
372
4.903846
0.442308
0.109804
0.086275
0.196078
0.423529
0.423529
0.423529
0.423529
0.423529
0
0
0.020408
0.209677
372
18
71
20.666667
0.846939
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.083333
0.166667
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
3
7953237757066a1e307a88164071dd53e0b5748e
22
py
Python
Data/__init__.py
himammz/GpTest
66d6158fe3729cd26ee89b5d4531a45ef80b4bb4
[ "Apache-2.0" ]
1
2017-05-03T17:45:58.000Z
2017-05-03T17:45:58.000Z
Data/__init__.py
LobnaMazhar/test-Python_heroku_webhook
cf51971646a3481cc89bbfef17e5816f8684448d
[ "Apache-2.0" ]
null
null
null
Data/__init__.py
LobnaMazhar/test-Python_heroku_webhook
cf51971646a3481cc89bbfef17e5816f8684448d
[ "Apache-2.0" ]
null
null
null
__all__ = ['Database']
22
22
0.681818
2
22
5.5
1
0
0
0
0
0
0
0
0
0
0
0
0.090909
22
1
22
22
0.55
0
0
0
0
0
0.347826
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
79742159685b138626139ec17f0dd1f22c8b1981
338
py
Python
rial_old/stages/post_parsing/infinite_loop_detector.py
L3tum/RIAL
fba25f37434ff51e0de8e22ce834af589aba24e8
[ "BSD-3-Clause" ]
2
2020-06-02T20:00:28.000Z
2020-06-06T02:15:49.000Z
rial_old/stages/post_parsing/infinite_loop_detector.py
L3tum/RIAL
fba25f37434ff51e0de8e22ce834af589aba24e8
[ "BSD-3-Clause" ]
51
2020-04-13T13:27:10.000Z
2020-06-12T11:38:36.000Z
rial_old/stages/post_parsing/infinite_loop_detector.py
L3tum/RIAL
fba25f37434ff51e0de8e22ce834af589aba24e8
[ "BSD-3-Clause" ]
2
2020-06-24T14:44:01.000Z
2020-11-29T04:08:54.000Z
from rial.concept.parser import Tree from rial.stages.post_parsing.PostParsingInterface import PostParsingInterface class InfiniteLoopDetector(PostParsingInterface): def execute(self, ast: Tree): while ast is not None: self.visit_tree(ast) ast = None def visit_tree(self, ast: Tree): pass
28.166667
78
0.704142
40
338
5.875
0.55
0.068085
0.093617
0
0
0
0
0
0
0
0
0
0.227811
338
12
79
28.166667
0.900383
0
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0.111111
0.222222
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
7982877c4674b7b8d256140ac5214051506dd2de
288
py
Python
model.py
ndminh21/aaa
b31fa62092f5839bda567d97e0b52868f52cc79e
[ "BSD-Source-Code" ]
null
null
null
model.py
ndminh21/aaa
b31fa62092f5839bda567d97e0b52868f52cc79e
[ "BSD-Source-Code" ]
null
null
null
model.py
ndminh21/aaa
b31fa62092f5839bda567d97e0b52868f52cc79e
[ "BSD-Source-Code" ]
null
null
null
from app import db from sqlalchemy.dialects.postgresql import JSON class Transaction(db.Model): __tablename__ = 'transaction' id = db.Column(db.String(), primary_key=True) size = db.Column(db.String()) time = db.Column(db.String()) valueout = db.Column(db.String())
26.181818
49
0.697917
39
288
5.025641
0.538462
0.163265
0.204082
0.326531
0
0
0
0
0
0
0
0
0.166667
288
11
50
26.181818
0.816667
0
0
0
0
0
0.038062
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
798637be871389748f30a7a91d907c86601d0900
2,438
py
Python
Data Analyst in Python/Step 1 - Introduction to Python/1. Python for Data Science Fundamentals/7. Functions Intermediate.py
MyArist/Dataquest
d0ee0a2a5e9d1f69f09bf0f6c32f382b6fa46b18
[ "MIT" ]
8
2020-07-27T12:04:54.000Z
2021-03-01T04:39:33.000Z
Data Scientist In Python/Step 1 - Python Introduction/1. Python for Data Science Fundamentals/7. Functions Intermediate.py
myarist/Dataquest
d0ee0a2a5e9d1f69f09bf0f6c32f382b6fa46b18
[ "MIT" ]
null
null
null
Data Scientist In Python/Step 1 - Python Introduction/1. Python for Data Science Fundamentals/7. Functions Intermediate.py
myarist/Dataquest
d0ee0a2a5e9d1f69f09bf0f6c32f382b6fa46b18
[ "MIT" ]
15
2021-03-30T06:45:19.000Z
2022-03-17T03:55:02.000Z
## 1. Interfering with the Built-in Functions ## a_list = [1, 8, 10, 9, 7] print(max(a_list)) def max(a_list): return "No max value returned" max_val_test_0 = max(a_list) print(max_val_test_0) del max ## 3. Default Arguments ## # INITIAL CODE def open_dataset(file_name): opened_file = open(file_name) from csv import reader read_file = reader(opened_file) data = list(read_file) return data # SOLUTION CODE def open_dataset(file_name='AppleStore.csv'): opened_file = open(file_name) from csv import reader read_file = reader(opened_file) data = list(read_file) return data apps_data = open_dataset() ## 4. The Official Python Documentation ## one_decimal = round(3.43, ndigits=1) two_decimals = round(0.23321, 2) # using only positional arguments five_decimals = round(921.2225227, 5) ## 5. Multiple Return Statements ## # INITIAL CODE def open_dataset(file_name='AppleStore.csv'): opened_file = open(file_name) from csv import reader read_file = reader(opened_file) data = list(read_file) return data # SOLUTION CODE def open_dataset(file_name='AppleStore.csv', header=True): opened_file = open(file_name) from csv import reader read_file = reader(opened_file) data = list(read_file) if header: return data[1:] else: return data apps_data = open_dataset() ## 6. Returning Multiple Variables ## # INITIAL CODE def open_dataset(file_name='AppleStore.csv', header=True): opened_file = open(file_name) from csv import reader read_file = reader(opened_file) data = list(read_file) if header: return data[1:] else: return data # SOLUTION CODE def open_dataset(file_name='AppleStore.csv', header=True): opened_file = open(file_name) from csv import reader read_file = reader(opened_file) data = list(read_file) if header: return data[1:], data[0] else: return data all_data = open_dataset() header = all_data[1] apps_data = all_data[0] ## 7. More About Tuples ## def open_dataset(file_name='AppleStore.csv', header=True): opened_file = open(file_name) from csv import reader read_file = reader(opened_file) data = list(read_file) if header: return data[1:], data[0] else: return data apps_data, header = open_dataset()
22.785047
66
0.664479
345
2,438
4.484058
0.22029
0.072398
0.063348
0.081448
0.72786
0.722689
0.698125
0.676794
0.676794
0.667744
0
0.023707
0.23872
2,438
107
67
22.785047
0.809806
0.123462
0
0.785714
0
0
0.049881
0
0
0
0
0
0
1
0.114286
false
0
0.1
0.014286
0.385714
0.028571
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
799a32f641dd939095011e0ef627b43b64e4cd1e
56
py
Python
insta_share/__init__.py
softcoder24/insta_share
955ea1052b739b029608a379ad7f2208a03f68ce
[ "Apache-2.0" ]
22
2020-11-17T19:16:58.000Z
2022-02-07T17:15:54.000Z
insta_share/__init__.py
softcoder24/insta_share
955ea1052b739b029608a379ad7f2208a03f68ce
[ "Apache-2.0" ]
8
2020-11-17T16:15:32.000Z
2022-01-18T19:09:00.000Z
insta_share/__init__.py
softcoder24/insta_share
955ea1052b739b029608a379ad7f2208a03f68ce
[ "Apache-2.0" ]
6
2020-11-17T15:31:16.000Z
2021-12-04T22:40:50.000Z
from .instagram import Instagram __version__ = "0.0.1"
14
32
0.75
8
56
4.75
0.75
0
0
0
0
0
0
0
0
0
0
0.0625
0.142857
56
3
33
18.666667
0.729167
0
0
0
0
0
0.089286
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
79b2113eada800efa20a5923fcf77c964fcabe4c
244
py
Python
src/tests/hoplalib/cast/test_classmodels.py
rickie/hopla
24a422194e42c03d5877dc167b2b07147326a595
[ "Apache-2.0" ]
null
null
null
src/tests/hoplalib/cast/test_classmodels.py
rickie/hopla
24a422194e42c03d5877dc167b2b07147326a595
[ "Apache-2.0" ]
null
null
null
src/tests/hoplalib/cast/test_classmodels.py
rickie/hopla
24a422194e42c03d5877dc167b2b07147326a595
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 from typing import List class HabiticaClassData: """A class with data about habitica classes. @see: hopla api content | jq .classes """ class_names: List[str] = ["warrior", "rogue", "healer", "wizard"]
22.181818
69
0.659836
31
244
5.16129
0.870968
0
0
0
0
0
0
0
0
0
0
0.005128
0.20082
244
10
70
24.4
0.815385
0.418033
0
0
0
0
0.188976
0
0
0
0
0
0
1
0
true
0
0.333333
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
79bbba38cafa68598c91dc9748366f0e4982f2f7
253
py
Python
solved/mq003.py
zao95/codingdojang-zao95-solving
409d1696700b453b183947d7bda8abcbbfe95bc5
[ "WTFPL" ]
2
2021-01-06T14:02:14.000Z
2022-02-19T17:38:16.000Z
solved/mq003.py
zao95/codingdojang-zao95-solving
409d1696700b453b183947d7bda8abcbbfe95bc5
[ "WTFPL" ]
null
null
null
solved/mq003.py
zao95/codingdojang-zao95-solving
409d1696700b453b183947d7bda8abcbbfe95bc5
[ "WTFPL" ]
null
null
null
# 자작 문제풀이 # Question number. 003 # Author: Lee Jeongwoo # Github name: zao95 # ========== Question ========== # python-packer를 이용하여 실행파일 제작 # ============================== def abc(): print("a") abc() print(hex(id(abc()))) print(hex(id("abc")))
14.882353
32
0.501976
30
253
4.233333
0.733333
0.188976
0.173228
0.204724
0.228346
0
0
0
0
0
0
0.023474
0.158103
253
17
33
14.882353
0.57277
0.624506
0
0
0
0
0.045455
0
0
0
0
0
0
1
0.2
true
0
0
0
0.2
0.6
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
3
79d6a844f0a97566c860753b867042dc06bee90a
95
py
Python
paleosites/apps.py
dennereed/paleocore
d6da6c39cde96050ee4b9e7213ec1200530cbeee
[ "MIT" ]
1
2021-02-05T19:50:13.000Z
2021-02-05T19:50:13.000Z
paleosites/apps.py
dennereed/paleocore
d6da6c39cde96050ee4b9e7213ec1200530cbeee
[ "MIT" ]
59
2020-06-17T22:21:51.000Z
2022-02-10T05:00:01.000Z
paleosites/apps.py
dennereed/paleocore
d6da6c39cde96050ee4b9e7213ec1200530cbeee
[ "MIT" ]
2
2020-07-01T14:11:09.000Z
2020-08-10T17:27:26.000Z
from django.apps import AppConfig class PaleositesConfig(AppConfig): name = 'paleosites'
15.833333
34
0.768421
10
95
7.3
0.9
0
0
0
0
0
0
0
0
0
0
0
0.157895
95
5
35
19
0.9125
0
0
0
0
0
0.105263
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
79d87f5f40b89e3cab855d94f84613002fc5749e
400
py
Python
poll/forms.py
vishalpandeyvip/GURU--an-online-class-portal
de6e129f2fd70f80393e273abd0f63a1a30cda72
[ "Apache-2.0" ]
1
2020-10-20T08:46:27.000Z
2020-10-20T08:46:27.000Z
poll/forms.py
vishalpandeyvip/GURU
de6e129f2fd70f80393e273abd0f63a1a30cda72
[ "Apache-2.0" ]
null
null
null
poll/forms.py
vishalpandeyvip/GURU
de6e129f2fd70f80393e273abd0f63a1a30cda72
[ "Apache-2.0" ]
1
2020-08-31T08:06:21.000Z
2020-08-31T08:06:21.000Z
from django import forms from .models import Poll, Choice class QuestionForm(forms.ModelForm): class Meta: model = Poll fields = ['topic','poll_details','who_can_vote','announce_at'] class PollUpdateForm(forms.ModelForm): class Meta: model = Poll fields = ['topic','poll_details','announce_at'] class ChoiceForm(forms.ModelForm): class Meta: model = Choice fields = ['choice_text']
22.222222
64
0.7325
51
400
5.607843
0.45098
0.146853
0.199301
0.241259
0.475524
0.377622
0.377622
0.377622
0.377622
0.377622
0
0
0.1425
400
18
65
22.222222
0.833819
0
0
0.357143
0
0
0.197007
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.571429
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
8dba79d39c18f46b669087098e07b5b8e9a3e067
2,195
py
Python
example/tester/migrations/0001_initial.py
WenminZhao/django-reactive
a579a96b6f0af6ed4affc3561cc0bc82e0fba59f
[ "MIT" ]
null
null
null
example/tester/migrations/0001_initial.py
WenminZhao/django-reactive
a579a96b6f0af6ed4affc3561cc0bc82e0fba59f
[ "MIT" ]
null
null
null
example/tester/migrations/0001_initial.py
WenminZhao/django-reactive
a579a96b6f0af6ed4affc3561cc0bc82e0fba59f
[ "MIT" ]
null
null
null
# Generated by Django 2.0.9 on 2018-12-08 12:25 from django.db import migrations, models import django_reactive.fields class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='TestModel', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('simple', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Simple')), ('nested', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Nested')), ('arrays', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Arrays')), ('numbers', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Numbers')), ('widgets', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Widgets')), ('ordering', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Ordering')), ('references', django_reactive.fields.ReactJSONSchemaField(default=dict)), ('errors', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Errors')), ('large', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Large')), ('date_and_time', django_reactive.fields.ReactJSONSchemaField( default=dict, help_text='Date and time')), ('validation', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Validation')), ('file', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Files')), ('alternatives', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Alternatives')), ('property_dependencies', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Property dependencies')), ('schema_dependencies', django_reactive.fields.ReactJSONSchemaField(default=dict, help_text='Schema dependencies')), ], ), ]
56.282051
118
0.660592
204
2,195
6.926471
0.289216
0.158528
0.226469
0.424628
0.63765
0.63765
0.601557
0.601557
0.100495
0
0
0.008716
0.215945
2,195
38
119
57.763158
0.812318
0.020501
0
0
1
0
0.132216
0.009777
0
0
0
0
0
1
0
false
0
0.0625
0
0.1875
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
8dd911497b1041f2adb09e4c8cc000d2f94e3512
2,938
py
Python
glamkit_collections/contrib/work_creator/migrations/0030_auto_20170523_1243.py
ic-labs/glamkit-collections
a99c64f1d6af2d900f2687dd4382404d67d559bb
[ "MIT" ]
52
2016-09-13T03:50:58.000Z
2022-02-23T16:25:08.000Z
glamkit_collections/contrib/work_creator/migrations/0030_auto_20170523_1243.py
ic-labs/django-icekit
c507ea5b1864303732c53ad7c5800571fca5fa94
[ "MIT" ]
304
2016-08-11T14:17:30.000Z
2020-07-22T13:35:18.000Z
glamkit_collections/contrib/work_creator/migrations/0030_auto_20170523_1243.py
ic-labs/django-icekit
c507ea5b1864303732c53ad7c5800571fca5fa94
[ "MIT" ]
12
2016-09-21T18:46:35.000Z
2021-02-15T19:37:50.000Z
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import edtf.fields class Migration(migrations.Migration): dependencies = [ ('gk_collections_work_creator', '0029_auto_20170523_1149'), ] operations = [ migrations.AddField( model_name='creatorbase', name='brief', field=models.TextField(blank=True, help_text=b'A document brief describing the purpose of this content'), ), migrations.AddField( model_name='workbase', name='brief', field=models.TextField(blank=True, help_text=b'A document brief describing the purpose of this content'), ), migrations.AlterField( model_name='creatorbase', name='admin_notes', field=models.TextField(blank=True, help_text=b"Administrator's notes about this content"), ), migrations.AlterField( model_name='creatorbase', name='birth_date_edtf', field=edtf.fields.EDTFField(help_text=b"an <a href='http://www.loc.gov/standards/datetime/implementations.html'>EDTF</a>-formatted date, parsed from the display date, e.g. '1855/1860-06-04'", blank=True, upper_fuzzy_field=b'birth_date_sort_descending', null=True, lower_fuzzy_field=b'birth_date_sort_ascending', upper_strict_field=b'birth_date_latest', verbose_name=b'Date of creation (EDTF)', lower_strict_field=b'birth_date_earliest', natural_text_field=b'birth_date_display'), ), migrations.AlterField( model_name='creatorbase', name='death_date_edtf', field=edtf.fields.EDTFField(help_text=b"an <a href='http://www.loc.gov/standards/datetime/implementations.html'>EDTF</a>-formatted date, parsed from the display date, e.g. '1855/1860-06-04'", blank=True, upper_fuzzy_field=b'death_date_sort_descending', null=True, lower_fuzzy_field=b'death_date_sort_ascending', upper_strict_field=b'death_date_latest', verbose_name=b'Date of death (EDTF)', lower_strict_field=b'death_date_earliest', natural_text_field=b'death_date_display'), ), migrations.AlterField( model_name='workbase', name='admin_notes', field=models.TextField(blank=True, help_text=b"Administrator's notes about this content"), ), migrations.AlterField( model_name='workbase', name='date_edtf', field=edtf.fields.EDTFField(help_text=b"an <a href='http://www.loc.gov/standards/datetime/implementations.html'>EDTF</a>-formatted date, parsed from the display date, e.g. '1855/1860-06-04'", blank=True, upper_fuzzy_field=b'date_sort_descending', null=True, lower_fuzzy_field=b'date_sort_ascending', upper_strict_field=b'date_latest', verbose_name=b'Date of creation (EDTF)', lower_strict_field=b'date_earliest', natural_text_field=b'date_display'), ), ]
57.607843
491
0.693329
387
2,938
5.015504
0.229974
0.046368
0.032458
0.074704
0.851108
0.829985
0.715611
0.648635
0.625451
0.560536
0
0.022166
0.186181
2,938
50
492
58.76
0.789628
0.007148
0
0.659091
0
0.068182
0.403774
0.052144
0
0
0
0
0
1
0
false
0
0.068182
0
0.136364
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
8ddf720d31f6738b5f0b050e396feb04999f5b66
1,157
py
Python
python/tblink_rpc_gw/rt/cocotb/__main__.py
tblink-rpc/tblink-rpc-gw
bc0c2e747b37f728128466af146597238d1c9cfb
[ "Apache-2.0" ]
null
null
null
python/tblink_rpc_gw/rt/cocotb/__main__.py
tblink-rpc/tblink-rpc-gw
bc0c2e747b37f728128466af146597238d1c9cfb
[ "Apache-2.0" ]
null
null
null
python/tblink_rpc_gw/rt/cocotb/__main__.py
tblink-rpc/tblink-rpc-gw
bc0c2e747b37f728128466af146597238d1c9cfb
[ "Apache-2.0" ]
null
null
null
''' Created on Mar 1, 2022 @author: mballance ''' import importlib import sys from tblink_rpc_core.endpoint import Endpoint from tblink_rpc_gw.rt.cocotb.mgr import Mgr def run_cocotb(ep : Endpoint): # cocotb has a native module for interfacing with the # simulator. We need to provide our own cocotb 'simulator' # module. We do this by inserting our own module prior # to importing cocotb. sys.modules['cocotb.simulator'] = importlib.import_module("tblink_rpc.rt.cocotb.simulator") # Set the endpoint for when the user calls # Note: it's required to import the module here so as # to avoid messing up replacement of the simulator module from tblink_rpc import cocotb_compat cocotb_compat._set_ep(ep) mgr = Mgr.inst() mgr.ep = ep # TODO: init ep.init(None) while not ep.is_init(): ep.process_one_message() import cocotb cocotb._initialise_testbench([]) pass def main(): ''' - Initiate connection to hardware platform - Pass endpoint to 'core' main ''' pass if __name__ == "__main__": main()
22.686275
95
0.656871
157
1,157
4.681529
0.515924
0.04898
0.053061
0
0
0
0
0
0
0
0
0.005869
0.263613
1,157
51
96
22.686275
0.856808
0.401901
0
0.1
0
0
0.081942
0.045524
0
0
0
0.019608
0
1
0.1
false
0.1
0.35
0
0.45
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
1
1
0
0
0
0
3
8de180647d2f66d6560c413289cd138d70ea2ad6
145
py
Python
exercicios_curso_em_video/Exercicio 46.py
Sposigor/Caminho_do_Python
e84d74e9dc89c0966f931a94cb9ebe3ee4671b6d
[ "MIT" ]
1
2021-01-13T18:07:46.000Z
2021-01-13T18:07:46.000Z
exercicios_curso_em_video/Exercicio 46.py
Sposigor/Caminho_do_Python
e84d74e9dc89c0966f931a94cb9ebe3ee4671b6d
[ "MIT" ]
null
null
null
exercicios_curso_em_video/Exercicio 46.py
Sposigor/Caminho_do_Python
e84d74e9dc89c0966f931a94cb9ebe3ee4671b6d
[ "MIT" ]
null
null
null
from time import sleep print('Fogos de artifício vai começar em:') for i in range(10, -1, -1): sleep(1) print(i) print('BUAAAAAAAAAAAAA')
24.166667
43
0.682759
24
145
4.125
0.75
0
0
0
0
0
0
0
0
0
0
0.042017
0.17931
145
6
44
24.166667
0.789916
0
0
0
0
0
0.335616
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
8de3b8cbefb7da78e212e39b7dfd4a9e45616ae9
395
py
Python
mailtrigger/trigger/trigger.py
craftslab/mailtrigger
18856d574d1c4c99a4fa84e88b46273b5df2582d
[ "Apache-2.0" ]
null
null
null
mailtrigger/trigger/trigger.py
craftslab/mailtrigger
18856d574d1c4c99a4fa84e88b46273b5df2582d
[ "Apache-2.0" ]
null
null
null
mailtrigger/trigger/trigger.py
craftslab/mailtrigger
18856d574d1c4c99a4fa84e88b46273b5df2582d
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- import abc class TriggerException(Exception): def __init__(self, info): super().__init__(self) self._info = info def __str__(self): return self._info class Trigger(object): __metaclass__ = abc.ABCMeta @staticmethod def help(): return '' @abc.abstractmethod def run(self, event): return '', True
15.8
34
0.594937
42
395
5.166667
0.595238
0.110599
0
0
0
0
0
0
0
0
0
0.003546
0.286076
395
24
35
16.458333
0.765957
0.053165
0
0
0
0
0
0
0
0
0
0
0
1
0.266667
false
0
0.066667
0.2
0.733333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
8de8024631576b67e72ffa9b638299366362e1a4
60
py
Python
Lesson8_1/ff.py
shinkai-tester/python_beginner
a934328c9a50241cc3f02a423060e16aab53b425
[ "Apache-2.0" ]
2
2021-06-01T13:24:04.000Z
2021-06-01T13:27:47.000Z
Lesson8_1/ff.py
shinkai-tester/python_beginner
a934328c9a50241cc3f02a423060e16aab53b425
[ "Apache-2.0" ]
null
null
null
Lesson8_1/ff.py
shinkai-tester/python_beginner
a934328c9a50241cc3f02a423060e16aab53b425
[ "Apache-2.0" ]
null
null
null
def f(a): a += 2 return a b = 1 b = f(b) print(b)
6.666667
12
0.416667
14
60
1.785714
0.571429
0
0
0
0
0
0
0
0
0
0
0.055556
0.4
60
8
13
7.5
0.638889
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.333333
0.166667
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
5c00950b25c9b7da1e6e25db92f6ed895bb30fc7
259
py
Python
config.py
caly-pso/disease_explorer_app
3a7a5123577b1d23af18c74ee9666dfa012298ab
[ "MIT" ]
2
2020-12-16T03:01:17.000Z
2020-12-16T03:39:46.000Z
config.py
caly-pso/disease_explorer_app
3a7a5123577b1d23af18c74ee9666dfa012298ab
[ "MIT" ]
null
null
null
config.py
caly-pso/disease_explorer_app
3a7a5123577b1d23af18c74ee9666dfa012298ab
[ "MIT" ]
null
null
null
db = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv" # database file downloaded from # https://www.weather.gov/source/gis/Shapefiles/County/c_03mr20.zip # to get the lat and long values for US counties dbf = "./c_03mr20.dbf"
37
85
0.764479
42
259
4.666667
0.857143
0.102041
0
0
0
0
0
0
0
0
0
0.042735
0.096525
259
6
86
43.166667
0.794872
0.548263
0
0
0
0.5
0.814159
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
5c08b211808dc9006c8493ebe3f747d2ee9a75e7
3,959
py
Python
tests/domain/test_Track_remove_devices.py
josiah-wolf-oberholtzer/tloen
731e57f2a0634d5e472c5878ff5b9cc7b4d84974
[ "MIT" ]
3
2020-02-09T09:29:45.000Z
2021-12-29T01:37:45.000Z
tests/domain/test_Track_remove_devices.py
josiah-wolf-oberholtzer/tloen
731e57f2a0634d5e472c5878ff5b9cc7b4d84974
[ "MIT" ]
null
null
null
tests/domain/test_Track_remove_devices.py
josiah-wolf-oberholtzer/tloen
731e57f2a0634d5e472c5878ff5b9cc7b4d84974
[ "MIT" ]
1
2020-12-12T22:29:48.000Z
2020-12-12T22:29:48.000Z
import asyncio import pytest from supriya.synthdefs import SynthDefFactory from tloen.domain import Application, AudioEffect @pytest.fixture def synthdef_factory(): return ( SynthDefFactory() .with_channel_count(2) .with_input() .with_signal_block(lambda builder, source, state: (source * -2) + 0.25) .with_gate(0.01, 0.01) .with_output(replacing=True) ) @pytest.mark.asyncio async def test_1(synthdef_factory): """ Remove one device """ application = Application() context = await application.add_context() track = await context.add_track() device = await track.add_device(AudioEffect, synthdef=synthdef_factory) await track.remove_devices(device) assert list(track.devices) == [] assert device.application is None assert device.graph_order == () assert device.parent is None assert device.provider is None @pytest.mark.asyncio async def test_2(synthdef_factory): """ Remove two devices """ application = Application() context = await application.add_context() track = await context.add_track() device_one = await track.add_device(AudioEffect, synthdef=synthdef_factory) device_two = await track.add_device(AudioEffect, synthdef=synthdef_factory) await track.remove_devices(device_one, device_two) assert list(track.devices) == [] assert device_one.application is None assert device_one.graph_order == () assert device_one.parent is None assert device_one.provider is None assert device_two.application is None assert device_two.graph_order == () assert device_two.parent is None assert device_two.provider is None @pytest.mark.asyncio async def test_3(synthdef_factory): """ Remove first device, leaving second untouched """ application = Application() context = await application.add_context() track = await context.add_track() device_one = await track.add_device(AudioEffect, synthdef=synthdef_factory) device_two = await track.add_device(AudioEffect, synthdef=synthdef_factory) await track.remove_devices(device_one) assert list(track.devices) == [device_two] assert device_one.application is None assert device_one.graph_order == () assert device_one.parent is None assert device_one.provider is None assert device_two.application is context.application assert device_two.graph_order == (3, 0, 0, 0, 5, 0) assert device_two.parent is track.devices assert device_two.provider is None @pytest.mark.asyncio async def test_4(synthdef_factory): """ Boot, remove first device, leaving second untouched """ application = Application() context = await application.add_context() track = await context.add_track() device_one = await track.add_device(AudioEffect, synthdef=synthdef_factory) device_two = await track.add_device(AudioEffect, synthdef=synthdef_factory) await application.boot() with context.provider.server.osc_protocol.capture() as transcript: await track.remove_devices(device_one) await asyncio.sleep(0.1) assert list(track.devices) == [device_two] assert device_one.application is None assert device_one.graph_order == () assert device_one.parent is None assert device_one.provider is None assert device_two.application is context.application assert device_two.graph_order == (3, 0, 0, 0, 5, 0) assert device_two.parent is track.devices assert device_two.provider is context.provider assert len(transcript.sent_messages) == 1 _, message = transcript.sent_messages[0] assert message.to_list() == [None, [["/n_set", 1014, "gate", 0]]] assert track.peak_levels == dict( input=(0.0, 0.0), postfader=(0.25, 0.25), prefader=(0.25, 0.25) ) assert context.master_track.peak_levels == dict( input=(0.25, 0.25), postfader=(0.25, 0.25), prefader=(0.25, 0.25) )
34.72807
79
0.714827
520
3,959
5.261538
0.161538
0.122807
0.057018
0.085526
0.766813
0.726974
0.665936
0.665936
0.665936
0.650219
0
0.02178
0.188179
3,959
113
80
35.035398
0.829496
0
0
0.539326
0
0
0.002657
0
0
0
0
0
0.404494
1
0.011236
false
0
0.044944
0.011236
0.067416
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
3
5c2928ba1d5fa2871aff1c4864e34b594c050393
934
py
Python
skp_edu_docker/code/master/services/service_manager.py
TensorMSA/hoyai_docker
12f0041e6306d8a6421585a4b51666bad30be442
[ "MIT" ]
8
2017-06-16T00:19:12.000Z
2020-08-13T03:15:57.000Z
skp_edu_docker/code/master/services/service_manager.py
TensorMSA/tensormsa_docker
12f0041e6306d8a6421585a4b51666bad30be442
[ "MIT" ]
21
2017-06-09T10:15:14.000Z
2018-03-29T07:51:02.000Z
skp_edu_docker/code/master/services/service_manager.py
TensorMSA/hoyai_docker
12f0041e6306d8a6421585a4b51666bad30be442
[ "MIT" ]
4
2017-10-25T09:59:53.000Z
2020-05-07T09:51:11.000Z
class ServiceManager() : """ 1. definition 2. table """ def get_view_obj(self): """ get view data for net config :return: """ pass def set_view_obj(self, obj): """ set net config data edited on view :param obj: :return: """ pass def get_batchver_list(self, nn_id, nn_ver): """ return list of batch version list :param nn_id: :param nn_ver: :return: """ return None def delete_batchver_info(self, nn_id, nn_ver, batch_ver): """ :param nn_id: :param nn_ver: :param batch_ver: :return: """ return None def set_active_batchver(self, nn_id, nn_ver, batch_ver): """ :param nn_id: :param nn_ver: :param batch_ver: :return: """ return None
17.622642
61
0.482869
106
934
4.009434
0.311321
0.056471
0.056471
0.070588
0.451765
0.369412
0.324706
0.324706
0.324706
0.324706
0
0.003676
0.417559
934
53
62
17.622642
0.777574
0.32227
0
0.454545
0
0
0
0
0
0
0
0
0
1
0.454545
false
0.181818
0
0
0.818182
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
5c482543235587e619471540dcd07c628bdf8c0f
473
py
Python
common/utils/file.py
BruceWW/flask-basic
3252f47e6b3fca170b57819f8fdbdeb0f868654e
[ "MIT" ]
1
2019-09-28T17:03:39.000Z
2019-09-28T17:03:39.000Z
common/utils/file.py
BruceWW/flask-basic
3252f47e6b3fca170b57819f8fdbdeb0f868654e
[ "MIT" ]
null
null
null
common/utils/file.py
BruceWW/flask-basic
3252f47e6b3fca170b57819f8fdbdeb0f868654e
[ "MIT" ]
1
2019-11-19T02:39:40.000Z
2019-11-19T02:39:40.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/9/13 13:58 # @Author : Lin Luo # @Site : # @File : file # @Software: PyCharm from os import path from application import app from common.utils.format_time import stamp_to_date class File(object): @staticmethod def get_upload_file_path(): """ 获取文件存储路径 :return: """ return path.join(app.root_path, app.config.get('FILE_PATH'), 'file', stamp_to_date())
20.565217
93
0.617336
64
473
4.40625
0.65625
0.049645
0.078014
0
0
0
0
0
0
0
0
0.03352
0.243129
473
22
94
21.5
0.75419
0.321353
0
0
0
0
0.046099
0
0
0
0
0
0
1
0.142857
true
0
0.428571
0
0.857143
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
3
3085744ebaced72e37060cc6921567307ee0329c
330
py
Python
exporters/groupers/no_grouper.py
scrapinghub/exporters
b14f70530826bbbd6163d9e56e74345e762a9189
[ "BSD-3-Clause" ]
41
2016-06-16T15:29:39.000Z
2021-08-06T03:29:13.000Z
exporters/groupers/no_grouper.py
bbotella/fluxo
c9fb01db1771ada4672bbffd67cb46e1f7802ab9
[ "BSD-3-Clause" ]
52
2016-06-20T12:46:57.000Z
2018-02-08T12:22:03.000Z
exporters/groupers/no_grouper.py
bbotella/fluxo
c9fb01db1771ada4672bbffd67cb46e1f7802ab9
[ "BSD-3-Clause" ]
10
2016-06-23T08:49:36.000Z
2018-01-13T10:12:10.000Z
from exporters.groupers.base_grouper import BaseGrouper class NoGrouper(BaseGrouper): """ Default group module, used when no grouping strategies are needed. """ def __init__(self, *args, **kwargs): super(NoGrouper, self).__init__(*args, **kwargs) def group_batch(self, batch): return batch
23.571429
70
0.681818
38
330
5.657895
0.710526
0.093023
0
0
0
0
0
0
0
0
0
0
0.212121
330
13
71
25.384615
0.826923
0.2
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0.166667
0.833333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
30a5a0e086c1e5bcc5b8d078d1c0dc1d9e9e9454
2,844
py
Python
pyplwnxml/tests/test_plwnxmlParser.py
red-rocket-dev/plwnXMLParser
b3d28d174c0915ecfc5530763a2cebc889cd1026
[ "0BSD" ]
5
2018-09-21T21:06:56.000Z
2022-02-01T19:44:48.000Z
pyplwnxml/tests/test_plwnxmlParser.py
red-rocket-dev/plwnXMLParser
b3d28d174c0915ecfc5530763a2cebc889cd1026
[ "0BSD" ]
1
2018-08-22T15:42:46.000Z
2019-12-02T20:38:10.000Z
pyplwnxml/tests/test_plwnxmlParser.py
red-rocket-dev/pyplwnxml
b3d28d174c0915ecfc5530763a2cebc889cd1026
[ "0BSD" ]
null
null
null
from unittest import TestCase from pyplwnxml import PlwnxmlParser, PartOfSpeech, SentimentType, Qualifier, RelationType class TestPlwnxmlParser(TestCase): def setUp(self): parser = PlwnxmlParser("test_file.xml") self.wordnet = parser.read_wordnet() def test_basic_field_rewriting(self): self.assertEqual(len(self.wordnet.synsets), 2) self.assertEqual(len(self.wordnet.lexical_units), 5) lemma_331 = self.wordnet.lemma_id(331) self.assertIsNotNone(lemma_331) self.assertEqual(lemma_331.id, 331) self.assertEqual(lemma_331.name, "jabłecznik") self.assertEqual(lemma_331.part_of_speech, PartOfSpeech.NOUN) self.assertEqual(lemma_331.tag_count, 0) self.assertEqual(lemma_331.description, "##K: og. apple pie") self.assertEqual(lemma_331.work_state, "Testing..") self.assertEqual(lemma_331.source, "source test") self.assertEqual(lemma_331.variant, "1") def test_lu_synset_relation(self): lemma_332 = self.wordnet.lemma_id(332) self.assertIsNotNone(lemma_332) self.assertEqual(lemma_332.id, 332) self.assertEqual(lemma_332.name, "szarlotka") synsets_332 = lemma_332.synsets self.assertEqual(len(synsets_332), 1) self.assertEqual(lemma_332.synsets[0].id, 111) def test_lu_relations(self): lemma_333 = self.wordnet.lemma_id(333) hypernyms = lemma_333.relations[RelationType.HYPERNYMS] self.assertEqual(len(hypernyms), 2) relation_ids = [relation.id for relation in hypernyms] self.assertIn(331, relation_ids) self.assertIn(332, relation_ids) def test_sentiment(self): list_wypiek = self.wordnet.lemma("wypiek") self.assertEqual(len(list_wypiek), 1) lemma_wypiek = list_wypiek[0] self.assertEqual(lemma_wypiek.name, "wypiek") self.assertIsNotNone(lemma_wypiek.sentiment) self.assertEqual(lemma_wypiek.sentiment.type, SentimentType.NEUTRAL) self.assertEqual(len(lemma_wypiek.sentiment.feelings), 0) list_burrito = self.wordnet.lemma("burrito") self.assertEqual(len(list_burrito), 1) lemma_burrito = list_burrito[0] self.assertEqual(lemma_burrito.name, "burrito") self.assertIsNotNone(lemma_burrito.sentiment) self.assertEqual(lemma_burrito.sentiment.type, SentimentType.STRONGLY_NEGATIVE) self.assertEqual(lemma_burrito.sentiment.feelings, {"example"}) def test_qualifier(self): list_ciasto = self.wordnet.lemma("ciasto") self.assertEqual(len(list_ciasto), 1) lemma_ciasto = list_ciasto[0] self.assertEqual(lemma_ciasto.name, "ciasto") self.assertIsNotNone(lemma_ciasto.qualifier) self.assertEqual(lemma_ciasto.qualifier, Qualifier.GENERAL)
41.217391
89
0.701477
337
2,844
5.721068
0.237389
0.202282
0.186722
0.095436
0.121369
0
0
0
0
0
0
0.042702
0.193038
2,844
68
90
41.823529
0.797386
0
0
0
0
0
0.040788
0
0
0
0
0
0.589286
1
0.107143
false
0
0.035714
0
0.160714
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
1
0
0
0
0
0
0
0
0
0
3
30ae3cbe610349b285e7a2669b8ef77b43be4c92
235
py
Python
argsort_info.py
ikwzm/ArgSort-Kv260
364f3c3164bb0a938bf65acdb254bd935873fd3f
[ "BSD-2-Clause" ]
1
2020-10-21T01:48:22.000Z
2020-10-21T01:48:22.000Z
argsort_info.py
ikwzm/ArgSort-Ultra96
7d18963d985403d67bc8e3dfa0e35493b99fb714
[ "BSD-2-Clause" ]
null
null
null
argsort_info.py
ikwzm/ArgSort-Ultra96
7d18963d985403d67bc8e3dfa0e35493b99fb714
[ "BSD-2-Clause" ]
null
null
null
from uio import Uio from argsort_axi import ArgSort_AXI if __name__ == '__main__': uio = Uio('uio_argsort') argsort_axi = ArgSort_AXI(uio.regs()) argsort_axi.print_info() argsort_axi.print_debug()
23.5
41
0.659574
31
235
4.451613
0.387097
0.434783
0.217391
0
0
0
0
0
0
0
0
0
0.246809
235
9
42
26.111111
0.779661
0
0
0
0
0
0.080851
0
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
0.285714
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
0
0
0
0
0
3
30c7e84f74ba8bf12401ce79d2978143101f2226
298
py
Python
src/oscar/templatetags/dashboard_tags.py
sainjusajan/django-oscar
466e8edc807be689b0a28c9e525c8323cc48b8e1
[ "BSD-3-Clause" ]
null
null
null
src/oscar/templatetags/dashboard_tags.py
sainjusajan/django-oscar
466e8edc807be689b0a28c9e525c8323cc48b8e1
[ "BSD-3-Clause" ]
null
null
null
src/oscar/templatetags/dashboard_tags.py
sainjusajan/django-oscar
466e8edc807be689b0a28c9e525c8323cc48b8e1
[ "BSD-3-Clause" ]
null
null
null
from django import template from oscar.core.compat import assignment_tag from oscar.core.loading import get_class get_nodes = get_class('dashboard.menu', 'get_nodes') register = template.Library() @assignment_tag(register) def dashboard_navigation(user): return get_nodes(user)
22.923077
53
0.768456
40
298
5.525
0.525
0.108597
0.117647
0
0
0
0
0
0
0
0
0
0.147651
298
12
54
24.833333
0.870079
0
0
0
0
0
0.08042
0
0
0
0
0
0
1
0.125
false
0
0.375
0.125
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
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
3
30cc287a08506c5a6079474b64a72925e2e92dbf
424
py
Python
traxee-simple/traxee/flipkart/forms.py
chauhan17nitin/traxee
2a861b89e2966024629f587b485a411ede958d02
[ "Apache-2.0" ]
null
null
null
traxee-simple/traxee/flipkart/forms.py
chauhan17nitin/traxee
2a861b89e2966024629f587b485a411ede958d02
[ "Apache-2.0" ]
2
2021-02-08T20:50:56.000Z
2021-04-30T21:23:50.000Z
traxee-simple/traxee/flipkart/forms.py
chauhan17nitin/traxee
2a861b89e2966024629f587b485a411ede958d02
[ "Apache-2.0" ]
1
2020-07-27T14:05:00.000Z
2020-07-27T14:05:00.000Z
from django import forms class UserForm(forms.Form): name = forms.CharField(max_length=30) email = forms.CharField(max_length=30, widget = forms.EmailInput) password = forms.CharField(widget = forms.PasswordInput) class Meta: fields = ['name', 'email', 'password'] # class HandlerForm(forms.ModelForm): # class Meta: # model = Handlers # fields = ['handle', 'handler_name']
26.5
71
0.658019
47
424
5.87234
0.531915
0.152174
0.123188
0.166667
0.181159
0
0
0
0
0
0
0.012048
0.216981
424
15
72
28.266667
0.819277
0.283019
0
0
0
0
0.056856
0
0
0
0
0
0
1
0
false
0.285714
0.142857
0
0.857143
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
3
30d165ce41d75db3b6c2ab11eadb6639cb54d231
4,872
py
Python
backend-code/yeprayas_project/settings.py
sumitpal1007/yeprayas_react
f09f56e4357b94412b091cdf7cad0de6e45aa7b8
[ "MIT" ]
null
null
null
backend-code/yeprayas_project/settings.py
sumitpal1007/yeprayas_react
f09f56e4357b94412b091cdf7cad0de6e45aa7b8
[ "MIT" ]
null
null
null
backend-code/yeprayas_project/settings.py
sumitpal1007/yeprayas_react
f09f56e4357b94412b091cdf7cad0de6e45aa7b8
[ "MIT" ]
null
null
null
""" Django settings for yeprayas_project project. Generated by 'django-admin startproject' using Django 3.2.3. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathlib import Path import os import mimetypes #mimetypes.add_type("text/css", ".css", True) #mimetypes.add_type("text/html", ".html", True) # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-0=yfl72t67$1%$to#*h66x-nid5kl@ycoowp$^^f@6^%u!%z)y' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = ['65.0.124.110','172.31.9.233'] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'party_register', 'admin_work', 'corsheaders', 'storages', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.BrokenLinkEmailsMiddleware', ] ROOT_URLCONF = 'yeprayas_project.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ os.path.join(BASE_DIR, 'yeprayas_reactapp/build'), ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'yeprayas_project.wsgi.application' # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'yeprayasdb', 'USER': 'ashusumit', 'PASSWORD': 'PASSW0RD', 'HOST' : 'localhost', 'PORT': '3306' } } # Password validation # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.2/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.2/howto/static-files/ #STATIC_URL = '/home/ubuntu/yeprayas/yeprayas_host/yeprayas_project/static/' #STATIC_URL = '/yeprayas_reactapp/build/static/' STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') #STATIC_URL = '/home/ubuntu/yeprayas/yeprayas_host/static/' # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' ################################################ AWS S3 #################################################### AWS_ACCESS_KEY_ID = 'AKIA6EK3RVEQOKXHOG4B' AWS_SECRET_ACCESS_KEY = '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' AWS_STORAGE_BUCKET_NAME = 'yeprayas-client-files' AWS_S3_SIGNATURE_VERSION = 's3v4' AWS_S3_REGION_NAME = 'ap-south-1' AWS_S3_FILE_OVERWRITE = False AWS_DEFAULT_ACL = None AWS_S3_VERIFY = True DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' #S3_URL = 'http://%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME #STATIC_URL = S3_URL ######################################################## CORS_ORIGIN_ALLOW_ALL = False #CORS_ORIGIN_WHITELIST = ( # 'http://localhost:3000' #) CORS_ORIGIN_WHITELIST = ( 'http://65.0.124.110:80' ) STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'yeprayas_reactapp/build/static'), ]
26.917127
108
0.687397
552
4,872
5.903986
0.400362
0.059834
0.054004
0.061369
0.196993
0.191777
0.143909
0.119975
0.07487
0
0
0.023626
0.148604
4,872
180
109
27.066667
0.762054
0.308703
0
0.020408
1
0.010204
0.526763
0.421285
0
0
0
0
0
1
0
false
0.061224
0.030612
0
0.030612
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
1
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
30e1cf3af18e266744529cd1e097d5e081833dff
260
py
Python
malcolm/modules/xmap/blocks/__init__.py
hir12111/pymalcolm
689542711ff903ee99876c40fc0eae8015e13314
[ "Apache-2.0" ]
11
2016-10-04T23:11:39.000Z
2022-01-25T15:44:43.000Z
malcolm/modules/xmap/blocks/__init__.py
hir12111/pymalcolm
689542711ff903ee99876c40fc0eae8015e13314
[ "Apache-2.0" ]
153
2016-06-01T13:31:02.000Z
2022-03-31T11:17:18.000Z
malcolm/modules/xmap/blocks/__init__.py
hir12111/pymalcolm
689542711ff903ee99876c40fc0eae8015e13314
[ "Apache-2.0" ]
16
2016-06-10T13:45:27.000Z
2020-10-24T13:45:04.000Z
from malcolm.yamlutil import check_yaml_names, make_block_creator xmap_driver_block = make_block_creator(__file__, "xmap_driver_block.yaml") xmap_runnable_block = make_block_creator(__file__, "xmap_runnable_block.yaml") __all__ = check_yaml_names(globals())
37.142857
78
0.85
37
260
5.162162
0.432432
0.141361
0.251309
0.219895
0.303665
0.303665
0
0
0
0
0
0
0.069231
260
6
79
43.333333
0.789256
0
0
0
0
0
0.176923
0.176923
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
a50518b05d4a3b822360cc6a23ab6bf41dfaa8d1
654
py
Python
app/model.py
fras2560/flask-pytest-cypress-ci-template
d86bee0a4dd59406093602b671f100bd132c16b0
[ "MIT" ]
null
null
null
app/model.py
fras2560/flask-pytest-cypress-ci-template
d86bee0a4dd59406093602b671f100bd132c16b0
[ "MIT" ]
4
2021-01-16T20:33:02.000Z
2022-01-15T21:17:05.000Z
app/model.py
fras2560/flask-pytest-cypress-ci-template
d86bee0a4dd59406093602b671f100bd132c16b0
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Holds a database model for the application.""" from flask_sqlalchemy import SQLAlchemy """The database object.""" DB = SQLAlchemy() class Entity(DB.Model): """ A class used to store some entity information Columns: id: the unique id name: the name of the entity """ id = DB.Column(DB.Integer, primary_key=True) name = DB.Column(DB.String(256)) def __init__(self, name: str): self.name = name def json(self) -> dict: return { "id": self.id, "name": self.name, } def __str__(self): return self.name
21.8
53
0.56422
82
654
4.378049
0.512195
0.089136
0.05571
0
0
0
0
0
0
0
0
0.008889
0.311927
654
29
54
22.551724
0.788889
0.269113
0
0
0
0
0.014888
0
0
0
0
0
0
1
0.214286
false
0
0.071429
0.142857
0.642857
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
eb519d6e95aedc19625a5475c8538a5f0dcd4657
220
py
Python
alpyro_msgs/actionlib/testresult.py
rho2/alpyro_msgs
b5a680976c40c83df70d61bb2db1de32a1cde8d3
[ "MIT" ]
1
2020-12-13T13:07:10.000Z
2020-12-13T13:07:10.000Z
alpyro_msgs/actionlib/testresult.py
rho2/alpyro_msgs
b5a680976c40c83df70d61bb2db1de32a1cde8d3
[ "MIT" ]
null
null
null
alpyro_msgs/actionlib/testresult.py
rho2/alpyro_msgs
b5a680976c40c83df70d61bb2db1de32a1cde8d3
[ "MIT" ]
null
null
null
from alpyro_msgs import RosMessage, int32 class TestResult(RosMessage): __msg_typ__ = "actionlib/TestResult" __msg_def__ = "aW50MzIgcmVzdWx0Cgo=" __md5_sum__ = "034a8e20d6a306665e3a5b340fab3f09" result: int32
22
50
0.795455
21
220
7.571429
0.809524
0
0
0
0
0
0
0
0
0
0
0.151832
0.131818
220
9
51
24.444444
0.680628
0
0
0
0
0
0.327273
0.145455
0
0
0
0
0
1
0
false
0
0.166667
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
eb5d4dca8b23629a4ac420050579c19d35630257
8,352
py
Python
ls/joyous/tests/test_weeks.py
tjwalch/ls.joyous
0ee50d3af71c066bddb2310948b02f74b52ee253
[ "BSD-3-Clause" ]
72
2018-03-16T16:35:08.000Z
2022-03-23T08:09:33.000Z
polrev/ls/joyous/tests/test_weeks.py
polrev-github/polrev-django
99108ace1a5307b14c3eccb424a9f9616e8c02ae
[ "MIT" ]
41
2018-03-25T20:36:52.000Z
2022-03-10T08:59:27.000Z
polrev/ls/joyous/tests/test_weeks.py
polrev-github/polrev-django
99108ace1a5307b14c3eccb424a9f9616e8c02ae
[ "MIT" ]
28
2018-08-13T22:36:09.000Z
2022-03-17T12:24:15.000Z
# ------------------------------------------------------------------------------ # Test Formatting weeks # ------------------------------------------------------------------------------ import sys import datetime as dt from django.test import TestCase, override_settings import ls.joyous.utils.weeks from ls.joyous.utils.weeks import ( _iso_year_start, _iso_info, _iso_num_weeks, _gregorian_to_iso, _iso_to_gregorian, _iso_week_of_month) from ls.joyous.utils.weeks import ( _ssweek_year_start, _ssweek_info, _ssweek_num_weeks, _gregorian_to_ssweek, _ssweek_to_gregorian, _ssweek_of_month) from django.utils.translation import override from django.utils.formats import get_format import importlib # ------------------------------------------------------------------------------ class TestMondayStartingWeek(TestCase): def testYearStart(self): self.assertEqual(_iso_year_start(1991), dt.date(1990,12,31)) self.assertEqual(_iso_year_start(2006), dt.date(2006,1,2)) self.assertEqual(_iso_year_start(2020), dt.date(2019,12,30)) self.assertEqual(_iso_year_start(2036), dt.date(2035,12,31)) def testNumWeeksInYear(self): self.assertEqual(_iso_num_weeks(1991), 52) self.assertEqual(_iso_num_weeks(2006), 52) self.assertEqual(_iso_num_weeks(2020), 53) self.assertEqual(_iso_num_weeks(2036), 52) def testWeekOfMonth(self): self.assertEqual(_iso_week_of_month(dt.date(1990,5,31)), 4) self.assertEqual(_iso_week_of_month(dt.date(2005,1,2)), 0) self.assertEqual(_iso_week_of_month(dt.date(2021,12,13)), 2) self.assertEqual(_iso_week_of_month(dt.date(2030,10,8)), 1) def testGregorianToWeekDate(self): self.assertEqual(_gregorian_to_iso(dt.date(1991,5,25)), (1991,21,6)) self.assertEqual(_gregorian_to_iso(dt.date(2007,1,2)), (2007,1,2)) self.assertEqual(_gregorian_to_iso(dt.date(2022,12,13)), (2022,50,2)) self.assertEqual(_gregorian_to_iso(dt.date(2035,12,31)), (2036,1,1)) self.assertEqual(_gregorian_to_iso(dt.date(2021,1,1)), (2020,53,5)) def testWeekToGregorianDate(self): self.assertEqual(_iso_to_gregorian(1990,2,6), dt.date(1990,1,13)) self.assertEqual(_iso_to_gregorian(2005,20,1), dt.date(2005,5,16)) self.assertEqual(_iso_to_gregorian(2020,53,5), dt.date(2021,1,1)) self.assertEqual(_iso_to_gregorian(2035,6,7), dt.date(2035,2,11)) def testWeekInfo(self): # (first_day, last_day, prev_year_num_weeks, year_num_weeks) self.assertEqual(_iso_info(1991,2), (dt.date(1991,1,7), dt.date(1991,1,13), 52, 52)) self.assertEqual(_iso_info(2006,20), (dt.date(2006,5,15), dt.date(2006,5,21), 52, 52)) self.assertEqual(_iso_info(2020,40), (dt.date(2020,9,28), dt.date(2020,10,4), 52, 53)) self.assertEqual(_iso_info(2036,21), (dt.date(2036,5,19), dt.date(2036,5,25), 52, 52)) # ------------------------------------------------------------------------------ class TestSundayStartingWeek(TestCase): def testYearStart(self): self.assertEqual(_ssweek_year_start(1991), dt.date(1990,12,30)) self.assertEqual(_ssweek_year_start(2006), dt.date(2006,1,1)) self.assertEqual(_ssweek_year_start(2020), dt.date(2019,12,29)) self.assertEqual(_ssweek_year_start(2036), dt.date(2035,12,30)) def testNumWeeksInYear(self): self.assertEqual(_ssweek_num_weeks(1991), 52) self.assertEqual(_ssweek_num_weeks(2006), 52) self.assertEqual(_ssweek_num_weeks(2020), 53) self.assertEqual(_ssweek_num_weeks(2036), 53) def testWeekOfMonth(self): self.assertEqual(_ssweek_of_month(dt.date(1990,5,31)), 4) self.assertEqual(_ssweek_of_month(dt.date(2005,1,2)), 1) self.assertEqual(_ssweek_of_month(dt.date(2021,12,13)), 2) self.assertEqual(_ssweek_of_month(dt.date(2030,10,8)), 1) def testGregorianToWeekDate(self): self.assertEqual(_gregorian_to_ssweek(dt.date(1991,5,25)), (1991,21,6)) self.assertEqual(_gregorian_to_ssweek(dt.date(2007,1,2)), (2007,1,2)) self.assertEqual(_gregorian_to_ssweek(dt.date(2022,12,13)), (2022,50,2)) self.assertEqual(_gregorian_to_ssweek(dt.date(2035,12,31)), (2036,1,1)) self.assertEqual(_gregorian_to_ssweek(dt.date(2019,12,1)), (2019,49,7)) self.assertEqual(_gregorian_to_ssweek(dt.date(2019,12,29)), (2020,1,7)) self.assertEqual(_gregorian_to_ssweek(dt.date(2021,1,1)), (2020,53,5)) def testWeekToGregorianDate(self): self.assertEqual(_ssweek_to_gregorian(1990,2,6), dt.date(1990,1,12)) self.assertEqual(_ssweek_to_gregorian(2005,20,1), dt.date(2005,5,15)) self.assertEqual(_ssweek_to_gregorian(2020,53,5), dt.date(2020,12,31)) self.assertEqual(_ssweek_to_gregorian(2035,6,7), dt.date(2035,2,10)) def testWeekInfo(self): # (first_day, last_day, prev_year_num_weeks, year_num_weeks) self.assertEqual(_ssweek_info(1991,2), (dt.date(1991,1,6), dt.date(1991,1,12), 52, 52)) self.assertEqual(_ssweek_info(2006,20), (dt.date(2006,5,14), dt.date(2006,5,20), 52, 52)) self.assertEqual(_ssweek_info(2020,40), (dt.date(2020,9,27), dt.date(2020,10,3), 52, 53)) self.assertEqual(_ssweek_info(2036,21), (dt.date(2036,5,18), dt.date(2036,5,24), 52, 53)) # ------------------------------------------------------------------------------ class TestSetting(TestCase): @override('en-gb') def testMondayStartingWeek(self): # FIRST_DAY_OF_WEEK is Monday for Great Britain self.assertEqual(get_format('FIRST_DAY_OF_WEEK'), 1) importlib.reload(ls.joyous.utils.weeks) from ls.joyous.utils.weeks import (week_info, num_weeks_in_year, gregorian_to_week_date, week_of_month, weekday_abbr, weekday_name, _iso_info, _iso_num_weeks, _gregorian_to_iso, _iso_week_of_month) self.assertIs(week_info, _iso_info) self.assertIs(num_weeks_in_year, _iso_num_weeks) self.assertIs(gregorian_to_week_date, _gregorian_to_iso) self.assertIs(week_of_month, _iso_week_of_month) self.assertEqual(weekday_abbr, ("Mon","Tue","Wed","Thu","Fri","Sat","Sun")) self.assertEqual(weekday_name, ("Monday","Tuesday","Wednesday","Thursday", "Friday","Saturday","Sunday")) @override('en-au') def testSundayStartingWeek(self): # FIRST_DAY_OF_WEEK is Sunday for Australia self.assertEqual(get_format('FIRST_DAY_OF_WEEK'), 0) importlib.reload(ls.joyous.utils.weeks) from ls.joyous.utils.weeks import (week_info, num_weeks_in_year, gregorian_to_week_date, week_of_month, weekday_abbr, weekday_name, _ssweek_info, _ssweek_num_weeks, _gregorian_to_ssweek, _ssweek_of_month) self.assertIs(week_info, _ssweek_info) self.assertIs(num_weeks_in_year, _ssweek_num_weeks) self.assertIs(gregorian_to_week_date, _gregorian_to_ssweek) self.assertIs(week_of_month, _ssweek_of_month) self.assertEqual(weekday_abbr, ("Sun","Mon","Tue","Wed","Thu","Fri","Sat")) self.assertEqual(weekday_name, ("Sunday","Monday","Tuesday","Wednesday","Thursday", "Friday","Saturday")) def testFirstDayOfWeek(self): with override_settings(JOYOUS_FIRST_DAY_OF_WEEK = 0): importlib.reload(ls.joyous.utils.weeks) from ls.joyous.utils.weeks import weekday_abbr self.assertEqual(weekday_abbr, ("Sun","Mon","Tue","Wed","Thu","Fri","Sat")) with override_settings(JOYOUS_FIRST_DAY_OF_WEEK = 1): importlib.reload(ls.joyous.utils.weeks) from ls.joyous.utils.weeks import weekday_abbr self.assertEqual(weekday_abbr, ("Mon","Tue","Wed","Thu","Fri","Sat","Sun")) # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
53.538462
91
0.617577
1,098
8,352
4.405282
0.113843
0.186066
0.074426
0.064503
0.831507
0.732479
0.609262
0.491007
0.444904
0.363035
0
0.097461
0.179358
8,352
155
92
53.883871
0.608258
0.10285
0
0.224
0
0
0.030485
0
0
0
0
0
0.544
1
0.12
false
0
0.136
0
0.28
0
0
0
0
null
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
3
eb6129e8100344d2c4d59d1aeb8ace08bde583d7
462
py
Python
mnistwebsite/models.py
4322vipul/mnist_digit_classifier_website
7086d9d144a757154e8332accf4efac65e3259e2
[ "MIT" ]
1
2021-04-18T15:23:23.000Z
2021-04-18T15:23:23.000Z
mnistwebsite/models.py
4322vipul/mnist_digit_classifier_website
7086d9d144a757154e8332accf4efac65e3259e2
[ "MIT" ]
null
null
null
mnistwebsite/models.py
4322vipul/mnist_digit_classifier_website
7086d9d144a757154e8332accf4efac65e3259e2
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. class given_image(models.Model): image_given=models.ImageField(max_length=64) class image_name(models.Model): name_of_image=models.CharField(max_length=64) def __str__(self): return self.name_of_image class predicted_label(models.Model): label=models.CharField(max_length=8) def __str__(self): return self.label
17.111111
49
0.658009
59
462
4.830508
0.440678
0.115789
0.077193
0.168421
0.140351
0
0
0
0
0
0
0.01462
0.25974
462
26
50
17.769231
0.818713
0.051948
0
0.181818
0
0
0
0
0
0
0
0
0
1
0.181818
false
0
0.090909
0.181818
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
3
eb6c6b65812954f620e852a7ab7b9ce069f38685
2,000
py
Python
api/users/models.py
mcauto/japronto-example
4683dcb1afdded4db86fa8db713289774b65d794
[ "MIT" ]
3
2018-10-21T13:47:28.000Z
2020-01-24T19:46:03.000Z
api/users/models.py
mcauto/japronto-example
4683dcb1afdded4db86fa8db713289774b65d794
[ "MIT" ]
null
null
null
api/users/models.py
mcauto/japronto-example
4683dcb1afdded4db86fa8db713289774b65d794
[ "MIT" ]
null
null
null
# coding=utf-8 import datetime from sqlalchemy import Column, Integer, String, DateTime from Database import Base, Session from werkzeug import generate_password_hash, check_password_hash class User(Base): __tablename__ = 'users' __table_args__ = {'mysql_collate': 'utf8_general_ci'} id = Column(Integer, primary_key=True) firstname = Column(String(64)) lastname = Column(String(64)) username = Column(String(16), unique=True) password = Column(String(93)) status = Column(String(20)) email = Column(String(64), unique=True) created_at = Column(DateTime, default=datetime.date.today()) def __init__(self, firstname, lastname, username, password, status, email): self.firstname = firstname.title() self.lastname = lastname.title() self.username = username self.set_password(password) self.status = status self.email = email.lower() def __repr__(self): return "< User(fistname='%s', lastname='%s', username='%s', password='%s',\ email='%s', created_at='%s') >" % (self.fristname, self.lastname, self.username, self.password, self.email, self.status, self.created_at) def set_password(self, password): self.password = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.pwdhash, password) def get_all_users(): session = Session() listUsers = [] users = session.query(User).all() for user in users: listUsers.append({"id": user.id, "firstname": user.firstname, "lastname": user.lastname, "username": user.username, "status": user.status, "email": user.email, "created_at" : user.created_at }) session.close() return listUsers
33.333333
114
0.5965
212
2,000
5.443396
0.320755
0.062392
0.036395
0
0
0
0
0
0
0
0
0.009831
0.288
2,000
59
115
33.898305
0.800562
0.006
0
0
1
0
0.046828
0
0
0
0
0
0
1
0.111111
false
0.222222
0.088889
0.044444
0.511111
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
3
eb899416ce1493419a9c025cc24c92306ff25556
671
py
Python
basisgen/containers.py
jccriado/basisgen
9d9f31bf9182915862d3c677f35b668fd3fd7184
[ "MIT" ]
7
2019-01-14T13:20:16.000Z
2021-09-09T03:12:48.000Z
basisgen/containers.py
jccriado/basisgen
9d9f31bf9182915862d3c677f35b668fd3fd7184
[ "MIT" ]
null
null
null
basisgen/containers.py
jccriado/basisgen
9d9f31bf9182915862d3c677f35b668fd3fd7184
[ "MIT" ]
3
2020-09-10T03:43:27.000Z
2022-02-15T15:11:10.000Z
import collections class MultivaluedMap(collections.defaultdict): def __init__(self, *args, **kwargs): return super().__init__(set, *args, **kwargs) @staticmethod def from_pairs(pairs): mapping = MultivaluedMap() for key, value in pairs: mapping[key].add(value) return mapping def update(self, other): for key, value in other.items(): self[key].update(value) class OrderedCounter(collections.Counter, collections.OrderedDict): @staticmethod def sort(items, key=lambda x: x): return OrderedCounter(collections.OrderedDict( sorted(items, key=key) ))
24.851852
67
0.636364
71
671
5.887324
0.450704
0.047847
0.052632
0.062201
0
0
0
0
0
0
0
0
0.256334
671
26
68
25.807692
0.837675
0
0
0.105263
0
0
0
0
0
0
0
0
0
1
0.210526
false
0
0.052632
0.105263
0.526316
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
ebc3b53e16e62253e51ad419c5ed6599ebb1c2c0
80
py
Python
dnswitcher/utils.py
jinxingxing/SmartDns
4a7eaef1d05dcc73f1c78b6bac4f335981945518
[ "MIT" ]
2
2021-08-24T03:08:56.000Z
2022-03-07T08:45:50.000Z
dnswitcher/utils.py
jinxingxing/SmartDns
4a7eaef1d05dcc73f1c78b6bac4f335981945518
[ "MIT" ]
null
null
null
dnswitcher/utils.py
jinxingxing/SmartDns
4a7eaef1d05dcc73f1c78b6bac4f335981945518
[ "MIT" ]
2
2020-07-25T11:14:09.000Z
2021-06-14T14:47:32.000Z
# coding: utf8 __author__ = 'JinXing' import logging logger = logging
10
23
0.6625
8
80
6.125
0.875
0
0
0
0
0
0
0
0
0
0
0.016949
0.2625
80
7
24
11.428571
0.813559
0.15
0
0
0
0
0.12069
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ebdf91c5cab55ca3bfd3e7d89a1ba89e113c4d38
144
py
Python
su4/path_util.py
njuwelkin/su4
e433f792186ee5868916cae3c062d6313dffd420
[ "MIT" ]
null
null
null
su4/path_util.py
njuwelkin/su4
e433f792186ee5868916cae3c062d6313dffd420
[ "MIT" ]
null
null
null
su4/path_util.py
njuwelkin/su4
e433f792186ee5868916cae3c062d6313dffd420
[ "MIT" ]
null
null
null
import os, sys def addModulePath(file): utils_path = os.path.dirname(os.path.abspath(file)) + "/../utils" sys.path.append(utils_path)
20.571429
69
0.6875
21
144
4.619048
0.52381
0.185567
0
0
0
0
0
0
0
0
0
0
0.145833
144
6
70
24
0.788618
0
0
0
0
0
0.062937
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
ebe7615b9cf517efd9c19f266f5d5ff2733cf13a
2,462
py
Python
mtp_common/auth/models.py
uk-gov-mirror/ministryofjustice.money-to-prisoners-common
283a72e796915c99cc5ed53b44f67d79628ffac8
[ "MIT" ]
null
null
null
mtp_common/auth/models.py
uk-gov-mirror/ministryofjustice.money-to-prisoners-common
283a72e796915c99cc5ed53b44f67d79628ffac8
[ "MIT" ]
null
null
null
mtp_common/auth/models.py
uk-gov-mirror/ministryofjustice.money-to-prisoners-common
283a72e796915c99cc5ed53b44f67d79628ffac8
[ "MIT" ]
null
null
null
class MojUser: """ Authenticated user, similar to the Django one. The built-in Django `AbstractBaseUser` sadly depends on a few tables and cannot be used without a datbase so we had to create a custom one. """ def __init__(self, pk, token, user_data): self.pk = pk self.is_active = True self.token = token self.user_data = user_data def save(self, *args, **kwargs): pass @property def is_anonymous(self): return False @property def is_authenticated(self): return True def get_all_permissions(self, obj=None): return self.user_data.get('permissions', []) def has_perm(self, perm, obj=None): return perm in self.user_data.get('permissions', []) def has_perms(self, perm_list, obj=None): return all( [perm in self.user_data.get('permissions', []) for perm in perm_list] ) @property def username(self): return self.user_data.get('username') @property def email(self): return self.user_data.get('email') def get_full_name(self): if not hasattr(self, '_full_name'): name_parts = [ self.user_data.get('first_name'), self.user_data.get('last_name') ] self._full_name = ' '.join(filter(None, name_parts)) return self._full_name def get_initials(self): if self.get_full_name(): return ''.join( filter( None, map(lambda name: name[0].upper() if name else None, self.get_full_name().split(' ')) ) ) class MojAnonymousUser: """ Anonymous non-authenticated user, similar to the Django one. The built-in Django `AnonymousUser` sadly depends on a few tables and gives several warnings when used without a database so we had to create a custom one. """ pk = None is_active = False token = None user_data = {} username = '' email = '' def get_full_name(self): return '' @property def is_anonymous(self): return True @property def is_authenticated(self): return False def get_all_permissions(self, obj=None): return [] def has_perm(self, perm, obj=None): return False def has_perms(self, perm_list, obj=None): return False
24.62
81
0.582047
309
2,462
4.472492
0.268608
0.063676
0.069465
0.075977
0.536903
0.536903
0.36903
0.264834
0.130246
0.078148
0
0.000599
0.32169
2,462
99
82
24.868687
0.826946
0.1645
0
0.363636
0
0
0.038385
0
0
0
0
0
0
1
0.257576
false
0.015152
0
0.19697
0.606061
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
ebe82754c4e1956d8128209d6933d8d8301a6dc9
5,604
py
Python
Session 7 - Python/WagerWarCardGame/Development/WWWarConstants.py
dbowmans46/PracticalProgramming
e9fee468eee12625ce198d9a4f4c5ee735f5db90
[ "MIT" ]
null
null
null
Session 7 - Python/WagerWarCardGame/Development/WWWarConstants.py
dbowmans46/PracticalProgramming
e9fee468eee12625ce198d9a4f4c5ee735f5db90
[ "MIT" ]
null
null
null
Session 7 - Python/WagerWarCardGame/Development/WWWarConstants.py
dbowmans46/PracticalProgramming
e9fee468eee12625ce198d9a4f4c5ee735f5db90
[ "MIT" ]
1
2019-08-07T16:51:23.000Z
2019-08-07T16:51:23.000Z
# -*- coding: utf-8 -*- """ LICENSE (MIT License): Copyright 2018 Jason Gilbert, Ryan Concienne, and Douglas Bowman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import sys from PyQt5 import QtWidgets, QtCore """ @brief This is a static class """ class WWWarConstants(): """ Set standard size of deck """ DECK_SIZE = 52 """ File location of cards """ CARD_PICTURE_LOCATION = "./resources/production/" CARD_FILE_NAMES = ['c01.bmp', 'c02.bmp', 'c03.bmp', 'c04.bmp', 'c05.bmp', 'c06.bmp', 'c07.bmp', 'c08.bmp', 'c09.bmp', 'c10.bmp', 'c11.bmp', 'c12.bmp', 'c13.bmp', 'd01.bmp', 'd02.bmp', 'd03.bmp', 'd04.bmp', 'd05.bmp', 'd06.bmp', 'd07.bmp', 'd08.bmp', 'd09.bmp', 'd10.bmp', 'd11.bmp', 'd12.bmp', 'd13.bmp', 'h01.bmp', 'h02.bmp', 'h03.bmp', 'h04.bmp', 'h05.bmp', 'h06.bmp', 'h07.bmp', 'h08.bmp', 'h09.bmp', 'h10.bmp', 'h11.bmp', 'h12.bmp', 'h13.bmp', 's01.bmp', 's02.bmp', 's03.bmp', 's04.bmp', 's05.bmp', 's06.bmp', 's07.bmp', 's08.bmp', 's09.bmp', 's10.bmp', 's11.bmp', 's12.bmp', 's13.bmp'] CARD_FILE_NAMES_TEST = ['A01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'E01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'c01.bmp', 'B01.bmp'] """ @brief Card style Dictionary @parma key, value """ deckStyle = {"BLUE": "blueBackVert.bmp", "RED": "redBackVert.bmp", "CAMO": "camoBackVert.bmp"} """ @ brief string used on all GUI windows, A credit to the developers """ """ @ brief Retrieve users resolution to use for window size """
33.556886
80
0.345646
463
5,604
4.166307
0.442765
0.155521
0.228616
0.292379
0.155521
0.155521
0.155521
0.155521
0.155521
0.155521
0
0.086817
0.556031
5,604
166
81
33.759036
0.688505
0.209315
0
0.4375
0
0
0.196741
0.005593
0
0
0
0
0
1
0
false
0
0.017857
0
0.071429
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ccd8569a30533d078dfba6a15b69e28a22136fde
226
py
Python
server/run.py
dactechie/intershift_comms
041e15426cf985fec30d1abc8068d1c52ba8e804
[ "MIT" ]
null
null
null
server/run.py
dactechie/intershift_comms
041e15426cf985fec30d1abc8068d1c52ba8e804
[ "MIT" ]
null
null
null
server/run.py
dactechie/intershift_comms
041e15426cf985fec30d1abc8068d1c52ba8e804
[ "MIT" ]
null
null
null
# run.py import os from apis import create_app # for >flask run if __name__ == '__main__': #print(os.path.abspath('./settings.py')) app = create_app(config_file=os.path.abspath('./settings.py')) app.run(debug=True)
28.25
66
0.690265
35
226
4.142857
0.6
0.124138
0.17931
0.289655
0.358621
0.358621
0
0
0
0
0
0
0.141593
226
8
67
28.25
0.747423
0.265487
0
0
0
0
0.128834
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
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
0
0
1
0
0
0
0
3
690fda5889590cd7261b2ffb9ea01afc1838fa09
25
py
Python
prinia/__init__.py
zamaudio/prinia
27cc34eedd8cf1fa8dc82b14ae676256af03407f
[ "MIT" ]
1
2019-12-13T08:00:31.000Z
2019-12-13T08:00:31.000Z
prinia/__init__.py
zamaudio/prinia
27cc34eedd8cf1fa8dc82b14ae676256af03407f
[ "MIT" ]
2
2018-09-27T07:39:36.000Z
2018-12-21T14:02:21.000Z
prinia/__init__.py
zamaudio/prinia
27cc34eedd8cf1fa8dc82b14ae676256af03407f
[ "MIT" ]
1
2018-09-20T02:03:58.000Z
2018-09-20T02:03:58.000Z
__author__ = 'ahbbollen'
12.5
24
0.76
2
25
7.5
1
0
0
0
0
0
0
0
0
0
0
0
0.12
25
1
25
25
0.681818
0
0
0
0
0
0.36
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
6916bad4afd02ac37b73f52e002bfae3ef4c834e
1,739
py
Python
liebraryrest/database.py
gekorob/liebraryrest
de0210464584ed30f792899a8c3a3ef6c5661145
[ "BSD-3-Clause" ]
6
2016-05-23T12:33:17.000Z
2019-01-28T10:41:12.000Z
liebraryrest/database.py
gekorob/liebraryrest
de0210464584ed30f792899a8c3a3ef6c5661145
[ "BSD-3-Clause" ]
null
null
null
liebraryrest/database.py
gekorob/liebraryrest
de0210464584ed30f792899a8c3a3ef6c5661145
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- """Database module, including the SQLAlchemy database object and DB-related utilities.""" import json from sqlalchemy.inspection import inspect from sqlalchemy.orm import relationship from .extensions import db # Alias common SQLAlchemy names Column = db.Column relationship = relationship class CRUDMixin(object): """Mixin that adds convenience methods for CRUD (create, read, update, delete) operations.""" @classmethod def create(cls, **kwargs): """Create a new record and save it the database.""" instance = cls(**kwargs) return instance.save() def update(self, commit=True, **kwargs): """Update specific fields of a record.""" for attr, value in kwargs.items(): setattr(self, attr, value) return commit and self.save() or self def save(self, commit=True): """Save the record.""" db.session.add(self) if commit: db.session.commit() return self def delete(self, commit=True): """Remove the record from the database.""" db.session.delete(self) return commit and db.session.commit() class Model(CRUDMixin, db.Model): """Base model class that includes CRUD convenience methods.""" __abstract__ = True def serialize(self, includes=None): return {c: getattr(self, c) for c in inspect(self).attrs.keys()} def to_json(self, includes=None): return json.dumps(self.serialize(includes)) @classmethod def serialize_list(cls, l, includes=None): return [m.serialize(includes) for m in l] @classmethod def list_to_json(cls, l, includes=None): return json.dumps(cls.serialize_list(l, includes))
28.508197
97
0.654974
220
1,739
5.136364
0.368182
0.031858
0.063717
0.038938
0.070796
0
0
0
0
0
0
0.000749
0.231742
1,739
60
98
28.983333
0.84506
0.239793
0
0.085714
0
0
0
0
0
0
0
0
0
1
0.228571
false
0
0.114286
0.114286
0.657143
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
692bef77b612bf77c047be1c12359e5ad49588c9
335
py
Python
misc/projections.py
DawyD/UNet-PS-4D
bdd31308854dbd5f309aec9bcc1f7a35f267481d
[ "MIT" ]
1
2021-12-06T17:20:36.000Z
2021-12-06T17:20:36.000Z
misc/projections.py
DawyD/UNet-PS-4D
bdd31308854dbd5f309aec9bcc1f7a35f267481d
[ "MIT" ]
null
null
null
misc/projections.py
DawyD/UNet-PS-4D
bdd31308854dbd5f309aec9bcc1f7a35f267481d
[ "MIT" ]
3
2021-12-06T08:09:42.000Z
2022-03-12T08:09:34.000Z
""" Projections To add a custom projection, create a method accepting (x, y, z) Cartesian coordinates and add an entry to the parse_projection method """ def parse_projection(name: str): if name == "standard": return standard_proj raise ValueError("Unknown projection") def standard_proj(x, y, z): return x, y
19.705882
109
0.704478
48
335
4.833333
0.604167
0.025862
0.025862
0
0
0
0
0
0
0
0
0
0.20597
335
16
110
20.9375
0.87218
0.432836
0
0
0
0
0.142857
0
0
0
0
0
0
1
0.333333
false
0
0
0.166667
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
69643f6ece91c08c39a6f3f3d39b28485616d456
5,798
py
Python
pyboletox/Cnab/Retorno/Cnab400/detalhe.py
lucasbrahm/pyboletox
d7cfff477622a4d5df255045428325f04fbe695a
[ "MIT" ]
1
2022-03-14T12:22:42.000Z
2022-03-14T12:22:42.000Z
pyboletox/Cnab/Retorno/Cnab400/detalhe.py
lucasbrahm/pyboletox
d7cfff477622a4d5df255045428325f04fbe695a
[ "MIT" ]
null
null
null
pyboletox/Cnab/Retorno/Cnab400/detalhe.py
lucasbrahm/pyboletox
d7cfff477622a4d5df255045428325f04fbe695a
[ "MIT" ]
1
2022-03-14T12:22:27.000Z
2022-03-14T12:22:27.000Z
from datetime import datetime from pyboletox.Contracts.Cnab.Retorno.Cnab400.detalhe import Detalhe as DetalheContract from pyboletox.magicTrait import MagicTrait class Detalhe(MagicTrait, DetalheContract): def __init__(self) -> None: super().__init__() self._carteira = None self._nossoNumero = None self._numeroDocumento = None self._numeroControle = None self._codigoLiquidacao = None self._ocorrencia = None self._ocorrenciaTipo = None self._ocorrenciaDescricao = None self._dataOcorrencia = None self._rejeicao = None self._dataVencimento = None self._dataCredito = None self._valor = None self._valorTarifa = None self._valorOutrasDespesas = None self._valorIOF = None self._valorAbatimento = None self._valorRecebido = None self._valorMora = None self._valorMulta = None self._error = None def getCarteira(self): return self._carteira def setCarteira(self, carteira): self._carteira = carteira return self def getNossoNumero(self): return self._nossoNumero def setNossoNumero(self, nossoNumero): self._nossoNumero = nossoNumero return self def getNumeroDocumento(self): return self._numeroDocumento def setNumeroDocumento(self, numeroDocumento): self._numeroDocumento = str(numeroDocumento).strip(' ').lstrip('0') return self def getNumeroControle(self): return self._numeroControle def setNumeroControle(self, numeroControle): self._numeroControle = numeroControle return self def getCodigoLiquidacao(self): return self._codigoLiquidacao def setCodigoLiquidacao(self, codigoLiquidacao): self._codigoLiquidacao = codigoLiquidacao return self def hasOcorrencia(self, *args): ocorrencias = args if len(ocorrencias) == 0 and not self.getOcorrencia(): return True if len(ocorrencias) == 1 and type(ocorrencias[0]) is list: ocorrencias = ocorrencias[0] if self.getOcorrencia() in ocorrencias: return True return False def getOcorrencia(self): return self._ocorrencia def setOcorrencia(self, ocorrencia): self._ocorrencia = "{0:0>2s}".format(ocorrencia) return self def getOcorrenciaDescricao(self): return self._ocorrenciaDescricao def setOcorrenciaDescricao(self, ocorrenciaDescricao): self._ocorrenciaDescricao = ocorrenciaDescricao return self def getOcorrenciaTipo(self): return self._ocorrenciaTipo def setOcorrenciaTipo(self, ocorrenciaTipo): self._ocorrenciaTipo = ocorrenciaTipo return self def getDataOcorrencia(self, format='%d/%m/%Y'): return self._dataOcorrencia.strftime(format) if self._dataOcorrencia else None def setDataOcorrencia(self, dataOcorrencia, format='%d%m%y'): self._dataOcorrencia = datetime.strptime(dataOcorrencia, format) if dataOcorrencia.strip("0 ") else None return self def getRejeicao(self): return self._rejeicao def setRejeicao(self, rejeicao): self._rejeicao = rejeicao return self def getDataVencimento(self, format='%d/%m/%Y'): return self._dataVencimento.strftime(format) if self._dataVencimento else None def setDataVencimento(self, dataVencimento, format='%d%m%y'): self._dataVencimento = datetime.strptime(dataVencimento, format) if dataVencimento.strip("0 ") else None return self def getDataCredito(self, format='%d/%m/%Y'): return self._dataCredito.strftime(format) if self._dataCredito else None def setDataCredito(self, dataCredito, format='%d%m%y'): self._dataCredito = datetime.strptime(dataCredito, format) if dataCredito.strip("0 ") else None return self def getValor(self): return self._valor def setValor(self, valor): self._valor = valor return self def getValorTarifa(self): return self._valorTarifa def setValorTarifa(self, valorTarifa): self._valorTarifa = valorTarifa return self def getValorOutrasDespesas(self): return self._valorOutrasDespesas def setValorOutrasDespesas(self, valorOutrasDespesas): self._valorOutrasDespesas = valorOutrasDespesas return self def getValorIOF(self): return self._valorIOF def setValorIOF(self, valorIOF): self._valorIOF = valorIOF return self def getValorAbatimento(self): return self._valorAbatimento def setValorAbatimento(self, valorAbatimento): self._valorAbatimento = valorAbatimento return self def getValorDesconto(self): return self._valorDesconto def setValorDesconto(self, valorDesconto): self._valorDesconto = valorDesconto return self def getValorRecebido(self): return self._valorRecebido def setValorRecebido(self, valorRecebido): self._valorRecebido = valorRecebido return self def getValorMora(self): return self._valorMora def setValorMora(self, valorMora): self._valorMora = valorMora return self def getValorMulta(self): return self._valorMulta def setValorMulta(self, valorMulta): self._valorMulta = valorMulta return self def hasError(self): return self.getOcorrencia == self.OCORRENCIA_ERRO def getError(self): return self._error def setError(self, error): self._ocorrenciaTipo = self.OCORRENCIA_ERRO self._error = error return self
28.421569
112
0.671438
555
5,798
6.872072
0.203604
0.117986
0.071578
0.014158
0.049554
0.039329
0.039329
0
0
0
0
0.003238
0.254398
5,798
203
113
28.561576
0.879019
0
0
0.161074
0
0
0.010003
0
0
0
0
0
0
1
0.315436
false
0
0.020134
0.154362
0.66443
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
69694310277e65251a0753febdaa9821eeeea635
319
py
Python
openmm_oemc/opoenmm_oemc/__init__.py
jht0664/Utility_python_gromacs
4457b62e2f0252bcb38021d5deda0cfb932e3ed9
[ "MIT" ]
1
2022-01-02T11:27:59.000Z
2022-01-02T11:27:59.000Z
openmm_oemc/opoenmm_oemc/__init__.py
jht0664/Utility_python_gromacs
4457b62e2f0252bcb38021d5deda0cfb932e3ed9
[ "MIT" ]
null
null
null
openmm_oemc/opoenmm_oemc/__init__.py
jht0664/Utility_python_gromacs
4457b62e2f0252bcb38021d5deda0cfb932e3ed9
[ "MIT" ]
null
null
null
#!/usr/local/bin/env python """ Python libraries for osmotic ensemble simulation which is an expanded ensemble for fixed (N_A, mu_B, P, T) in OpenMM. """ # define global version from openmm_oemc import version __version__ = version.version # import modules from openmm_oemc import cfc, integrator, opt_wl, constant
22.785714
117
0.77116
48
319
4.9375
0.729167
0.177215
0.118143
0.168776
0
0
0
0
0
0
0
0
0.15047
319
13
118
24.538462
0.874539
0.567398
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
3
15ca83d38898cb5f942ea39040025053294ed0e6
89,464
py
Python
S4/S4 Library/simulation/careers/career_tuning.py
NeonOcean/Environment
ca658cf66e8fd6866c22a4a0136d415705b36d26
[ "CC-BY-4.0" ]
1
2021-05-20T19:33:37.000Z
2021-05-20T19:33:37.000Z
S4/S4 Library/simulation/careers/career_tuning.py
NeonOcean/Environment
ca658cf66e8fd6866c22a4a0136d415705b36d26
[ "CC-BY-4.0" ]
null
null
null
S4/S4 Library/simulation/careers/career_tuning.py
NeonOcean/Environment
ca658cf66e8fd6866c22a4a0136d415705b36d26
[ "CC-BY-4.0" ]
null
null
null
from protocolbuffers.DistributorOps_pb2 import Operation import protocolbuffers from audio.primitive import TunablePlayAudio from away_actions.away_actions import AwayAction from buffs.tunable import TunableBuffReference from caches import cached from careers import career_ops from careers.career_enums import CareerCategory, CareerOutfitGenerationType, CareerPanelType, CareerShiftType, get_selector_type_from_career_category, CareerSelectorTypes from careers.career_location import TunableCareerLocationVariant from careers.career_scheduler import TunableCareerScheduleVariant, get_career_schedule_for_level from careers.career_story_progression import CareerStoryProgressionParameters from distributor.ops import GenericProtocolBufferOp from distributor.system import Distributor from event_testing.resolver import SingleSimResolver from event_testing.test_events import TestEvent from event_testing.tests import TunableTestSet from filters.tunable import TunableSimFilter from interactions import ParticipantType from interactions.utils.adventure import Adventure from interactions.utils.loot import LootActions from interactions.utils.success_chance import SuccessChance from interactions.utils.tested_variant import TunableTestedVariant from objects.mixins import SuperAffordanceProviderMixin, TargetSuperAffordanceProviderMixin, MixerProviderMixin, MixerActorMixin from objects.object_creation import ObjectCreation from sims.outfits.outfit_generator import TunableOutfitGeneratorReference from sims.sim_info_types import Age from sims4.localization import TunableLocalizedStringFactory, TunableLocalizedString from sims4.math import MAX_UINT64 from sims4.tuning.geometric import TunableCurve from sims4.tuning.instances import HashedTunedInstanceMetaclass from sims4.tuning.tunable import TunableTuple, TunableEnumFlags, TunableEnumEntry, OptionalTunable, Tunable, TunableMapping, TunableThreshold, TunableList, TunableReference, TunableRange, HasTunableReference, TunableSimMinute, TunableSet, TunablePercent, HasTunableSingletonFactory, AutoFactoryInit, TunableVariant, TunableRegionDescription, HasTunableFactory, TunablePackSafeReference from sims4.tuning.tunable_base import GroupNames, ExportModes from sims4.utils import classproperty from singletons import DEFAULT from statistics.commodity import RuntimeCommodity, CommodityTimePassageFixupType from statistics.runtime_statistic import RuntimeStatistic from traits.trait_type import TraitType from tunable_multiplier import TunableMultiplier, TestedSum from ui.ui_dialog import UiDialogResponse, UiDialogOkCancel, UiDialogOk, UiDialog, PhoneRingType from ui.ui_dialog_generic import UiDialogTextInputOk, UiDialogTextInputOkCancel from ui.ui_dialog_notification import UiDialogNotification, TunableUiDialogNotificationSnippet from venues.venue_constants import NPCSummoningPurpose import careers.career_base import event_testing.tests import interactions.utils.interaction_elements import scheduler import services import sims4.localization import sims4.resources import sims4.tuning.tunable import tunable_time import ui.screen_slam logger = sims4.log.Logger('CareerTuning', default_owner='tingyul') def _get_career_notification_tunable_factory(**kwargs): return UiDialogNotification.TunableFactory(locked_args={'text_tokens': DEFAULT, 'icon': None, 'primary_icon_response': UiDialogResponse(text=None, ui_request=UiDialogResponse.UiDialogUiRequest.SHOW_CAREER_PANEL), 'secondary_icon': None}, **kwargs) class CareerToneTuning(AutoFactoryInit, HasTunableSingletonFactory): FACTORY_TUNABLES = {'default_action_list': TunableList(description='\n List of test to default action. Should any test pass, that will\n be set as the default action.\n ', tunable=TunableTuple(default_action_test=OptionalTunable(description='\n If enabled, test will be run on the sim. \n Otherwise, no test will be run and default_action tuned will\n automatically be chosen. There should only be one item, \n which is also the default item in the list which has this \n disabled.\n ', tunable=TunableTestSet(description='\n Test to run to figure out what the default away action \n should be.\n ')), default_action=AwayAction.TunableReference(description='\n Default away action tone.\n '))), 'optional_actions': TunableSet(description='\n Additional selectable away action tones.\n ', tunable=AwayAction.TunableReference(pack_safe=True)), 'leave_work_early': TunableReference(description='\n Sim Info interaction to end work early.\n ', manager=services.get_instance_manager(sims4.resources.Types.INTERACTION), class_restrictions='CareerLeaveWorkEarlyInteraction')} def get_default_action(self, sim_info): resolver = SingleSimResolver(sim_info) for default_action_info in self.default_action_list: default_test = default_action_info.default_action_test if not default_test is None: if default_test.run_tests(resolver): return default_action_info.default_action return default_action_info.default_action logger.error('Failed to find default action for career tone tuning. Did you forget to add a default action with no test at the end of the list?') class Career(HasTunableReference, careers.career_base.CareerBase, metaclass=HashedTunedInstanceMetaclass, manager=services.get_instance_manager(sims4.resources.Types.CAREER)): HOMEWORK_HELP_MAPPING = TunableMapping(description='\n Determine how often and how much help a sim receives on their homework.\n ', key_type=TunableEnumEntry(description='\n The age at which the homework help data applies.\n ', tunable_type=Age, default=Age.CHILD), value_type=TunableTuple(description='\n The homework help data the defines the eligibility, chance\n and percent of homework completeness to apply when giving\n homework help.\n ', eligible_regions=TunableList(description='\n Regions in which sims who attend school are\n eligible to get homework help. If none are tuned,\n all regions are valid.\n ', tunable=TunableRegionDescription(description='\n Regions in which children who attend school are\n eligible to get homework help. If none are tuned,\n all regions are valid.\n ', pack_safe=True)), progress_percentage=TunablePercent(description='\n The progress percentage that the homework is complete\n after the student has been given homework help.\n ', default=50), base_chance=TunablePercent(description='\n The tunable chance that the sim receives homework help.\n ', default=50), homework_help_notification=TunableUiDialogNotificationSnippet(description='\n The notification that will show at the end of the day if a sim\n receives homework help.\n '))) NUM_CAREERS_PER_DAY = sims4.tuning.tunable.Tunable(int, 2, description='\n The number of careers that are randomly selected\n each day to populate career selection for the\n computer and phone.\n ') CAREER_TONE_INTERACTION = TunableReference(description='\n The interaction that applies the tone away action.\n ', manager=services.get_instance_manager(sims4.resources.Types.INTERACTION)) FIND_JOB_PHONE_INTERACTION = sims4.tuning.tunable.TunableReference(description="\n Find job phone interaction. This will be pushed on a Sim when player\n presses the Look For Job button on the Sim's career panel.\n ", manager=services.get_instance_manager(sims4.resources.Types.INTERACTION)) SWITCH_JOBS_DIALOG = UiDialogOkCancel.TunableFactory(description='\n If a Sim already has a career and is joining a new one, this dialog\n asks the player to confirm that they want to quit the existing career.\n \n Params passed to Text:\n {0.SimFirstName} and the like - Sim switching jobs\n {1.String} - Job title of existing career\n {2.String} - Career name of existing career\n {3.String} - Company name of existing career\n {4.String} - Career name of new career\n ') SWITCH_MANY_JOBS_DIALOG = UiDialogOkCancel.TunableFactory(description='\n If a Sim already has more than one career and is joining a new one, \n this dialog asks the player to confirm that they want to quit the existing careers.\n \n Params passed to Text:\n {0.SimFirstName} and the like - Sim switching jobs\n {1.String} - Job title of existing career\n {2.String} - Career name of existing career\n {3.String} - Company name of existing career\n {4.String} - Career name of new career\n ') UNRETIRE_DIALOG = UiDialogOkCancel.TunableFactory(description='\n If a Sim is retired and is joining a career, this dialog asks the\n player to confirm that they want to unretire and lose any retirement\n benefits.\n \n Params passed to Text:\n {0.SimFirstName} and the like - Sim switching jobs\n {1.String} - Job title of retired career\n {2.String} - Career name of retired career\n {3.String} - Career name of new career\n ') FIRST_TIME_ASSIGNMENT_DIALOG = UiDialogOkCancel.TunableFactory(description='\n Dialog to offer an immediate assignment to a Sim on accepting a\n new job. \n \n Params passed to Text:\n {0.SimFirstName} and the like - Sim switching jobs\n {1.String} - Line separated list of assignment names.\n ') FIRST_TIME_ASSIGNMENT_DIALOG_DELAY = sims4.tuning.tunable.TunableSimMinute(description='\n The time in Sim Minutes between a Sim accepting\n a job and getting the first assignment pop-up\n ', default=3.0, minimum=0.0) FIRST_TIME_DEFERRED_ASSIGNMENT_ADDITIONAL_DELAY = sims4.tuning.tunable.TunableInterval(description='\n A minimum and maximum time between which an additional delay will be\n randomly chosen. This delay will be added to the normal first time\n assignment delay. A different value will be chosen for each occurrence.\n ', tunable_type=sims4.tuning.tunable.TunableSimMinute, default_lower=120, default_upper=720, minimum=0) CAREER_PERFORMANCE_UPDATE_INTERVAL = sims4.tuning.tunable.TunableSimMinute(description="\n In Sim minutes, how often during a work session the Sim's work\n performance is updated.\n ", default=30.0, minimum=0.0) SCHOLARSHIP_INFO_EVENT = TunableEnumEntry(description='\n The event to register for when waiting for a Scholarship Info Sign to be shown.\n ', tunable_type=TestEvent, default=TestEvent.Invalid) WORK_SESSION_PERFORMANCE_CHANGE = TunableReference(description="\n Used to track a sim's work performance change over a work session.\n ", manager=services.get_instance_manager(sims4.resources.Types.STATISTIC)) BUFFS_LEAVE_WORK = TunableSet(description='\n The buffs that are applied when sim left work.\n ', tunable=TunableBuffReference(pack_safe=True)) PART_TIME_CAREER_SHIFT_ICONS = TunableMapping(description='\n Used to populate icons on the shifts dropdown on Career Selector\n ', key_name='shift_type', key_type=TunableEnumEntry(description='Shift Type.', tunable_type=CareerShiftType, default=CareerShiftType.ALL_DAY), value_name='icon', value_type=sims4.tuning.tunable.TunableResourceKey(None, resource_types=sims4.resources.CompoundTypes.IMAGE, description='The icon to be displayed.'), tuple_name='PartTimeShiftTuningTuple', export_modes=ExportModes.All) TEXT_INPUT_NEW_NAME = 'new_name' TEXT_INPUT_NEW_DESCRIPTION = 'new_description' REGISTER_CAREER_DIALOG_DATA = TunableTuple(register_career_dialog=TunableVariant(description='\n The rename dialog to show when running this interaction.\n ', ok_dialog=UiDialogTextInputOk.TunableFactory(text_inputs=(TEXT_INPUT_NEW_NAME, TEXT_INPUT_NEW_DESCRIPTION)), ok_cancel_dialog=UiDialogTextInputOkCancel.TunableFactory(text_inputs=(TEXT_INPUT_NEW_NAME, TEXT_INPUT_NEW_DESCRIPTION))), register_career_rename_title=OptionalTunable(TunableLocalizedStringFactory(description="\n If set, this localized string will be used as the interaction's \n display name if the object has been previously renamed.\n "))) CUSTOM_CAREER_KNOWLEDGE_NOTIFICATION = TunableUiDialogNotificationSnippet(description="\n The notification to use when one Sim learns about another Sim's\n career. This is only used when the sim has a custom career. \n Regular career's notification is found in the career track.\n ") CUSTOM_CAREER_REGISTER_LOOT = LootActions.TunableReference(description='\n Loot to give when sim registers for custom career. This is not tuned\n directly on interaction because the sim can leave custom career through\n code for various reasons. The join loot is applied through code to \n standardize the flow.\n ') CUSTOM_CAREER_UNREGISTER_LOOT = LootActions.TunableReference(description='\n Loot to give when sim unregisters custom career. This is not tuned\n directly on interaction because the sim can leave custom career through\n code for various reasons. \n ') GIG_PICKER_LOCALIZATION_FORMAT = TunableLocalizedStringFactory(description='\n String used to format the description in the gig picker.\n Currently has tokens for name, payout range, audition time, gig time\n and audition prep recommendation.\n ') GIG_PICKER_SKIPPED_AUDITION_LOCALIZATION_FORMAT = TunableLocalizedStringFactory(description='\n String used to format the description in the gig picker if audition is \n skipped. Currently has tokens for name, payout range, gig time and \n audition prep recommendation.\n ') TRAIT_BASED_CAREER_LEVEL_ENTITLEMENTS = TunableList(description='\n A list of mappings of traits to CareerLevel references. If a sim has\n a given trait, the associated CareerLevels will become available\n in the career selector.\n ', tunable=sims4.tuning.tunable.TunableTuple(trait=sims4.tuning.tunable.TunableReference(description='\n Trait to test for on the Sim that makes the associated\n career levels available in the career selector.\n ', manager=services.get_instance_manager(sims4.resources.Types.TRAIT), pack_safe=True), career_entitlements=sims4.tuning.tunable.TunableList(description='\n The list of CareerLevels.\n ', tunable=sims4.tuning.tunable.TunableReference(description='\n A CareerLevel.\n ', manager=services.get_instance_manager(sims4.resources.Types.CAREER_LEVEL), pack_safe=True)), benefits_description=TunableLocalizedString(description='\n A description of the benefits granted by the trait to be \n displayed in the career selector.\n '))) INSTANCE_TUNABLES = {'career_category': TunableEnumEntry(description='\n Category for career, this will be used for aspirations and other\n systems which should trigger for careers categories but not for\n others.\n ', tunable_type=CareerCategory, default=CareerCategory.Invalid, export_modes=ExportModes.All), 'career_panel_type': TunableEnumEntry(description='\n Type of panel that UI should use for this career.\n ', tunable_type=CareerPanelType, default=CareerPanelType.NORMAL_CAREER, export_modes=ExportModes.All, tuning_group=GroupNames.UI), 'career_story_progression': CareerStoryProgressionParameters.TunableFactory(description='\n Define how Story Progression handles this specific career.\n '), 'career_location': TunableCareerLocationVariant(description='\n Define where Sims go to work.\n ', tuning_group=GroupNames.UI), 'start_track': sims4.tuning.tunable.TunableReference(description='\n This is the career track that a Sim would start when joining\n this career for the first time. Career Tracks contain a series of\n levels you need to progress through to finish it. Career tracks can branch at the end\n of a track, to multiple different tracks which is tuned within\n the career track tuning.\n ', manager=services.get_instance_manager(sims4.resources.Types.CAREER_TRACK), export_modes=sims4.tuning.tunable_base.ExportModes.All), 'career_affordance': sims4.tuning.tunable.TunableReference(manager=services.get_instance_manager(sims4.resources.Types.INTERACTION), description='SI to push to go to work.'), 'go_home_to_work_affordance': TunableReference(description='\n Interaction pushed onto a Sim to go home and start work from there\n if they are not on their home lot.\n ', manager=services.affordance_manager()), 'career_rabbit_hole': TunablePackSafeReference(description='\n Rabbit hole to put sim in when they are at work.\n ', manager=services.get_instance_manager(sims4.resources.Types.RABBIT_HOLE), class_restrictions=('CareerRabbitHole',)), 'tested_affordances': TunableList(description="\n A list of test sets to run to choose the affordance to go work. If \n an affordance is found from this list, it will be pushed onto the \n Sim.\n \n If no affordance is found from this list that pass the tests, \n normal work affordance behavior will take over, running \n 'career_affordance' if at home or 'go_home_to_work_affordance' if \n not at home.\n ", tunable=TunableTuple(tests=TunableTestSet(description='\n A set of tests that if passed will make this the affordance\n that is run to send the Sim to work.\n '), affordance=TunableReference(description='\n The career affordance for this test set. \n ', manager=services.get_instance_manager(sims4.resources.Types.INTERACTION)))), 'levels_lost_on_leave': sims4.tuning.tunable.Tunable(int, 1, description='When you leave this career for any reason you will immediately lose this many levels, for rejoining the career. i.e. if you quit your job at level 8, and then rejoined with this value set to 1, you would rejoin the career at level 7.'), 'days_to_level_loss': sims4.tuning.tunable.Tunable(int, 1, description='When you leave a career, we store off the level youwould rejoin the career at. Every days_to_level_loss days you will lose another level. i.e. I quit my job at level 8. I get reducedlevel 7 right away because of levels_lost_on_leave. Then with days_to_level_loss set to 3, in 3 days I would goto level 6, in 6 days level 5, etc...'), 'start_level_modifiers': TestedSum.TunableFactory(description='\n A tunable list of test sets and associated values to apply to the\n starting level of this Sim.\n '), 'promotion_buff': OptionalTunable(description='\n The buff to trigger when this Sim is promoted in this career.', tunable=TunableBuffReference()), 'demotion_buff': OptionalTunable(description='\n The buff to trigger when this Sim is demoted in this career.', tunable=TunableBuffReference()), 'fired_buff': OptionalTunable(description='\n The buff to trigger when this Sim is fired from this career.', tunable=TunableBuffReference()), 'early_promotion_modifiers': TunableMultiplier.TunableFactory(description='\n A tunable list of test sets and associated multipliers to apply to \n the moment of promotion. A resulting modifier multiplier of 0.10 means that promotion \n could happen up to 10% earlier. A value less than 0 has no effect.\n '), 'early_promotion_chance': TunableMultiplier.TunableFactory(description='\n A tunable list of test sets and associated multipliers to apply to the percentage chance, \n should the early promotion modifier deem that early promotion is possible,\n that a Sim is in fact given a promotion. A resolved value of 0.10 will result in a 10%\n chance.\n '), 'demotion_chance_modifiers': TunableMultiplier.TunableFactory(description="\n A tunable list of test sets and associated multipliers to apply to \n the moment of a Sim's demotion, to provide the chance that Sim will get demoted. A resultant\n modifier value of 0.50 means at the point of work end where performance would require demotion,\n the Sim would have a 50% chance of being demoted. Any resultant value over 1 will result in demotion.\n "), 'scholarship_info_loot': OptionalTunable(description='\n If enabled, this loot will run at the beginning of the career si.\n ', tunable=LootActions.TunablePackSafeReference(description='\n Loot to trigger at the beginning of the career\n ', allow_none=True)), 'career_messages': TunableTuple(join_career_notification=OptionalTunable(description='\n If tuned, we will show a message when a sim joins this career.\n If not tuned, no message will be shown.\n ', tunable=_get_career_notification_tunable_factory(description='\n Message when a Sim joins a new career.\n '), enabled_by_default=True), quit_career_notification=_get_career_notification_tunable_factory(description='\n Message when a Sim quits a career.\n '), fire_career_notification=_get_career_notification_tunable_factory(description='\n Message when a Sim is fired from a career.\n '), promote_career_notification=_get_career_notification_tunable_factory(description='\n Message when a Sim is promoted in their career.\n '), promote_career_rewardless_notification=_get_career_notification_tunable_factory(description="\n Message when a Sim is promoted in their career and there are no\n promotion rewards, either because there are none tuned or Sim\n was demoted from this level in the past and so shouldn't get\n rewards again.\n "), demote_career_notification=_get_career_notification_tunable_factory(description='\n Message when a Sim is demoted in their career.\n '), career_daily_start_notification=_get_career_notification_tunable_factory(description='\n Message on notification when sim starts his work day\n '), career_daily_end_notification=TunableTestedVariant(description='\n Message on notification when sim ends his work day\n ', tunable_type=_get_career_notification_tunable_factory(), locked_args={'no_notification': None}), career_event_confirmation_dialog=UiDialogOkCancel.TunableFactory(description='\n At the begining of a work day, if the career has available events and\n the Sim is eligible to do an event, this dialog is shown. If player\n accepts, the Sim is sent to the career event (e.g. hospital, police\n station, etc.). If player declines, the Sim goes to rabbit hole to \n work.\n \n Params passed to Text:\n {0.SimFirstName} and the like - Sim in career\n {1.String} - Job title\n {2.String} - Career name\n {3.String} - Company name\n '), career_time_off_messages=TunableMapping(description='\n Mapping of time off reason to the messages displayed for that reason\n ', key_type=TunableEnumEntry(career_ops.CareerTimeOffReason, career_ops.CareerTimeOffReason.NO_TIME_OFF), value_type=TunableTuple(text=TunableLocalizedStringFactory(description='\n Localization String for the text displayed on the panel when\n taking time off for the specified reason.\n \n First token: sim info\n Second token: PTO days remaining.\n ', allow_none=True), tooltip=TunableLocalizedStringFactory(description='\n Localization String for the tooltip displayed when\n taking time off for the specified reason\n \n First token: sim info\n Second token: PTO days remaining.\n ', allow_none=True), day_end_notification=OptionalTunable(description='\n If enabled, the notification that will be sent when the\n Sim ends his day of PTO.\n ', tunable=TunableTestedVariant(description='\n Message on notification when sim ends his day of PTO\n ', tunable_type=_get_career_notification_tunable_factory())))), career_early_warning_notification=_get_career_notification_tunable_factory(description='\n Message warning the Sim will need to leave for work soon.\n '), career_early_warning_time=Tunable(description='\n How many hours before a the Sim needs to go to work to show\n the Career Early Warning Notification. If this is <= 0, the\n notification will not be shown.\n ', tunable_type=float, default=1), career_early_warning_alarm=OptionalTunable(description='\n If enabled, provides options to the player to go to work,\n work from home, or take pto. \n \n {0.SimFirstName} Sim in career\n {1.String} - Career level title\n {2.String} - Career name\n {3.String} - Company name\n ', tunable=TunableTuple(dialog=UiDialog.TunableFactory(description="\n Dialog that's shown. Okay is confirming leaving the\n situation, cancel is to miss work and stay in the\n situation.\n ", locked_args={'phone_ring_type': PhoneRingType.ALARM}), go_to_work_text=sims4.localization.TunableLocalizedStringFactory(description='\n Button text for choosing to go to work.\n '), work_from_home_text=sims4.localization.TunableLocalizedStringFactory(description='\n If the Sim has career assignments to offer, a button with\n this text will show up.\n '), take_pto_text=sims4.localization.TunableLocalizedStringFactory(description='\n If the Sim has enough PTO, a button with this text will\n show up.\n '), call_in_sick_text=sims4.localization.TunableLocalizedStringFactory(description='\n If the Sim does not have enough PTO, a button with this\n text will show up.\n ')), enabled_by_default=True), career_missing_work=OptionalTunable(description='\n If enabled, being late for work will trigger the missing work flow\n ', tunable=TunableTuple(description='\n Tuning for triggering the missing work flow.\n ', dialog=UiDialogOk.TunableFactory(description='\n The dialog that will be triggered when the sim misses work.\n '), affordance=sims4.tuning.tunable.TunableReference(description='\n The affordance that is pushed onto the sim when the accepts\n the modal dialog.\n ', manager=services.get_instance_manager(sims4.resources.Types.INTERACTION))), enabled_by_default=True), career_performance_warning=TunableTuple(description='\n Tuning for triggering the career performance warning flow.\n ', dialog=UiDialogOk.TunableFactory(description='\n The dialog that will be triggered when when the sim falls\n below their performance threshold.\n '), threshold=TunableThreshold(description='\n The threshold that the performance stat value will be\n compared to. If the threshold returns true then the\n performance warning notification will be triggered.\n \n '), affordance=sims4.tuning.tunable.TunableReference(description='\n The affordance that is pushed onto the sim when the accepts\n the modal dialog.\n ', manager=services.get_instance_manager(sims4.resources.Types.INTERACTION))), pto_gained_text=sims4.localization.TunableLocalizedStringFactory(description='\n Text passed to daily end notifications when additional day of \n PTO is earned.\n \n First token: sim info\n ', allow_none=True), overmax_rewardless_notification=_get_career_notification_tunable_factory(description='\n The notification to display when a Sim reaches an overmax level.\n The following tokens are provided:\n * 0: The Sim owner of the career\n * 1: The level name (e.g. Chef)\n * 2: The career name (e.g. Culinary)\n * 3: The company name (e.g. Maids United)\n * 4: The overmax level\n * 5: The new salary\n * 6: The salary increase\n '), overmax_notification=_get_career_notification_tunable_factory(description='\n The notification to display when a Sim reaches an overmax level.\n The following tokens are provided:\n * 0: The Sim owner of the career\n * 1: The level name (e.g. Chef)\n * 2: The career name (e.g. Culinary)\n * 3: The company name (e.g. Maids United)\n * 4: The overmax level\n * 5: The new salary\n * 6: The salary increase\n * 7: The rewards, in the form of a string\n '), situation_leave_confirmation=TunableTuple(description='\n If a playable Sim is in a situation with a job with Confirm\n Leave Situation For Work set, this dialog will be shown to the\n player with the options of leaving the situation for work,\n staying in situation and let Sim miss work, or stay in\n situation and Sim take PTO.\n \n {0.SimFirstName} and the like - Sim in career\n {1.String} - Job title\n {2.String} - Career name\n {3.String} - Company name\n ', dialog=UiDialogOkCancel.TunableFactory(description="\n Dialog that's shown. Okay is confirming leaving the situation,\n cancel is to miss work and stay in the situation.\n "), take_pto_button_text=sims4.localization.TunableLocalizedStringFactory(description='\n If the Sim has enough PTO, a button with this text will show up.\n ')), career_event_end_warning=OptionalTunable(description='\n If enabled, a notification will be displayed if time left is \n more than time tuned. \n If disabled, no notification will be displayed.\n ', tunable=TunableTuple(description="\n Tuning for a notification warning the player that their Sim's\n active career event is about to end.\n ", notification=_get_career_notification_tunable_factory(description='\n Notification warning work day is going to end.\n \n Params passed to Text:\n {0.SimFirstName} and the like - Sim in career\n {1.String} - Job title\n {2.String} - Career name\n {3.String} - Company name\n '), time=TunableSimMinute(description='\n How many Sim minutes prior to the end to show notification.\n ', default=60, minimum=0))), career_assignment_summary_notification=TunableTestedVariant(description='\n Message on notification when day starts after having assignment(s).\n ', tunable_type=_get_career_notification_tunable_factory(), locked_args={'no_notification': None}), tuning_group=GroupNames.UI), 'can_be_fired': sims4.tuning.tunable.Tunable(bool, True, description='Whether or not the Sim can be fired from this career. For example, children cannot be fired from school.'), 'quittable_data': OptionalTunable(description='\n Whether or not Sims can quit this career.\n e.g.: Children/Teens cannot quit School.\n \n If the career is quittable, specify tuning directly related to\n quitting, e.g. the confirmation dialog.\n ', tunable=TunableTuple(tested_quit_dialog=OptionalTunable(description='\n If enabled and the tuned tests pass, instead of showing the default\n quit dialog the tested quit dialog will be displayed.\n \n Example: If a Sim has a scholarship (EP8) that depends on\n staying in the career, a tested quit dialog can be tuned to\n include a warning in its dialog text.\n ', tunable=TunableTuple(quit_dialog=UiDialogOkCancel.TunableFactory(description='\n This dialog asks the player to confirm that they want to\n quit.\n '), test_set=event_testing.tests.TunableTestSet(description='\n If the tests pass, the test-dependent-quit-dialog will\n show. Otherwise, the default quit-dialog will show.\n '))), quit_dialog=UiDialogOkCancel.TunableFactory(description='\n This dialog asks the player to confirm that they want to\n quit.\n ')), enabled_by_default=True, enabled_name='Can_Quit', disabled_name='Cannot_Quit'), 'career_availablity_tests': event_testing.tests.TunableTestSet(description='\n When a Sim calls to join a Career, this test set determines if a \n particular career can be available to that Sim at all. This test\n set determines if a Career is visible in the Career Panel.\n '), 'career_selectable_tests': event_testing.tests.TunableTestSet(description='\n Test set that determines if a career that is available to a Sim\n is valid or not. This test set determines if a Career is selectable\n in the Career Panel.\n '), 'show_career_in_join_career_picker': Tunable(description='\n If checked, this career will be visible in the join career picker\n window. If not checked, it will not be.\n ', tunable_type=bool, default=True, tuning_group=GroupNames.UI), 'initial_pto': sims4.tuning.tunable.Tunable(description='\n Initial amount of PTO earned when joining the career\n ', tunable_type=float, default=0), 'disable_pto': Tunable(description='\n If checked, will disable PTO references in the UI. This option is\n incompatible with setting any pto tuning in the carrer or career \n levels to non-default values.\n ', default=False, tunable_type=bool, tuning_group=GroupNames.UI), 'initial_delay': TunableSimMinute(description='\n The amount of time a Sim is exempt from going to work after being\n hired. Their first work day will be at least this much into the\n future.\n ', default=480.0, minimum=0.0), 'is_active': sims4.tuning.tunable.Tunable(description='\n Whether this career is considered active. Active careers appear in\n a separate tab in the Join Career dialog.\n ', tunable_type=bool, default=False), 'career_events': TunableList(description='\n A list of available career events.\n ', tunable=sims4.tuning.tunable.TunableReference(manager=services.get_instance_manager(sims4.resources.Types.CAREER_EVENT))), 'hire_agent_interaction': OptionalTunable(tunable=TunableReference(description='\n The interaction to push a sim to hire an agent.\n ', manager=services.affordance_manager()), tuning_group=GroupNames.GIG, export_modes=(ExportModes.ClientBinary,)), 'find_audition_interaction': OptionalTunable(tunable=TunableReference(description='\n The interaction to push a sim to look for an audition.\n ', manager=services.affordance_manager()), tuning_group=GroupNames.GIG, export_modes=(ExportModes.ClientBinary,)), 'cancel_audition_interaction': OptionalTunable(tunable=TunableReference(description='\n The interaction to push on a sim who cancels an audition.\n ', manager=services.affordance_manager()), tuning_group=GroupNames.GIG, export_modes=(ExportModes.ClientBinary,)), 'cancel_gig_interaction': OptionalTunable(tunable=TunableReference(description='\n The interaction to push on a sim to cancel a gig.\n ', manager=services.affordance_manager()), tuning_group=GroupNames.GIG, export_modes=(ExportModes.ClientBinary,)), 'call_costar_interaction': OptionalTunable(tunable=TunableReference(description='\n The interaction to push a sim to call up their costars. This is added\n for gigs.\n ', manager=services.affordance_manager()), tuning_group=GroupNames.GIG, export_modes=(ExportModes.ClientBinary,)), 'invite_over': OptionalTunable(description='\n Tuning that provides a tunable chance for the Sim in this career\n inviting over someone at the end of the work/school day. For\n example, a child Sim can invite over a classmate after school,\n or an adult can invite over a co-worker after their shift ends.\n \n Invite overs will only occur if the player is on the home lot.\n ', tunable=TunableTuple(chance=SuccessChance.TunableFactory(description='\n Chance of inviting over a Sim after work/school.\n '), confirmation_dialog=UiDialogOkCancel.TunableFactory(description='\n Dialog offered to player to confirm inviting over someone.\n \n Localization Tokens:\n 0: Sim in career.\n 1: Sim being invited over.\n '), sim_filter=TunableSimFilter.TunableReference(description='\n Sim filter specifying who to invite over.\n '), purpose=TunableEnumEntry(description='\n The purpose for the invite over. This will determine the\n behavior of the invited over Sim, as tuned in Venue -> Npc\n Summoning Behavior.\n ', tunable_type=NPCSummoningPurpose, default=NPCSummoningPurpose.DEFAULT))), 'available_for_club_criteria': Tunable(description='\n If enabled, this career type will be available for selection when\n creating Club Criteria. If disabled, it will not be available.\n ', tunable_type=bool, default=False), 'has_coworkers': Tunable(description='\n If checked, other Sims in this career are considered coworkers. If\n unchecked, they are not.\n \n e.g.\n * Sims in High School might should not be considered coworkers.\n ', tunable_type=bool, default=True), 'display_career_info': Tunable(description='\n If checked, the full set of career messages are displayed for this\n career. This includes notifications when the career is joined as\n well as performance evaluation results.\n \n If unchecked, those two sets of data are not made visible to the\n player, e.g. for school career.\n ', tunable_type=bool, default=True), 'is_school_career': Tunable(description='\n If checked, the career will test into special behavior and treated\n as school for children or teens.\n \n If unchecked, this is a professional career.\n \n Used to branch behavior at the end of the day for re-setting the career\n performance statistics for childreen/teens so they may receive\n homework help.\n ', tunable_type=bool, default=False), 'aspirations_to_activate': TunableList(description="\n A list of aspirations we want to activate while the Sim is in this\n career. This saves from having to track them when the Sim is not in\n the career.\n \n Note: You don't need to tune Aspirations that the Career Level\n references directly. But if those aspirations rely on others, then\n they need to be tuned here.\n ", tunable=sims4.tuning.tunable.TunableReference(description='\n A Career Aspiration that we want to activate when the Sim is in\n this career.\n ', manager=services.get_instance_manager(sims4.resources.Types.ASPIRATION), class_restrictions='AspirationCareer'), unique_entries=True), 'show_ideal_mood': Tunable(description="\n If checked, displays the current career track's ideal mood in the UI.\n Does not change whether the ideal mood affects the career performance.\n ", tunable_type=bool, default=False, tuning_group=GroupNames.UI, export_modes=ExportModes.All), 'is_visible_career': Tunable(description='\n If checked, this will be considered a professional career. If \n unchecked, any career tests that check for a visible, \n professional career will not take this career into account. In \n addition, any unchecked career will not be affected by any Career \n Loot Ops (because it is invisible).\n ', tunable_type=bool, default=True), 'early_work_loot': OptionalTunable(description='\n If enabled, this loot will be applied to the Sim prior to going to\n work.\n ', tunable=LootActions.TunablePackSafeReference(description='\n Loot to apply to the Sim prior to going to work.\n ', allow_none=True))} _days_worked_statistic_type = None _active_days_worked_statistic_type = None @classmethod def _verify_tuning_callback(cls): if cls.disable_pto: if cls.initial_pto > 0: logger.error('Career: {} has disable PTO set but has initial PTO', cls) for career_level in cls.start_track.career_levels: if career_level.pto_per_day != 0: logger.error('Career: {} has disable PTO set but has nonzero PTO gain in career level {} (zero indexed)', cls, career_level.level) if cls.available_for_club_criteria: start_track = cls.start_track if start_track.career_name._string_id == start_track.career_name_gender_neutral.hash: logger.error('Career {} has the same string tuned for its display name and its gender-neutral display name. These must be different strings for localization.', start_track, owner='BadTuning') for reason in career_ops.CareerTimeOffReason: if reason == career_ops.CareerTimeOffReason.NO_TIME_OFF: continue if reason not in cls.career_messages.career_time_off_messages: logger.error('Career: {} is missing career.career time off messages for reason: {}', cls, reason) @classmethod def _tuning_loaded_callback(cls): cls._create_runtime_commodities() cls._propagate_track_and_level_data() @classmethod def _create_runtime_commodities(cls): temp_commodity = RuntimeCommodity.generate(cls.__name__) temp_commodity.decay_rate = 0 temp_commodity.convergence_value = 0 temp_commodity.remove_on_convergence = False temp_commodity.visible = False temp_commodity.max_value_tuning = 99 temp_commodity.min_value_tuning = 0 temp_commodity.initial_value = cls.initial_pto temp_commodity.add_if_not_in_tracker = True temp_commodity._time_passage_fixup_type = CommodityTimePassageFixupType.FIXUP_USING_TIME_ELAPSED cls._pto_commodity = temp_commodity if cls._days_worked_statistic_type is None: cls._days_worked_statistic_type = RuntimeStatistic.generate(cls.__name__ + '_DaysWorked') cls._active_days_worked_statistic_type = RuntimeStatistic.generate(cls.__name__ + '_ActiveDaysWorked') cls.max_value_tuning = MAX_UINT64 @classmethod def _propagate_track_and_level_data(cls): tracks = [] tracks.append((cls.start_track, 1)) while tracks: (track, starting_user_level) = tracks.pop() for (index, career_level) in enumerate(track.career_levels): if career_level.track is not None: logger.assert_log('Invalid tuning. {} is in multiple career tracks: {}, {}', career_level.__name__, career_level.track.__name__, cls.__name__) career_level.career = cls career_level.track = track career_level.level = index career_level.user_level = index + starting_user_level branch_user_level = len(track.career_levels) + starting_user_level for branch in track.branches: if branch.parent_track is not None: logger.error('Invalid tuning. {} has multiple parent tracks: {}, {}', branch.__name__, branch.parent_track.__name__, track.__name__) branch.parent_track = track tracks.append((branch, branch_user_level)) @classmethod @cached def get_max_user_level(cls): max_user_level = 0 stack = [(cls.start_track, 0)] while stack: (track, level) = stack.pop() level += len(track.career_levels) if track.branches: for branch in track.branches: stack.append((branch, level)) else: max_user_level = max(max_user_level, level) else: max_user_level = max(max_user_level, level) return max_user_level @classproperty def allow_multiple_careers(cls): return False @classproperty def pto_commodity(cls): return cls._pto_commodity @classproperty def can_quit(cls): return cls.quittable_data is not None @staticmethod def _append_career_info_pb(msg, sim_info, career, current_track, new_level, benefit_description=None, is_selectable=True): if current_track is not None: career_track = current_track elif career.start_track is not None: career_track = career.start_track else: logger.error('Career {} is unjoinable because it is missing Start Track tuning.', career) return if new_level < 0 or new_level >= len(career_track.career_levels): logger.error('Career {} has an invalid index for career level: new_level={}.', career, new_level) return career_level = career_track.career_levels[new_level] career_info_msg = msg.career_choices.add() career_info_msg.uid = career.guid64 career_info_msg.career_track = career_track.guid64 career_info_msg.career_level = new_level career_info_msg.is_active = career.is_active if benefit_description is not None: career_info_msg.benefit_description = benefit_description career_info_msg.is_selectable = is_selectable career_info_msg.hourly_pay = career.get_hourly_pay(sim_info=sim_info, career_track=career_track, career_level=career_level.level, overmax_level=0) work_schedule = get_career_schedule_for_level(career_level) if work_schedule is not None: work_schedule.populate_scheduler_msg(career_info_msg.work_schedule) @staticmethod def get_join_career_pb(sim_info, num_careers_to_show=0, default_career_selection_data=None): msg = protocolbuffers.Sims_pb2.CareerSelectionUI() msg.sim_id = sim_info.sim_id msg.is_branch_select = False msg.reason = career_ops.CareerOps.JOIN_CAREER current_shift = CareerShiftType.ALL_DAY for sim_career_id in sim_info.career_tracker.careers: sim_career = sim_info.career_tracker.get_career_by_uid(sim_career_id) if sim_career.schedule_shift_type != CareerShiftType.ALL_DAY: current_shift = sim_career.schedule_shift_type break msg.current_shift = current_shift if default_career_selection_data is not None: msg.default_career_select_uid = default_career_selection_data.default_career_select msg.career_selector_type = default_career_selection_data.career_selector_type all_possible_careers = services.get_career_service().get_shuffled_career_list() career_tracks_added = [] career_tracks_to_skip = [] for entitlement in Career.TRAIT_BASED_CAREER_LEVEL_ENTITLEMENTS: if sim_info.trait_tracker.has_trait(entitlement.trait): for career_level in entitlement.career_entitlements: test_result = career_level.career.is_career_available(sim_info=sim_info, from_join=True) if test_result and sim_info.career_tracker.get_career_by_uid(career_level.career.guid64) is None and career_level.track not in career_tracks_added: is_selectable_test_result = career_level.career.is_career_selectable(sim_info=sim_info) Career._append_career_info_pb(msg, sim_info, career_level.career, career_level.track, career_level.level, benefit_description=entitlement.benefits_description, is_selectable=is_selectable_test_result.result) career_tracks_added.append(career_level.track) parent_track = career_level.track.parent_track if parent_track is not None: all_child_branches_available = True for child in parent_track.branches: if child not in career_tracks_added: all_child_branches_available = False break if all_child_branches_available: career_tracks_to_skip.append(parent_track) for career_tuning in all_possible_careers: if 0 < num_careers_to_show <= len(career_tracks_added): break if not career_tuning.show_career_in_join_career_picker: continue test_result = career_tuning.is_career_available(sim_info=sim_info, from_join=True) if test_result: if sim_info.career_tracker.get_career_by_uid(career_tuning.guid64) is None: (new_level, _, current_track) = career_tuning.get_career_entry_level(career_history=sim_info.career_tracker.career_history, resolver=SingleSimResolver(sim_info)) if current_track in career_tracks_to_skip: continue is_selectable_test_result = career_tuning.is_career_selectable(sim_info=sim_info) if current_track not in career_tracks_added: Career._append_career_info_pb(msg, sim_info, career_tuning, current_track, new_level, is_selectable=is_selectable_test_result.result) return msg @staticmethod def get_quit_career_pb(sim_info): msg = protocolbuffers.Sims_pb2.CareerSelectionUI() msg.sim_id = sim_info.sim_id msg.is_branch_select = False msg.reason = career_ops.CareerOps.QUIT_CAREER for career_instance in sim_info.careers.values(): if not career_instance.show_career_in_join_career_picker: continue career_info_msg = msg.career_choices.add() career_info_msg.uid = career_instance.guid64 career_info_msg.career_track = career_instance.current_track_tuning.guid64 career_info_msg.career_level = career_instance.level career_info_msg.company = career_instance.get_company_name() career_info_msg.conflicted_schedule = False career_level = career_instance.current_track_tuning.career_levels[career_instance.level] work_schedule = get_career_schedule_for_level(career_level) if work_schedule is not None: work_schedule.populate_scheduler_msg(career_info_msg.work_schedule, career_instance.schedule_shift_type) return msg @staticmethod def get_select_career_track_pb(sim_info, career, career_branches): msg = protocolbuffers.Sims_pb2.CareerSelectionUI() msg.sim_id = sim_info.sim_id msg.is_branch_select = True for career_track in career_branches: career_info_msg = msg.career_choices.add() career_info_msg.uid = career.guid64 career_info_msg.career_track = career_track.guid64 career_info_msg.career_level = 0 career_info_msg.company = career.get_company_name() work_schedule = get_career_schedule_for_level(career_track.career_levels[0]) career_level = career_track.career_levels[0] work_schedule = get_career_schedule_for_level(career_level) if work_schedule is not None: work_schedule.populate_scheduler_msg(career_info_msg.work_schedule) return msg class TunableCareerTrack(metaclass=HashedTunedInstanceMetaclass, manager=services.get_instance_manager(sims4.resources.Types.CAREER_TRACK)): INSTANCE_TUNABLES = {'career_name': sims4.localization.TunableLocalizedStringFactory(description='\n The name of this Career Track\n ', export_modes=sims4.tuning.tunable_base.ExportModes.All, tuning_group=GroupNames.UI), 'career_name_gender_neutral': sims4.localization.TunableLocalizedString(description="\n The gender neutral name for this Career. This string is not provided\n any tokens, and thus can't rely on context to properly form\n masculine and feminine forms.\n ", export_modes=sims4.tuning.tunable_base.ExportModes.All, tuning_group=GroupNames.UI), 'career_description': sims4.localization.TunableLocalizedString(description='A description for this Career Track', allow_none=True, export_modes=sims4.tuning.tunable_base.ExportModes.All, tuning_group=GroupNames.UI), 'icon': sims4.tuning.tunable.TunableResourceKey(None, resource_types=sims4.resources.CompoundTypes.IMAGE, description='Icon to be displayed for this Career Track', export_modes=sims4.tuning.tunable_base.ExportModes.All, tuning_group=GroupNames.UI), 'icon_high_res': sims4.tuning.tunable.TunableResourceKey(None, resource_types=sims4.resources.CompoundTypes.IMAGE, description='Icon to be displayed for screen slams from this career track', export_modes=sims4.tuning.tunable_base.ExportModes.All, tuning_group=GroupNames.UI), 'image': sims4.tuning.tunable.TunableResourceKey(None, resource_types=sims4.resources.CompoundTypes.IMAGE, description='Pre-rendered image to show in the branching select UI.', export_modes=sims4.tuning.tunable_base.ExportModes.All, tuning_group=GroupNames.UI), 'display_overmax_instead_of_career_levels': Tunable(description='\n If checked, we will display overmax levels to the user instead of user career levels in the UI.\n ', tunable_type=bool, default=False, tuning_group=GroupNames.UI), 'career_levels': sims4.tuning.tunable.TunableList(description='\n All of the career levels you need to be promoted through to\n get through this career track. When you get promoted past the\n end of a career track, and branches is tuned, you will get a selection\n UI where you get to pick the next part of your career.\n ', tunable=sims4.tuning.tunable.TunableReference(description='\n A single career track', manager=services.get_instance_manager(sims4.resources.Types.CAREER_LEVEL), reload_dependent=True), export_modes=sims4.tuning.tunable_base.ExportModes.All), 'branches': sims4.tuning.tunable.TunableList(sims4.tuning.tunable.TunableReference(description='A single career level', manager=services.get_instance_manager(sims4.resources.Types.CAREER_TRACK)), description="\n When you get promoted past the end of a career track, branches\n determine which career tracks you can progress to next. i.e.\n You're in the medical career and the starter track has 5 levels in\n it. When you get promoted to level 6, you get to choose either the\n surgeon track, or the organ seller track \n ", export_modes=sims4.tuning.tunable_base.ExportModes.All), 'overmax': OptionalTunable(description='\n If enabled, then this track is eligible for overmaxing, making Sims\n able to increase their level and salary despite reaching the top\n tier.\n ', tunable=TunableTuple(description='\n Overmax data for this career.\n ', salary_increase=TunableRange(description='\n The pay raise awarded per overmax level.\n ', tunable_type=int, default=1, minimum=1), reward=TunableReference(description='\n If specified, any rewards that may be awarded when\n overmaxing.\n ', manager=services.get_instance_manager(sims4.resources.Types.REWARD)), reward_by_level=OptionalTunable(description='\n If tuned, a special reward that will substituted for the\n normal reward on certain overmax levels. The keys should be\n tuned such that if we want a reward for the first overmax,\n its key should be 1.\n ', tunable=TunableMapping(key_type=TunableRange(tunable_type=int, default=0, minimum=0), value_type=TunableReference(manager=services.get_instance_manager(sims4.resources.Types.REWARD)))), performance_threshold_increase=TunableRange(description='\n The amount to increase the performance requirement per\n overmax level. Eventually, this will be max performance.\n ', tunable_type=float, default=0))), 'knowledge_notification': OptionalTunable(description="\n If enabled, this career track will provide a TNS when a Sim learns\n about another Sim's career.\n ", tunable=TunableUiDialogNotificationSnippet(description="\n The notification to use when one Sim learns about another Sim's\n career. Three additional tokens are provided: the level name (e.g.\n Chef), the career name (e.g. Culinary), and the company name (e.g.\n The Solar Flare).\n "), enabled_by_default=True), 'goodbye_notification': TunableUiDialogNotificationSnippet(description='\n The notification to use when the Sim is leaving a visit situation to\n go to work. Three additional tokens are provided: the level name\n (e.g. Chef), the career name (e.g. Culinary), and the company name\n (e.g. The Solar Flare).\n '), 'busy_time_situation_picker_tooltip': sims4.localization.TunableLocalizedString(description='\n The tooltip that will display on the situation sim picker for\n user selectable sims that will be busy during the situation.\n ', export_modes=sims4.tuning.tunable_base.ExportModes.All), 'assignments': TunableList(description='\n List of possible tested assignemnts that can offered on a work \n day inside this career track.\n ', tunable=TunableTuple(description='\n Tuple of test and aspirations that will be run when selecting\n a daily assignment.\n ', tests=event_testing.tests.TunableTestSet(description='\n Tests to be run when daily tasks are being offered inside\n a career track.\n '), career_assignment=sims4.tuning.tunable.TunableReference(description='\n Aspiration that needs to be completed for satisfying the\n daily assignment.\n ', manager=services.get_instance_manager(sims4.resources.Types.ASPIRATION), class_restrictions='AspirationAssignment', pack_safe=True), weight=TunableRange(description='\n The weight of this assignment when the random roll chooses\n the daily tasks.\n ', tunable_type=float, default=1.0, minimum=0), is_first_assignment=sims4.tuning.tunable.Tunable(description='\n Setting this to true will trigger this assignment when a sim\n first joins a career.\n \n If all assignments are unchecked, the first assignment\n will be selected randomly.\n ', tunable_type=bool, default=False))), 'assignment_chance': TunablePercent(description='\n Chance of an assignment being offered during a regular work day.\n ', default=50), 'active_assignment_amount': sims4.tuning.tunable.Tunable(description='\n Amount of active assignments to offer each time a Sim goes to work\n \n WARNING: Always make this less than the number of possible weighted\n assignments.\n ', tunable_type=float, default=2), 'outfit_generation_type': TunableEnumEntry(description='\n Possible ways the career will generate the outfits for its sims.\n By default CAREER tuning will use the level tuning to generate \n the ouftit.\n Zone director will use the restaurant zone director tuning to \n validate and generate the outfits for each level.\n ', tunable_type=CareerOutfitGenerationType, default=CareerOutfitGenerationType.CAREER_TUNING)} parent_track = None @classmethod def _verify_tuning_callback(cls): if cls.active_assignment_amount > len(cls.assignments) and len(cls.assignments) > 0: logger.error('Warning - the Active Assignment Amount is greater than the number of possible assignments {}', cls, owner='Shirley') @classmethod def get_career_description(cls, sim): return cls.career_description @classmethod def get_career_name(cls, sim): return cls.career_name(sim) class TunableTimePeriod(sims4.tuning.tunable.TunableTuple): def __init__(self, **kwargs): super().__init__(start_time=tunable_time.TunableTimeOfWeek(description='Time when the period starts.'), period_duration=sims4.tuning.tunable.Tunable(float, 1.0, description='Duration of this time period in hours.'), **kwargs) class TunableOutfit(TunableTuple): def __init__(self, **kwargs): super().__init__(outfit_generator=OptionalTunable(TunableOutfitGeneratorReference()), generate_on_level_change=Tunable(description='\n If checked, then an outfit is regenerated for this Sim on\n promotion/demotion. If unchecked, the existing outfit is\n maintained.\n ', tunable_type=bool, default=True), **kwargs) class StatisticPerformanceModifier(TunableTuple): def __init__(self, **kwargs): super().__init__(statistic=TunableReference(description='\n Statistic that contributes to this performance modifier.\n ', manager=services.get_instance_manager(sims4.resources.Types.STATISTIC)), performance_curve=TunableCurve(description='\n Curve that maps the commodity to performance change. X is the\n commodity value, Y is the bonus performance.\n '), reset_at_end_of_work=Tunable(description='\n If set, the statistic will be reset back to its default value\n when a Sim leaves work.\n ', tunable_type=bool, default=True), tooltip_text=OptionalTunable(description="\n If enabled, this performance modifier's description will appear\n in its tooltip.\n ", tunable=TunableTuple(general_description=TunableLocalizedStringFactory(description='\n A description of the performance modifier. {0.String}\n is the thresholded description.\n '), thresholded_descriptions=TunableList(description='\n A list of thresholds and the text describing it. The\n thresholded description will be largest threshold\n value in this list that the commodity is >= to.\n ', tunable=TunableTuple(threshold=Tunable(description='\n Threshold that the commodity must >= to.\n ', tunable_type=float, default=0.0), text=TunableLocalizedString(description='\n Description for meeting this threshold.\n '))))), **kwargs) class TunableWorkPerformanceMetrics(sims4.tuning.tunable.TunableTuple): def __init__(self, **kwargs): super().__init__(base_performance=sims4.tuning.tunable.Tunable(float, 1.0, description='Base work performance before any modifications are applied for going to a full day of work.'), missed_work_penalty=sims4.tuning.tunable.Tunable(float, 1.0, description="Penalty that is applied to your work day performance if you don't attend a full day of work."), full_work_day_percent=sims4.tuning.tunable.TunableRange(float, 80, 1, 100, description='This is the percent of the work day you must have been running the work interaction, to get full credit for your performance on that day. Ex: If this is tuned to 80, and you have a 5 hour work day, You must be inside the work interaction for at least 4 hours to get 100% of your performance. If you only went to work for 2 hours, you would get: (base_performance + positive performance mods * 0.5) + negative performance mods'), commodity_metrics=sims4.tuning.tunable.TunableList(sims4.tuning.tunable.TunableTuple(commodity=sims4.tuning.tunable.TunableReference(description='Commodity this test should apply to on the sim.', manager=services.get_instance_manager(sims4.resources.Types.STATISTIC)), threshold=sims4.tuning.tunable.TunableThreshold(description='The amount of commodity needed to get this performance mod.'), performance_mod=sims4.tuning.tunable.Tunable(float, 1.0, description='Work Performance you get for passing the commodity threshold.'), description='DEPRECATED. USE STATISTIC METRICS INSTEAD. If the tunable commodity is within the tuned threshold, this performance mod will be applied to an individual day of work.')), mood_metrics=sims4.tuning.tunable.TunableList(sims4.tuning.tunable.TunableTuple(mood=sims4.tuning.tunable.TunableReference(description='Mood the Sim needs to get this performance change.', manager=services.get_instance_manager(sims4.resources.Types.MOOD)), performance_mod=sims4.tuning.tunable.Tunable(float, 1.0, description='Work Performance you get for having this mood.'), description='If the Sim is in this mood state, they will get this performance mod applied for a day of work')), statistic_metrics=TunableList(description='\n Performance modifiers based on a statistic.\n ', tunable=StatisticPerformanceModifier()), performance_tooltip=OptionalTunable(description='\n Text to show on the performance tooltip below the\n ideal mood bar. Any Statistic Metric tooltip text\n will appear below this text on a new line.\n ', tunable=TunableLocalizedString()), performance_per_completed_goal=Tunable(description='\n The performance amount to give per completed\n career goal each work period.\n ', tunable_type=float, default=0.0), tested_metrics=TunableList(description='\n Performance modifiers that are applied based on\n the test.\n ', tunable=TunableTuple(tests=event_testing.tests.TunableTestSet(description='\n Tests that must pass to get the performance modifier.\n '), performance_mod=sims4.tuning.tunable.Tunable(description='\n Performance modifier the Sim receives for passing the test. Can be negative.\n ', tunable_type=float, default=0.0))), daily_assignment_performance=Tunable(description='\n The total performance amount to give for completing all\n assignments.\n ', tunable_type=float, default=1.0), **kwargs) class CareerLevel(SuperAffordanceProviderMixin, TargetSuperAffordanceProviderMixin, MixerProviderMixin, MixerActorMixin, metaclass=HashedTunedInstanceMetaclass, manager=services.get_instance_manager(sims4.resources.Types.CAREER_LEVEL)): INSTANCE_TUNABLES = {'title': sims4.localization.TunableLocalizedStringFactory(description='Your career title for this career level', export_modes=sims4.tuning.tunable_base.ExportModes.All, tuning_group=GroupNames.UI), 'title_description': sims4.localization.TunableLocalizedStringFactory(description='A description for this individual career level', allow_none=True, export_modes=sims4.tuning.tunable_base.ExportModes.All, tuning_group=GroupNames.UI), 'promotion_audio_sting': OptionalTunable(description='\n The audio sting to play when the Sim is promoted to this Career Level.\n ', tunable=TunablePlayAudio(), tuning_group=GroupNames.AUDIO), 'screen_slam': OptionalTunable(description='\n Which screen slam to show when this career level is reached.\n Localization Tokens: Sim - {0.SimFirstName}, Level Name - \n {1.String}, Level Number - {2.Number}, Track Name - {3.String}\n ', tunable=ui.screen_slam.TunableScreenSlamSnippet()), 'work_schedule': scheduler.WeeklySchedule.TunableFactory(description='\n A tunable schedule that will determine when you have to be at work.\n ', export_modes=sims4.tuning.tunable_base.ExportModes.All, tuning_group=GroupNames.DEPRECATED), 'schedule': TunableCareerScheduleVariant(description='\n Define the work hours for this particular career level.\n '), 'additional_unavailable_times': sims4.tuning.tunable.TunableList(TunableTimePeriod(description='An individual period of time in which the sim is unavailible at this Career Level.'), description='A list time periods in which the Sim is considered busy for the sake of Sim Filters in addition to the normal working hours.'), 'wakeup_time': tunable_time.TunableTimeOfDay(description="\n The time when the sim needs to wake up for work. This is used by autonomy\n to determine when it's appropriate to nap vs sleep. It also guides a series\n of buffs to make the sim more inclined to sleep as their bedtime approaches.", default_hour=8, needs_tuning=True), 'work_outfit': TunableOutfit(description='Tuning for this career level outfit.'), 'work_outfit_overrides': sims4.tuning.tunable.TunableList(description='\n A list of (test, outfit) pairs. If any test passes, the corresponding\n work outfit override will be chosen. When a work outfit override is\n chosen, no later tests will be evaluated, so higher priority tests\n should come first. \n ', tunable=TunableTuple(test=TunableTestSet(description='\n The test.\n '), work_outfit=TunableOutfit(description='\n The outfit to use to override work_outfit\n '))), 'aspiration': sims4.tuning.tunable.TunableReference(manager=services.get_instance_manager(sims4.resources.Types.ASPIRATION), allow_none=True, description='The Aspiration you need to complete to be eligible for promotion.', export_modes=sims4.tuning.tunable_base.ExportModes.All), 'pay_type': TunableVariant(description='\n The different way the sim can be paid. \n If it is gig based then just a string is displayed. \n ', simoleons_per_hour=Tunable(description='\n number of simoleons you get per hour this level.\n ', tunable_type=int, default=10), potential_simoleons_weekly=TunableLocalizedStringFactory(description="\n String to display if sim doesn't earn a set amount of simoleons\n per hour. \n "), export_modes=ExportModes.All), 'simoleons_for_assignments_per_day': sims4.tuning.tunable.Tunable(description=' \n Number of simoleons acquired if completing all assignments in a day.\n (scaled and handled out per assignment.)\n ', tunable_type=int, default=10), 'pto_per_day': sims4.tuning.tunable.Tunable(description=' \n Number of days of PTO per full day worked. Will be scaled according\n to how much time is actually worked.\n ', tunable_type=float, default=0.1, export_modes=sims4.tuning.tunable_base.ExportModes.All), 'pto_accrual_trait_multiplier': TunableList(description='\n A multiplier on the rate of pto accrual\n ', tunable=sims4.tuning.tunable.TunableTuple(trait=sims4.tuning.tunable.TunableReference(description='\n Trait to test for on the Sim that applies the pto multiplier.\n ', manager=services.get_instance_manager(sims4.resources.Types.TRAIT), pack_safe=True), multiplier=sims4.tuning.tunable.Tunable(description='\n The multiplier to apply to the rate of pto accrual\n ', tunable_type=float, default=1))), 'simolean_trait_bonus': sims4.tuning.tunable.TunableList(description='\n A bonus additional income amount applied at the end of the work day to total take home pay\n based on the presence of the tuned trait.', tunable=sims4.tuning.tunable.TunableTuple(trait=sims4.tuning.tunable.TunableReference(description='\n Trait to test for on the Sim that allows the bonus to get added.', manager=services.get_instance_manager(sims4.resources.Types.TRAIT), pack_safe=True), bonus=sims4.tuning.tunable.Tunable(description='\n Percentage of daily take to add as bonus income.', tunable_type=int, default=20, tuning_group=GroupNames.SCORING))), 'performance_stat': sims4.tuning.tunable.TunableReference(services.get_instance_manager(sims4.resources.Types.STATISTIC), description='Commodity used to track career performance for this level.', export_modes=sims4.tuning.tunable_base.ExportModes.All, tuning_group=GroupNames.SCORING), 'demotion_performance_level': sims4.tuning.tunable.Tunable(float, -80.0, description='Level of performance commodity to cause demotion.', tuning_group=GroupNames.SCORING), 'fired_performance_level': sims4.tuning.tunable.Tunable(float, -95.0, description='Level of performance commodity to cause being fired.', tuning_group=GroupNames.SCORING), 'promote_performance_level': sims4.tuning.tunable.Tunable(float, 100.0, description='Level of performance commodity to cause being promoted.', tuning_group=GroupNames.SCORING), 'performance_metrics': TunableWorkPerformanceMetrics(tuning_group=GroupNames.SCORING), 'promotion_reward': sims4.tuning.tunable.TunableReference(manager=services.get_instance_manager(sims4.resources.Types.REWARD), allow_none=True, description='\n Which rewards are given when this career level\n is reached.\n '), 'tones': OptionalTunable(description='\n If enabled, specify tones that the Sim can have in its skewer while\n at work.\n ', tunable=CareerToneTuning.TunableFactory(description='\n Tuning for tones.\n ')), 'ideal_mood': sims4.tuning.tunable.TunableReference(description='\n The ideal mood to display to the user to be in to gain performance at this career level\n ', manager=services.get_instance_manager(sims4.resources.Types.MOOD), allow_none=True, export_modes=sims4.tuning.tunable_base.ExportModes.ClientBinary, tuning_group=GroupNames.UI), 'loot_on_join': TunableList(description='\n A list of loot actions to give the sim when they join the career\n at this level.\n ', tunable=LootActions.TunableReference(description='\n Loot to give when Sim joins the career at this career level.\n ', pack_safe=True)), 'loot_on_quit': LootActions.TunableReference(description='\n Loot to give when Sim quits the career on this career level.\n ', allow_none=True), 'object_create_on_join': TunableList(description='\n Objects to create on join. If marked as require claim they will only exist\n for as long as the sim in in the career at this level.\n ', tunable=ObjectCreation.TunableFactory()), 'stay_late_extension': TunableSimMinute(description='\n How long to extend the active work shift when the Sim stays late.\n ', default=120), 'end_of_day_loot': TunableSet(description='\n List of loot applied to the sim at the end of the day.\n Currently used only to max out daily task at the end of the day\n if responsible trait is available but it can be extended to include\n more end of day loot in the future.\n ', tunable=LootActions.TunableReference(description='\n Loot to give at the end of the day. \n ', pack_safe=True)), 'fame_moment': OptionalTunable(description='\n When enabled allows a fame adventure moment to be displayed to the\n user, once per career track.\n ', tunable=TunableTuple(description='\n The data associated with a fame moment.\n \n moment is the adventure moment that is displayed when the\n moment occurs\n \n chance_to_occur is the liklihood that a moment happens during\n a shift.\n ', moment=Adventure.TunableFactory(description='\n A reference to the adventure moment that can happen once and only\n once while the Sim has this career track.\n '), chance_to_occur=SuccessChance.TunableFactory(description='\n The chance the moment will happen during a given shift.\n '))), 'agents_available': TunableList(description='\n List of agents available for this career level. A higher level \n should include more agents not fewer.\n ', tunable=TunableReference(description='\n A reference to the agent available for this career level.\n ', manager=services.get_instance_manager(sims4.resources.Types.TRAIT), pack_safe=True), export_modes=ExportModes.All), 'ageup_branch_career': OptionalTunable(description='\n This adult career will be assigned to the teen that ages up while\n on the parent career.\n ', tunable=TunableReference(manager=services.get_instance_manager(sims4.resources.Types.CAREER)))} career = None track = None level = None user_level = None @classmethod def _verify_tuning_callback(cls): for trait in cls.agents_available: if trait.trait_type != TraitType.AGENT: logger.error('Only trait type agent allowed in this list.') @classmethod def get_aspiration(cls): return cls.aspiration @classmethod def get_title(cls, sim): return cls.title(sim) @classproperty def simoleons_per_hour(cls): if isinstance(cls.pay_type, int): return cls.pay_type return 0 @classmethod def get_work_outfit(cls, sim_info): if cls.work_outfit_overrides: if sim_info is not None: resolver = SingleSimResolver(sim_info) for override in cls.work_outfit_overrides: if override.test.run_tests(resolver): return override.work_outfit return cls.work_outfit class DefaultCareerSelectionData: def __init__(self, default_career_select=0, career_selector_type=0): self.default_career_select = default_career_select self.career_selector_type = career_selector_type class CareerSelectionDefault(HasTunableSingletonFactory, AutoFactoryInit): def get_default_career_information(self): raise NotImplementedError class CareerReferenceSelectionDefault(CareerSelectionDefault): FACTORY_TUNABLES = {'toggle_career': TunableTuple(default_career=TunablePackSafeReference(description='\n The default selected career.\n ', manager=services.get_instance_manager(sims4.resources.Types.CAREER)), toggle_to_career_selector_type=Tunable(description="\n If set to True, the career panel will open to the career selector\n type panel of the tuned default career's selector type. If False,\n the career will be selected in the default All Careers panel.\n ", tunable_type=bool, default=False))} def get_default_career_information(self): default_career = self.toggle_career.default_career default_career_select_uid = self.toggle_career.default_career.guid64 if default_career is not None else 0 career_selector_type = CareerSelectorTypes.ALL if default_career is not None: if self.toggle_career.toggle_to_career_selector_type: career_selector_type = get_selector_type_from_career_category(default_career) return DefaultCareerSelectionData(default_career_select=default_career_select_uid, career_selector_type=career_selector_type) class CareerSelectorCategoryDefault(CareerSelectionDefault): FACTORY_TUNABLES = {'default_selector_type': TunableEnumEntry(description='\n The default panel at which to open the career selection\n window.\n ', tunable_type=CareerSelectorTypes, default=CareerSelectorTypes.ALL)} def get_default_career_information(self): return DefaultCareerSelectionData(career_selector_type=self.default_selector_type) class CareerSelectElement(interactions.utils.interaction_elements.XevtTriggeredElement): FACTORY_TUNABLES = {'description': 'Perform an operation on a Sim Career', 'career_op': sims4.tuning.tunable.TunableEnumEntry(career_ops.CareerOps, career_ops.CareerOps.JOIN_CAREER, description='\n Operation this basic extra will perform on the\n career. Currently supports Joining, Quitting\n and Playing Hooky/Calling In Sick.\n '), 'subject': TunableEnumFlags(description='\n The Sim to run this career op on.\n Currently, the only supported options are Actor and PickedSim\n ', enum_type=ParticipantType, default=ParticipantType.Actor), 'default_career_window_selection': OptionalTunable(description='\n If enabled, then the default selection in the Career Selection Window\n will be set to the tuned value.\n ', tunable=TunableVariant(career_reference=CareerReferenceSelectionDefault.TunableFactory(description='\n Default selection and selector type is based on a single \n career reference.\n '), career_selector_type=CareerSelectorCategoryDefault.TunableFactory(description='\n Default selector type panel is the tuned value.\n '), default='career_reference'))} def _get_default_selection_data(self): if self.default_career_window_selection is not None: return self.default_career_window_selection.get_default_career_information() def _do_behavior(self): if services.current_zone().ui_dialog_service.auto_respond: return participants = self.interaction.get_participants(self.subject) if participants is None or len(participants) == 0: logger.error('Could not find participant type, {}, for the Career Select op on interaction, {}', self.subject, self.interaction, owner='Trevor') return if len(participants) > 1: logger.warn('More than one participant found of type, {}, for the Career Select op on interaction, {}', self.subject, self.interaction, owner='Dan P') sim_or_sim_info = next(iter(participants)) sim_info = getattr(sim_or_sim_info, 'sim_info', sim_or_sim_info) if self.career_op == career_ops.CareerOps.JOIN_CAREER: num = Career.NUM_CAREERS_PER_DAY if self.interaction.debug or self.interaction.cheat: num = 0 if sim_info.is_selectable and sim_info.valid_for_distribution: default_career_selection_data = self._get_default_selection_data() msg = Career.get_join_career_pb(sim_info, num_careers_to_show=num, default_career_selection_data=default_career_selection_data) Distributor.instance().add_op(sim_info, GenericProtocolBufferOp(Operation.SELECT_CAREER_UI, msg)) elif self.career_op == career_ops.CareerOps.QUIT_CAREER: if len(sim_info.career_tracker.get_quittable_careers()) == 1: def on_quit_dialog_response(dialog): if dialog.accepted: sim_info.career_tracker.remove_career(career.guid64) for career in sim_info.career_tracker.get_quittable_careers().values(): career_name = career._current_track.get_career_name(sim_info) job_title = career.current_level_tuning.get_title(sim_info) dialog = None resolver = SingleSimResolver(sim_info) if career.quittable_data.tested_quit_dialog is not None and career.quittable_data.tested_quit_dialog.test_set.run_tests(resolver): dialog = career.quittable_data.tested_quit_dialog.quit_dialog(sim_info, resolver) else: dialog = career.quittable_data.quit_dialog(sim_info, resolver) dialog.show_dialog(on_response=on_quit_dialog_response, additional_tokens=(career_name, job_title, career.get_company_name())) elif sim_info.is_selectable: if sim_info.valid_for_distribution: msg = Career.get_quit_career_pb(sim_info) Distributor.instance().add_op(sim_info, GenericProtocolBufferOp(Operation.SELECT_CAREER_UI, msg)) elif self.career_op == career_ops.CareerOps.CALLED_IN_SICK: for career in sim_info.careers.values(): career.request_day_off(career_ops.CareerTimeOffReason.FAKE_SICK)
194.486957
28,174
0.680072
11,156
89,464
5.297418
0.096092
0.044875
0.026498
0.014958
0.424651
0.363075
0.293969
0.260026
0.240076
0.21197
0
0.005763
0.249396
89,464
459
28,175
194.910675
0.8743
0
0
0.199029
0
0.317961
0.494076
0.011289
0
0
0
0
0.002427
1
0.080097
false
0.024272
0.126214
0.021845
0.390777
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
15d9363d0780e92ab8588a5f80532260973a46c5
214
py
Python
problem/01000~09999/05073/5073.py3.py
njw1204/BOJ-AC
1de41685725ae4657a7ff94e413febd97a888567
[ "MIT" ]
1
2019-04-19T16:37:44.000Z
2019-04-19T16:37:44.000Z
problem/01000~09999/05073/5073.py3.py
njw1204/BOJ-AC
1de41685725ae4657a7ff94e413febd97a888567
[ "MIT" ]
1
2019-04-20T11:42:44.000Z
2019-04-20T11:42:44.000Z
problem/01000~09999/05073/5073.py3.py
njw1204/BOJ-AC
1de41685725ae4657a7ff94e413febd97a888567
[ "MIT" ]
3
2019-04-19T16:37:47.000Z
2021-10-25T00:45:00.000Z
while True: A,B,C=map(int,input().split()) if not A: exit() if A+B+C<=max(A,B,C)*2: print('Invalid') elif A==B==C: print('Equilateral') elif True in (A==B,A==C,B==C): print('Isosceles') else: print('Scalene')
30.571429
50
0.61215
44
214
2.977273
0.5
0.076336
0.091603
0
0
0
0
0
0
0
0
0.005291
0.116822
214
7
51
30.571429
0.687831
0
0
0
0
0
0.15814
0
0
0
0
0
0
1
0
true
0
0
0
0
0.571429
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
3
15e1a628015b100f880c6693b3858c224413079f
1,167
py
Python
tests/xlfunctions_vs_excel/test_logical.py
ckp95/xlcalculator
8f3f04a2a0a2ecb12c3d5837a5b13519137ae427
[ "MIT" ]
54
2020-04-26T09:18:29.000Z
2022-03-30T08:47:45.000Z
tests/xlfunctions_vs_excel/test_logical.py
st-lo/xlcalculator
19190ec90e948b7ab1eceb06448b96cc1728bc51
[ "MIT" ]
41
2020-05-04T04:12:36.000Z
2022-01-31T02:41:05.000Z
tests/xlfunctions_vs_excel/test_logical.py
st-lo/xlcalculator
19190ec90e948b7ab1eceb06448b96cc1728bc51
[ "MIT" ]
21
2020-05-21T20:49:23.000Z
2022-02-20T14:15:56.000Z
from .. import testing class LogicalFunctionsTest(testing.FunctionalTestCase): filename = "logical.xlsx" def test_IF_false_case(self): self.assertEqual( self.evaluator.evaluate('Sheet1!C2'), self.evaluator.get_cell_value('Sheet1!C2') ) def test_IF_true_case(self): self.assertEqual( self.evaluator.evaluate('Sheet1!C3'), self.evaluator.get_cell_value('Sheet1!C3') ) def test_AND_false_case(self): self.assertEqual( self.evaluator.evaluate('Sheet1!D2'), self.evaluator.get_cell_value('Sheet1!D2') ) def test_AND_true_case(self): self.assertEqual( self.evaluator.evaluate('Sheet1!D3'), self.evaluator.get_cell_value('Sheet1!D3') ) def test_OR_false_case(self): self.assertEqual( self.evaluator.evaluate('Sheet1!E2'), self.evaluator.get_cell_value('Sheet1!E2') ) def test_OR_true_case(self): self.assertEqual( self.evaluator.evaluate('Sheet1!E3'), self.evaluator.get_cell_value('Sheet1!E3') )
27.139535
55
0.607541
130
1,167
5.223077
0.238462
0.22975
0.106038
0.20324
0.755523
0.755523
0.481591
0.481591
0.481591
0
0
0.028402
0.275921
1,167
42
56
27.785714
0.775148
0
0
0.181818
0
0
0.102828
0
0
0
0
0
0.181818
1
0.181818
false
0
0.030303
0
0.272727
0
0
0
0
null
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
c60524500bee3252e9285b5a43e103c5930e7840
816
py
Python
python_oop/interface.py
tokusumi/python-oop
c2ec4ff17fa305af44cdfbefb8d569518b83eb37
[ "MIT" ]
null
null
null
python_oop/interface.py
tokusumi/python-oop
c2ec4ff17fa305af44cdfbefb8d569518b83eb37
[ "MIT" ]
null
null
null
python_oop/interface.py
tokusumi/python-oop
c2ec4ff17fa305af44cdfbefb8d569518b83eb37
[ "MIT" ]
null
null
null
from abc import ABC, abstractmethod class Car(ABC): @abstractmethod def move(self) -> bool: pass @abstractmethod def stop(self) -> bool: pass class Tractor(Car): def move(self) -> bool: pass # do something def stop(self) -> bool: pass # do anything tractor = Tractor() # => OK class Kar(Car): def move(self) -> bool: pass # do something kar = Kar() # => TypeError # and => (mypy) error: Cannot instantiate abstract class 'Kar' with abstract attribute 'stop' class BaseCar: def move(self) -> bool: raise NotImplementedError def stop(self) -> bool: raise NotImplementedError class Truck(BaseCar): def move(self) -> bool: pass # do something truck = Truck().stop() # => NotImplementedError
17.361702
93
0.604167
93
816
5.301075
0.333333
0.129817
0.146045
0.15213
0.369168
0.194726
0.194726
0.133874
0
0
0
0
0.284314
816
47
94
17.361702
0.844178
0.22549
0
0.666667
0
0
0
0
0
0
0
0
0
1
0.296296
false
0.222222
0.037037
0
0.518519
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
c629960ba54bec780ff6943bb8d0dca0df41e1b8
368
py
Python
src/structures.py
adamtpowell/mdgrep
1d9131c2a56d8755ac3d3d180880372f37037e3e
[ "MIT" ]
null
null
null
src/structures.py
adamtpowell/mdgrep
1d9131c2a56d8755ac3d3d180880372f37037e3e
[ "MIT" ]
null
null
null
src/structures.py
adamtpowell/mdgrep
1d9131c2a56d8755ac3d3d180880372f37037e3e
[ "MIT" ]
null
null
null
from typing import NamedTuple # Holds a line and its number in the original file (used for returnarea expansion) class FileLine(NamedTuple): line_number: int line_text: str class FoundSegment(NamedTuple): line_number: int line_position: int text: str class Expansion(NamedTuple): line_number: int line_position: int text: str
23
82
0.720109
49
368
5.285714
0.510204
0.162162
0.23166
0.266409
0.451737
0.34749
0.34749
0.34749
0.34749
0
0
0
0.225543
368
16
83
23
0.908772
0.217391
0
0.583333
0
0
0
0
0
0
0
0
0
1
0
true
0
0.083333
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
c64370f69c25b4b6ed9e2699666db61f7d61acc5
224
py
Python
bin/dist.py
soloproyectos-ts/matrix2
0f3713fbf45285ac35eb206dd0a091057c27405f
[ "MIT" ]
null
null
null
bin/dist.py
soloproyectos-ts/matrix2
0f3713fbf45285ac35eb206dd0a091057c27405f
[ "MIT" ]
null
null
null
bin/dist.py
soloproyectos-ts/matrix2
0f3713fbf45285ac35eb206dd0a091057c27405f
[ "MIT" ]
null
null
null
#!/usr/bin/env python """Creates or updates distribution files""" import subprocess print "Updates JavaScript and Type Definition files..." subprocess.call(['rm', 'dist', '-rf']) subprocess.call(['tsc', '--declaration'])
22.4
55
0.705357
27
224
5.851852
0.814815
0.177215
0
0
0
0
0
0
0
0
0
0
0.107143
224
9
56
24.888889
0.79
0.089286
0
0
0
0
0.45
0
0
0
0
0
0
0
null
null
0
0.25
null
null
0.25
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
c64e11a98e45581f789ae12c34c82c81fafbec85
183
py
Python
Python/Ex013.py
renato-rt/Python
ba033094e1da5b55cf9ce4c8a5cf2cd90247db36
[ "MIT" ]
null
null
null
Python/Ex013.py
renato-rt/Python
ba033094e1da5b55cf9ce4c8a5cf2cd90247db36
[ "MIT" ]
null
null
null
Python/Ex013.py
renato-rt/Python
ba033094e1da5b55cf9ce4c8a5cf2cd90247db36
[ "MIT" ]
1
2021-11-30T17:34:33.000Z
2021-11-30T17:34:33.000Z
s = float(input('\033[1;24;3mQual é o salário do funcionário? \033[m')) print('Um funcionário que ganhava R${:.2f} com 15% de aumento agora ganhará R${:.2f}.'.format(s, s+(s*15/100)))
91.5
111
0.672131
35
183
3.514286
0.771429
0.04878
0
0
0
0
0
0
0
0
0
0.117284
0.114754
183
2
111
91.5
0.641975
0
0
0
0
0
0.701087
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
c6552fec5dddcac5e5cc8d95e1a81f16cf186dbf
149
py
Python
adrian/cgen/includes.py
adrian-lang/paka.cgen
bedb7ebf559c03c732b48a6d018bacaca0bc343e
[ "BSD-3-Clause" ]
1
2017-03-31T14:56:23.000Z
2017-03-31T14:56:23.000Z
adrian/cgen/includes.py
adrian-lang/paka.cgen
bedb7ebf559c03c732b48a6d018bacaca0bc343e
[ "BSD-3-Clause" ]
null
null
null
adrian/cgen/includes.py
adrian-lang/paka.cgen
bedb7ebf559c03c732b48a6d018bacaca0bc343e
[ "BSD-3-Clause" ]
null
null
null
from adrian.cgen import Include stdlib = Include("stdlib.h") stdint = Include("stdint.h") stdio = Include("stdio.h") assert_ = Include("assert.h")
18.625
31
0.711409
21
149
5
0.47619
0.247619
0
0
0
0
0
0
0
0
0
0
0.120805
149
7
32
21.285714
0.801527
0
0
0
0
0
0.208054
0
0
0
0
0
0.2
1
0
false
0
0.2
0
0.2
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d66e98b2d4b4a2f5b11596b7aad6bd253b7b49c7
190
py
Python
ghostwriter/reporting/tests/factories.py
fastlorenzo/Ghostwriter
8acb2a824fc487d51ff6be845fe874d91ec74bb6
[ "BSD-3-Clause" ]
null
null
null
ghostwriter/reporting/tests/factories.py
fastlorenzo/Ghostwriter
8acb2a824fc487d51ff6be845fe874d91ec74bb6
[ "BSD-3-Clause" ]
null
null
null
ghostwriter/reporting/tests/factories.py
fastlorenzo/Ghostwriter
8acb2a824fc487d51ff6be845fe874d91ec74bb6
[ "BSD-3-Clause" ]
null
null
null
# 3rd Party Libraries import factory class FindingFactory(factory.django.DjangoModelFactory): class Meta: model = "reporting.Finding" django_get_or_create = ("title",)
21.111111
56
0.710526
20
190
6.6
0.85
0
0
0
0
0
0
0
0
0
0
0.006579
0.2
190
8
57
23.75
0.861842
0.1
0
0
0
0
0.130178
0
0
0
0
0
0
1
0
false
0
0.2
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
0
0
0
0
1
0
0
3
d6c36b9671620c92f24fb323e4e5a94bb19c721f
393
py
Python
pyaz/cosmosdb/mongodb/restorable_database/__init__.py
py-az-cli/py-az-cli
9a7dc44e360c096a5a2f15595353e9dad88a9792
[ "MIT" ]
null
null
null
pyaz/cosmosdb/mongodb/restorable_database/__init__.py
py-az-cli/py-az-cli
9a7dc44e360c096a5a2f15595353e9dad88a9792
[ "MIT" ]
null
null
null
pyaz/cosmosdb/mongodb/restorable_database/__init__.py
py-az-cli/py-az-cli
9a7dc44e360c096a5a2f15595353e9dad88a9792
[ "MIT" ]
1
2022-02-03T09:12:01.000Z
2022-02-03T09:12:01.000Z
from .... pyaz_utils import _call_az def list(instance_id, location): ''' List all the versions of all the mongodb databases that were created / modified / deleted in the given restorable account. Required Parameters: - instance_id -- InstanceId of the Account - location -- Location ''' return _call_az("az cosmosdb mongodb restorable-database list", locals())
30.230769
126
0.709924
50
393
5.44
0.66
0.044118
0
0
0
0
0
0
0
0
0
0
0.208651
393
12
127
32.75
0.874598
0.534351
0
0
0
0
0.285714
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
3
d6ca2b568f0c91caeff6328f1ba427465345e07b
256
py
Python
test/test_ames.py
camille-chanel/ames
640ae9cb068932a68c6475db177e7e462350d9ab
[ "MIT" ]
null
null
null
test/test_ames.py
camille-chanel/ames
640ae9cb068932a68c6475db177e7e462350d9ab
[ "MIT" ]
null
null
null
test/test_ames.py
camille-chanel/ames
640ae9cb068932a68c6475db177e7e462350d9ab
[ "MIT" ]
null
null
null
""" Tests for `ames` module. """ import pytest from ames import ames class TestAmes(object): @classmethod def setup_class(cls): pass def test_something(self): pass @classmethod def teardown_class(cls): pass
12.8
29
0.621094
30
256
5.2
0.633333
0.179487
0.153846
0
0
0
0
0
0
0
0
0
0.289063
256
19
30
13.473684
0.857143
0.09375
0
0.454545
0
0
0
0
0
0
0
0
0
1
0.272727
false
0.272727
0.181818
0
0.545455
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
d6d19655db1289518e6d9544311e74ae96c87a06
193
py
Python
erede/Document.py
collabo-br/erede-python
695ac91cd886d899440fe222f0bb72cd062874e9
[ "MIT" ]
4
2019-04-05T13:01:19.000Z
2021-02-06T17:45:50.000Z
erede/Document.py
collabo-br/erede-python
695ac91cd886d899440fe222f0bb72cd062874e9
[ "MIT" ]
2
2020-05-08T17:50:04.000Z
2020-07-29T21:24:40.000Z
erede/Document.py
collabo-br/erede-python
695ac91cd886d899440fe222f0bb72cd062874e9
[ "MIT" ]
8
2019-08-06T18:25:34.000Z
2021-07-21T17:57:03.000Z
from .RedeSerializable import RedeSerializable class Document(RedeSerializable): def __init__(self, document_type, number): self.type = document_type self.number = number
24.125
46
0.735751
20
193
6.8
0.5
0.176471
0
0
0
0
0
0
0
0
0
0
0.196891
193
7
47
27.571429
0.877419
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
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
d6d2fd2c2ecd8d116b1fd1279ee230b5b1353cf9
1,402
py
Python
tests/test_sqlalchemy.py
kisspy/abcms
b0019600a414b4bfebafed689e6e028871334dcd
[ "MIT" ]
null
null
null
tests/test_sqlalchemy.py
kisspy/abcms
b0019600a414b4bfebafed689e6e028871334dcd
[ "MIT" ]
null
null
null
tests/test_sqlalchemy.py
kisspy/abcms
b0019600a414b4bfebafed689e6e028871334dcd
[ "MIT" ]
null
null
null
from sqlalchemy import create_engine from sqlalchemy import func from sqlalchemy import Column, Integer, String, DateTime, Boolean from sqlalchemy import Text, ForeignKey from sqlalchemy import INTEGER from sqlalchemy.orm import relationship, backref from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.schema import Sequence from sqlalchemy import event from sqlalchemy import DDL Base = declarative_base() #Base.metadata.schema = 'ksforum' engine = create_engine('postgresql://huyoo:xyz2014@localhost:5432/cccc', convert_unicode=True, echo=True) #event.listen(Base.metadata, 'before_create', DDL("CREATE SCHEMA IF NOT EXISTS ksforum")) ''' #event.listen( # Account.__table__, # "after_create", # DDL("ALTER SEQUENCE %(schema)s.%(table)s_id_seq RESTART WITH 10000;") #) # PLEASE ALWARS REMEMBER NOT UNCOMMENT THESE 2 LINES, IF YOU DONT KNOW WHAT YOU ARE DOING. # delete all tables!!!! ''' Session = sessionmaker(bind=engine) session = Session() sql="select id from ksforum.forum_stats where name='' and uid=0 limit 1" params=None cursor = session.execute(sql, {'username':'', 'password':''}) record = cursor.fetchone() print record for x in xrange(1000): cursor = session.execute(sql, {'username':'', 'password':''}) record = cursor.fetchone() print record
34.195122
105
0.738231
179
1,402
5.698324
0.530726
0.15098
0.137255
0.045098
0.137255
0.137255
0.137255
0.137255
0.137255
0.137255
0
0.016849
0.153352
1,402
40
106
35.05
0.84246
0.085592
0
0.25
0
0
0.159435
0.046418
0
0
0
0
0
0
null
null
0.083333
0.458333
null
null
0.083333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
1
0
0
0
0
3
d6d43fc9fb5384978e04418d62e77273b21d60d5
91
py
Python
heroku_py/__init__.py
AnthonyAniobi/heroku-py
72e56799e95e7a8208f2a5a46b4eb98c9c256b0d
[ "MIT" ]
5
2021-05-30T17:45:24.000Z
2021-05-31T01:59:41.000Z
heroku_py/__init__.py
AnthonyAniobi/heroku-py
72e56799e95e7a8208f2a5a46b4eb98c9c256b0d
[ "MIT" ]
null
null
null
heroku_py/__init__.py
AnthonyAniobi/heroku-py
72e56799e95e7a8208f2a5a46b4eb98c9c256b0d
[ "MIT" ]
2
2021-06-02T17:17:04.000Z
2021-07-29T19:02:01.000Z
from .heroku_client import HerokuClient __version__ = "1.2.0" __all__ = ["HerokuClient"]
15.166667
39
0.747253
11
91
5.363636
0.909091
0
0
0
0
0
0
0
0
0
0
0.037975
0.131868
91
5
40
18.2
0.708861
0
0
0
0
0
0.186813
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ba3779cdcd4535870d81b611d4da474703d1ca1f
533
py
Python
src/processTypes/bind.py
Razikus/TotallyDockerVolumeBackuper
4c27888e79fa2ee82c6d636367d2229e07482ec2
[ "MIT" ]
null
null
null
src/processTypes/bind.py
Razikus/TotallyDockerVolumeBackuper
4c27888e79fa2ee82c6d636367d2229e07482ec2
[ "MIT" ]
null
null
null
src/processTypes/bind.py
Razikus/TotallyDockerVolumeBackuper
4c27888e79fa2ee82c6d636367d2229e07482ec2
[ "MIT" ]
null
null
null
from docker.types import Mount import datetime def processMount(mount): result = dict() result["type"] = mount["Type"] result["source"] = mount["Source"] return result def getMountType(mount, target): return Mount(type=mount["type"], source=mount["source"], target=target) def getBackupName(mount): now = datetime.datetime.now() prefix = now.strftime('%Y%m%d%H%M%S') return prefix + mount["type"] + mount["source"].replace("/", "-") + ".tar.gz" def getSourceName(mount): return mount["source"]
28.052632
81
0.658537
67
533
5.238806
0.41791
0.102564
0.074074
0
0
0
0
0
0
0
0
0
0.161351
533
19
82
28.052632
0.785235
0
0
0
0
0
0.125468
0
0
0
0
0
0
1
0.266667
false
0
0.133333
0.133333
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
ba44c814229cc4fa352a3704026d375b6e5b8faa
65
py
Python
myp/pip/__init__.py
YunisDEV/py-scripts
c9eccffa3e69bb32a46fef94e0517a149f3701ea
[ "MIT" ]
2
2021-04-03T14:16:16.000Z
2021-04-03T15:38:32.000Z
myp/pip/__init__.py
YunisDEV/py-scripts
c9eccffa3e69bb32a46fef94e0517a149f3701ea
[ "MIT" ]
null
null
null
myp/pip/__init__.py
YunisDEV/py-scripts
c9eccffa3e69bb32a46fef94e0517a149f3701ea
[ "MIT" ]
2
2021-04-15T10:28:28.000Z
2021-04-28T19:22:16.000Z
from .commands import ( install_command, freeze_command )
16.25
23
0.723077
7
65
6.428571
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.215385
65
4
24
16.25
0.882353
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
ba48aea1045656d7d3c025b16e7b851211128657
299
py
Python
bili_kits/api/user.py
LonelySteve/Bili-Kits
42e536400b2f35d57e5871de34303b6f2fc901ed
[ "MIT" ]
null
null
null
bili_kits/api/user.py
LonelySteve/Bili-Kits
42e536400b2f35d57e5871de34303b6f2fc901ed
[ "MIT" ]
null
null
null
bili_kits/api/user.py
LonelySteve/Bili-Kits
42e536400b2f35d57e5871de34303b6f2fc901ed
[ "MIT" ]
null
null
null
from . import _BASE_WEB_INTERFACE,_BASE_API_BILIBILI_COM_X,_BASE_API_BILIBILI_COM,_BASE_API_BILIBILI_COM_X_V2 CARD="%s/card" % _BASE_WEB_INTERFACE NAV="%s/nav" % _BASE_WEB_INTERFACE RELATION_STAT="%s/relation/stat" % _BASE_API_BILIBILI_COM_X FAV_FOLDER="%s/fav/folder" % _BASE_API_BILIBILI_COM_X_V2
49.833333
109
0.846154
53
299
4.075472
0.320755
0.162037
0.347222
0.416667
0.37037
0.194444
0
0
0
0
0
0.007067
0.053512
299
6
110
49.833333
0.756184
0
0
0
0
0
0.14
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
ba51c6da519449ea6c186aa6964b421f5e367518
118
py
Python
{{ cookiecutter.repo_name }}/{{ cookiecutter.package_name }}/command_line.py
mazzma12/cookiecutter-data-science
8b5ca776071b596bfa93e5c222c633cdd232e96a
[ "MIT" ]
1
2021-05-28T14:53:30.000Z
2021-05-28T14:53:30.000Z
{{ cookiecutter.repo_name }}/{{ cookiecutter.package_name }}/command_line.py
mazzma12/cookiecutter-data-science
8b5ca776071b596bfa93e5c222c633cdd232e96a
[ "MIT" ]
null
null
null
{{ cookiecutter.repo_name }}/{{ cookiecutter.package_name }}/command_line.py
mazzma12/cookiecutter-data-science
8b5ca776071b596bfa93e5c222c633cdd232e96a
[ "MIT" ]
1
2020-04-27T13:58:36.000Z
2020-04-27T13:58:36.000Z
import fire def main(): """Command line interface.""" pass if __name__ == "__main__": fire.Fire(main)
10.727273
33
0.601695
14
118
4.5
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.245763
118
10
34
11.8
0.707865
0.194915
0
0
0
0
0.089888
0
0
0
0
0
0
1
0.2
true
0.2
0.2
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
3
ba530b374855abf8fb214c997a4977d9d4ea9b60
242
py
Python
ElcheapoAIS_manhole/manhole/urls.py
innovationgarage/ElCheapoAIS-manhole
157e855b8904e135da808a004f2244445498891d
[ "MIT" ]
null
null
null
ElcheapoAIS_manhole/manhole/urls.py
innovationgarage/ElCheapoAIS-manhole
157e855b8904e135da808a004f2244445498891d
[ "MIT" ]
null
null
null
ElcheapoAIS_manhole/manhole/urls.py
innovationgarage/ElCheapoAIS-manhole
157e855b8904e135da808a004f2244445498891d
[ "MIT" ]
null
null
null
from django.contrib import admin from django.urls import path import manhole.views urlpatterns = [ path('<str:client>', manhole.views.script, name='script'), path('<str:client>/<int:ordering>', manhole.views.output, name='output') ]
26.888889
76
0.719008
32
242
5.4375
0.53125
0.206897
0.149425
0
0
0
0
0
0
0
0
0
0.119835
242
8
77
30.25
0.816901
0
0
0
0
0
0.210744
0.11157
0
0
0
0
0
1
0
false
0
0.428571
0
0.428571
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
0
0
1
0
0
0
0
3
ba6aa4bd005fdb31cf463d45052158dba57c12af
167
py
Python
handlers/load_python_modules.py
gofynd/alb-logs-parser
5678796f7001eecc6d68cb84c2ccd04e83e2ec1f
[ "Apache-2.0" ]
2
2018-04-11T08:05:36.000Z
2018-09-03T08:45:05.000Z
handlers/load_python_modules.py
gofynd/alb-logs-parser
5678796f7001eecc6d68cb84c2ccd04e83e2ec1f
[ "Apache-2.0" ]
null
null
null
handlers/load_python_modules.py
gofynd/alb-logs-parser
5678796f7001eecc6d68cb84c2ccd04e83e2ec1f
[ "Apache-2.0" ]
1
2018-08-23T05:33:50.000Z
2018-08-23T05:33:50.000Z
''' Load external modules ''' import os import sys BASE_DIR = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(BASE_DIR, "../python_modules"))
20.875
60
0.742515
26
167
4.5
0.576923
0.153846
0
0
0
0
0
0
0
0
0
0
0.083832
167
7
61
23.857143
0.764706
0.125749
0
0
0
0
0.123188
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
ba7bff1142fef326f9dc106d5d72ea722359ed53
106
py
Python
bgp/apps.py
maznu/peering-manager
d249fcf530f4cc48b39429badb79bc203e0148ba
[ "Apache-2.0" ]
127
2017-10-12T00:27:45.000Z
2020-08-07T11:13:55.000Z
bgp/apps.py
maznu/peering-manager
d249fcf530f4cc48b39429badb79bc203e0148ba
[ "Apache-2.0" ]
247
2017-12-26T12:55:34.000Z
2020-08-08T11:57:35.000Z
bgp/apps.py
maznu/peering-manager
d249fcf530f4cc48b39429badb79bc203e0148ba
[ "Apache-2.0" ]
63
2017-10-13T06:46:05.000Z
2020-08-08T00:41:57.000Z
from django.apps import AppConfig class BgpConfig(AppConfig): name = "bgp" verbose_name = "BGP"
15.142857
33
0.698113
13
106
5.615385
0.769231
0.191781
0
0
0
0
0
0
0
0
0
0
0.207547
106
6
34
17.666667
0.869048
0
0
0
0
0
0.056604
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
3
ba83540ec91871ea2e3b033b8b4ec6bbe1b71828
54,599
py
Python
adspygoogle/adwords/AdWordsClient.py
nearlyfreeapps/python-googleadwords
b30d90f74248cfd5ca52967e9ee77fc4cd1b9abc
[ "Apache-2.0" ]
2
2020-03-24T10:02:39.000Z
2020-04-22T09:01:59.000Z
adspygoogle/adwords/AdWordsClient.py
nearlyfreeapps/python-googleadwords
b30d90f74248cfd5ca52967e9ee77fc4cd1b9abc
[ "Apache-2.0" ]
null
null
null
adspygoogle/adwords/AdWordsClient.py
nearlyfreeapps/python-googleadwords
b30d90f74248cfd5ca52967e9ee77fc4cd1b9abc
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/python # # Copyright 2010 Google Inc. 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. """Interface for accessing all other services.""" __author__ = 'api.sgrinberg@gmail.com (Stan Grinberg)' import os import re import thread import time from adspygoogle.adwords import AdWordsSanityCheck from adspygoogle.adwords import AUTH_TOKEN_SERVICE from adspygoogle.adwords import DEFAULT_API_VERSION from adspygoogle.adwords import LIB_SHORT_NAME from adspygoogle.adwords import LIB_SIG from adspygoogle.adwords import REQUIRED_SOAP_HEADERS from adspygoogle.adwords.AdWordsErrors import AdWordsError from adspygoogle.adwords.GenericAdWordsService import GenericAdWordsService from adspygoogle.adwords.ReportDownloader import ReportDownloader from adspygoogle.common import SanityCheck from adspygoogle.common import Utils from adspygoogle.common.Client import Client from adspygoogle.common.Errors import AuthTokenError from adspygoogle.common.Errors import ValidationError from adspygoogle.common.Logger import Logger class AdWordsClient(Client): """Provides entry point to all web services. Allows instantiation of all AdWords API web services. """ auth_pkl_name = 'adwords_api_auth.pkl' config_pkl_name = 'adwords_api_config.pkl' def __init__(self, headers=None, config=None, path=None, login_token=None, login_captcha=None): """Inits AdWordsClient. Args: [optional] headers: dict Object with populated authentication credentials. config: dict Object with client configuration values. path: str Relative or absolute path to home directory (i.e. location of pickles and logs/). login_token: str Token representing the specific CAPTCHA challenge. login_captcha: str String entered by the user as an answer to a CAPTCHA challenge. Example: headers = { 'email': 'johndoe@example.com', 'password': 'secret', 'authToken': '...', 'clientCustomerId': '1234567890', 'userAgent': 'GoogleTest', 'developerToken': 'johndoe@example.com++USD', 'validateOnly': 'n', 'partialFailure': 'n', 'oauth_credentials': { 'oauth_consumer_key': ..., 'oauth_consumer_secret': ..., 'oauth_token': ..., 'oauth_token_secret': ... }, 'oauth2credentials': 'See use_oauth2.py'. } config = { 'home': '/path/to/home', 'log_home': '/path/to/logs/home', 'proxy': 'http://example.com:8080', 'xml_parser': 1, # PYXML = 1, ELEMENTREE = 2 'debug': 'n', 'raw_debug': 'n', 'xml_log': 'y', 'request_log': 'y', 'raw_response': 'n', 'strict': 'y', 'pretty_xml': 'y', 'compress': 'y', 'access': '' } path = '/path/to/home' """ super(AdWordsClient, self).__init__(headers, config, path) self.__lock = thread.allocate_lock() self.__loc = None if path is not None: # Update absolute path for a given instance of AdWordsClient, based on # provided relative path. if os.path.isabs(path): AdWordsClient.home = path else: # NOTE(api.sgrinberg): Keep first parameter of join() as os.getcwd(), # do not change it to AdWordsClient.home. Otherwise, may break when # multiple instances of AdWordsClient exist during program run. AdWordsClient.home = os.path.join(os.getcwd(), path) # If pickles don't exist at given location, default to "~". if (not headers and not config and (not os.path.exists(os.path.join(AdWordsClient.home, AdWordsClient.auth_pkl_name)) or not os.path.exists(os.path.join(AdWordsClient.home, AdWordsClient.config_pkl_name)))): AdWordsClient.home = os.path.expanduser('~') else: AdWordsClient.home = os.path.expanduser('~') # Update location for both pickles. AdWordsClient.auth_pkl = os.path.join(AdWordsClient.home, AdWordsClient.auth_pkl_name) AdWordsClient.config_pkl = os.path.join(AdWordsClient.home, AdWordsClient.config_pkl_name) # Only load from the pickle if config wasn't specified. self._config = config or self.__LoadConfigValues() self._config = self.__SetMissingDefaultConfigValues(self._config) self._config['home'] = AdWordsClient.home # Validate XML parser to use. SanityCheck.ValidateConfigXmlParser(self._config['xml_parser']) # Initialize units and operations for current instance of AdWordsClient # object (using list to take advantage of Python's pass-by-reference). self._config['units'] = [0] self._config['operations'] = [0] self._config['last_units'] = [0] self._config['last_operations'] = [0] # Only load from the pickle if 'headers' wasn't specified. if headers is None: self._headers = self.__LoadAuthCredentials() else: if Utils.BoolTypeConvert(self._config['strict']): SanityCheck.ValidateRequiredHeaders(headers, REQUIRED_SOAP_HEADERS) self._headers = headers # Internally, store user agent as 'userAgent'. if 'useragent' in self._headers: self._headers['userAgent'] = self._headers['useragent'] self._headers = Utils.UnLoadDictKeys(self._headers, ['useragent']) if Utils.BoolTypeConvert(self._config['strict']): SanityCheck.ValidateRequiredHeaders(self._headers, REQUIRED_SOAP_HEADERS) # Load validateOnly header, if one was set. if 'validateOnly' in self._headers: self._headers['validateOnly'] = str(Utils.BoolTypeConvert( self._headers['validateOnly'])).lower() # Load partialFailure header, if one was set. if 'partialFailure' in self._headers: self._headers['partialFailure'] = str(Utils.BoolTypeConvert( self._headers['partialFailure'])).lower() # Load/set authentication token. if self._headers.get('authToken'): # If they have a non-empty authToken, set the epoch and skip the rest. self._config['auth_token_epoch'] = time.time() elif (self._headers.get('oauth_credentials') or self._headers.get('oauth2credentials')): # If they have oauth_credentials, that's also fine. pass elif (self._headers.get('email') and self._headers.get('password') and not self._headers.get('authToken')): # If they have a non-empty email and password but no or empty authToken, # generate an authToken. try: self._headers['authToken'] = Utils.GetAuthToken( self._headers['email'], self._headers['password'], AUTH_TOKEN_SERVICE, LIB_SIG, self._config['proxy'], login_token, login_captcha) self._config['auth_token_epoch'] = time.time() except AuthTokenError, e: # We would end up here if non-valid Google Account's credentials were # specified. raise ValidationError('Was not able to obtain an AuthToken for ' 'provided email and password, see root_cause.', e) else: # We need either oauth_credentials OR authToken. raise ValidationError('Authentication data is missing.') # Insert library's signature into user agent. if self._headers['userAgent'].rfind(LIB_SIG) == -1: # Make sure library name shows up only once. if self._headers['userAgent'].rfind(LIB_SHORT_NAME) > -1: pattern = re.compile('.*' + LIB_SHORT_NAME + '.*?\|') self._headers['userAgent'] = pattern.sub( '', self._headers['userAgent'], 1) self._headers['userAgent'] = ( '%s%s' % (self._headers['userAgent'], LIB_SIG)) self.__is_mcc = False # Initialize logger. self.__logger = Logger(LIB_SIG, self._config['log_home']) def __LoadAuthCredentials(self): """Load existing authentication credentials from adwords_api_auth.pkl. Returns: dict Dictionary object with populated authentication credentials. """ return super(AdWordsClient, self)._LoadAuthCredentials() def __WriteUpdatedAuthValue(self, key, new_value): """Write updated authentication value for a key in adwords_api_auth.pkl. Args: key: str Key to update. new_value: str New value to update the key with. """ super(AdWordsClient, self)._WriteUpdatedAuthValue(key, new_value) def __LoadConfigValues(self): """Load existing configuration values from adwords_api_config.pkl. Returns: dict Dictionary object with populated configuration values. """ return super(AdWordsClient, self)._LoadConfigValues() def __SetMissingDefaultConfigValues(self, config=None): """Set default configuration values for missing elements in the config dict. Args: config: dict Object with client configuration values. Returns: dict A config dictionary with default values set. """ if config is None: config = {} config = super(AdWordsClient, self)._SetMissingDefaultConfigValues(config) default_config = { 'home': AdWordsClient.home, 'log_home': os.path.join(AdWordsClient.home, 'logs') } for key in default_config: if key not in config: config[key] = default_config[key] return config def GetUnits(self): """Return number of API units consumed by current instance of AdWordsClient object. Returns: int Number of API units. """ return self._config['units'][0] def GetOperations(self): """Return number of API ops performed by current instance of AdWordsClient object. Returns: int Number of API operations. """ return self._config['operations'][0] def GetLastUnits(self): """Return number of API units consumed by last API call. Returns: int Number of API units. """ return self._config['last_units'][0] def GetLastOperations(self): """Return number of API ops performed by last API call. Returns: int Number of API operations. """ return self._config['last_operations'][0] def UseMcc(self, state): """Choose to make an API request against MCC account or a sub-account. Args: state: bool State of the API request, whether to use MCC. """ self.__is_mcc = False if state: self.__is_mcc = True def __GetUseMcc(self): """Return current state of the API request. Returns: bool State of the API request, whether to use MCC. """ return self.__is_mcc def __SetUseMcc(self, state): """Chooses to make an API request against MCC account or a sub-account. Args: state: bool State of the API request, whether to use MCC. """ self.__is_mcc = state use_mcc = property(__GetUseMcc, __SetUseMcc) def SetClientCustomerId(self, client_customer_id): """Temporarily change client customer id for a given AdWordsClient instance. Args: client_customer_id: str New client customer id to use. """ if ('clientCustomerId' not in self._headers or self._headers['clientCustomerId'] != client_customer_id): self._headers['clientCustomerId'] = client_customer_id def __GetValidateOnly(self): """Return current state of the validation mode. Returns: bool State of the validation mode. """ return self._headers['validateOnly'] def __SetValidateOnly(self, value): """Temporarily change validation mode for a given AdWordsClient instance. Args: value: mixed New state of the validation mode using BoolTypeConvert. """ self._headers['validateOnly'] = str(Utils.BoolTypeConvert(value)).lower() validate_only = property(__GetValidateOnly, __SetValidateOnly) def __GetPartialFailure(self): """Return current state of the partial failure mode. Returns: bool State of the partial failure mode. """ return self._headers['partialFailure'] def __SetPartialFailure(self, value): """Temporarily change partial failure mode for a given AdWordsClient instance. Args: value: mixed New state of the partial failure mode using BoolTypeConvert. """ self._headers['partialFailure'] = str(Utils.BoolTypeConvert(value)).lower() partial_failure = property(__GetPartialFailure, __SetPartialFailure) def __GetAuthCredentialsForAccessLevel(self): """Return auth credentials based on the access level of the request. Request can have an MCC level access or a sub account level access. Returns: dict Authentiaction credentials. """ old_headers = self.GetAuthCredentials() new_headers = {} is_mcc = self.__is_mcc for key, value in old_headers.iteritems(): new_headers[key] = value if key == 'clientCustomerId': if is_mcc and 'email' in old_headers: new_headers[key] = None return new_headers def CallRawMethod(self, soap_message, url, server, http_proxy): """Call API method directly, using raw SOAP message. For API calls performed with this method, outgoing data is not run through library's validation logic. Args: soap_message: str SOAP XML message. url: str URL of the API service for the method to call. server: str API server to access for this API call. http_proxy: str HTTP proxy to use for this API call. Returns: tuple Response from the API method (SOAP XML response message). """ service_name = url.split('/')[-1] service = getattr(self, 'Get' + service_name)(server=server, http_proxy=http_proxy) return service.CallRawMethod(soap_message) def GetAdExtensionOverrideService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in AdExtensionOverrideService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of AdExtensionOverrideService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'AdExtensionOverrideService') def GetAdGroupAdService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in AdGroupAdService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of AdGroupAdService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'AdGroupAdService') def GetAdGroupCriterionService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in AdGroupCriterionService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of AdGroupCriterionService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'AdGroupCriterionService') def GetAdGroupService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in AdGroupService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' or 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of AdGroupService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'AdGroupService') def GetAdParamService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in AdParamService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of AdParamService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'AdParamService') def GetAlertService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in AlertService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of AlertService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'mcm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'AlertService') def GetBidLandscapeService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in BidLandscapeService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of BidLandscapeService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'BidLandscapeService') def GetBudgetOrderService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in BudgetOrderService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of BudgetOrderService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'billing', 'default_group': 'billing', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'BudgetOrderService') def GetBulkMutateJobService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in BulkMutateJobService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of BulkMutateJobService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'BulkMutateJobService') def GetMutateJobService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in MutateJobService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of BulkMutateJobService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'MutateJobService') def GetCampaignAdExtensionService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in CampaignAdExtensionService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of CampaignAdExtensionService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'CampaignAdExtensionService') def GetCampaignCriterionService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in CampaignCriterionService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of CampaignCriterionService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'CampaignCriterionService') def GetCampaignService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in CampaignService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' or 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of CampaignService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'CampaignService') def GetCampaignTargetService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in CampaignTargetService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of CampaignTargetService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) AdWordsSanityCheck.ValidateService('CampaignTargetService', version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'CampaignTargetService') def GetCreateAccountService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in CreateAccountService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of CreateAccountService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) AdWordsSanityCheck.ValidateService('CreateAccountService', version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'mcm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'CreateAccountService') def GetConstantDataService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in ConstantDataService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of ConstantDataService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'ConstantDataService') def GetCustomerService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in CustomerService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of CustomerService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'mcm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'CustomerService') def GetCustomerSyncService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in CustomerSyncService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of CustomerSyncService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'ch', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'CustomerSyncService') def GetExperimentService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in ExperimentService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of ExperimentService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'ExperimentService') def GetGeoLocationService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in GeoLocationService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of GeoLocationService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'GeoLocationService') def GetInfoService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in InfoService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' or 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of InfoService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'info', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'InfoService') def GetLocationCriterionService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in LocationCriterionService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' or 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: LocationCriterionService New instance of LocationCriterionService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'LocationCriterionService') def GetManagedCustomerService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in ManagedCustomerService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of ManagedCustomerService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'mcm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'ManagedCustomerService') def GetMediaService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in MediaService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' or 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of MediaService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'MediaService') def GetReportDefinitionService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in ReportDefinitionService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' or 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of ReportDefinitionService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'ReportDefinitionService') def GetReportDownloader(self, server='https://adwords.google.com', version=None, http_proxy=None): """Returns an instance of ReportDownloader, used to download reports. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://adwords-sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: ReportService New instance of ReportDownloader object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return ReportDownloader(headers, self._config, op_config, self.__logger) def GetServicedAccountService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in ServicedAccountService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of ServicedAccountService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) AdWordsSanityCheck.ValidateService('ServicedAccountService', version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'mcm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'ServicedAccountService') def GetTargetingIdeaService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in TargetingIdeaService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of TargetingIdeaService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'o', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'TargetingIdeaService') def GetTrafficEstimatorService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in TrafficEstimatorService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of TrafficEstimatorService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'o', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'TrafficEstimatorService') def GetUserListService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in UserListService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of UserListService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'UserListService') def GetConversionTrackerService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in ConversionTrackerService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of ConversionTrackerService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'ConversionTrackerService') def GetDataService(self, server='https://adwords.google.com', version=None, http_proxy=None): """Call API method in DataService. Args: [optional] server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' for sandbox. The default behavior is to access live site. version: str API version to use. http_proxy: str HTTP proxy to use. Returns: GenericAdWordsService New instance of DataService object. """ headers = self.__GetAuthCredentialsForAccessLevel() if version is None: version = DEFAULT_API_VERSION if Utils.BoolTypeConvert(self._config['strict']): AdWordsSanityCheck.ValidateServer(server, version) # Load additional configuration data. op_config = { 'server': server, 'version': version, 'group': 'cm', 'default_group': 'cm', 'http_proxy': http_proxy } return GenericAdWordsService(headers, self._config, op_config, self.__lock, self.__logger, 'DataService') def _GetOAuthScope(self, server='https://adwords.google.com'): """Retrieves the OAuth Scope to use. Args: server: str API server to access for this API call. Possible values are: 'https://adwords.google.com' for live site and 'https://sandbox.google.com' for sandbox. The default behavior is to access live site. Returns: str Full scope to use for OAuth. """ return server + '/api/adwords/'
35.944042
80
0.645378
5,901
54,599
5.836129
0.077783
0.04312
0.034496
0.040245
0.727663
0.708877
0.688754
0.680856
0.672784
0.664363
0
0.000994
0.262715
54,599
1,518
81
35.967721
0.854527
0.055038
0
0.624815
0
0
0.130586
0.011538
0
0
0
0
0
0
null
null
0.005908
0.028065
null
null
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
bab113e16eaad6cbc67608faad8b86d0f01e96d5
1,474
py
Python
python/agent.py
tbvanderwoude/research-project
1c5cb09a424a0db83f18dae3278ecb7ad6866d2c
[ "Apache-2.0", "MIT" ]
3
2021-08-23T18:00:44.000Z
2022-02-09T06:00:50.000Z
python/agent.py
tbvanderwoude/research-project
1c5cb09a424a0db83f18dae3278ecb7ad6866d2c
[ "Apache-2.0", "MIT" ]
null
null
null
python/agent.py
tbvanderwoude/research-project
1c5cb09a424a0db83f18dae3278ecb7ad6866d2c
[ "Apache-2.0", "MIT" ]
1
2021-06-15T11:38:45.000Z
2021-06-15T11:38:45.000Z
from __future__ import annotations import copy from typing import Optional from mapfmclient import MarkedLocation from python.coord import Coord, UncalculatedCoord class Agent: def __init__(self, location: Coord, color: int, accumulated_cost: Optional[int]): self.location = location self.accumulated_cost = accumulated_cost if accumulated_cost else 0 self.color = color @property def x(self): return self.location.x @property def y(self): return self.location.y def __eq__(self, other: Agent): if other is self: return True return self.location == other and self.accumulated_cost == other.accumulated_cost def __hash__(self): return hash(self.location) ^ hash(self.accumulated_cost) def __repr__(self): if self == UncalculatedAgent: return "UncalculatedAgent " else: return f"Agent({self.location}, {self.accumulated_cost})" @classmethod def from_marked_location(cls, location: MarkedLocation, accumulated_cost: int) -> Agent: return cls(Coord(location.x, location.y), location.color, accumulated_cost) def with_new_position(self, new_pos: Coord) -> Agent: return Agent(new_pos, self.color, self.accumulated_cost) # An agent that has not yet been calculated. Stand in # for agents in OD when states are only partially calculated UncalculatedAgent = Agent(UncalculatedCoord, 0, 0)
29.48
92
0.695387
181
1,474
5.458564
0.342541
0.167004
0.096154
0.054656
0
0
0
0
0
0
0
0.002629
0.225916
1,474
49
93
30.081633
0.863278
0.074627
0
0.060606
0
0
0.049963
0.033799
0
0
0
0
0
1
0.242424
false
0
0.151515
0.151515
0.69697
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
bab80a31d238be536a1982c0370a6e9ddb03e510
360
py
Python
{{cookiecutter.project_slug}}/tests/unit/{{cookiecutter.project_slug}}/graphql/resolvers/test_query.py
Maximilien-R/cookiecutter-tartiflette-aiohttp
66e7e0897b315df6a1908c6c31ec58b74e0b3a6f
[ "MIT" ]
3
2020-06-01T14:16:19.000Z
2021-11-07T19:54:08.000Z
{{cookiecutter.project_slug}}/tests/unit/{{cookiecutter.project_slug}}/graphql/resolvers/test_query.py
Maximilien-R/cookiecutter-tartiflette-aiohttp
66e7e0897b315df6a1908c6c31ec58b74e0b3a6f
[ "MIT" ]
88
2019-11-15T17:35:54.000Z
2021-08-02T04:50:51.000Z
{{cookiecutter.project_slug}}/tests/unit/{{cookiecutter.project_slug}}/graphql/resolvers/test_query.py
Maximilien-R/cookiecutter-tartiflette-aiohttp
66e7e0897b315df6a1908c6c31ec58b74e0b3a6f
[ "MIT" ]
2
2020-05-04T08:35:34.000Z
2020-10-22T17:47:26.000Z
from unittest.mock import Mock import pytest from {{cookiecutter.project_slug}}.graphql.resolvers import resolve_query_hello @pytest.mark.asyncio async def test_resolve_query_hello(): result = await resolve_query_hello( None, {"name": "{{cookiecutter.author_name}}"}, {}, Mock() ) assert result == "Hello {{cookiecutter.author_name}}!"
25.714286
79
0.725
43
360
5.837209
0.55814
0.143426
0.203187
0
0
0
0
0
0
0
0
0
0.147222
360
13
80
27.692308
0.81759
0
0
0
0
0
0.186111
0.158333
0
0
0
0
0.111111
0
null
null
0
0.333333
null
null
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
3
bacc74e14cea55ddb3f53681cd742f9b52ee85c7
310
py
Python
output/models/nist_data/atomic/non_positive_integer/schema_instance/nistschema_sv_iv_atomic_non_positive_integer_pattern_1_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
1
2021-08-14T17:59:21.000Z
2021-08-14T17:59:21.000Z
output/models/nist_data/atomic/non_positive_integer/schema_instance/nistschema_sv_iv_atomic_non_positive_integer_pattern_1_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
4
2020-02-12T21:30:44.000Z
2020-04-15T20:06:46.000Z
output/models/nist_data/atomic/non_positive_integer/schema_instance/nistschema_sv_iv_atomic_non_positive_integer_pattern_1_xsd/__init__.py
tefra/xsdata-w3c-tests
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
[ "MIT" ]
null
null
null
from output.models.nist_data.atomic.non_positive_integer.schema_instance.nistschema_sv_iv_atomic_non_positive_integer_pattern_1_xsd.nistschema_sv_iv_atomic_non_positive_integer_pattern_1 import NistschemaSvIvAtomicNonPositiveIntegerPattern1 __all__ = [ "NistschemaSvIvAtomicNonPositiveIntegerPattern1", ]
51.666667
240
0.912903
34
310
7.588235
0.588235
0.104651
0.197674
0.27907
0.356589
0.356589
0.356589
0.356589
0.356589
0
0
0.013514
0.045161
310
5
241
62
0.858108
0
0
0
0
0
0.148387
0.148387
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
badc471c18802ff07742dbc8a984c7483d241aed
334
py
Python
unit6/spiders/p5_downloader_middleware_handson/p5_downloader_middleware_handson/settings.py
nulearn3296/scrapy-training
8981dbc33b68bd7246839eee34ca8266d5a0066f
[ "BSD-3-Clause" ]
182
2017-04-05T23:39:22.000Z
2022-02-22T19:49:52.000Z
unit6/spiders/p5_downloader_middleware_handson/p5_downloader_middleware_handson/settings.py
nulearn3296/scrapy-training
8981dbc33b68bd7246839eee34ca8266d5a0066f
[ "BSD-3-Clause" ]
3
2017-04-18T07:16:39.000Z
2019-05-04T22:54:53.000Z
unit6/spiders/p5_downloader_middleware_handson/p5_downloader_middleware_handson/settings.py
nulearn3296/scrapy-training
8981dbc33b68bd7246839eee34ca8266d5a0066f
[ "BSD-3-Clause" ]
53
2017-04-07T03:25:54.000Z
2022-02-21T21:51:01.000Z
BOT_NAME = 'p5_downloader_middleware_handson' SPIDER_MODULES = ['p5_downloader_middleware_handson.spiders'] NEWSPIDER_MODULE = 'p5_downloader_middleware_handson.spiders' ROBOTSTXT_OBEY = True DOWNLOADER_MIDDLEWARES = { 'p5_downloader_middleware_handson.middlewares.SeleniumDownloaderMiddleware': 543, } SELENIUM_ENABLED = True
27.833333
85
0.844311
35
334
7.542857
0.542857
0.181818
0.333333
0.439394
0.272727
0
0
0
0
0
0
0.022876
0.083832
334
11
86
30.363636
0.839869
0
0
0
0
0
0.553892
0.553892
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
2431b272767b88594353f5a57a81caf0a74688f4
1,606
py
Python
sasync/errors.py
edsuom/sAsync
fe5119719d12a09665face6731ffc67bbc45971a
[ "Apache-2.0" ]
1
2020-09-25T18:13:00.000Z
2020-09-25T18:13:00.000Z
sasync/errors.py
edsuom/sAsync
fe5119719d12a09665face6731ffc67bbc45971a
[ "Apache-2.0" ]
null
null
null
sasync/errors.py
edsuom/sAsync
fe5119719d12a09665face6731ffc67bbc45971a
[ "Apache-2.0" ]
null
null
null
# sAsync: # An enhancement to the SQLAlchemy package that provides persistent # item-value stores, arrays, and dictionaries, and an access broker for # conveniently managing database access, table setup, and # transactions. Everything can be run in an asynchronous fashion using # the Twisted framework and its deferred processing capabilities. # # Copyright (C) 2006, 2015 by Edwin A. Suominen, http://edsuom.com/sAsync # # See edsuom.com for API documentation as well as information about # Ed's background and other projects, software and otherwise. # # 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. """ Errors relating to database access """ class AsyncError(Exception): """ The requested action is incompatible with asynchronous operations. """ class TransactionError(Exception): """ An exception was raised while trying to run a transaction. """ class DatabaseError(Exception): """ A problem occured when trying to access the database. """ class TransactIterationError(Exception): """ An attempt to access a transaction result as an iterator """
33.458333
73
0.744707
218
1,606
5.486239
0.614679
0.050167
0.021739
0.026756
0
0
0
0
0
0
0
0.009153
0.183686
1,606
47
74
34.170213
0.903127
0.825654
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
3
244c59854e305c7ea70a2b023f1c927cf7a0e1bc
1,201
py
Python
quant/state.py
vincent87lee/alphahunter
5f45dbd5f09354dd161606f7e740f8c8d8ae2772
[ "MIT" ]
149
2019-12-05T05:26:15.000Z
2022-03-15T03:44:46.000Z
quant/state.py
webclinic017/alphahunter
e3ccc10bb8b641a6a516ec7cd908e5b006343264
[ "MIT" ]
4
2020-09-12T20:46:06.000Z
2021-09-01T16:39:14.000Z
quant/state.py
webclinic017/alphahunter
e3ccc10bb8b641a6a516ec7cd908e5b006343264
[ "MIT" ]
73
2019-11-29T03:13:11.000Z
2022-03-24T06:06:31.000Z
# -*- coding:utf-8 -*- """ 状态信息 Project: alphahunter Author: HJQuant Description: Asynchronous driven quantitative trading framework """ class State: STATE_CODE_PARAM_MISS = 1 #交易接口初始化过程缺少参数 STATE_CODE_CONNECT_SUCCESS = 2 #交易接口连接成功 STATE_CODE_CONNECT_FAILED = 3 #交易接口连接失败 STATE_CODE_DISCONNECT = 4 #交易接口连接断开 STATE_CODE_RECONNECTING = 5 #交易接口重新连接中 STATE_CODE_READY = 6 #交易接口准备好 STATE_CODE_GENERAL_ERROR = 7 #交易接口常规错误 STATE_CODE_DB_SUCCESS = 8 #数据库连接成功 STATE_CODE_DB_ERROR = 9 #数据库连接失败 def __init__(self, platform, account, msg, code = STATE_CODE_PARAM_MISS): self._platform = platform self._account = account self._msg = msg self._code = code @property def platform(self): return self._platform @property def account(self): return self._account @property def msg(self): return self._msg @property def code(self): return self._code def __str__(self): return "platform:{} account:{} msg:{}".format(self._platform, self._account, self._msg) def __repr__(self): return str(self)
23.54902
95
0.638634
138
1,201
5.195652
0.405797
0.125523
0.078103
0.050209
0
0
0
0
0
0
0
0.011534
0.278102
1,201
50
96
24.02
0.815456
0.169026
0
0.129032
0
0
0.029562
0
0
0
0
0
0
1
0.225806
false
0
0
0.193548
0.741935
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
24525887544853b79abf1af748bdda46247aa80d
2,704
py
Python
restcli/utils.py
dustinrohde/restcli
ca45cee01aca406b1219a64d03a77eda5c2516e3
[ "Apache-2.0" ]
12
2017-03-13T18:51:48.000Z
2020-05-04T00:22:09.000Z
restcli/utils.py
dustinrohde/restcli
ca45cee01aca406b1219a64d03a77eda5c2516e3
[ "Apache-2.0" ]
1
2017-03-16T15:18:14.000Z
2017-03-16T15:18:14.000Z
restcli/utils.py
dustinrohde/restcli
ca45cee01aca406b1219a64d03a77eda5c2516e3
[ "Apache-2.0" ]
2
2017-03-16T02:44:49.000Z
2017-07-27T04:54:06.000Z
from collections import OrderedDict from collections.abc import Mapping, Sequence class AttrSeq(Sequence): """An immutable sequence that supports dot notation. Args: *args: Items to create the sequence from. """ def __init__(self, *args): self._seq = args def __getattr__(self, item): return item def __getitem__(self, item): return self._seq[item] def __iter__(self): return iter(self._seq) def __len__(self): return len(self._seq) def __copy__(self): return self.__class__(*self._seq) copy = __copy__ class AttrMap(Mapping): """An immutable, ordered mapping that supports dot notation. Args: *pairs: 2-tuples to create the mapping from. """ def __init__(self, *pairs, **kws): self._dict = OrderedDict(pairs, **kws) def __getitem__(self, item): return self._dict[item] __getattr__ = __getitem__ def __iter__(self): return iter(self._dict) def __len__(self): return len(self._dict) def __copy__(self): return self.__class__(*self._dict.items()) copy = __copy__ class MultiAttrMap(AttrMap): """Like AttrMap, but supports multiple keys for each value. Each key must be a tuple. When accessing attrs, any key in the tuple works. """ def __init__(self, *pairs): expanded_pairs = [] for multi_key, value in pairs: if not isinstance(multi_key, tuple): raise TypeError( f"'{type(multi_key)}' object is not an instance of tuple" ) expanded_pairs.extend((key, value) for key in multi_key) super().__init__(*expanded_pairs) class classproperty: """Like the @property decorator but for class methods.""" def __init__(self, method=None): self.fget = method def __get__(self, instance, cls=None): return self.fget(cls) def getter(self, method): self.fget = method return self def recursive_update(mapping, data): """Like dict.update, but recursively updates nested dicts as well.""" for key, val in data.items(): if isinstance(val, Mapping): if key in mapping: recursive_update(mapping[key], val) else: mapping[key] = val else: mapping[key] = val def is_ascii(s): """Return True if the given string contains only ASCII characters.""" return len(s) == len(s.encode()) def select_first(*args): """Return the first argument that's not None.""" for arg in args: if arg is not None: return arg return None
23.513043
79
0.610207
334
2,704
4.625749
0.317365
0.038835
0.028479
0.029773
0.202589
0.167638
0.069256
0
0
0
0
0.000521
0.29068
2,704
114
80
23.719298
0.805005
0.211908
0
0.253968
0
0
0.026214
0
0
0
0
0
0
1
0.285714
false
0
0.031746
0.15873
0.650794
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
24604a4f9f632756925e48db8b2f6f25d32b4532
4,833
py
Python
pre-benchmarks/Lisp_interpreter/interpreter/Tests/Test_Interpreter.py
nuprl/retic_performance
621211c2f40251ce5364c33e72e4067e34a32013
[ "MIT" ]
3
2018-08-03T02:41:29.000Z
2021-03-19T03:18:47.000Z
pre-benchmarks/Lisp_interpreter/interpreter/Tests/Test_Interpreter.py
nuprl/retic_performance
621211c2f40251ce5364c33e72e4067e34a32013
[ "MIT" ]
3
2018-02-04T17:53:56.000Z
2018-11-10T17:06:57.000Z
pre-benchmarks/Lisp_interpreter/interpreter/Tests/Test_Interpreter.py
nuprl/retic_performance
621211c2f40251ce5364c33e72e4067e34a32013
[ "MIT" ]
1
2018-08-04T00:14:12.000Z
2018-08-04T00:14:12.000Z
import pytest import sys sys.path.insert(0, '/Users/zeinamigeed/Lisp_interpreter/interpreter/BSL_Expr') sys.path.insert(0, '/Users/zeinamigeed/Lisp_interpreter/interpreter/Other') from Variable import Variable from BSLError import BSLError from Num import Num from Boolean import Boolean from Constants import Constants as c def test_eval_num(): assert Num(1).eval_internal(c.defs1) == Num(1) assert Num(9).eval_internal(c.defs1) == Num(9) def test_eval_add(): assert c.expradd1.eval_internal(c.defs1) == Num(1) assert c.expradd123.eval_internal(c.defs1) == Num(6) assert c.expradd123.eval(c.defs1) == [Num(6), c.defs1] with pytest.raises(BSLError): c.expradderror.eval_internal(c.defs1) def test_eval_sub(): assert c.exprsub1.eval_internal(c.defs1) == Num(-1) assert c.exprsub123.eval_internal(c.defs1) == Num(-4) def test_eval_mult(): assert c.exprmul1.eval_internal(c.defs1) == Num(1) assert c.exprmul84.eval_internal(c.defs1) == Num(32) def test_eval_div(): assert c.exprdiv1.eval_internal(c.defs1) == Num(1) assert c.exprdiv84.eval_internal(c.defs1) == Num(2) def test_eval_comp(): assert c.expradd_expradd123_exprdiv84.eval_internal(c.defs1) == Num(8) def test_eval_var(): assert c.expraddx23.eval_internal(c.defs1) == Num(6) def test_equals(): assert c.expradd1 != c.expradd123 assert c.expradd1 == c.expradd1 assert c.func_def_varx != c.funcDef2 assert c.func_def_varx == c.func_def_varx assert c.func_def_varx == c.func_def_varx assert c.and3 == c.and3 assert c.and3 != c.and2 def test_funcAppEval(): assert c.func_app_varx.eval_internal(c.defs1) == Num(4) assert c.func_app_emptylist.eval_internal(c.defs1) == Num(6) assert c.func_app_varx_vary.eval_internal(c.defs1) == Num(14) def test_bslError(): with pytest.raises(BSLError): Variable('o').eval_internal(c.defs1) with pytest.raises(BSLError): c.func_app_error_777.eval_internal(c.defs1) # with pytest.raises(BSLError): # c.exprdiv403.eval_internal(c.defs1) def test_struct(): assert c.make_posn.eval_internal(c.defs1) == c.value_posn assert c.make_posn_comp.eval_internal(c.defs1) == (c.value_posn_comp) assert c.is_posn.eval_internal(c.defs1) assert c.is_not_posn.eval_internal(c.defs1) == Boolean(False) assert c.select_posn_x.eval_internal(c.defs1) == Num(1) assert c.select_posn_y.eval_internal(c.defs1) == Num(2) assert c.select_posn_y_comp.eval_internal(c.defs1) == Num(2) assert c.select_posn_x_comp.eval_internal(c.defs1) == c.value_posn assert c.func_app_varx_1.eval_internal(c.defs1) == c.value_posn_func assert c.posn_x_func_app_varx_1.eval_internal(c.defs1) == Num(4) def test_struct_error(): with pytest.raises(BSLError): c.select_posn_x_error.eval_internal(c.defs1) with pytest.raises(BSLError): c.select_zeina_x.eval_internal(c.defs1) def test_and(): assert c.and1.eval_internal(c.defs1) == Boolean(True) # assert c.and2.eval_internal(c.defs1) == Boolean(False) with pytest.raises(BSLError): c.and3.eval_internal(c.defs1) def test_equal(): assert c.equals34.eval_internal(c.defs1) == Boolean(False) assert c.equals33.eval_internal(c.defs1) == Boolean(True) assert c.equals_3_true.eval_internal(c.defs1) == Boolean(False) def test_str(): assert str(c.value_posn) == "(posn, 1,2)" assert str(c.varx) == 'Variable(x)' assert str(Num(3)) == '3' assert str(c.posn_def) == "StructureDefinition(posn, ('y', 'x'))" def test_if(): assert c.if_1.eval_internal(c.defs1) == Num(4) assert c.if_2.eval_internal(c.defs1) == Num(3) def test_bigger_and_less_than(): #this test occassionally fails assert c.biggerthan34.eval_internal(c.defs1) == Boolean(False) assert c.lessthan34.eval_internal(c.defs1) == Boolean(True) with pytest.raises(BSLError): c.lessthan_error.eval_internal(c.defs1) #error message that comes with the test: # > assert c.lessthan34.eval_internal(c.defs1) == Boolean(True) # E assert <Boolean.Boolean instance at 0x10ef732d8> == <Boolean.Boolean instance at 0x10ef73560> # E + where <Boolean.Boolean instance at 0x10ef732d8> = <bound method FuncApplication.eval_internal of <FuncApplication.FuncApplication instance at 0x10ef75638>>(<Scope.Scope instance at 0x10ef67cb0>) # E + where <bound method FuncApplication.eval_internal of <FuncApplication.FuncApplication instance at 0x10ef75638>> = <FuncApplication.FuncApplication instance at 0x10ef75638>.eval_internal # E + where <FuncApplication.FuncApplication instance at 0x10ef75638> = c.lessthan34 # E + and <Scope.Scope instance at 0x10ef67cb0> = c.defs1 # E + and <Boolean.Boolean instance at 0x10ef73560> = Boolean(True)
37.757813
208
0.717567
730
4,833
4.557534
0.157534
0.165915
0.168019
0.232642
0.669372
0.502855
0.412684
0.391644
0.219417
0.098287
0
0.052129
0.154562
4,833
128
209
37.757813
0.762115
0.208566
0
0.105882
0
0
0.044584
0.035143
0
0
0
0
0.529412
1
0.2
true
0
0.082353
0
0.282353
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
1
0
0
0
0
0
0
3
79f1ff92ec1e6acd3c59af6c5fe99bb9e7be57fe
49
py
Python
src/spc/__init__.py
whbrewer/spc
859f15e0fcb3f5f7d84d420f4757ae0a42c5837a
[ "MIT" ]
12
2017-01-25T02:13:34.000Z
2020-03-11T18:22:31.000Z
src/spc/__init__.py
whbrewer/spc
859f15e0fcb3f5f7d84d420f4757ae0a42c5837a
[ "MIT" ]
1
2018-01-08T19:21:24.000Z
2018-01-08T19:21:24.000Z
src/spc/__init__.py
whbrewer/spc
859f15e0fcb3f5f7d84d420f4757ae0a42c5837a
[ "MIT" ]
2
2017-06-14T04:29:14.000Z
2018-01-28T20:25:54.000Z
__author__ = 'Wesley Brewer' __license__ = 'MIT'
16.333333
28
0.734694
5
49
5.6
1
0
0
0
0
0
0
0
0
0
0
0
0.142857
49
2
29
24.5
0.666667
0
0
0
0
0
0.326531
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
79ff7b8687e44250039535319562a18fcc77d579
2,661
py
Python
tests/test_models.py
wecode12/TheBlog
f2ce56f0e7d95919e7a7b53892f303338fd2f1ab
[ "MIT" ]
null
null
null
tests/test_models.py
wecode12/TheBlog
f2ce56f0e7d95919e7a7b53892f303338fd2f1ab
[ "MIT" ]
null
null
null
tests/test_models.py
wecode12/TheBlog
f2ce56f0e7d95919e7a7b53892f303338fd2f1ab
[ "MIT" ]
null
null
null
import unittest from app.models import User,Posts,Comments,Subscribe class UserModelTest(unittest.TestCase): def setUp(self): self.new_user = User(password = 'banana') def test_password_setter(self): self.assertTrue(self.new_user.pass_secure is not None) def test_no_access_password(self): with self.assertRaises(AttributeError): self.new_user.password def test_password_verification(self): self.assertTrue(self.new_user.verify_password('banana')) class PostsModelTest(unittest.TestCase): def setUp(self): self.new_post = Posts(title='Terabyte', body='This is a new post',category='Technology') def test_instance(self): ''' Test case to check if new_post is an instance of Posts class ''' self.assertTrue( isinstance( self.new_post, Posts) ) def test_save_post(self): ''' Test case to check if a post is saved to the database ''' self.new_post.save_post() self.assertTrue( len(Posts.query.all()) > 0 ) class TestComments(unittest.TestCase): ''' Test class to test behaviours of the Comments class Args: unittest.TestCase : Test case class that helps create test cases ''' def setUp(self): ''' Set up method that will run before every Test ''' self.new_comment = Comments(the_comment="This is a test comment") def test_instance(self): ''' Test to check if new_comment is an instance of Comments ''' self.assertTrue( isinstance( self.new_comment, Comments) ) def test_save_comment(self): ''' Test case to check if comment is saved to the database ''' self.new_comment.save_comment() self.assertTrue( len(Comments.query.all()) > 0) class TestSubscribe(unittest.TestCase): ''' Test class to test behaviours of the Comments class Args: unittest.TestCase : Test case class that helps create test cases ''' def setUp(self): ''' Set up method that will run before every Test ''' self.new_subscriber = Subscribe(name="New Subscriber",email="newsubscriber@gmail.com") def test_instance(self): ''' Test to check if new_comment is an instance of Comments ''' self.assertTrue( isinstance( self.new_subscriber, Subscribe) ) def test_save_subscriber(self): ''' Test case to check if comment is saved to the database ''' self.new_subscriber.save_subscriber() self.assertTrue( len(Subscribe.query.all()) > 0)
26.61
96
0.636979
333
2,661
4.975976
0.24024
0.054919
0.032589
0.033796
0.535305
0.507544
0.447194
0.388654
0.388654
0.388654
0
0.001542
0.269072
2,661
99
97
26.878788
0.850386
0.256295
0
0.194444
0
0
0.061283
0.013173
0
0
0
0
0.25
1
0.361111
false
0.194444
0.055556
0
0.527778
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
3
030361a3a07366fe3fca8925cb15ee416c8d5edc
77
py
Python
src/main.py
DMinghao/Stock_Trading_Bot
67e510868fcb81fb1166e50a1ee4ad0face1f597
[ "MIT" ]
1
2021-01-30T04:21:17.000Z
2021-01-30T04:21:17.000Z
src/main.py
DMinghao/Stock_Trading_Bot
67e510868fcb81fb1166e50a1ee4ad0face1f597
[ "MIT" ]
null
null
null
src/main.py
DMinghao/Stock_Trading_Bot
67e510868fcb81fb1166e50a1ee4ad0face1f597
[ "MIT" ]
1
2021-11-25T15:39:43.000Z
2021-11-25T15:39:43.000Z
from utility import util CONN = util.connectAlpaca() class algo: pass
11
27
0.714286
10
77
5.5
0.9
0
0
0
0
0
0
0
0
0
0
0
0.220779
77
6
28
12.833333
0.916667
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.25
0.25
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
031333ba3988ef98fbd4715a4e62cc80ec83e8a6
20
py
Python
BackpackTF/__init__.py
danocmx/BackpackTF
f72e3e469564bac3437e46b609295ed9682fa111
[ "MIT" ]
null
null
null
BackpackTF/__init__.py
danocmx/BackpackTF
f72e3e469564bac3437e46b609295ed9682fa111
[ "MIT" ]
null
null
null
BackpackTF/__init__.py
danocmx/BackpackTF
f72e3e469564bac3437e46b609295ed9682fa111
[ "MIT" ]
null
null
null
name = "BackpackTF"
10
19
0.7
2
20
7
1
0
0
0
0
0
0
0
0
0
0
0
0.15
20
1
20
20
0.823529
0
0
0
0
0
0.5
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0334e651421abe1c3bbd784b6968c6b9f2211995
762
py
Python
crits/exploits/urls.py
dutrow/crits
6b357daa5c3060cf622d3a3b0c7b41a9ca69c049
[ "MIT" ]
738
2015-01-02T12:39:55.000Z
2022-03-23T11:05:51.000Z
crits/exploits/urls.py
dutrow/crits
6b357daa5c3060cf622d3a3b0c7b41a9ca69c049
[ "MIT" ]
605
2015-01-01T01:03:39.000Z
2021-11-17T18:51:07.000Z
crits/exploits/urls.py
dutrow/crits
6b357daa5c3060cf622d3a3b0c7b41a9ca69c049
[ "MIT" ]
316
2015-01-07T12:35:01.000Z
2022-03-30T04:44:30.000Z
from django.conf.urls import url from . import views urlpatterns = [ url(r'^add/$', views.add_exploit, name='crits-exploits-views-add_exploit'), url(r'^edit/cve/$', views.edit_exploit_cve, name='crits-exploits-views-edit_exploit_cve'), url(r'^edit/name/(?P<id_>\S+)/$', views.edit_exploit_name, name='crits-exploits-views-edit_exploit_name'), url(r'^details/(?P<id_>\S+)/$', views.exploit_detail, name='crits-exploits-views-exploit_detail'), url(r'^remove/(?P<id_>\S+)/$', views.remove_exploit, name='crits-exploits-views-remove_exploit'), url(r'^list/$', views.exploits_listing, name='crits-exploits-views-exploits_listing'), url(r'^list/(?P<option>\S+)/$', views.exploits_listing, name='crits-exploits-views-exploits_listing'), ]
54.428571
110
0.708661
112
762
4.633929
0.223214
0.05395
0.229287
0.296724
0.458574
0.346821
0.219653
0.219653
0.219653
0
0
0
0.082677
762
13
111
58.615385
0.742489
0
0
0
0
0
0.48294
0.451444
0
0
0
0
0
1
0
false
0
0.181818
0
0.181818
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
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
03472bc113607c9cce24676674e3bde57eee28aa
435
py
Python
path.py
jihuacao/Putil
b753fc94bea4cbda00f483681c55f0e9f54adef2
[ "Apache-2.0" ]
1
2018-12-09T06:09:29.000Z
2018-12-09T06:09:29.000Z
path.py
jihuacao/Putil
b753fc94bea4cbda00f483681c55f0e9f54adef2
[ "Apache-2.0" ]
null
null
null
path.py
jihuacao/Putil
b753fc94bea4cbda00f483681c55f0e9f54adef2
[ "Apache-2.0" ]
null
null
null
import os def touch_dir(wanted_dir): not_exist_collection = [] while os.path.exists(wanted_dir) is not True and wanted_dir != '': wanted_dir, step = os.path.split(wanted_dir) not_exist_collection.append(step) pass while len(not_exist_collection) != 0: step = not_exist_collection.pop() wanted_dir = os.path.join(wanted_dir, step) os.mkdir(wanted_dir) pass pass
27.1875
70
0.650575
61
435
4.360656
0.393443
0.270677
0.270677
0.12782
0.203008
0
0
0
0
0
0
0.003077
0.252874
435
16
71
27.1875
0.815385
0
0
0.230769
0
0
0
0
0
0
0
0
0
1
0.076923
false
0.230769
0.076923
0
0.153846
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
0362e3e2a8505146a18fa8d1c03cc3f8125b8048
274
py
Python
go/apps/access_mobile_http_api/__init__.py
lynnUg/vumi-go
852f906c46d5d26940bd6699f11488b73bbc3742
[ "BSD-3-Clause" ]
null
null
null
go/apps/access_mobile_http_api/__init__.py
lynnUg/vumi-go
852f906c46d5d26940bd6699f11488b73bbc3742
[ "BSD-3-Clause" ]
null
null
null
go/apps/access_mobile_http_api/__init__.py
lynnUg/vumi-go
852f906c46d5d26940bd6699f11488b73bbc3742
[ "BSD-3-Clause" ]
null
null
null
from zope.interface import implements from twisted.cred import portal, checkers, credentials, error from twisted.internet.defer import inlineCallbacks, returnValue from twisted.web import resource from twisted.web.guard import HTTPAuthSessionWrapper, BasicCredentialFactory
45.666667
76
0.864964
32
274
7.40625
0.625
0.185654
0.118143
0
0
0
0
0
0
0
0
0
0.091241
274
6
76
45.666667
0.951807
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
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
3
0372470bd73314dd6de4de8ad09ee2efbf1ce927
1,138
py
Python
src/sage/manifolds/differentiable/examples/symplectic_space_test.py
UCD4IDS/sage
43474c96d533fd396fe29fe0782d44dc7f5164f7
[ "BSL-1.0" ]
null
null
null
src/sage/manifolds/differentiable/examples/symplectic_space_test.py
UCD4IDS/sage
43474c96d533fd396fe29fe0782d44dc7f5164f7
[ "BSL-1.0" ]
null
null
null
src/sage/manifolds/differentiable/examples/symplectic_space_test.py
UCD4IDS/sage
43474c96d533fd396fe29fe0782d44dc7f5164f7
[ "BSL-1.0" ]
null
null
null
import sage.all from sage.manifolds.differentiable.symplectic_form import SymplecticForm from sage.manifolds.differentiable.examples.symplectic_space import ( StandardSymplecticSpace, ) import pytest class TestR2VectorSpace: @pytest.fixture def M(self): return StandardSymplecticSpace(2, "R2", symplectic_name="omega") @pytest.fixture def omega(self, M: StandardSymplecticSpace): return M.symplectic_form() def test_repr(self, M: StandardSymplecticSpace): assert str(M) == "Standard symplectic space R2" def test_display(self, omega: SymplecticForm): assert str(omega.display()) == r"omega = -dq∧dp" class TestR4VectorSpace: @pytest.fixture def M(self): return StandardSymplecticSpace(4, "R4", symplectic_name="omega") @pytest.fixture def omega(self, M: StandardSymplecticSpace): return M.symplectic_form() def test_repr(self, M: StandardSymplecticSpace): assert str(M) == "Standard symplectic space R4" def test_display(self, omega: SymplecticForm): assert str(omega.display()) == r"omega = -dq1∧dp1 - dq2∧dp2"
29.179487
72
0.705624
131
1,138
6.076336
0.312977
0.065327
0.080402
0.077889
0.690955
0.690955
0.690955
0.565327
0.565327
0.565327
0
0.013015
0.189807
1,138
38
73
29.947368
0.847072
0
0
0.5
0
0
0.096661
0
0
0
0
0
0.142857
1
0.285714
false
0
0.142857
0.142857
0.642857
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
3
301c0312019459ee3c1cee213b0c5d83ed3d800e
66
py
Python
definitions.py
krolse/discord-bot
721cc2db11bf625ae0b82241b48b4a8d6cddfef6
[ "MIT" ]
null
null
null
definitions.py
krolse/discord-bot
721cc2db11bf625ae0b82241b48b4a8d6cddfef6
[ "MIT" ]
null
null
null
definitions.py
krolse/discord-bot
721cc2db11bf625ae0b82241b48b4a8d6cddfef6
[ "MIT" ]
null
null
null
import os ROOT_PATH = os.path.dirname(__file__) PREFIX = '!'
13.2
38
0.666667
9
66
4.333333
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.19697
66
4
39
16.5
0.735849
0
0
0
0
0
0.016129
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
3026e265d52f0e4e8547e9c71406ecd9ba63127b
224
py
Python
Python/Python For Absolute Beginner/mainfile.py
omkarsutar1255/Python-Data
169d0c54b23d9dd5a7f1aea41ab385121c3b3c63
[ "CC-BY-3.0" ]
null
null
null
Python/Python For Absolute Beginner/mainfile.py
omkarsutar1255/Python-Data
169d0c54b23d9dd5a7f1aea41ab385121c3b3c63
[ "CC-BY-3.0" ]
null
null
null
Python/Python For Absolute Beginner/mainfile.py
omkarsutar1255/Python-Data
169d0c54b23d9dd5a7f1aea41ab385121c3b3c63
[ "CC-BY-3.0" ]
null
null
null
def printom(str): return f"ye hath mujhe {str}" def add(n1, n2): return n1 + n2 + 5 print("and the name is", __name__) if __name__ == '__main__': print(printom("de de thakur")) o = add(4, 6) print(o)
16
34
0.589286
37
224
3.243243
0.648649
0.066667
0
0
0
0
0
0
0
0
0
0.041916
0.254464
224
13
35
17.230769
0.676647
0
0
0
0
0
0.241071
0
0
0
0
0
0
1
0.222222
false
0
0
0.222222
0.444444
0.444444
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
1
0
3
30287041d7af11f5fa52ba839473d1d0593377f9
46
py
Python
src/iJungle/config.py
microsoft/dstoolkit-anomaly-detection-ijungle
74946cffa2c45de8203cc63830220d928b767751
[ "MIT" ]
3
2021-11-11T17:41:49.000Z
2021-11-23T18:01:11.000Z
src/iJungle/config.py
microsoft/dstoolkit-anomaly-detection-ijungle
74946cffa2c45de8203cc63830220d928b767751
[ "MIT" ]
1
2021-10-01T06:06:27.000Z
2021-10-01T06:06:27.000Z
src/iJungle/config.py
microsoft/dstoolkit-anomaly-detection-ijungle
74946cffa2c45de8203cc63830220d928b767751
[ "MIT" ]
1
2021-10-01T05:56:13.000Z
2021-10-01T05:56:13.000Z
__version__ = '0.1.73' _MODEL_DIR = 'outputs'
15.333333
22
0.695652
7
46
3.714286
1
0
0
0
0
0
0
0
0
0
0
0.1
0.130435
46
2
23
23
0.55
0
0
0
0
0
0.282609
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
303a017c75510b182fa84c03281ca852da5367a0
479
py
Python
info/views.py
RockyRoad29/flask-kit
e77501f4d68f76949cff91bea3664292fc17f4d4
[ "BSD-3-Clause" ]
1
2022-03-20T11:21:00.000Z
2022-03-20T11:21:00.000Z
info/views.py
RockyRoad29/flask-kit
e77501f4d68f76949cff91bea3664292fc17f4d4
[ "BSD-3-Clause" ]
null
null
null
info/views.py
RockyRoad29/flask-kit
e77501f4d68f76949cff91bea3664292fc17f4d4
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- """ Example additional blueprint. :copyright: (c) 2012 by Roman Semirook. :license: BSD, see LICENSE for more details. """ from flask.templating import render_template from flask.views import MethodView from info import info class HelpPageView(MethodView): "An example view for your own Blueprint" def get(self): return render_template('info/info_page.html') info.add_url_rule('', view_func=HelpPageView.as_view('help'))
22.809524
61
0.713987
64
479
5.234375
0.703125
0.053731
0
0
0
0
0
0
0
0
0
0.012658
0.175365
479
20
62
23.95
0.835443
0.36952
0
0
0
0
0.190031
0
0
0
0
0
0
1
0.125
false
0
0.375
0.125
0.75
0.125
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
3
305dd0cf234605970af277d1a10677b89e0e29d1
1,113
py
Python
src/backend/backend/users/migrations/0010_update_uuid_field.py
tejpratap545/E-Commerce-Application
c1aada5d86f231e5acd6ba4c6c9b88ff4b351f7a
[ "MIT" ]
null
null
null
src/backend/backend/users/migrations/0010_update_uuid_field.py
tejpratap545/E-Commerce-Application
c1aada5d86f231e5acd6ba4c6c9b88ff4b351f7a
[ "MIT" ]
7
2021-08-13T23:05:47.000Z
2022-02-27T10:23:46.000Z
src/backend/backend/users/migrations/0010_update_uuid_field.py
tejpratap545/E-Commerce-Application
c1aada5d86f231e5acd6ba4c6c9b88ff4b351f7a
[ "MIT" ]
null
null
null
# Generated by Django 3.1.2 on 2020-10-21 15:40 from django.db import migrations, models import uuid class Migration(migrations.Migration): dependencies = [ ('users', '0009_auto_20201021_2108'), ] operations = [ migrations.AlterField( model_name='emailconfirmation', name='token', field=models.CharField(default='u0-0Pm80IRgk5OLJj2HTChIcemJMWdhKY8Kv1tv76dE', max_length=250), ), migrations.AlterField( model_name='emailconfirmation', name='uuid', field=models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False), ), migrations.AlterField( model_name='passwordreset', name='url_token', field=models.CharField(default='zFWVX3XmTRupCasd0T9zX6G4pArN-cLsf0bRy8YIAvA', max_length=250), ), migrations.AlterField( model_name='passwordreset', name='uuid', field=models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False), ), ]
31.8
106
0.628032
104
1,113
6.605769
0.5
0.116448
0.14556
0.16885
0.643377
0.550218
0.366812
0.247453
0.247453
0.247453
0
0.06821
0.262354
1,113
34
107
32.735294
0.768575
0.040431
0
0.571429
1
0
0.183865
0.102251
0
0
0
0
0
1
0
false
0.071429
0.071429
0
0.178571
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
3
3061799da4b27da8e82e9b9f427b99189cda21d4
981
py
Python
indico/modules/events/models/labels.py
Nordix/indico
8eff8f046d0cb6dcac4f5ef9750ed79a9d38acf0
[ "MIT" ]
null
null
null
indico/modules/events/models/labels.py
Nordix/indico
8eff8f046d0cb6dcac4f5ef9750ed79a9d38acf0
[ "MIT" ]
null
null
null
indico/modules/events/models/labels.py
Nordix/indico
8eff8f046d0cb6dcac4f5ef9750ed79a9d38acf0
[ "MIT" ]
null
null
null
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals import uuid from indico.util.locators import locator_property from indico.util.string import format_repr, return_ascii class EventLabel(object): # TODO: convert this to a proper model in 2.3 id = None title = None color = None def __init__(self, **kwargs): if 'id' not in kwargs: self.id = str(uuid.uuid4()) for name, value in kwargs.iteritems(): setattr(self, name, value) def __eq__(self, other): return isinstance(other, EventLabel) and other.id == self.id @locator_property def locator(self): return {'event_label_id': self.id} @return_ascii def __repr__(self): return format_repr(self, 'id', _text=self.title)
25.815789
68
0.673802
140
981
4.535714
0.557143
0.037795
0.044094
0
0
0
0
0
0
0
0
0.014726
0.238532
981
37
69
26.513514
0.835341
0.248726
0
0
0
0
0.024691
0
0
0
0
0.027027
0
1
0.190476
false
0
0.190476
0.142857
0.714286
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
1
1
0
0
3
061c8039533a39fbab640592d28268452289ba56
3,580
py
Python
sparse_arrays.py
Digit4/randoms
f1f8d9f9b03286f157fa69042c9ac7f5f00e4dec
[ "MIT" ]
1
2018-12-15T17:47:07.000Z
2018-12-15T17:47:07.000Z
sparse_arrays.py
Digit4/randoms
f1f8d9f9b03286f157fa69042c9ac7f5f00e4dec
[ "MIT" ]
null
null
null
sparse_arrays.py
Digit4/randoms
f1f8d9f9b03286f157fa69042c9ac7f5f00e4dec
[ "MIT" ]
null
null
null
inpu = """4 aba baba aba xzxb 3 aba xzxb ab """ inp = """100 lekgdisnsbfdzpqlkg eagemhdygyv jwvwwnrhuai urcadmrwlqe mpgqsvxrijpombyv mpgqsvxrijpombyv urcadmrwlqe mpgqsvxrijpombyv eagemhdygyv eagemhdygyv jwvwwnrhuai urcadmrwlqe jwvwwnrhuai kvugevicpsdf kvugevicpsdf mpgqsvxrijpombyv urcadmrwlqe mpgqsvxrijpombyv exdafbnobg qhootohpnfvbl suffrbmqgnln exdafbnobg exdafbnobg eagemhdygyv mpgqsvxrijpombyv urcadmrwlqe jwvwwnrhuai lekgdisnsbfdzpqlkg mpgqsvxrijpombyv lekgdisnsbfdzpqlkg jwvwwnrhuai exdafbnobg mpgqsvxrijpombyv kvugevicpsdf qhootohpnfvbl urcadmrwlqe kvugevicpsdf mpgqsvxrijpombyv lekgdisnsbfdzpqlkg mpgqsvxrijpombyv kvugevicpsdf qhootohpnfvbl lxyqetmgdbmh urcadmrwlqe urcadmrwlqe kvugevicpsdf lxyqetmgdbmh urcadmrwlqe lxyqetmgdbmh jwvwwnrhuai qhootohpnfvbl qhootohpnfvbl jwvwwnrhuai lekgdisnsbfdzpqlkg kvugevicpsdf mpgqsvxrijpombyv exdafbnobg kvugevicpsdf lekgdisnsbfdzpqlkg qhootohpnfvbl exdafbnobg qhootohpnfvbl exdafbnobg mpgqsvxrijpombyv suffrbmqgnln mpgqsvxrijpombyv qhootohpnfvbl jwvwwnrhuai mpgqsvxrijpombyv qhootohpnfvbl lekgdisnsbfdzpqlkg eagemhdygyv jwvwwnrhuai kvugevicpsdf eagemhdygyv eagemhdygyv lxyqetmgdbmh qhootohpnfvbl lxyqetmgdbmh exdafbnobg qhootohpnfvbl qhootohpnfvbl exdafbnobg suffrbmqgnln mpgqsvxrijpombyv urcadmrwlqe eagemhdygyv lxyqetmgdbmh urcadmrwlqe suffrbmqgnln qhootohpnfvbl kvugevicpsdf lekgdisnsbfdzpqlkg lxyqetmgdbmh mpgqsvxrijpombyv jwvwwnrhuai lxyqetmgdbmh lxyqetmgdbmh lekgdisnsbfdzpqlkg qhootohpnfvbl 100 exdafbnobg eagemhdygyv mpgqsvxrijpombyv kvugevicpsdf lekgdisnsbfdzpqlkg kvugevicpsdf exdafbnobg qhootohpnfvbl eagemhdygyv kvugevicpsdf suffrbmqgnln jwvwwnrhuai lekgdisnsbfdzpqlkg lekgdisnsbfdzpqlkg mpgqsvxrijpombyv jwvwwnrhuai kvugevicpsdf lekgdisnsbfdzpqlkg exdafbnobg suffrbmqgnln qhootohpnfvbl eagemhdygyv exdafbnobg suffrbmqgnln jwvwwnrhuai qhootohpnfvbl eagemhdygyv exdafbnobg exdafbnobg jwvwwnrhuai qhootohpnfvbl lxyqetmgdbmh qhootohpnfvbl suffrbmqgnln lxyqetmgdbmh qhootohpnfvbl eagemhdygyv jwvwwnrhuai eagemhdygyv qhootohpnfvbl mpgqsvxrijpombyv qhootohpnfvbl jwvwwnrhuai exdafbnobg eagemhdygyv eagemhdygyv kvugevicpsdf kvugevicpsdf jwvwwnrhuai urcadmrwlqe lxyqetmgdbmh qhootohpnfvbl exdafbnobg exdafbnobg eagemhdygyv qhootohpnfvbl exdafbnobg exdafbnobg lekgdisnsbfdzpqlkg jwvwwnrhuai eagemhdygyv urcadmrwlqe kvugevicpsdf lekgdisnsbfdzpqlkg jwvwwnrhuai eagemhdygyv lekgdisnsbfdzpqlkg exdafbnobg kvugevicpsdf jwvwwnrhuai exdafbnobg lxyqetmgdbmh exdafbnobg lxyqetmgdbmh jwvwwnrhuai mpgqsvxrijpombyv eagemhdygyv urcadmrwlqe kvugevicpsdf qhootohpnfvbl jwvwwnrhuai eagemhdygyv urcadmrwlqe urcadmrwlqe exdafbnobg qhootohpnfvbl exdafbnobg eagemhdygyv exdafbnobg jwvwwnrhuai eagemhdygyv jwvwwnrhuai mpgqsvxrijpombyv urcadmrwlqe urcadmrwlqe eagemhdygyv eagemhdygyv jwvwwnrhuai suffrbmqgnln eagemhdygyv""" inp = list(inp.strip().split("\n")) string_count = int(inp[0]) strings = [] for i in range(string_count): strings.append(inp[i+1]) query_count = int(inp[string_count + 1]) queries = [] for i in range(query_count): queries.append(inp[i + string_count + 2]) print(query_count, string_count) def queryProcessed(ele, arr): for var in arr: if (ele == var): return True return False def matchingStrings(strings, queries): query_count,string_count = len(queries),len(strings) result = [0 for x in range(query_count)] for i,query in enumerate(queries): for string in strings: if (query == string): if (not queryProcessed(query, queries[:i])): ind = i result[ind] += 1 else: ind = queries.index(query) result[i] = result[ind] return (result) print(matchingStrings(strings,queries))
14.32
53
0.861732
336
3,580
9.14881
0.166667
0.042941
0.026025
0.007157
0
0
0
0
0
0
0
0.004352
0.101397
3,580
249
54
14.37751
0.951197
0
0
0.846473
0
0
0.762011
0
0
1
0
0
0
1
0.008299
false
0
0
0
0.020747
0.008299
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
3
06291bcd3823b5f56cbc0312a7f61a050ba0609f
1,789
py
Python
restclients/test/gws/trumba_group.py
uw-it-cte/uw-restclients
2b09348bf066e5508304401f93f281805e965af5
[ "Apache-2.0" ]
null
null
null
restclients/test/gws/trumba_group.py
uw-it-cte/uw-restclients
2b09348bf066e5508304401f93f281805e965af5
[ "Apache-2.0" ]
null
null
null
restclients/test/gws/trumba_group.py
uw-it-cte/uw-restclients
2b09348bf066e5508304401f93f281805e965af5
[ "Apache-2.0" ]
null
null
null
from django.test import TestCase from restclients.models.gws import GroupUser from restclients.exceptions import DataFailureException from restclients.gws import GWS from restclients.test import fdao_gws_override @fdao_gws_override class TestGwsTrumbaGroup(TestCase): def test_get_group(self): group = GWS().get_group_by_id('u_eventcal_sea_1013649-editor') self.assertEquals(group.name, "u_eventcal_sea_1013649-editor") self.assertEquals(group.uwregid, "143bc3d173d244f6a2c3ced159ba9c97") self.assertEquals(group.title, "College of Arts and Sciences calendar editor group") self.assertEquals( group.description, "Specifying the editors who are able to add/edit/delete any event on the corresponding Seattle Trumba calendar") self.assertIsNotNone(group.admins) self.assertEquals(len(group.admins) , 1) self.assertEquals(group.admins[0].user_type, GroupUser.GROUP_TYPE) self.assertEquals(group.admins[0].name, "u_eventcal_support") self.assertIsNotNone(group.updaters) self.assertEquals(len(group.updaters) , 1) self.assertEquals(group.updaters[0].user_type, GroupUser.GROUP_TYPE) self.assertEquals( group.updaters[0].name, "u_eventcal_sea_1013649-editor") self.assertIsNotNone(group.readers) self.assertEquals(len(group.readers) , 1) self.assertEquals(group.readers[0].user_type, GroupUser.NONE_TYPE) self.assertEquals(group.readers[0].name, "dc=all") self.assertIsNotNone(group.optouts) self.assertEquals(len(group.optouts) , 1) self.assertEquals(group.optouts[0].user_type, GroupUser.NONE_TYPE) self.assertEquals(group.optouts[0].name, "dc=all")
42.595238
124
0.714925
214
1,789
5.845794
0.317757
0.204636
0.201439
0.076739
0.370104
0.254996
0.254996
0.22542
0.151879
0
0
0.035739
0.186696
1,789
41
125
43.634146
0.824055
0
0
0.060606
0
0
0.172163
0.066518
0
0
0
0
0.606061
1
0.030303
false
0
0.151515
0
0.212121
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
1
0
0
0
0
0
0
0
0
0
3
06508ced0b67c00a43888b30d90b61c487445db6
523
py
Python
home/migrations/0003_rename_image_movie_thumbnail_and_more.py
italoseara/Django-Movie
57721da4a972f059c5bf67bff8183724e62307b6
[ "MIT" ]
1
2022-03-03T15:49:37.000Z
2022-03-03T15:49:37.000Z
home/migrations/0003_rename_image_movie_thumbnail_and_more.py
italoseara/Django-Movie
57721da4a972f059c5bf67bff8183724e62307b6
[ "MIT" ]
null
null
null
home/migrations/0003_rename_image_movie_thumbnail_and_more.py
italoseara/Django-Movie
57721da4a972f059c5bf67bff8183724e62307b6
[ "MIT" ]
null
null
null
# Generated by Django 4.0 on 2021-12-26 20:08 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('home', '0002_remove_movie_language_remove_serie_language'), ] operations = [ migrations.RenameField( model_name='movie', old_name='image', new_name='thumbnail', ), migrations.RenameField( model_name='serie', old_name='image', new_name='thumbnail', ), ]
21.791667
69
0.573614
52
523
5.538462
0.615385
0.145833
0.180556
0.208333
0.194444
0.194444
0
0
0
0
0
0.050562
0.319312
523
23
70
22.73913
0.758427
0.082218
0
0.470588
1
0
0.188285
0.100418
0
0
0
0
0
1
0
false
0
0.058824
0
0.235294
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3