content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class_cpp_header = """\ #include <pybind11/pybind11.h> #include <pybind11/stl.h> {includes} #include "{class_short_name}.cppwg.hpp" namespace py = pybind11; typedef {class_full_name} {class_short_name};{smart_ptr_handle} """ class_cpp_header_chaste = """\ #include <pybind11/pybind11.h> #include <pybind11/stl.h> {includes} //#include "PythonObjectConverters.hpp" #include "{class_short_name}.cppwg.hpp" namespace py = pybind11; //PYBIND11_CVECTOR_TYPECASTER2(); //PYBIND11_CVECTOR_TYPECASTER3(); typedef {class_full_name} {class_short_name};{smart_ptr_handle} """ class_hpp_header = """\ #ifndef {class_short_name}_hpp__pyplusplus_wrapper #define {class_short_name}_hpp__pyplusplus_wrapper namespace py = pybind11; void register_{class_short_name}_class(py::module &m); #endif // {class_short_name}_hpp__pyplusplus_wrapper """ class_virtual_override_header = """\ class {class_short_name}_Overloads : public {class_short_name}{{ public: using {class_short_name}::{class_base_name}; """ class_virtual_override_footer = "}\n" class_definition = """\ void register_{short_name}_class(py::module &m){{ py::class_<{short_name} {overrides_string} {ptr_support} {bases} >(m, "{short_name}") """ method_virtual_override = """\ {return_type} {method_name}({arg_string}){const_adorn} override {{ PYBIND11_OVERLOAD{overload_adorn}( {tidy_method_name}, {short_class_name}, {method_name}, {args_string}); }} """ smart_pointer_holder = "PYBIND11_DECLARE_HOLDER_TYPE(T, {}<T>)" free_function = """\ m.def{def_adorn}("{function_name}", &{function_name}, {function_docs} {default_args}); """ class_method = """\ .def{def_adorn}( "{method_name}", ({return_type}({self_ptr})({arg_signature}){const_adorn}) &{class_short_name}::{method_name}, {method_docs} {default_args} {call_policy}) """ template_collection = { "class_cpp_header": class_cpp_header, "free_function": free_function, "class_hpp_header": class_hpp_header, "class_method": class_method, "class_definition": class_definition, "class_virtual_override_header": class_virtual_override_header, "class_virtual_override_footer": class_virtual_override_footer, "smart_pointer_holder": smart_pointer_holder, "method_virtual_override": method_virtual_override, }
class_cpp_header = '#include <pybind11/pybind11.h>\n#include <pybind11/stl.h>\n{includes}\n#include "{class_short_name}.cppwg.hpp"\n\nnamespace py = pybind11;\ntypedef {class_full_name} {class_short_name};{smart_ptr_handle}\n' class_cpp_header_chaste = '#include <pybind11/pybind11.h>\n#include <pybind11/stl.h>\n{includes}\n//#include "PythonObjectConverters.hpp"\n#include "{class_short_name}.cppwg.hpp"\n\nnamespace py = pybind11;\n//PYBIND11_CVECTOR_TYPECASTER2();\n//PYBIND11_CVECTOR_TYPECASTER3();\ntypedef {class_full_name} {class_short_name};{smart_ptr_handle}\n' class_hpp_header = '#ifndef {class_short_name}_hpp__pyplusplus_wrapper\n#define {class_short_name}_hpp__pyplusplus_wrapper\n\nnamespace py = pybind11;\nvoid register_{class_short_name}_class(py::module &m);\n#endif // {class_short_name}_hpp__pyplusplus_wrapper\n' class_virtual_override_header = 'class {class_short_name}_Overloads : public {class_short_name}{{\n public:\n using {class_short_name}::{class_base_name};\n' class_virtual_override_footer = '}\n' class_definition = 'void register_{short_name}_class(py::module &m){{\npy::class_<{short_name} {overrides_string} {ptr_support} {bases} >(m, "{short_name}")\n' method_virtual_override = ' {return_type} {method_name}({arg_string}){const_adorn} override {{\n PYBIND11_OVERLOAD{overload_adorn}(\n {tidy_method_name},\n {short_class_name},\n {method_name},\n {args_string});\n }}\n' smart_pointer_holder = 'PYBIND11_DECLARE_HOLDER_TYPE(T, {}<T>)' free_function = ' m.def{def_adorn}("{function_name}", &{function_name}, {function_docs} {default_args});\n' class_method = ' .def{def_adorn}(\n "{method_name}", \n ({return_type}({self_ptr})({arg_signature}){const_adorn}) &{class_short_name}::{method_name}, \n {method_docs} {default_args} {call_policy})\n' template_collection = {'class_cpp_header': class_cpp_header, 'free_function': free_function, 'class_hpp_header': class_hpp_header, 'class_method': class_method, 'class_definition': class_definition, 'class_virtual_override_header': class_virtual_override_header, 'class_virtual_override_footer': class_virtual_override_footer, 'smart_pointer_holder': smart_pointer_holder, 'method_virtual_override': method_virtual_override}
# BGR Blue = (255, 0, 0) Green = (0, 255, 0) Red = (0, 0, 255) Black = (0, 0, 0) White = (255, 255, 255)
blue = (255, 0, 0) green = (0, 255, 0) red = (0, 0, 255) black = (0, 0, 0) white = (255, 255, 255)
def solve_power_consumption(): """Print the power consumption.""" with open('../data/day03.txt') as f: lines = [line.strip() for line in f] ones = [sum(bit == '1' for bit in column) for column in zip(*lines)] gamma = ''.join('1' if n > len(lines) / 2 else '0' for n in ones) epsilon = ''.join('1' if char == '0' else '0' for char in gamma) print(int(gamma, 2) * int(epsilon, 2)) if __name__ == '__main__': solve_power_consumption()
def solve_power_consumption(): """Print the power consumption.""" with open('../data/day03.txt') as f: lines = [line.strip() for line in f] ones = [sum((bit == '1' for bit in column)) for column in zip(*lines)] gamma = ''.join(('1' if n > len(lines) / 2 else '0' for n in ones)) epsilon = ''.join(('1' if char == '0' else '0' for char in gamma)) print(int(gamma, 2) * int(epsilon, 2)) if __name__ == '__main__': solve_power_consumption()
# #08 Anomalous Counter! # @DSAghicha (Darshaan Aghicha) def counter_value(timer: int) -> int: if timer == 0: return 0 counter_dial: int = 0 prev_dial: int = 0 cycle_dial: int = 0 counter = 0 while timer > counter_dial: counter += 1 prev_dial = counter_dial counter_dial = counter_dial + 3 * (2 ** cycle_dial) cycle_dial += 1 return 3 * (2 ** (cycle_dial - 1)) - (timer - prev_dial) + 1 def main() -> None: try: time: int = int(input("Enter time: ")) value: int = counter_value(time) print(f"Counter value = {value}") except ValueError: print("I expected a number!!\n\n") main() if __name__ == "__main__": main()
def counter_value(timer: int) -> int: if timer == 0: return 0 counter_dial: int = 0 prev_dial: int = 0 cycle_dial: int = 0 counter = 0 while timer > counter_dial: counter += 1 prev_dial = counter_dial counter_dial = counter_dial + 3 * 2 ** cycle_dial cycle_dial += 1 return 3 * 2 ** (cycle_dial - 1) - (timer - prev_dial) + 1 def main() -> None: try: time: int = int(input('Enter time: ')) value: int = counter_value(time) print(f'Counter value = {value}') except ValueError: print('I expected a number!!\n\n') main() if __name__ == '__main__': main()
__version__ = '0.1.3' __title__ = 'dadjokes-cli' __description__ = 'Dad Jokes on your Terminal' __author__ = 'sangarshanan' __author_email__= 'sangarshanan1998@gmail.com' __url__ = 'https://github.com/Sangarshanan/dadjokes-cli'
__version__ = '0.1.3' __title__ = 'dadjokes-cli' __description__ = 'Dad Jokes on your Terminal' __author__ = 'sangarshanan' __author_email__ = 'sangarshanan1998@gmail.com' __url__ = 'https://github.com/Sangarshanan/dadjokes-cli'
""" misc/bi_tree.py """ class BiTree: """ Binary Indexed Tree is represented as an array. Each node of the Binary Indexed Tree stores the sum of some elements of the original array. The size of the Binary Indexed Tree is equal to the size of the original input array, denoted as n. This class use a size of n+1 for ease of implementation. How does Binary Indexed Tree work? The idea is based on the fact that all positive integers can be represented as the sum of powers of 2. For example 19 can be represented as 16 + 2 + 1. Every node of the BiTree stores the sum of n elements, n is a power of 2. For example, in the first diagram above (the diagram for getSum()), the sum of the first 12 elements can be obtained by the sum of the last 4 elements (from 9 to 12) plus the sum of 8 elements (from 1 to 8). The number of set bits in the binary representation of a number n is O(Logn). Therefore, we traverse at-most O(Logn) nodes in both getSum() and update() operations. The time complexity of the construction is O(nLogn) as it calls update() for all n elements. See - https://www.geeksforgeeks.org/binary-indexed-tree-or-fenwick-tree-2/ - https://blog.csdn.net/Yaokai_AssultMaster/article/details/79492190 """ def __init__(self, array: list): n = len(array) # create and initialize BiTree data as all zeroes list self.data = [0]*(n+1) self.list = array # store the actual values in BiTree for i in range(n): self.update(i, array[i]) pass def get(self, index: int): return self.list[index] # if index < len(self.list) and index >= 0 else None def getsum(self, index: int): """ Returns sum of a sub array [0..index-1]. """ sum = 0 # initialize result # BiTree index is 1 more than the index in original list. ndx = index + 1 # traverse ancestors of BiTree data[index] while ndx > 0: # add current element of BiTree to sum sum += self.data[ndx] # get index of parent node ndx -= ndx & (-ndx) return sum def update(self, index: int, value: int): """ Updates a note in Binary Index Tree (BiTree) at given list index, which will add given value to the data index position of BiTree and all of its ancestors in tree. """ # BiTree index is 1 more than the index in original list. ndx = index + 1 # traverse all ancestors and update the value while ndx > 0: # add value to current node of BiTree self.data[ndx] += value # get index of parent node ndx -= ndx & (-ndx) self.list[index] = value
""" misc/bi_tree.py """ class Bitree: """ Binary Indexed Tree is represented as an array. Each node of the Binary Indexed Tree stores the sum of some elements of the original array. The size of the Binary Indexed Tree is equal to the size of the original input array, denoted as n. This class use a size of n+1 for ease of implementation. How does Binary Indexed Tree work? The idea is based on the fact that all positive integers can be represented as the sum of powers of 2. For example 19 can be represented as 16 + 2 + 1. Every node of the BiTree stores the sum of n elements, n is a power of 2. For example, in the first diagram above (the diagram for getSum()), the sum of the first 12 elements can be obtained by the sum of the last 4 elements (from 9 to 12) plus the sum of 8 elements (from 1 to 8). The number of set bits in the binary representation of a number n is O(Logn). Therefore, we traverse at-most O(Logn) nodes in both getSum() and update() operations. The time complexity of the construction is O(nLogn) as it calls update() for all n elements. See - https://www.geeksforgeeks.org/binary-indexed-tree-or-fenwick-tree-2/ - https://blog.csdn.net/Yaokai_AssultMaster/article/details/79492190 """ def __init__(self, array: list): n = len(array) self.data = [0] * (n + 1) self.list = array for i in range(n): self.update(i, array[i]) pass def get(self, index: int): return self.list[index] def getsum(self, index: int): """ Returns sum of a sub array [0..index-1]. """ sum = 0 ndx = index + 1 while ndx > 0: sum += self.data[ndx] ndx -= ndx & -ndx return sum def update(self, index: int, value: int): """ Updates a note in Binary Index Tree (BiTree) at given list index, which will add given value to the data index position of BiTree and all of its ancestors in tree. """ ndx = index + 1 while ndx > 0: self.data[ndx] += value ndx -= ndx & -ndx self.list[index] = value
# -*- coding: utf-8 -*- class Header(object): def __init__(self, name): if (isinstance(name, Header)): name = name.normalized name = name.strip() self.normalized = name.lower() def __hash__(self): return hash(self.normalized) def __eq__(self, right): assert isinstance(right, Header), 'Invalid Comparison' return self.normalized == right.normalized def __str__(self): return self.normalized ACCEPT = Header('a') CONTENT_ENCODING = Header('e') CONTENT_LENGTH = Header('l') CONTENT_RANGE = Header('n') CONTENT_TYPE = Header('c') FROM = Header('f') FROM_EX = Header('g') FROM_RIGHTS = Header('h') REFER_TO = Header('r') REPLY_TO = Header('p') SEQUENCE = Header('q') STREAM = Header('m') SUBJECT = Header('s') TIMESTAMP = Header('z') TO = Header('t') TRACE = Header('i') TRANSFER_ENCODING = Header('x') VIA = Header('v') COMPACT_HEADERS = dict([(Header(key), value) for key, value in list({ 'Accept': ACCEPT, 'Content-Encoding': CONTENT_ENCODING, 'Content-Length': CONTENT_LENGTH, 'Content-Range': CONTENT_RANGE, 'Content-Type': CONTENT_TYPE, 'From': FROM, 'X-From-Game': FROM_EX, 'X-From-Rights': FROM_RIGHTS, 'Refer-To': REFER_TO, 'Reply-To': REPLY_TO, 'X-Sequence': SEQUENCE, 'Stream': STREAM, 'Subject': SUBJECT, 'Timestamp': TIMESTAMP, 'To': TO, 'X-Trace-ID': TRACE, 'Transfer-Encoding': TRANSFER_ENCODING, 'Via': VIA }.items())]) MULTI_HEADERS = frozenset([Header(name) for name in [ ACCEPT, 'Accept-Charset', 'Accept-Encoding', 'Accept-Language', 'Accept-Ranges', 'Allow', 'Cache-Control', 'Connection', CONTENT_ENCODING, 'Content-Language', 'Expect', 'If-Match', 'If-None-Match', 'Pragma', 'Proxy-Authenticate', 'Set-Cookie', 'TE', 'Trailer', TRANSFER_ENCODING, 'Upgrade', 'User-Agent', 'Vary', VIA, 'Warning', 'WWW-Authenticate', 'X-Forwarded-For' ]])
class Header(object): def __init__(self, name): if isinstance(name, Header): name = name.normalized name = name.strip() self.normalized = name.lower() def __hash__(self): return hash(self.normalized) def __eq__(self, right): assert isinstance(right, Header), 'Invalid Comparison' return self.normalized == right.normalized def __str__(self): return self.normalized accept = header('a') content_encoding = header('e') content_length = header('l') content_range = header('n') content_type = header('c') from = header('f') from_ex = header('g') from_rights = header('h') refer_to = header('r') reply_to = header('p') sequence = header('q') stream = header('m') subject = header('s') timestamp = header('z') to = header('t') trace = header('i') transfer_encoding = header('x') via = header('v') compact_headers = dict([(header(key), value) for (key, value) in list({'Accept': ACCEPT, 'Content-Encoding': CONTENT_ENCODING, 'Content-Length': CONTENT_LENGTH, 'Content-Range': CONTENT_RANGE, 'Content-Type': CONTENT_TYPE, 'From': FROM, 'X-From-Game': FROM_EX, 'X-From-Rights': FROM_RIGHTS, 'Refer-To': REFER_TO, 'Reply-To': REPLY_TO, 'X-Sequence': SEQUENCE, 'Stream': STREAM, 'Subject': SUBJECT, 'Timestamp': TIMESTAMP, 'To': TO, 'X-Trace-ID': TRACE, 'Transfer-Encoding': TRANSFER_ENCODING, 'Via': VIA}.items())]) multi_headers = frozenset([header(name) for name in [ACCEPT, 'Accept-Charset', 'Accept-Encoding', 'Accept-Language', 'Accept-Ranges', 'Allow', 'Cache-Control', 'Connection', CONTENT_ENCODING, 'Content-Language', 'Expect', 'If-Match', 'If-None-Match', 'Pragma', 'Proxy-Authenticate', 'Set-Cookie', 'TE', 'Trailer', TRANSFER_ENCODING, 'Upgrade', 'User-Agent', 'Vary', VIA, 'Warning', 'WWW-Authenticate', 'X-Forwarded-For']])
# -*- coding: utf-8 -*- """Top-level package for SlimStaty.""" __author__ = """Andy Mroczkowski""" __email__ = 'a@mrox.co' __version__ = '0.1.0'
"""Top-level package for SlimStaty.""" __author__ = 'Andy Mroczkowski' __email__ = 'a@mrox.co' __version__ = '0.1.0'
class Solution: def validateStackSequences(self, pushed: List[int], popped: List[int]) -> bool: if not pushed and not popped: return True if len(pushed) != len(popped): return False popIdx = 0 count = 0 stack = [] for i in range(len(pushed)): stack.append(pushed[i]) while len(stack) > 0 and stack[-1] == popped[popIdx]: stack.pop() popIdx += 1 return len(stack) == 0
class Solution: def validate_stack_sequences(self, pushed: List[int], popped: List[int]) -> bool: if not pushed and (not popped): return True if len(pushed) != len(popped): return False pop_idx = 0 count = 0 stack = [] for i in range(len(pushed)): stack.append(pushed[i]) while len(stack) > 0 and stack[-1] == popped[popIdx]: stack.pop() pop_idx += 1 return len(stack) == 0
""" 62. Unique Paths Medium 7114 267 Add to List Share A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths are there? Example 1: Input: m = 3, n = 7 Output: 28 Example 2: Input: m = 3, n = 2 Output: 3 Explanation: From the top-left corner, there are a total of 3 ways to reach the bottom-right corner: 1. Right -> Down -> Down 2. Down -> Down -> Right 3. Down -> Right -> Down Example 3: Input: m = 7, n = 3 Output: 28 Example 4: Input: m = 3, n = 3 Output: 6 Constraints: 1 <= m, n <= 100 It's guaranteed that the answer will be less than or equal to 2 * 109. """ # approach: dynamic programming # memory: O(m * n) # runtime: O(m * n) class Solution: def uniquePaths(self, m: int, n: int) -> int: lookup = [[1 for i in range(n)] for j in range(m)] for row in range(m): for col in range(n): if row > 0 and col > 0: # add the top and left lookup[row][col] = lookup[row - 1][col] + lookup[row][col - 1] return lookup[-1][-1]
""" 62. Unique Paths Medium 7114 267 Add to List Share A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths are there? Example 1: Input: m = 3, n = 7 Output: 28 Example 2: Input: m = 3, n = 2 Output: 3 Explanation: From the top-left corner, there are a total of 3 ways to reach the bottom-right corner: 1. Right -> Down -> Down 2. Down -> Down -> Right 3. Down -> Right -> Down Example 3: Input: m = 7, n = 3 Output: 28 Example 4: Input: m = 3, n = 3 Output: 6 Constraints: 1 <= m, n <= 100 It's guaranteed that the answer will be less than or equal to 2 * 109. """ class Solution: def unique_paths(self, m: int, n: int) -> int: lookup = [[1 for i in range(n)] for j in range(m)] for row in range(m): for col in range(n): if row > 0 and col > 0: lookup[row][col] = lookup[row - 1][col] + lookup[row][col - 1] return lookup[-1][-1]
unsorted_list = [("w",23), (9,1), ("543",99), ("sena",18)] print(sorted(unsorted_list, key=lambda x: x[1])) list = [43, 743, 342, 8874, 49] print(sorted(list, reverse=True))
unsorted_list = [('w', 23), (9, 1), ('543', 99), ('sena', 18)] print(sorted(unsorted_list, key=lambda x: x[1])) list = [43, 743, 342, 8874, 49] print(sorted(list, reverse=True))
# This is a handy reverses the endianess of a given binary string in HEX input = "020000000001017c037e163f8dfee4632a8cf6c87187d3cb61224e6dae8f4b0ed0fae3a38008570000000017160014c5729e3aaacb6a160fa79949a8d7f1e5cd1fbc51feffffff0288102c040000000017a914ed649576ad657747835d116611981c90113c074387005a62020000000017a914e62a29e7d756eb30c453ae022f315619fe8ddfbb8702483045022100b40db3a574a7254d60f8e64335d9bab60ff986ad7fe1c0ad06dcfc4ba896e16002201bbf15e25b0334817baa34fd02ebe90c94af2d65226c9302a60a96e8357c0da50121034f889691dacb4b7152f42f566095a8c2cec6482d2fc0a16f87f59691e7e37824df000000" def test(): assert reverse("") == "" assert reverse("F") == "F" assert reverse("FF") == "FF" assert reverse("00FF") == "FF00" assert reverse("AA00FF") == "FF00AA" assert reverse("AB01EF") == "EF01AB" assert reverse("b50cc069d6a3e33e3ff84a5c41d9d3febe7c770fdcc96b2c3ff60abe184f1963") == "63194f18be0af63f2c6bc9dc0f777cbefed3d9415c4af83f3ee3a3d669c00cb5" def reverse(input): res = "".join(reversed([input[i:i+2] for i in range(0, len(input), 2)])) return res if __name__ == "__main__": test() print(reverse(input))
input = '020000000001017c037e163f8dfee4632a8cf6c87187d3cb61224e6dae8f4b0ed0fae3a38008570000000017160014c5729e3aaacb6a160fa79949a8d7f1e5cd1fbc51feffffff0288102c040000000017a914ed649576ad657747835d116611981c90113c074387005a62020000000017a914e62a29e7d756eb30c453ae022f315619fe8ddfbb8702483045022100b40db3a574a7254d60f8e64335d9bab60ff986ad7fe1c0ad06dcfc4ba896e16002201bbf15e25b0334817baa34fd02ebe90c94af2d65226c9302a60a96e8357c0da50121034f889691dacb4b7152f42f566095a8c2cec6482d2fc0a16f87f59691e7e37824df000000' def test(): assert reverse('') == '' assert reverse('F') == 'F' assert reverse('FF') == 'FF' assert reverse('00FF') == 'FF00' assert reverse('AA00FF') == 'FF00AA' assert reverse('AB01EF') == 'EF01AB' assert reverse('b50cc069d6a3e33e3ff84a5c41d9d3febe7c770fdcc96b2c3ff60abe184f1963') == '63194f18be0af63f2c6bc9dc0f777cbefed3d9415c4af83f3ee3a3d669c00cb5' def reverse(input): res = ''.join(reversed([input[i:i + 2] for i in range(0, len(input), 2)])) return res if __name__ == '__main__': test() print(reverse(input))
# startswith # endswith inp = "ajay kumar" out = inp.startswith("aj") print(out) out = inp.startswith("jay") print(out) # inp1 = "print('a')" inp1 = "# isdecimal -> given a string, check if it is decimal" out = inp1.startswith("#") print(out)
inp = 'ajay kumar' out = inp.startswith('aj') print(out) out = inp.startswith('jay') print(out) inp1 = '# isdecimal -> given a string, check if it is decimal' out = inp1.startswith('#') print(out)
class Queue(object): """ Implment Queue using List """ def __init__(self): self._list = [] def enqueue(self, value): self._list.append(value) def dequeue(self): try: value = self._list[0] del self._list[0] return value except IndexError: print("is empty") def size(self): return len(self._list) def top(self): if self.size() is 0: return 0 return self._list[-1] class Stack(object): def __init__(self): self.queue = Queue() self.emptyQueue = Queue() def push(self, x): """ :type x: int :rtype: nothing """ self.queue.enqueue(x) def pop(self): """ Put values of `queue` untail last one. """ if self.queue.size() is 0: print("is empty") return while(self.queue.size() is not 1): self.emptyQueue.enqueue(self.queue.dequeue()) value = self.queue.dequeue() self.queue, self.emptyQueue = self.emptyQueue, self.queue return value def top(self): """ :rtype: int """ return self.queue.top() def empty(self): """ :rtype: bool """ return self.queue.size() is 0
class Queue(object): """ Implment Queue using List """ def __init__(self): self._list = [] def enqueue(self, value): self._list.append(value) def dequeue(self): try: value = self._list[0] del self._list[0] return value except IndexError: print('is empty') def size(self): return len(self._list) def top(self): if self.size() is 0: return 0 return self._list[-1] class Stack(object): def __init__(self): self.queue = queue() self.emptyQueue = queue() def push(self, x): """ :type x: int :rtype: nothing """ self.queue.enqueue(x) def pop(self): """ Put values of `queue` untail last one. """ if self.queue.size() is 0: print('is empty') return while self.queue.size() is not 1: self.emptyQueue.enqueue(self.queue.dequeue()) value = self.queue.dequeue() (self.queue, self.emptyQueue) = (self.emptyQueue, self.queue) return value def top(self): """ :rtype: int """ return self.queue.top() def empty(self): """ :rtype: bool """ return self.queue.size() is 0
# -*- coding: utf-8 -*- """ Created on Fri Jun 21 15:44:41 2019 @author: f.divruno """ ms = 1e-3 us = 1e-6 MHz = 1e6 GHz = 1e9 km = 1e3 minute = 60 hr = 60*minute km_h = km/hr k_bolt = 1.38e-23 def Apply_DISH(Telescope_list,Band='B1',scaling = 'Correlator_opimized', atten = 0): """ scaling: Correlator_optimized scales the input signals so tht the noise (without RFI) scales to 0.335*Stdv(noise) = 1 level of ADC. Linearity_optimized scales the input signals so that the RMS power (noise + RFI) scales to the full scale of the ADC (minimum clipping) Defined_Gain scales the input signal by a defined atten, parameter atten needs to be provided Band: 'B1' 'B2' 'B3' 'B4' 'B5a' 'B5b' """ # SampleRate = Telescope_list[0].SampleRate # Duration = Telescope_list[0].Duration for i in range(len(Telescope_list)): #filter and scales the signals according to the Band and optimiztion selected, attenuation can be provided. Telescope_list[i].Apply_analog_chain(Band,scaling,atten=0,f_offset=0) # The signal inputing to the ADC is in the variable Receiver.ADC_input # digitize the signals. Telescope_list[i].Apply_ADC(nBits=12) # The output signal is stored in Receiver.ADC_output #TO-DO: frequency offset scheme. Telescope_list[i].Apply_antSampleRate() return Telescope_list
""" Created on Fri Jun 21 15:44:41 2019 @author: f.divruno """ ms = 0.001 us = 1e-06 m_hz = 1000000.0 g_hz = 1000000000.0 km = 1000.0 minute = 60 hr = 60 * minute km_h = km / hr k_bolt = 1.38e-23 def apply_dish(Telescope_list, Band='B1', scaling='Correlator_opimized', atten=0): """ scaling: Correlator_optimized scales the input signals so tht the noise (without RFI) scales to 0.335*Stdv(noise) = 1 level of ADC. Linearity_optimized scales the input signals so that the RMS power (noise + RFI) scales to the full scale of the ADC (minimum clipping) Defined_Gain scales the input signal by a defined atten, parameter atten needs to be provided Band: 'B1' 'B2' 'B3' 'B4' 'B5a' 'B5b' """ for i in range(len(Telescope_list)): Telescope_list[i].Apply_analog_chain(Band, scaling, atten=0, f_offset=0) Telescope_list[i].Apply_ADC(nBits=12) Telescope_list[i].Apply_antSampleRate() return Telescope_list
for _ in range(int(input())): a,b,c=map(int,input().split()) ans=a+c-b-b ans=abs(ans) c1=ans%3 c2=ans%(-3) c2=abs(c2) if c1<c2: print(c1) else: print(c2)
for _ in range(int(input())): (a, b, c) = map(int, input().split()) ans = a + c - b - b ans = abs(ans) c1 = ans % 3 c2 = ans % -3 c2 = abs(c2) if c1 < c2: print(c1) else: print(c2)
"""Config for the `config-f` setting in StyleGAN2.""" _base_ = ['./stylegan2_c2_ffhq_256_b4x8_800k.py'] model = dict( disc_auxiliary_loss=dict(use_apex_amp=False), gen_auxiliary_loss=dict(use_apex_amp=False), ) total_iters = 800002 apex_amp = dict(mode='gan', init_args=dict(opt_level='O1', num_losses=2)) resume_from = None
"""Config for the `config-f` setting in StyleGAN2.""" _base_ = ['./stylegan2_c2_ffhq_256_b4x8_800k.py'] model = dict(disc_auxiliary_loss=dict(use_apex_amp=False), gen_auxiliary_loss=dict(use_apex_amp=False)) total_iters = 800002 apex_amp = dict(mode='gan', init_args=dict(opt_level='O1', num_losses=2)) resume_from = None
# Author: Mujib Ansari # Date: Jan 23, 2021 # Problem Statement: WAP to check given number is palindorome or not def check_palindorme(num): temp = num reverse = 0 while temp > 0: lastDigit = temp % 10 reverse = (reverse * 10) + lastDigit temp = temp // 10 return "Yes" if num == reverse else "No" n = int(input("Enter a number : ")) print("Entered number : ", n) print("Is palindrome or not : ", check_palindorme(n))
def check_palindorme(num): temp = num reverse = 0 while temp > 0: last_digit = temp % 10 reverse = reverse * 10 + lastDigit temp = temp // 10 return 'Yes' if num == reverse else 'No' n = int(input('Enter a number : ')) print('Entered number : ', n) print('Is palindrome or not : ', check_palindorme(n))
# # PySNMP MIB module CXCFG-IP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXCFG-IP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:16:46 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) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint") cxCfgIp, Alias, cxIcmp, cxCfgIpSap = mibBuilder.importSymbols("CXProduct-SMI", "cxCfgIp", "Alias", "cxIcmp", "cxCfgIpSap") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") TimeTicks, Gauge32, ObjectIdentity, iso, Integer32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, IpAddress, NotificationType, Counter64, Counter32, ModuleIdentity, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "Gauge32", "ObjectIdentity", "iso", "Integer32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "IpAddress", "NotificationType", "Counter64", "Counter32", "ModuleIdentity", "Unsigned32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") cxCfgIpAddrTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1), ) if mibBuilder.loadTexts: cxCfgIpAddrTable.setStatus('mandatory') cxCfgIpAddrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1), ).setIndexNames((0, "CXCFG-IP-MIB", "cxCfgIpAdEntAddr")) if mibBuilder.loadTexts: cxCfgIpAddrEntry.setStatus('mandatory') cxCfgIpAdEntAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxCfgIpAdEntAddr.setStatus('mandatory') cxCfgIpAdEntIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpAdEntIfIndex.setStatus('mandatory') cxCfgIpAdEntNetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpAdEntNetMask.setStatus('mandatory') cxCfgIpAdEntBcastAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpAdEntBcastAddr.setStatus('mandatory') cxCfgIpAdEntSubnetworkSAPAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 5), Alias()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpAdEntSubnetworkSAPAlias.setStatus('mandatory') cxCfgIpAdEntRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpAdEntRowStatus.setStatus('mandatory') cxCfgIpAdEntState = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("on", 1), ("off", 2), ("onether", 3), ("ontoken", 4))).clone('on')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpAdEntState.setStatus('mandatory') cxCfgIpAdEntPeerAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 8), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpAdEntPeerAddr.setStatus('mandatory') cxCfgIpAdEntRtProto = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("rip", 2), ("ospf", 3))).clone('rip')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpAdEntRtProto.setStatus('mandatory') cxCfgIpAdEntMtu = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(64, 4096)).clone(1600)).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpAdEntMtu.setStatus('mandatory') cxCfgIpAdEntReplyToRARP = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpAdEntReplyToRARP.setStatus('mandatory') cxCfgIpAdEntSRSupport = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpAdEntSRSupport.setStatus('mandatory') cxCfgIpPingTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1), ) if mibBuilder.loadTexts: cxCfgIpPingTable.setStatus('mandatory') cxCfgIpPingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1), ).setIndexNames((0, "CXCFG-IP-MIB", "cxCfgIpPingDestAddr")) if mibBuilder.loadTexts: cxCfgIpPingEntry.setStatus('mandatory') cxCfgIpPingIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpPingIndex.setStatus('mandatory') cxCfgIpPingDestAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpPingDestAddr.setStatus('mandatory') cxCfgIpPingGapsInMs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1000)).clone(10)).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpPingGapsInMs.setStatus('mandatory') cxCfgIpPingNbOfPings = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4000000)).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpPingNbOfPings.setStatus('mandatory') cxCfgIpPingDataSize = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 300)).clone(64)).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpPingDataSize.setStatus('mandatory') cxCfgIpPingRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpPingRowStatus.setStatus('mandatory') cxCfgIpPingTriggerSend = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ipIdle", 1), ("ipSend", 2))).clone('ipIdle')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpPingTriggerSend.setStatus('mandatory') cxCfgIpPingNbTx = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxCfgIpPingNbTx.setStatus('mandatory') cxCfgIpPingNbReplyRx = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxCfgIpPingNbReplyRx.setStatus('mandatory') cxCfgIpPingNbErrorRx = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxCfgIpPingNbErrorRx.setStatus('mandatory') cxCfgIpPingLastSeqNumRx = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxCfgIpPingLastSeqNumRx.setStatus('mandatory') cxCfgIpPingLastRoundTripInMs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxCfgIpPingLastRoundTripInMs.setStatus('mandatory') cxCfgIpPingAvgRoundTripInMs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxCfgIpPingAvgRoundTripInMs.setStatus('mandatory') cxCfgIpPingMinRoundTripInMs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 26), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxCfgIpPingMinRoundTripInMs.setStatus('mandatory') cxCfgIpPingMaxRoundTripInMs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 27), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxCfgIpPingMaxRoundTripInMs.setStatus('mandatory') cxCfgIpPingLastNumHopsTraveled = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 28), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxCfgIpPingLastNumHopsTraveled.setStatus('mandatory') cxCfgIpRIP = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgIpRIP.setStatus('mandatory') cxCfgRIPII = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxCfgRIPII.setStatus('mandatory') cxCfgIpMibLevel = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxCfgIpMibLevel.setStatus('mandatory') mibBuilder.exportSymbols("CXCFG-IP-MIB", cxCfgIpPingDestAddr=cxCfgIpPingDestAddr, cxCfgIpPingTriggerSend=cxCfgIpPingTriggerSend, cxCfgIpPingLastSeqNumRx=cxCfgIpPingLastSeqNumRx, cxCfgIpPingAvgRoundTripInMs=cxCfgIpPingAvgRoundTripInMs, cxCfgIpAdEntRtProto=cxCfgIpAdEntRtProto, cxCfgIpAdEntNetMask=cxCfgIpAdEntNetMask, cxCfgIpPingNbTx=cxCfgIpPingNbTx, cxCfgIpAdEntMtu=cxCfgIpAdEntMtu, cxCfgIpPingIndex=cxCfgIpPingIndex, cxCfgIpAdEntReplyToRARP=cxCfgIpAdEntReplyToRARP, cxCfgIpAdEntBcastAddr=cxCfgIpAdEntBcastAddr, cxCfgIpPingNbOfPings=cxCfgIpPingNbOfPings, cxCfgIpPingMinRoundTripInMs=cxCfgIpPingMinRoundTripInMs, cxCfgIpPingLastNumHopsTraveled=cxCfgIpPingLastNumHopsTraveled, cxCfgIpPingMaxRoundTripInMs=cxCfgIpPingMaxRoundTripInMs, cxCfgIpAdEntSRSupport=cxCfgIpAdEntSRSupport, cxCfgIpPingLastRoundTripInMs=cxCfgIpPingLastRoundTripInMs, cxCfgRIPII=cxCfgRIPII, cxCfgIpAdEntSubnetworkSAPAlias=cxCfgIpAdEntSubnetworkSAPAlias, cxCfgIpAdEntRowStatus=cxCfgIpAdEntRowStatus, cxCfgIpMibLevel=cxCfgIpMibLevel, cxCfgIpPingTable=cxCfgIpPingTable, cxCfgIpAddrEntry=cxCfgIpAddrEntry, cxCfgIpPingNbReplyRx=cxCfgIpPingNbReplyRx, cxCfgIpAdEntIfIndex=cxCfgIpAdEntIfIndex, cxCfgIpAdEntState=cxCfgIpAdEntState, cxCfgIpAddrTable=cxCfgIpAddrTable, cxCfgIpPingDataSize=cxCfgIpPingDataSize, cxCfgIpPingRowStatus=cxCfgIpPingRowStatus, cxCfgIpPingGapsInMs=cxCfgIpPingGapsInMs, cxCfgIpRIP=cxCfgIpRIP, cxCfgIpPingNbErrorRx=cxCfgIpPingNbErrorRx, cxCfgIpAdEntPeerAddr=cxCfgIpAdEntPeerAddr, cxCfgIpAdEntAddr=cxCfgIpAdEntAddr, cxCfgIpPingEntry=cxCfgIpPingEntry)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_intersection, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueSizeConstraint') (cx_cfg_ip, alias, cx_icmp, cx_cfg_ip_sap) = mibBuilder.importSymbols('CXProduct-SMI', 'cxCfgIp', 'Alias', 'cxIcmp', 'cxCfgIpSap') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (time_ticks, gauge32, object_identity, iso, integer32, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, bits, ip_address, notification_type, counter64, counter32, module_identity, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'Gauge32', 'ObjectIdentity', 'iso', 'Integer32', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'IpAddress', 'NotificationType', 'Counter64', 'Counter32', 'ModuleIdentity', 'Unsigned32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') cx_cfg_ip_addr_table = mib_table((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1)) if mibBuilder.loadTexts: cxCfgIpAddrTable.setStatus('mandatory') cx_cfg_ip_addr_entry = mib_table_row((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1)).setIndexNames((0, 'CXCFG-IP-MIB', 'cxCfgIpAdEntAddr')) if mibBuilder.loadTexts: cxCfgIpAddrEntry.setStatus('mandatory') cx_cfg_ip_ad_ent_addr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 1), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: cxCfgIpAdEntAddr.setStatus('mandatory') cx_cfg_ip_ad_ent_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 2), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpAdEntIfIndex.setStatus('mandatory') cx_cfg_ip_ad_ent_net_mask = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 3), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpAdEntNetMask.setStatus('mandatory') cx_cfg_ip_ad_ent_bcast_addr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 4), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpAdEntBcastAddr.setStatus('mandatory') cx_cfg_ip_ad_ent_subnetwork_sap_alias = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 5), alias()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpAdEntSubnetworkSAPAlias.setStatus('mandatory') cx_cfg_ip_ad_ent_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('invalid', 1), ('valid', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpAdEntRowStatus.setStatus('mandatory') cx_cfg_ip_ad_ent_state = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('on', 1), ('off', 2), ('onether', 3), ('ontoken', 4))).clone('on')).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpAdEntState.setStatus('mandatory') cx_cfg_ip_ad_ent_peer_addr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 8), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpAdEntPeerAddr.setStatus('mandatory') cx_cfg_ip_ad_ent_rt_proto = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('none', 1), ('rip', 2), ('ospf', 3))).clone('rip')).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpAdEntRtProto.setStatus('mandatory') cx_cfg_ip_ad_ent_mtu = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(64, 4096)).clone(1600)).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpAdEntMtu.setStatus('mandatory') cx_cfg_ip_ad_ent_reply_to_rarp = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpAdEntReplyToRARP.setStatus('mandatory') cx_cfg_ip_ad_ent_sr_support = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpAdEntSRSupport.setStatus('mandatory') cx_cfg_ip_ping_table = mib_table((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1)) if mibBuilder.loadTexts: cxCfgIpPingTable.setStatus('mandatory') cx_cfg_ip_ping_entry = mib_table_row((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1)).setIndexNames((0, 'CXCFG-IP-MIB', 'cxCfgIpPingDestAddr')) if mibBuilder.loadTexts: cxCfgIpPingEntry.setStatus('mandatory') cx_cfg_ip_ping_index = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 32))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpPingIndex.setStatus('mandatory') cx_cfg_ip_ping_dest_addr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 2), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpPingDestAddr.setStatus('mandatory') cx_cfg_ip_ping_gaps_in_ms = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 1000)).clone(10)).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpPingGapsInMs.setStatus('mandatory') cx_cfg_ip_ping_nb_of_pings = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 4000000)).clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpPingNbOfPings.setStatus('mandatory') cx_cfg_ip_ping_data_size = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 300)).clone(64)).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpPingDataSize.setStatus('mandatory') cx_cfg_ip_ping_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('invalid', 1), ('valid', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpPingRowStatus.setStatus('mandatory') cx_cfg_ip_ping_trigger_send = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('ipIdle', 1), ('ipSend', 2))).clone('ipIdle')).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpPingTriggerSend.setStatus('mandatory') cx_cfg_ip_ping_nb_tx = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 20), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cxCfgIpPingNbTx.setStatus('mandatory') cx_cfg_ip_ping_nb_reply_rx = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 21), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cxCfgIpPingNbReplyRx.setStatus('mandatory') cx_cfg_ip_ping_nb_error_rx = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 22), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cxCfgIpPingNbErrorRx.setStatus('mandatory') cx_cfg_ip_ping_last_seq_num_rx = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 23), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cxCfgIpPingLastSeqNumRx.setStatus('mandatory') cx_cfg_ip_ping_last_round_trip_in_ms = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 24), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cxCfgIpPingLastRoundTripInMs.setStatus('mandatory') cx_cfg_ip_ping_avg_round_trip_in_ms = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 25), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cxCfgIpPingAvgRoundTripInMs.setStatus('mandatory') cx_cfg_ip_ping_min_round_trip_in_ms = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 26), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cxCfgIpPingMinRoundTripInMs.setStatus('mandatory') cx_cfg_ip_ping_max_round_trip_in_ms = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 27), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cxCfgIpPingMaxRoundTripInMs.setStatus('mandatory') cx_cfg_ip_ping_last_num_hops_traveled = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 28), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cxCfgIpPingLastNumHopsTraveled.setStatus('mandatory') cx_cfg_ip_rip = mib_scalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('on', 1), ('off', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgIpRIP.setStatus('mandatory') cx_cfg_ripii = mib_scalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('on', 1), ('off', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cxCfgRIPII.setStatus('mandatory') cx_cfg_ip_mib_level = mib_scalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cxCfgIpMibLevel.setStatus('mandatory') mibBuilder.exportSymbols('CXCFG-IP-MIB', cxCfgIpPingDestAddr=cxCfgIpPingDestAddr, cxCfgIpPingTriggerSend=cxCfgIpPingTriggerSend, cxCfgIpPingLastSeqNumRx=cxCfgIpPingLastSeqNumRx, cxCfgIpPingAvgRoundTripInMs=cxCfgIpPingAvgRoundTripInMs, cxCfgIpAdEntRtProto=cxCfgIpAdEntRtProto, cxCfgIpAdEntNetMask=cxCfgIpAdEntNetMask, cxCfgIpPingNbTx=cxCfgIpPingNbTx, cxCfgIpAdEntMtu=cxCfgIpAdEntMtu, cxCfgIpPingIndex=cxCfgIpPingIndex, cxCfgIpAdEntReplyToRARP=cxCfgIpAdEntReplyToRARP, cxCfgIpAdEntBcastAddr=cxCfgIpAdEntBcastAddr, cxCfgIpPingNbOfPings=cxCfgIpPingNbOfPings, cxCfgIpPingMinRoundTripInMs=cxCfgIpPingMinRoundTripInMs, cxCfgIpPingLastNumHopsTraveled=cxCfgIpPingLastNumHopsTraveled, cxCfgIpPingMaxRoundTripInMs=cxCfgIpPingMaxRoundTripInMs, cxCfgIpAdEntSRSupport=cxCfgIpAdEntSRSupport, cxCfgIpPingLastRoundTripInMs=cxCfgIpPingLastRoundTripInMs, cxCfgRIPII=cxCfgRIPII, cxCfgIpAdEntSubnetworkSAPAlias=cxCfgIpAdEntSubnetworkSAPAlias, cxCfgIpAdEntRowStatus=cxCfgIpAdEntRowStatus, cxCfgIpMibLevel=cxCfgIpMibLevel, cxCfgIpPingTable=cxCfgIpPingTable, cxCfgIpAddrEntry=cxCfgIpAddrEntry, cxCfgIpPingNbReplyRx=cxCfgIpPingNbReplyRx, cxCfgIpAdEntIfIndex=cxCfgIpAdEntIfIndex, cxCfgIpAdEntState=cxCfgIpAdEntState, cxCfgIpAddrTable=cxCfgIpAddrTable, cxCfgIpPingDataSize=cxCfgIpPingDataSize, cxCfgIpPingRowStatus=cxCfgIpPingRowStatus, cxCfgIpPingGapsInMs=cxCfgIpPingGapsInMs, cxCfgIpRIP=cxCfgIpRIP, cxCfgIpPingNbErrorRx=cxCfgIpPingNbErrorRx, cxCfgIpAdEntPeerAddr=cxCfgIpAdEntPeerAddr, cxCfgIpAdEntAddr=cxCfgIpAdEntAddr, cxCfgIpPingEntry=cxCfgIpPingEntry)
class AttackGroup: def __init__(self, botai, own, targets, iter): self.botai = botai self.own = own self.targets = targets self.iteration = iter @property def done(self): return len(self.own) == 0 or len(self.targets) == 0 def actions(self, iter): actions = [] target_units = self.botai.known_enemy_units.tags_in(self.targets) if target_units.exists: target = target_units.first for unit in self.botai.units.tags_in(self.own): actions.append(unit.attack(target)) else: self.targets = set() #lost targets return actions def clear_tag(self, tag): if tag in self.own: self.own.remove(tag) elif tag in self.targets: self.targets.remove(tag)
class Attackgroup: def __init__(self, botai, own, targets, iter): self.botai = botai self.own = own self.targets = targets self.iteration = iter @property def done(self): return len(self.own) == 0 or len(self.targets) == 0 def actions(self, iter): actions = [] target_units = self.botai.known_enemy_units.tags_in(self.targets) if target_units.exists: target = target_units.first for unit in self.botai.units.tags_in(self.own): actions.append(unit.attack(target)) else: self.targets = set() return actions def clear_tag(self, tag): if tag in self.own: self.own.remove(tag) elif tag in self.targets: self.targets.remove(tag)
class Rocket: def calc_fuel_weight(self, weight): weight = int(weight) return int(weight / 3) - 2 def calc_fuel_weight_recursive(self, weight): weight = int(weight) # This time with recursion for fuel weight total = self.calc_fuel_weight(weight) fuelweight = self.calc_fuel_weight(total) while fuelweight > 0: total = total + fuelweight fuelweight = self.calc_fuel_weight(fuelweight) return total
class Rocket: def calc_fuel_weight(self, weight): weight = int(weight) return int(weight / 3) - 2 def calc_fuel_weight_recursive(self, weight): weight = int(weight) total = self.calc_fuel_weight(weight) fuelweight = self.calc_fuel_weight(total) while fuelweight > 0: total = total + fuelweight fuelweight = self.calc_fuel_weight(fuelweight) return total
def captial(string): strs = string.title() return strs n = input() n = captial(n) print(n)
def captial(string): strs = string.title() return strs n = input() n = captial(n) print(n)
''' Copyright (c) 2012-2021 Roel Derickx, Paul Norman <penorman@mac.com>, Sebastiaan Couwenberg <sebastic@xs4all.nl>, The University of Vermont <andrew.guertin@uvm.edu>, github contributors Released under the MIT license, as given in the file LICENSE, which must accompany any distribution of this code. ''' __author__ = "Roel Derickx" __program__ = "ogr2osm" __version__ = "1.1.1" __license__ = "MIT License"
""" Copyright (c) 2012-2021 Roel Derickx, Paul Norman <penorman@mac.com>, Sebastiaan Couwenberg <sebastic@xs4all.nl>, The University of Vermont <andrew.guertin@uvm.edu>, github contributors Released under the MIT license, as given in the file LICENSE, which must accompany any distribution of this code. """ __author__ = 'Roel Derickx' __program__ = 'ogr2osm' __version__ = '1.1.1' __license__ = 'MIT License'
streams_dict = {} def session_established(session): # When a WebTransport session is established, a bidirectional stream is # created by the server, which is used to echo back stream data from the # client. session.create_bidirectional_stream() def stream_data_received(session, stream_id: int, data: bytes, stream_ended: bool): # If a stream is unidirectional, create a new unidirectional stream and echo # back the data on that stream. if session.stream_is_unidirectional(stream_id): if (session.session_id, stream_id) not in streams_dict.keys(): new_stream_id = session.create_unidirectional_stream() streams_dict[(session.session_id, stream_id)] = new_stream_id session.send_stream_data(streams_dict[(session.session_id, stream_id)], data, end_stream=stream_ended) if (stream_ended): del streams_dict[(session.session_id, stream_id)] return # Otherwise (e.g. if the stream is bidirectional), echo back the data on the # same stream. session.send_stream_data(stream_id, data, end_stream=stream_ended) def datagram_received(session, data: bytes): session.send_datagram(data)
streams_dict = {} def session_established(session): session.create_bidirectional_stream() def stream_data_received(session, stream_id: int, data: bytes, stream_ended: bool): if session.stream_is_unidirectional(stream_id): if (session.session_id, stream_id) not in streams_dict.keys(): new_stream_id = session.create_unidirectional_stream() streams_dict[session.session_id, stream_id] = new_stream_id session.send_stream_data(streams_dict[session.session_id, stream_id], data, end_stream=stream_ended) if stream_ended: del streams_dict[session.session_id, stream_id] return session.send_stream_data(stream_id, data, end_stream=stream_ended) def datagram_received(session, data: bytes): session.send_datagram(data)
"""gcam_cerf_expansion Generate an electricity capacity expansion plan from GCAM-USA in the format utilized by CERF. License: BSD 2-Clause, see LICENSE and DISCLAIMER files """ def gcam_cerf_expansion(a, b): """Generate an electricity capacity expansion plan from GCAM-USA in the format utilized by CERF.""" return a + b
"""gcam_cerf_expansion Generate an electricity capacity expansion plan from GCAM-USA in the format utilized by CERF. License: BSD 2-Clause, see LICENSE and DISCLAIMER files """ def gcam_cerf_expansion(a, b): """Generate an electricity capacity expansion plan from GCAM-USA in the format utilized by CERF.""" return a + b
n = int(input()) c = int(input()) numbers = [] for i in range(n): numbers.append(int(input())) if sum(numbers) < c: print("IMPOSSIBLE") else: while sum(numbers) > c: numbers[numbers.index(max(numbers))] -= 1 for number in sorted(numbers): print(number)
n = int(input()) c = int(input()) numbers = [] for i in range(n): numbers.append(int(input())) if sum(numbers) < c: print('IMPOSSIBLE') else: while sum(numbers) > c: numbers[numbers.index(max(numbers))] -= 1 for number in sorted(numbers): print(number)
def change(age,*som): print(age) for i in som: print(i) return change(12,'name','year','mon','address') change('a1','b1') change('a2','b2',11)
def change(age, *som): print(age) for i in som: print(i) return change(12, 'name', 'year', 'mon', 'address') change('a1', 'b1') change('a2', 'b2', 11)
FreeMono18pt7bBitmaps = [ 0x27, 0x77, 0x77, 0x77, 0x77, 0x22, 0x22, 0x20, 0x00, 0x6F, 0xF6, 0xF1, 0xFE, 0x3F, 0xC7, 0xF8, 0xFF, 0x1E, 0xC3, 0x98, 0x33, 0x06, 0x60, 0xCC, 0x18, 0x04, 0x20, 0x10, 0x80, 0x42, 0x01, 0x08, 0x04, 0x20, 0x10, 0x80, 0x42, 0x01, 0x10, 0x04, 0x41, 0xFF, 0xF0, 0x44, 0x02, 0x10, 0x08, 0x40, 0x21, 0x0F, 0xFF, 0xC2, 0x10, 0x08, 0x40, 0x21, 0x00, 0x84, 0x02, 0x10, 0x08, 0x40, 0x23, 0x00, 0x88, 0x02, 0x20, 0x02, 0x00, 0x10, 0x00, 0x80, 0x1F, 0xA3, 0x07, 0x10, 0x09, 0x00, 0x48, 0x00, 0x40, 0x03, 0x00, 0x0C, 0x00, 0x3C, 0x00, 0x1E, 0x00, 0x18, 0x00, 0x20, 0x01, 0x80, 0x0C, 0x00, 0x70, 0x05, 0xE0, 0xC9, 0xF8, 0x01, 0x00, 0x08, 0x00, 0x40, 0x02, 0x00, 0x10, 0x00, 0x1E, 0x00, 0x42, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x08, 0x40, 0x0F, 0x00, 0x00, 0x1E, 0x01, 0xF0, 0x1F, 0x01, 0xE0, 0x0E, 0x00, 0x00, 0x3C, 0x00, 0x86, 0x02, 0x06, 0x04, 0x04, 0x08, 0x08, 0x10, 0x30, 0x10, 0xC0, 0x1E, 0x00, 0x0F, 0xC1, 0x00, 0x20, 0x02, 0x00, 0x20, 0x02, 0x00, 0x10, 0x01, 0x00, 0x08, 0x03, 0xC0, 0x6C, 0x3C, 0x62, 0x82, 0x68, 0x34, 0x81, 0xCC, 0x08, 0x61, 0xC3, 0xE7, 0xFF, 0xFF, 0xF6, 0x66, 0x66, 0x08, 0xC4, 0x62, 0x31, 0x8C, 0xC6, 0x31, 0x8C, 0x63, 0x18, 0xC3, 0x18, 0xC2, 0x18, 0xC3, 0x18, 0x86, 0x10, 0xC2, 0x18, 0xC6, 0x10, 0xC6, 0x31, 0x8C, 0x63, 0x18, 0x8C, 0x62, 0x31, 0x98, 0x80, 0x02, 0x00, 0x10, 0x00, 0x80, 0x04, 0x0C, 0x21, 0x9D, 0x70, 0x1C, 0x00, 0xA0, 0x0D, 0x80, 0xC6, 0x04, 0x10, 0x40, 0x80, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0xFF, 0xFE, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x3E, 0x78, 0xF3, 0xC7, 0x8E, 0x18, 0x70, 0xC1, 0x80, 0xFF, 0xFE, 0x77, 0xFF, 0xF7, 0x00, 0x00, 0x08, 0x00, 0xC0, 0x04, 0x00, 0x60, 0x02, 0x00, 0x30, 0x01, 0x00, 0x18, 0x00, 0x80, 0x0C, 0x00, 0x40, 0x02, 0x00, 0x20, 0x01, 0x00, 0x10, 0x00, 0x80, 0x08, 0x00, 0x40, 0x04, 0x00, 0x20, 0x02, 0x00, 0x10, 0x01, 0x00, 0x08, 0x00, 0x80, 0x04, 0x00, 0x00, 0x0F, 0x81, 0x82, 0x08, 0x08, 0x80, 0x24, 0x01, 0x60, 0x0E, 0x00, 0x30, 0x01, 0x80, 0x0C, 0x00, 0x60, 0x03, 0x00, 0x18, 0x00, 0xC0, 0x06, 0x00, 0x30, 0x03, 0x40, 0x12, 0x00, 0x88, 0x08, 0x60, 0xC0, 0xF8, 0x00, 0x06, 0x00, 0x70, 0x06, 0x80, 0x64, 0x06, 0x20, 0x31, 0x00, 0x08, 0x00, 0x40, 0x02, 0x00, 0x10, 0x00, 0x80, 0x04, 0x00, 0x20, 0x01, 0x00, 0x08, 0x00, 0x40, 0x02, 0x00, 0x10, 0x00, 0x80, 0x04, 0x0F, 0xFF, 0x80, 0x0F, 0x80, 0xC3, 0x08, 0x04, 0x80, 0x24, 0x00, 0x80, 0x04, 0x00, 0x20, 0x02, 0x00, 0x10, 0x01, 0x00, 0x10, 0x01, 0x80, 0x18, 0x01, 0x80, 0x18, 0x01, 0x80, 0x18, 0x01, 0x80, 0x58, 0x03, 0x80, 0x1F, 0xFF, 0x80, 0x0F, 0xC0, 0xC0, 0x86, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x04, 0x00, 0x20, 0x0F, 0x00, 0x06, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x40, 0x01, 0x00, 0x04, 0x00, 0x2C, 0x01, 0x9C, 0x0C, 0x0F, 0xC0, 0x01, 0xC0, 0x14, 0x02, 0x40, 0x64, 0x04, 0x40, 0xC4, 0x08, 0x41, 0x84, 0x10, 0x42, 0x04, 0x20, 0x44, 0x04, 0x40, 0x48, 0x04, 0xFF, 0xF0, 0x04, 0x00, 0x40, 0x04, 0x00, 0x40, 0x04, 0x07, 0xF0, 0x3F, 0xF0, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x0B, 0xF0, 0x30, 0x30, 0x00, 0x60, 0x00, 0x80, 0x01, 0x00, 0x04, 0x00, 0x10, 0x00, 0x40, 0x01, 0x00, 0x0E, 0x00, 0x2C, 0x01, 0x0C, 0x18, 0x0F, 0xC0, 0x01, 0xF0, 0x60, 0x18, 0x03, 0x00, 0x20, 0x04, 0x00, 0x40, 0x0C, 0x00, 0x80, 0x08, 0xF8, 0x98, 0x4A, 0x02, 0xE0, 0x3C, 0x01, 0x80, 0x14, 0x01, 0x40, 0x14, 0x03, 0x20, 0x21, 0x0C, 0x0F, 0x80, 0xFF, 0xF8, 0x01, 0x80, 0x18, 0x03, 0x00, 0x20, 0x02, 0x00, 0x20, 0x04, 0x00, 0x40, 0x04, 0x00, 0xC0, 0x08, 0x00, 0x80, 0x18, 0x01, 0x00, 0x10, 0x01, 0x00, 0x30, 0x02, 0x00, 0x20, 0x02, 0x00, 0x0F, 0x81, 0x83, 0x10, 0x05, 0x80, 0x38, 0x00, 0xC0, 0x06, 0x00, 0x30, 0x03, 0x40, 0x11, 0x83, 0x07, 0xF0, 0x60, 0xC4, 0x01, 0x60, 0x0E, 0x00, 0x30, 0x01, 0x80, 0x0E, 0x00, 0xD0, 0x04, 0x60, 0xC1, 0xFC, 0x00, 0x1F, 0x03, 0x08, 0x40, 0x4C, 0x02, 0x80, 0x28, 0x02, 0x80, 0x18, 0x03, 0xC0, 0x74, 0x05, 0x21, 0x91, 0xF1, 0x00, 0x10, 0x03, 0x00, 0x20, 0x02, 0x00, 0x40, 0x0C, 0x01, 0x80, 0x60, 0xF8, 0x00, 0x77, 0xFF, 0xF7, 0x00, 0x00, 0x00, 0x1D, 0xFF, 0xFD, 0xC0, 0x1C, 0x7C, 0xF9, 0xF1, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xF1, 0xE3, 0x8F, 0x1C, 0x38, 0xE1, 0xC3, 0x06, 0x00, 0x00, 0x06, 0x00, 0x18, 0x00, 0xE0, 0x07, 0x00, 0x38, 0x01, 0xC0, 0x06, 0x00, 0x38, 0x00, 0xE0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x18, 0x00, 0x1C, 0x00, 0x0E, 0x00, 0x07, 0x00, 0x03, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFC, 0xC0, 0x00, 0xC0, 0x00, 0xE0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1C, 0x00, 0x0C, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x70, 0x03, 0x80, 0x0C, 0x00, 0x70, 0x03, 0x80, 0x1C, 0x00, 0x60, 0x00, 0x3F, 0x8E, 0x0C, 0x80, 0x28, 0x01, 0x80, 0x10, 0x01, 0x00, 0x10, 0x02, 0x00, 0xC0, 0x38, 0x06, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x01, 0xF0, 0x1F, 0x00, 0xE0, 0x0F, 0x01, 0x86, 0x08, 0x08, 0x80, 0x24, 0x01, 0x40, 0x0A, 0x00, 0x50, 0x1E, 0x83, 0x14, 0x20, 0xA2, 0x05, 0x10, 0x28, 0x81, 0x46, 0x0A, 0x18, 0x50, 0x3F, 0x80, 0x04, 0x00, 0x10, 0x00, 0x80, 0x02, 0x00, 0x18, 0x18, 0x3F, 0x00, 0x1F, 0xF0, 0x00, 0x06, 0x80, 0x00, 0x34, 0x00, 0x01, 0x30, 0x00, 0x18, 0x80, 0x00, 0x86, 0x00, 0x04, 0x30, 0x00, 0x60, 0x80, 0x02, 0x06, 0x00, 0x10, 0x10, 0x01, 0x80, 0x80, 0x08, 0x06, 0x00, 0x7F, 0xF0, 0x06, 0x00, 0x80, 0x20, 0x06, 0x01, 0x00, 0x10, 0x18, 0x00, 0xC0, 0x80, 0x06, 0x04, 0x00, 0x11, 0xFC, 0x0F, 0xF0, 0xFF, 0xF8, 0x04, 0x01, 0x01, 0x00, 0x20, 0x40, 0x04, 0x10, 0x01, 0x04, 0x00, 0x41, 0x00, 0x10, 0x40, 0x08, 0x10, 0x0C, 0x07, 0xFF, 0x01, 0x00, 0x70, 0x40, 0x06, 0x10, 0x00, 0x84, 0x00, 0x11, 0x00, 0x04, 0x40, 0x01, 0x10, 0x00, 0x44, 0x00, 0x21, 0x00, 0x33, 0xFF, 0xF8, 0x03, 0xF1, 0x06, 0x0E, 0x8C, 0x01, 0xC4, 0x00, 0x64, 0x00, 0x12, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x20, 0x01, 0x88, 0x01, 0x83, 0x03, 0x80, 0x7E, 0x00, 0xFF, 0xE0, 0x20, 0x18, 0x20, 0x0C, 0x20, 0x04, 0x20, 0x02, 0x20, 0x02, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x02, 0x20, 0x02, 0x20, 0x04, 0x20, 0x0C, 0x20, 0x18, 0xFF, 0xE0, 0xFF, 0xFF, 0x08, 0x00, 0x84, 0x00, 0x42, 0x00, 0x21, 0x00, 0x10, 0x80, 0x00, 0x40, 0x00, 0x20, 0x40, 0x10, 0x20, 0x0F, 0xF0, 0x04, 0x08, 0x02, 0x04, 0x01, 0x00, 0x00, 0x80, 0x00, 0x40, 0x02, 0x20, 0x01, 0x10, 0x00, 0x88, 0x00, 0x44, 0x00, 0x3F, 0xFF, 0xF0, 0xFF, 0xFF, 0x88, 0x00, 0x44, 0x00, 0x22, 0x00, 0x11, 0x00, 0x08, 0x80, 0x00, 0x40, 0x00, 0x20, 0x40, 0x10, 0x20, 0x0F, 0xF0, 0x04, 0x08, 0x02, 0x04, 0x01, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x1F, 0xF8, 0x00, 0x03, 0xF9, 0x06, 0x07, 0x84, 0x00, 0xC4, 0x00, 0x24, 0x00, 0x12, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x0F, 0xF8, 0x00, 0x14, 0x00, 0x09, 0x00, 0x04, 0x80, 0x02, 0x20, 0x01, 0x18, 0x00, 0x83, 0x01, 0xC0, 0x7F, 0x00, 0xFC, 0x3F, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x3F, 0xFC, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0xFC, 0x3F, 0xFF, 0xF8, 0x10, 0x00, 0x80, 0x04, 0x00, 0x20, 0x01, 0x00, 0x08, 0x00, 0x40, 0x02, 0x00, 0x10, 0x00, 0x80, 0x04, 0x00, 0x20, 0x01, 0x00, 0x08, 0x00, 0x40, 0x02, 0x00, 0x10, 0x00, 0x81, 0xFF, 0xF0, 0x03, 0xFF, 0x80, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x10, 0x01, 0x08, 0x00, 0x84, 0x00, 0x42, 0x00, 0x21, 0x00, 0x10, 0x80, 0x10, 0x20, 0x18, 0x0C, 0x18, 0x01, 0xF0, 0x00, 0xFF, 0x1F, 0x84, 0x01, 0x81, 0x00, 0xC0, 0x40, 0x60, 0x10, 0x30, 0x04, 0x18, 0x01, 0x0C, 0x00, 0x46, 0x00, 0x13, 0x00, 0x05, 0xF0, 0x01, 0xC6, 0x00, 0x60, 0xC0, 0x10, 0x18, 0x04, 0x06, 0x01, 0x00, 0xC0, 0x40, 0x30, 0x10, 0x04, 0x04, 0x01, 0x81, 0x00, 0x23, 0xFC, 0x0F, 0xFF, 0x80, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x42, 0x00, 0x84, 0x01, 0x08, 0x02, 0x10, 0x04, 0x20, 0x0F, 0xFF, 0xF0, 0xF0, 0x01, 0xE7, 0x00, 0x70, 0xA0, 0x0A, 0x16, 0x03, 0x42, 0x40, 0x48, 0x4C, 0x19, 0x08, 0x82, 0x21, 0x10, 0x44, 0x23, 0x18, 0x84, 0x22, 0x10, 0x86, 0xC2, 0x10, 0x50, 0x42, 0x0E, 0x08, 0x41, 0xC1, 0x08, 0x00, 0x21, 0x00, 0x04, 0x20, 0x00, 0x84, 0x00, 0x10, 0x80, 0x02, 0x7F, 0x03, 0xF0, 0xF8, 0x1F, 0xC6, 0x00, 0x41, 0xC0, 0x10, 0x50, 0x04, 0x12, 0x01, 0x04, 0xC0, 0x41, 0x10, 0x10, 0x46, 0x04, 0x10, 0x81, 0x04, 0x10, 0x41, 0x04, 0x10, 0x40, 0x84, 0x10, 0x31, 0x04, 0x04, 0x41, 0x01, 0x90, 0x40, 0x24, 0x10, 0x05, 0x04, 0x01, 0xC1, 0x00, 0x31, 0xFC, 0x0C, 0x03, 0xE0, 0x06, 0x0C, 0x04, 0x01, 0x04, 0x00, 0x46, 0x00, 0x32, 0x00, 0x0B, 0x00, 0x05, 0x00, 0x01, 0x80, 0x00, 0xC0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0E, 0x00, 0x0D, 0x00, 0x04, 0xC0, 0x06, 0x20, 0x02, 0x08, 0x02, 0x03, 0x06, 0x00, 0x7C, 0x00, 0xFF, 0xF0, 0x10, 0x0C, 0x10, 0x02, 0x10, 0x03, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x03, 0x10, 0x06, 0x10, 0x0C, 0x1F, 0xF0, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xFF, 0xC0, 0x03, 0xE0, 0x06, 0x0C, 0x04, 0x01, 0x04, 0x00, 0x46, 0x00, 0x32, 0x00, 0x0B, 0x00, 0x07, 0x00, 0x01, 0x80, 0x00, 0xC0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0E, 0x00, 0x0D, 0x00, 0x04, 0xC0, 0x06, 0x20, 0x02, 0x08, 0x02, 0x03, 0x06, 0x00, 0xFC, 0x00, 0x30, 0x00, 0x30, 0x00, 0x7F, 0xC6, 0x38, 0x1E, 0xFF, 0xF0, 0x02, 0x01, 0x80, 0x40, 0x08, 0x08, 0x01, 0x81, 0x00, 0x10, 0x20, 0x02, 0x04, 0x00, 0x40, 0x80, 0x18, 0x10, 0x06, 0x02, 0x03, 0x80, 0x7F, 0xC0, 0x08, 0x18, 0x01, 0x01, 0x80, 0x20, 0x18, 0x04, 0x01, 0x80, 0x80, 0x10, 0x10, 0x03, 0x02, 0x00, 0x20, 0x40, 0x06, 0x7F, 0x80, 0x70, 0x0F, 0xC8, 0x61, 0xE2, 0x01, 0x90, 0x02, 0x40, 0x09, 0x00, 0x04, 0x00, 0x08, 0x00, 0x38, 0x00, 0x3E, 0x00, 0x0F, 0x00, 0x06, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x60, 0x01, 0x80, 0x0F, 0x00, 0x2B, 0x03, 0x23, 0xF0, 0xFF, 0xFF, 0x02, 0x06, 0x04, 0x0C, 0x08, 0x18, 0x10, 0x20, 0x20, 0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x04, 0x01, 0xFF, 0xC0, 0xFC, 0x1F, 0x90, 0x01, 0x08, 0x00, 0x84, 0x00, 0x42, 0x00, 0x21, 0x00, 0x10, 0x80, 0x08, 0x40, 0x04, 0x20, 0x02, 0x10, 0x01, 0x08, 0x00, 0x84, 0x00, 0x42, 0x00, 0x21, 0x00, 0x10, 0x80, 0x08, 0x40, 0x04, 0x10, 0x04, 0x0C, 0x06, 0x03, 0x06, 0x00, 0x7C, 0x00, 0xFE, 0x03, 0xF8, 0x80, 0x02, 0x04, 0x00, 0x10, 0x30, 0x01, 0x80, 0x80, 0x08, 0x06, 0x00, 0xC0, 0x30, 0x06, 0x00, 0x80, 0x20, 0x06, 0x03, 0x00, 0x30, 0x10, 0x00, 0x80, 0x80, 0x06, 0x0C, 0x00, 0x10, 0x40, 0x00, 0x86, 0x00, 0x06, 0x20, 0x00, 0x11, 0x00, 0x00, 0xD8, 0x00, 0x06, 0x80, 0x00, 0x1C, 0x00, 0x00, 0xE0, 0x00, 0xFC, 0x0F, 0xE8, 0x00, 0x19, 0x00, 0x03, 0x10, 0x00, 0x62, 0x00, 0x08, 0x41, 0x81, 0x08, 0x28, 0x21, 0x05, 0x04, 0x21, 0xA0, 0x84, 0x36, 0x30, 0x84, 0x46, 0x08, 0x88, 0xC1, 0x31, 0x18, 0x24, 0x12, 0x04, 0x82, 0x40, 0xB0, 0x48, 0x14, 0x09, 0x02, 0x80, 0xA0, 0x30, 0x1C, 0x06, 0x03, 0x80, 0x7E, 0x0F, 0xC2, 0x00, 0x60, 0x60, 0x0C, 0x06, 0x03, 0x00, 0x60, 0xC0, 0x0C, 0x10, 0x00, 0xC6, 0x00, 0x0D, 0x80, 0x00, 0xA0, 0x00, 0x1C, 0x00, 0x03, 0x80, 0x00, 0xD8, 0x00, 0x11, 0x00, 0x06, 0x30, 0x01, 0x83, 0x00, 0x60, 0x30, 0x08, 0x06, 0x03, 0x00, 0x60, 0xC0, 0x06, 0x7F, 0x07, 0xF0, 0xFC, 0x1F, 0x98, 0x03, 0x04, 0x01, 0x03, 0x01, 0x80, 0xC1, 0x80, 0x20, 0x80, 0x18, 0xC0, 0x04, 0x40, 0x03, 0x60, 0x00, 0xE0, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x03, 0xFF, 0x80, 0xFF, 0xF4, 0x00, 0xA0, 0x09, 0x00, 0x48, 0x04, 0x40, 0x40, 0x02, 0x00, 0x20, 0x02, 0x00, 0x10, 0x01, 0x00, 0x10, 0x00, 0x80, 0x08, 0x04, 0x80, 0x24, 0x01, 0x40, 0x0C, 0x00, 0x60, 0x03, 0xFF, 0xF0, 0xFC, 0x21, 0x08, 0x42, 0x10, 0x84, 0x21, 0x08, 0x42, 0x10, 0x84, 0x21, 0x08, 0x42, 0x10, 0xF8, 0x80, 0x02, 0x00, 0x10, 0x00, 0xC0, 0x02, 0x00, 0x18, 0x00, 0x40, 0x03, 0x00, 0x08, 0x00, 0x40, 0x01, 0x00, 0x08, 0x00, 0x20, 0x01, 0x00, 0x04, 0x00, 0x20, 0x00, 0x80, 0x04, 0x00, 0x10, 0x00, 0x80, 0x02, 0x00, 0x10, 0x00, 0x40, 0x02, 0x00, 0x08, 0x00, 0x40, 0xF8, 0x42, 0x10, 0x84, 0x21, 0x08, 0x42, 0x10, 0x84, 0x21, 0x08, 0x42, 0x10, 0x84, 0x21, 0xF8, 0x02, 0x00, 0x38, 0x03, 0x60, 0x11, 0x01, 0x8C, 0x18, 0x31, 0x80, 0xD8, 0x03, 0x80, 0x08, 0xFF, 0xFF, 0xF8, 0xC1, 0x83, 0x06, 0x0C, 0x0F, 0xC0, 0x70, 0x30, 0x00, 0x10, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x0F, 0xF8, 0x30, 0x08, 0x40, 0x08, 0x80, 0x08, 0x80, 0x08, 0x80, 0x08, 0x80, 0x38, 0x60, 0xE8, 0x3F, 0x8F, 0xF0, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x10, 0x00, 0x04, 0x00, 0x01, 0x0F, 0x80, 0x4C, 0x18, 0x14, 0x01, 0x06, 0x00, 0x21, 0x80, 0x08, 0x40, 0x01, 0x10, 0x00, 0x44, 0x00, 0x11, 0x00, 0x04, 0x40, 0x01, 0x18, 0x00, 0x86, 0x00, 0x21, 0xC0, 0x10, 0x5C, 0x18, 0xF1, 0xF8, 0x00, 0x07, 0xE4, 0x30, 0x78, 0x80, 0x32, 0x00, 0x24, 0x00, 0x50, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x03, 0x00, 0x02, 0x00, 0x12, 0x00, 0xC3, 0x07, 0x01, 0xF8, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x80, 0x00, 0x20, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x80, 0x7C, 0x20, 0x60, 0xC8, 0x20, 0x0A, 0x10, 0x01, 0x84, 0x00, 0x62, 0x00, 0x08, 0x80, 0x02, 0x20, 0x00, 0x88, 0x00, 0x22, 0x00, 0x08, 0xC0, 0x06, 0x10, 0x01, 0x82, 0x00, 0xE0, 0x60, 0xE8, 0x0F, 0xE3, 0xC0, 0x07, 0xE0, 0x1C, 0x18, 0x30, 0x0C, 0x60, 0x06, 0x40, 0x03, 0xC0, 0x03, 0xC0, 0x01, 0xFF, 0xFF, 0xC0, 0x00, 0xC0, 0x00, 0x40, 0x00, 0x60, 0x00, 0x30, 0x03, 0x0C, 0x0E, 0x03, 0xF0, 0x03, 0xFC, 0x18, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x0F, 0xFF, 0x82, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0xFF, 0xF0, 0x0F, 0xC7, 0x9C, 0x3A, 0x18, 0x07, 0x08, 0x01, 0x8C, 0x00, 0xC4, 0x00, 0x22, 0x00, 0x11, 0x00, 0x08, 0x80, 0x04, 0x40, 0x02, 0x10, 0x03, 0x08, 0x01, 0x82, 0x01, 0x40, 0xC3, 0x20, 0x3F, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x7F, 0x00, 0xF0, 0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x47, 0xC0, 0x2C, 0x18, 0x1C, 0x04, 0x0C, 0x01, 0x04, 0x00, 0x82, 0x00, 0x41, 0x00, 0x20, 0x80, 0x10, 0x40, 0x08, 0x20, 0x04, 0x10, 0x02, 0x08, 0x01, 0x04, 0x00, 0x82, 0x00, 0x47, 0xC0, 0xF8, 0x06, 0x00, 0x18, 0x00, 0x60, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x03, 0xFF, 0xF0, 0x03, 0x00, 0xC0, 0x30, 0x0C, 0x00, 0x00, 0x00, 0x03, 0xFF, 0x00, 0x40, 0x10, 0x04, 0x01, 0x00, 0x40, 0x10, 0x04, 0x01, 0x00, 0x40, 0x10, 0x04, 0x01, 0x00, 0x40, 0x10, 0x04, 0x01, 0x00, 0x40, 0x10, 0x08, 0x06, 0xFE, 0x00, 0xF0, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0xFE, 0x10, 0x30, 0x10, 0xE0, 0x11, 0xC0, 0x13, 0x00, 0x16, 0x00, 0x1E, 0x00, 0x1B, 0x00, 0x11, 0x80, 0x10, 0xC0, 0x10, 0x60, 0x10, 0x30, 0x10, 0x18, 0x10, 0x1C, 0xF0, 0x3F, 0x7E, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0xFF, 0xFC, 0xEF, 0x9E, 0x07, 0x1E, 0x20, 0xC1, 0x82, 0x10, 0x20, 0x42, 0x04, 0x08, 0x40, 0x81, 0x08, 0x10, 0x21, 0x02, 0x04, 0x20, 0x40, 0x84, 0x08, 0x10, 0x81, 0x02, 0x10, 0x20, 0x42, 0x04, 0x08, 0x40, 0x81, 0x3E, 0x1C, 0x38, 0x71, 0xF0, 0x0B, 0x06, 0x07, 0x01, 0x03, 0x00, 0x41, 0x00, 0x20, 0x80, 0x10, 0x40, 0x08, 0x20, 0x04, 0x10, 0x02, 0x08, 0x01, 0x04, 0x00, 0x82, 0x00, 0x41, 0x00, 0x20, 0x80, 0x13, 0xF0, 0x3E, 0x07, 0xC0, 0x30, 0x60, 0x80, 0x22, 0x00, 0x24, 0x00, 0x50, 0x00, 0x60, 0x00, 0xC0, 0x01, 0x80, 0x03, 0x00, 0x05, 0x00, 0x12, 0x00, 0x22, 0x00, 0x83, 0x06, 0x01, 0xF0, 0x00, 0xF1, 0xFC, 0x05, 0xC1, 0x81, 0xC0, 0x10, 0x60, 0x02, 0x18, 0x00, 0xC4, 0x00, 0x11, 0x00, 0x04, 0x40, 0x01, 0x10, 0x00, 0x44, 0x00, 0x11, 0x80, 0x08, 0x60, 0x02, 0x14, 0x01, 0x04, 0xC1, 0x81, 0x0F, 0x80, 0x40, 0x00, 0x10, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x10, 0x00, 0x3F, 0xC0, 0x00, 0x0F, 0xE3, 0xC6, 0x0E, 0x86, 0x00, 0xE1, 0x00, 0x18, 0xC0, 0x06, 0x20, 0x00, 0x88, 0x00, 0x22, 0x00, 0x08, 0x80, 0x02, 0x20, 0x00, 0x84, 0x00, 0x61, 0x00, 0x18, 0x20, 0x0A, 0x06, 0x0C, 0x80, 0x7C, 0x20, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x80, 0x00, 0x20, 0x00, 0x08, 0x00, 0x02, 0x00, 0x0F, 0xF0, 0xF8, 0x7C, 0x11, 0x8C, 0x2C, 0x00, 0x70, 0x00, 0xC0, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x3F, 0xFC, 0x00, 0x0F, 0xD1, 0x83, 0x98, 0x04, 0x80, 0x24, 0x00, 0x30, 0x00, 0xF0, 0x00, 0xFC, 0x00, 0x30, 0x00, 0xE0, 0x03, 0x00, 0x1C, 0x01, 0xF0, 0x1A, 0x7F, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0xFF, 0xFC, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x01, 0x06, 0x0F, 0x03, 0xF8, 0xF0, 0x3E, 0x08, 0x01, 0x04, 0x00, 0x82, 0x00, 0x41, 0x00, 0x20, 0x80, 0x10, 0x40, 0x08, 0x20, 0x04, 0x10, 0x02, 0x08, 0x01, 0x04, 0x00, 0x82, 0x00, 0x41, 0x00, 0xE0, 0x41, 0xD0, 0x1F, 0x8E, 0xFE, 0x0F, 0xE2, 0x00, 0x20, 0x60, 0x0C, 0x0C, 0x01, 0x80, 0x80, 0x20, 0x18, 0x0C, 0x01, 0x01, 0x00, 0x30, 0x60, 0x02, 0x08, 0x00, 0x41, 0x00, 0x0C, 0x60, 0x00, 0x88, 0x00, 0x19, 0x00, 0x01, 0x40, 0x00, 0x38, 0x00, 0xFC, 0x07, 0xE4, 0x00, 0x10, 0x80, 0x02, 0x18, 0x20, 0xC3, 0x0E, 0x18, 0x21, 0x42, 0x04, 0x28, 0x40, 0x8D, 0x88, 0x19, 0x93, 0x03, 0x22, 0x60, 0x2C, 0x68, 0x05, 0x85, 0x00, 0xA0, 0xA0, 0x1C, 0x1C, 0x01, 0x81, 0x80, 0x7C, 0x1F, 0x18, 0x03, 0x06, 0x03, 0x01, 0x83, 0x00, 0x63, 0x00, 0x1B, 0x00, 0x07, 0x00, 0x03, 0x80, 0x03, 0x60, 0x03, 0x18, 0x03, 0x06, 0x03, 0x01, 0x83, 0x00, 0x61, 0x00, 0x33, 0xF0, 0x7E, 0xFC, 0x1F, 0x90, 0x01, 0x8C, 0x00, 0x86, 0x00, 0xC1, 0x80, 0x40, 0xC0, 0x60, 0x20, 0x20, 0x18, 0x30, 0x04, 0x10, 0x03, 0x08, 0x00, 0x8C, 0x00, 0x64, 0x00, 0x16, 0x00, 0x0E, 0x00, 0x07, 0x00, 0x01, 0x00, 0x01, 0x80, 0x00, 0x80, 0x00, 0xC0, 0x00, 0x60, 0x00, 0x20, 0x07, 0xFE, 0x00, 0xFF, 0xF4, 0x01, 0x20, 0x09, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00, 0xC0, 0x04, 0x00, 0x40, 0x04, 0x00, 0x40, 0x14, 0x00, 0xA0, 0x07, 0xFF, 0xE0, 0x07, 0x0C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x30, 0xC0, 0x30, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0C, 0x07, 0xFF, 0xFF, 0xFF, 0x80, 0xE0, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x07, 0x0C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x30, 0xE0, 0x1C, 0x00, 0x44, 0x0D, 0x84, 0x36, 0x04, 0x40, 0x07, 0x00 ] FreeMono18pt7bGlyphs = [ [ 0, 0, 0, 21, 0, 1 ], # 0x20 ' ' [ 0, 4, 22, 21, 8, -21 ], # 0x21 '!' [ 11, 11, 10, 21, 5, -20 ], # 0x22 '"' [ 25, 14, 24, 21, 3, -21 ], # 0x23 '#' [ 67, 13, 26, 21, 4, -22 ], # 0x24 '$' [ 110, 15, 21, 21, 3, -20 ], # 0x25 '%' [ 150, 12, 18, 21, 4, -17 ], # 0x26 '&' [ 177, 4, 10, 21, 8, -20 ], # 0x27 ''' [ 182, 5, 25, 21, 10, -20 ], # 0x28 '(' [ 198, 5, 25, 21, 6, -20 ], # 0x29 ')' [ 214, 13, 12, 21, 4, -20 ], # 0x2A '#' [ 234, 15, 17, 21, 3, -17 ], # 0x2B '+' [ 266, 7, 10, 21, 5, -4 ], # 0x2C ',' [ 275, 15, 1, 21, 3, -9 ], # 0x2D '-' [ 277, 5, 5, 21, 8, -4 ], # 0x2E '.' [ 281, 13, 26, 21, 4, -22 ], # 0x2F '/' [ 324, 13, 21, 21, 4, -20 ], # 0x30 '0' [ 359, 13, 21, 21, 4, -20 ], # 0x31 '1' [ 394, 13, 21, 21, 3, -20 ], # 0x32 '2' [ 429, 14, 21, 21, 3, -20 ], # 0x33 '3' [ 466, 12, 21, 21, 4, -20 ], # 0x34 '4' [ 498, 14, 21, 21, 3, -20 ], # 0x35 '5' [ 535, 12, 21, 21, 5, -20 ], # 0x36 '6' [ 567, 12, 21, 21, 4, -20 ], # 0x37 '7' [ 599, 13, 21, 21, 4, -20 ], # 0x38 '8' [ 634, 12, 21, 21, 5, -20 ], # 0x39 '9' [ 666, 5, 15, 21, 8, -14 ], # 0x3A ':' [ 676, 7, 20, 21, 5, -14 ], # 0x3B '' [ 694, 15, 16, 21, 3, -17 ], # 0x3C '<' [ 724, 17, 6, 21, 2, -12 ], # 0x3D '=' [ 737, 15, 16, 21, 3, -17 ], # 0x3E '>' [ 767, 12, 20, 21, 5, -19 ], # 0x3F '?' [ 797, 13, 23, 21, 4, -20 ], # 0x40 '@' [ 835, 21, 20, 21, 0, -19 ], # 0x41 'A' [ 888, 18, 20, 21, 1, -19 ], # 0x42 'B' [ 933, 17, 20, 21, 2, -19 ], # 0x43 'C' [ 976, 16, 20, 21, 2, -19 ], # 0x44 'D' [ 1016, 17, 20, 21, 1, -19 ], # 0x45 'E' [ 1059, 17, 20, 21, 1, -19 ], # 0x46 'F' [ 1102, 17, 20, 21, 2, -19 ], # 0x47 'G' [ 1145, 16, 20, 21, 2, -19 ], # 0x48 'H' [ 1185, 13, 20, 21, 4, -19 ], # 0x49 'I' [ 1218, 17, 20, 21, 3, -19 ], # 0x4A 'J' [ 1261, 18, 20, 21, 1, -19 ], # 0x4B 'K' [ 1306, 15, 20, 21, 3, -19 ], # 0x4C 'L' [ 1344, 19, 20, 21, 1, -19 ], # 0x4D 'M' [ 1392, 18, 20, 21, 1, -19 ], # 0x4E 'N' [ 1437, 17, 20, 21, 2, -19 ], # 0x4F 'O' [ 1480, 16, 20, 21, 1, -19 ], # 0x50 'P' [ 1520, 17, 24, 21, 2, -19 ], # 0x51 'Q' [ 1571, 19, 20, 21, 1, -19 ], # 0x52 'R' [ 1619, 14, 20, 21, 3, -19 ], # 0x53 'S' [ 1654, 15, 20, 21, 3, -19 ], # 0x54 'T' [ 1692, 17, 20, 21, 2, -19 ], # 0x55 'U' [ 1735, 21, 20, 21, 0, -19 ], # 0x56 'V' [ 1788, 19, 20, 21, 1, -19 ], # 0x57 'W' [ 1836, 19, 20, 21, 1, -19 ], # 0x58 'X' [ 1884, 17, 20, 21, 2, -19 ], # 0x59 'Y' [ 1927, 13, 20, 21, 4, -19 ], # 0x5A 'Z' [ 1960, 5, 25, 21, 10, -20 ], # 0x5B '[' [ 1976, 13, 26, 21, 4, -22 ], # 0x5C '\' [ 2019, 5, 25, 21, 6, -20 ], # 0x5D ']' [ 2035, 13, 9, 21, 4, -20 ], # 0x5E '^' [ 2050, 21, 1, 21, 0, 4 ], # 0x5F '_' [ 2053, 6, 5, 21, 5, -21 ], # 0x60 '`' [ 2057, 16, 15, 21, 3, -14 ], # 0x61 'a' [ 2087, 18, 21, 21, 1, -20 ], # 0x62 'b' [ 2135, 15, 15, 21, 3, -14 ], # 0x63 'c' [ 2164, 18, 21, 21, 2, -20 ], # 0x64 'd' [ 2212, 16, 15, 21, 2, -14 ], # 0x65 'e' [ 2242, 14, 21, 21, 4, -20 ], # 0x66 'f' [ 2279, 17, 22, 21, 2, -14 ], # 0x67 'g' [ 2326, 17, 21, 21, 1, -20 ], # 0x68 'h' [ 2371, 14, 22, 21, 4, -21 ], # 0x69 'i' [ 2410, 10, 29, 21, 5, -21 ], # 0x6A 'j' [ 2447, 16, 21, 21, 2, -20 ], # 0x6B 'k' [ 2489, 14, 21, 21, 4, -20 ], # 0x6C 'l' [ 2526, 19, 15, 21, 1, -14 ], # 0x6D 'm' [ 2562, 17, 15, 21, 1, -14 ], # 0x6E 'n' [ 2594, 15, 15, 21, 3, -14 ], # 0x6F 'o' [ 2623, 18, 22, 21, 1, -14 ], # 0x70 'p' [ 2673, 18, 22, 21, 2, -14 ], # 0x71 'q' [ 2723, 15, 15, 21, 3, -14 ], # 0x72 'r' [ 2752, 13, 15, 21, 4, -14 ], # 0x73 's' [ 2777, 16, 20, 21, 1, -19 ], # 0x74 't' [ 2817, 17, 15, 21, 1, -14 ], # 0x75 'u' [ 2849, 19, 15, 21, 1, -14 ], # 0x76 'v' [ 2885, 19, 15, 21, 1, -14 ], # 0x77 'w' [ 2921, 17, 15, 21, 2, -14 ], # 0x78 'x' [ 2953, 17, 22, 21, 2, -14 ], # 0x79 'y' [ 3000, 13, 15, 21, 4, -14 ], # 0x7A 'z' [ 3025, 8, 25, 21, 6, -20 ], # 0x7B '[' [ 3050, 1, 25, 21, 10, -20 ], # 0x7C '|' [ 3054, 8, 25, 21, 7, -20 ], # 0x7D ']' [ 3079, 15, 5, 21, 3, -11 ] ] # 0x7E '~' FreeMono18pt7b = [ FreeMono18pt7bBitmaps, FreeMono18pt7bGlyphs, 0x20, 0x7E, 35 ] # Approx. 3761 bytes
free_mono18pt7b_bitmaps = [39, 119, 119, 119, 119, 34, 34, 32, 0, 111, 246, 241, 254, 63, 199, 248, 255, 30, 195, 152, 51, 6, 96, 204, 24, 4, 32, 16, 128, 66, 1, 8, 4, 32, 16, 128, 66, 1, 16, 4, 65, 255, 240, 68, 2, 16, 8, 64, 33, 15, 255, 194, 16, 8, 64, 33, 0, 132, 2, 16, 8, 64, 35, 0, 136, 2, 32, 2, 0, 16, 0, 128, 31, 163, 7, 16, 9, 0, 72, 0, 64, 3, 0, 12, 0, 60, 0, 30, 0, 24, 0, 32, 1, 128, 12, 0, 112, 5, 224, 201, 248, 1, 0, 8, 0, 64, 2, 0, 16, 0, 30, 0, 66, 1, 2, 2, 4, 4, 8, 8, 16, 8, 64, 15, 0, 0, 30, 1, 240, 31, 1, 224, 14, 0, 0, 60, 0, 134, 2, 6, 4, 4, 8, 8, 16, 48, 16, 192, 30, 0, 15, 193, 0, 32, 2, 0, 32, 2, 0, 16, 1, 0, 8, 3, 192, 108, 60, 98, 130, 104, 52, 129, 204, 8, 97, 195, 231, 255, 255, 246, 102, 102, 8, 196, 98, 49, 140, 198, 49, 140, 99, 24, 195, 24, 194, 24, 195, 24, 134, 16, 194, 24, 198, 16, 198, 49, 140, 99, 24, 140, 98, 49, 152, 128, 2, 0, 16, 0, 128, 4, 12, 33, 157, 112, 28, 0, 160, 13, 128, 198, 4, 16, 64, 128, 1, 0, 2, 0, 4, 0, 8, 0, 16, 0, 32, 0, 64, 0, 128, 255, 254, 2, 0, 4, 0, 8, 0, 16, 0, 32, 0, 64, 0, 128, 1, 0, 62, 120, 243, 199, 142, 24, 112, 193, 128, 255, 254, 119, 255, 247, 0, 0, 8, 0, 192, 4, 0, 96, 2, 0, 48, 1, 0, 24, 0, 128, 12, 0, 64, 2, 0, 32, 1, 0, 16, 0, 128, 8, 0, 64, 4, 0, 32, 2, 0, 16, 1, 0, 8, 0, 128, 4, 0, 0, 15, 129, 130, 8, 8, 128, 36, 1, 96, 14, 0, 48, 1, 128, 12, 0, 96, 3, 0, 24, 0, 192, 6, 0, 48, 3, 64, 18, 0, 136, 8, 96, 192, 248, 0, 6, 0, 112, 6, 128, 100, 6, 32, 49, 0, 8, 0, 64, 2, 0, 16, 0, 128, 4, 0, 32, 1, 0, 8, 0, 64, 2, 0, 16, 0, 128, 4, 15, 255, 128, 15, 128, 195, 8, 4, 128, 36, 0, 128, 4, 0, 32, 2, 0, 16, 1, 0, 16, 1, 128, 24, 1, 128, 24, 1, 128, 24, 1, 128, 88, 3, 128, 31, 255, 128, 15, 192, 192, 134, 1, 0, 2, 0, 8, 0, 32, 0, 128, 4, 0, 32, 15, 0, 6, 0, 4, 0, 8, 0, 16, 0, 64, 1, 0, 4, 0, 44, 1, 156, 12, 15, 192, 1, 192, 20, 2, 64, 100, 4, 64, 196, 8, 65, 132, 16, 66, 4, 32, 68, 4, 64, 72, 4, 255, 240, 4, 0, 64, 4, 0, 64, 4, 7, 240, 63, 240, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 11, 240, 48, 48, 0, 96, 0, 128, 1, 0, 4, 0, 16, 0, 64, 1, 0, 14, 0, 44, 1, 12, 24, 15, 192, 1, 240, 96, 24, 3, 0, 32, 4, 0, 64, 12, 0, 128, 8, 248, 152, 74, 2, 224, 60, 1, 128, 20, 1, 64, 20, 3, 32, 33, 12, 15, 128, 255, 248, 1, 128, 24, 3, 0, 32, 2, 0, 32, 4, 0, 64, 4, 0, 192, 8, 0, 128, 24, 1, 0, 16, 1, 0, 48, 2, 0, 32, 2, 0, 15, 129, 131, 16, 5, 128, 56, 0, 192, 6, 0, 48, 3, 64, 17, 131, 7, 240, 96, 196, 1, 96, 14, 0, 48, 1, 128, 14, 0, 208, 4, 96, 193, 252, 0, 31, 3, 8, 64, 76, 2, 128, 40, 2, 128, 24, 3, 192, 116, 5, 33, 145, 241, 0, 16, 3, 0, 32, 2, 0, 64, 12, 1, 128, 96, 248, 0, 119, 255, 247, 0, 0, 0, 29, 255, 253, 192, 28, 124, 249, 241, 192, 0, 0, 0, 0, 241, 227, 143, 28, 56, 225, 195, 6, 0, 0, 6, 0, 24, 0, 224, 7, 0, 56, 1, 192, 6, 0, 56, 0, 224, 0, 112, 0, 56, 0, 24, 0, 28, 0, 14, 0, 7, 0, 3, 255, 255, 128, 0, 0, 0, 0, 0, 0, 0, 7, 255, 252, 192, 0, 192, 0, 224, 0, 112, 0, 56, 0, 28, 0, 12, 0, 14, 0, 14, 0, 112, 3, 128, 12, 0, 112, 3, 128, 28, 0, 96, 0, 63, 142, 12, 128, 40, 1, 128, 16, 1, 0, 16, 2, 0, 192, 56, 6, 0, 64, 4, 0, 0, 0, 0, 0, 14, 1, 240, 31, 0, 224, 15, 1, 134, 8, 8, 128, 36, 1, 64, 10, 0, 80, 30, 131, 20, 32, 162, 5, 16, 40, 129, 70, 10, 24, 80, 63, 128, 4, 0, 16, 0, 128, 2, 0, 24, 24, 63, 0, 31, 240, 0, 6, 128, 0, 52, 0, 1, 48, 0, 24, 128, 0, 134, 0, 4, 48, 0, 96, 128, 2, 6, 0, 16, 16, 1, 128, 128, 8, 6, 0, 127, 240, 6, 0, 128, 32, 6, 1, 0, 16, 24, 0, 192, 128, 6, 4, 0, 17, 252, 15, 240, 255, 248, 4, 1, 1, 0, 32, 64, 4, 16, 1, 4, 0, 65, 0, 16, 64, 8, 16, 12, 7, 255, 1, 0, 112, 64, 6, 16, 0, 132, 0, 17, 0, 4, 64, 1, 16, 0, 68, 0, 33, 0, 51, 255, 248, 3, 241, 6, 14, 140, 1, 196, 0, 100, 0, 18, 0, 10, 0, 1, 0, 0, 128, 0, 64, 0, 32, 0, 16, 0, 8, 0, 4, 0, 1, 0, 0, 128, 0, 32, 1, 136, 1, 131, 3, 128, 126, 0, 255, 224, 32, 24, 32, 12, 32, 4, 32, 2, 32, 2, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 2, 32, 2, 32, 4, 32, 12, 32, 24, 255, 224, 255, 255, 8, 0, 132, 0, 66, 0, 33, 0, 16, 128, 0, 64, 0, 32, 64, 16, 32, 15, 240, 4, 8, 2, 4, 1, 0, 0, 128, 0, 64, 2, 32, 1, 16, 0, 136, 0, 68, 0, 63, 255, 240, 255, 255, 136, 0, 68, 0, 34, 0, 17, 0, 8, 128, 0, 64, 0, 32, 64, 16, 32, 15, 240, 4, 8, 2, 4, 1, 0, 0, 128, 0, 64, 0, 32, 0, 16, 0, 8, 0, 4, 0, 31, 248, 0, 3, 249, 6, 7, 132, 0, 196, 0, 36, 0, 18, 0, 2, 0, 1, 0, 0, 128, 0, 64, 0, 32, 0, 16, 15, 248, 0, 20, 0, 9, 0, 4, 128, 2, 32, 1, 24, 0, 131, 1, 192, 127, 0, 252, 63, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 63, 252, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 252, 63, 255, 248, 16, 0, 128, 4, 0, 32, 1, 0, 8, 0, 64, 2, 0, 16, 0, 128, 4, 0, 32, 1, 0, 8, 0, 64, 2, 0, 16, 0, 129, 255, 240, 3, 255, 128, 4, 0, 2, 0, 1, 0, 0, 128, 0, 64, 0, 32, 0, 16, 0, 8, 0, 4, 0, 2, 16, 1, 8, 0, 132, 0, 66, 0, 33, 0, 16, 128, 16, 32, 24, 12, 24, 1, 240, 0, 255, 31, 132, 1, 129, 0, 192, 64, 96, 16, 48, 4, 24, 1, 12, 0, 70, 0, 19, 0, 5, 240, 1, 198, 0, 96, 192, 16, 24, 4, 6, 1, 0, 192, 64, 48, 16, 4, 4, 1, 129, 0, 35, 252, 15, 255, 128, 16, 0, 32, 0, 64, 0, 128, 1, 0, 2, 0, 4, 0, 8, 0, 16, 0, 32, 0, 64, 0, 128, 1, 0, 66, 0, 132, 1, 8, 2, 16, 4, 32, 15, 255, 240, 240, 1, 231, 0, 112, 160, 10, 22, 3, 66, 64, 72, 76, 25, 8, 130, 33, 16, 68, 35, 24, 132, 34, 16, 134, 194, 16, 80, 66, 14, 8, 65, 193, 8, 0, 33, 0, 4, 32, 0, 132, 0, 16, 128, 2, 127, 3, 240, 248, 31, 198, 0, 65, 192, 16, 80, 4, 18, 1, 4, 192, 65, 16, 16, 70, 4, 16, 129, 4, 16, 65, 4, 16, 64, 132, 16, 49, 4, 4, 65, 1, 144, 64, 36, 16, 5, 4, 1, 193, 0, 49, 252, 12, 3, 224, 6, 12, 4, 1, 4, 0, 70, 0, 50, 0, 11, 0, 5, 0, 1, 128, 0, 192, 0, 96, 0, 48, 0, 24, 0, 14, 0, 13, 0, 4, 192, 6, 32, 2, 8, 2, 3, 6, 0, 124, 0, 255, 240, 16, 12, 16, 2, 16, 3, 16, 1, 16, 1, 16, 1, 16, 3, 16, 6, 16, 12, 31, 240, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 255, 192, 3, 224, 6, 12, 4, 1, 4, 0, 70, 0, 50, 0, 11, 0, 7, 0, 1, 128, 0, 192, 0, 96, 0, 48, 0, 24, 0, 14, 0, 13, 0, 4, 192, 6, 32, 2, 8, 2, 3, 6, 0, 252, 0, 48, 0, 48, 0, 127, 198, 56, 30, 255, 240, 2, 1, 128, 64, 8, 8, 1, 129, 0, 16, 32, 2, 4, 0, 64, 128, 24, 16, 6, 2, 3, 128, 127, 192, 8, 24, 1, 1, 128, 32, 24, 4, 1, 128, 128, 16, 16, 3, 2, 0, 32, 64, 6, 127, 128, 112, 15, 200, 97, 226, 1, 144, 2, 64, 9, 0, 4, 0, 8, 0, 56, 0, 62, 0, 15, 0, 6, 0, 12, 0, 24, 0, 96, 1, 128, 15, 0, 43, 3, 35, 240, 255, 255, 2, 6, 4, 12, 8, 24, 16, 32, 32, 0, 64, 0, 128, 1, 0, 2, 0, 4, 0, 8, 0, 16, 0, 32, 0, 64, 0, 128, 1, 0, 2, 0, 4, 1, 255, 192, 252, 31, 144, 1, 8, 0, 132, 0, 66, 0, 33, 0, 16, 128, 8, 64, 4, 32, 2, 16, 1, 8, 0, 132, 0, 66, 0, 33, 0, 16, 128, 8, 64, 4, 16, 4, 12, 6, 3, 6, 0, 124, 0, 254, 3, 248, 128, 2, 4, 0, 16, 48, 1, 128, 128, 8, 6, 0, 192, 48, 6, 0, 128, 32, 6, 3, 0, 48, 16, 0, 128, 128, 6, 12, 0, 16, 64, 0, 134, 0, 6, 32, 0, 17, 0, 0, 216, 0, 6, 128, 0, 28, 0, 0, 224, 0, 252, 15, 232, 0, 25, 0, 3, 16, 0, 98, 0, 8, 65, 129, 8, 40, 33, 5, 4, 33, 160, 132, 54, 48, 132, 70, 8, 136, 193, 49, 24, 36, 18, 4, 130, 64, 176, 72, 20, 9, 2, 128, 160, 48, 28, 6, 3, 128, 126, 15, 194, 0, 96, 96, 12, 6, 3, 0, 96, 192, 12, 16, 0, 198, 0, 13, 128, 0, 160, 0, 28, 0, 3, 128, 0, 216, 0, 17, 0, 6, 48, 1, 131, 0, 96, 48, 8, 6, 3, 0, 96, 192, 6, 127, 7, 240, 252, 31, 152, 3, 4, 1, 3, 1, 128, 193, 128, 32, 128, 24, 192, 4, 64, 3, 96, 0, 224, 0, 32, 0, 16, 0, 8, 0, 4, 0, 2, 0, 1, 0, 0, 128, 0, 64, 0, 32, 3, 255, 128, 255, 244, 0, 160, 9, 0, 72, 4, 64, 64, 2, 0, 32, 2, 0, 16, 1, 0, 16, 0, 128, 8, 4, 128, 36, 1, 64, 12, 0, 96, 3, 255, 240, 252, 33, 8, 66, 16, 132, 33, 8, 66, 16, 132, 33, 8, 66, 16, 248, 128, 2, 0, 16, 0, 192, 2, 0, 24, 0, 64, 3, 0, 8, 0, 64, 1, 0, 8, 0, 32, 1, 0, 4, 0, 32, 0, 128, 4, 0, 16, 0, 128, 2, 0, 16, 0, 64, 2, 0, 8, 0, 64, 248, 66, 16, 132, 33, 8, 66, 16, 132, 33, 8, 66, 16, 132, 33, 248, 2, 0, 56, 3, 96, 17, 1, 140, 24, 49, 128, 216, 3, 128, 8, 255, 255, 248, 193, 131, 6, 12, 15, 192, 112, 48, 0, 16, 0, 8, 0, 8, 0, 8, 15, 248, 48, 8, 64, 8, 128, 8, 128, 8, 128, 8, 128, 56, 96, 232, 63, 143, 240, 0, 4, 0, 1, 0, 0, 64, 0, 16, 0, 4, 0, 1, 15, 128, 76, 24, 20, 1, 6, 0, 33, 128, 8, 64, 1, 16, 0, 68, 0, 17, 0, 4, 64, 1, 24, 0, 134, 0, 33, 192, 16, 92, 24, 241, 248, 0, 7, 228, 48, 120, 128, 50, 0, 36, 0, 80, 0, 32, 0, 64, 0, 128, 1, 0, 3, 0, 2, 0, 18, 0, 195, 7, 1, 248, 0, 0, 30, 0, 0, 128, 0, 32, 0, 8, 0, 2, 0, 0, 128, 124, 32, 96, 200, 32, 10, 16, 1, 132, 0, 98, 0, 8, 128, 2, 32, 0, 136, 0, 34, 0, 8, 192, 6, 16, 1, 130, 0, 224, 96, 232, 15, 227, 192, 7, 224, 28, 24, 48, 12, 96, 6, 64, 3, 192, 3, 192, 1, 255, 255, 192, 0, 192, 0, 64, 0, 96, 0, 48, 3, 12, 14, 3, 240, 3, 252, 24, 0, 128, 2, 0, 8, 0, 32, 15, 255, 130, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 255, 240, 15, 199, 156, 58, 24, 7, 8, 1, 140, 0, 196, 0, 34, 0, 17, 0, 8, 128, 4, 64, 2, 16, 3, 8, 1, 130, 1, 64, 195, 32, 63, 16, 0, 8, 0, 4, 0, 2, 0, 1, 0, 1, 0, 1, 0, 127, 0, 240, 0, 8, 0, 4, 0, 2, 0, 1, 0, 0, 128, 0, 71, 192, 44, 24, 28, 4, 12, 1, 4, 0, 130, 0, 65, 0, 32, 128, 16, 64, 8, 32, 4, 16, 2, 8, 1, 4, 0, 130, 0, 71, 192, 248, 6, 0, 24, 0, 96, 1, 128, 0, 0, 0, 0, 0, 31, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 3, 255, 240, 3, 0, 192, 48, 12, 0, 0, 0, 3, 255, 0, 64, 16, 4, 1, 0, 64, 16, 4, 1, 0, 64, 16, 4, 1, 0, 64, 16, 4, 1, 0, 64, 16, 8, 6, 254, 0, 240, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 254, 16, 48, 16, 224, 17, 192, 19, 0, 22, 0, 30, 0, 27, 0, 17, 128, 16, 192, 16, 96, 16, 48, 16, 24, 16, 28, 240, 63, 126, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 255, 252, 239, 158, 7, 30, 32, 193, 130, 16, 32, 66, 4, 8, 64, 129, 8, 16, 33, 2, 4, 32, 64, 132, 8, 16, 129, 2, 16, 32, 66, 4, 8, 64, 129, 62, 28, 56, 113, 240, 11, 6, 7, 1, 3, 0, 65, 0, 32, 128, 16, 64, 8, 32, 4, 16, 2, 8, 1, 4, 0, 130, 0, 65, 0, 32, 128, 19, 240, 62, 7, 192, 48, 96, 128, 34, 0, 36, 0, 80, 0, 96, 0, 192, 1, 128, 3, 0, 5, 0, 18, 0, 34, 0, 131, 6, 1, 240, 0, 241, 252, 5, 193, 129, 192, 16, 96, 2, 24, 0, 196, 0, 17, 0, 4, 64, 1, 16, 0, 68, 0, 17, 128, 8, 96, 2, 20, 1, 4, 193, 129, 15, 128, 64, 0, 16, 0, 4, 0, 1, 0, 0, 64, 0, 16, 0, 63, 192, 0, 15, 227, 198, 14, 134, 0, 225, 0, 24, 192, 6, 32, 0, 136, 0, 34, 0, 8, 128, 2, 32, 0, 132, 0, 97, 0, 24, 32, 10, 6, 12, 128, 124, 32, 0, 8, 0, 2, 0, 0, 128, 0, 32, 0, 8, 0, 2, 0, 15, 240, 248, 124, 17, 140, 44, 0, 112, 0, 192, 1, 0, 2, 0, 4, 0, 8, 0, 16, 0, 32, 0, 64, 0, 128, 1, 0, 63, 252, 0, 15, 209, 131, 152, 4, 128, 36, 0, 48, 0, 240, 0, 252, 0, 48, 0, 224, 3, 0, 28, 1, 240, 26, 127, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 255, 252, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 1, 6, 15, 3, 248, 240, 62, 8, 1, 4, 0, 130, 0, 65, 0, 32, 128, 16, 64, 8, 32, 4, 16, 2, 8, 1, 4, 0, 130, 0, 65, 0, 224, 65, 208, 31, 142, 254, 15, 226, 0, 32, 96, 12, 12, 1, 128, 128, 32, 24, 12, 1, 1, 0, 48, 96, 2, 8, 0, 65, 0, 12, 96, 0, 136, 0, 25, 0, 1, 64, 0, 56, 0, 252, 7, 228, 0, 16, 128, 2, 24, 32, 195, 14, 24, 33, 66, 4, 40, 64, 141, 136, 25, 147, 3, 34, 96, 44, 104, 5, 133, 0, 160, 160, 28, 28, 1, 129, 128, 124, 31, 24, 3, 6, 3, 1, 131, 0, 99, 0, 27, 0, 7, 0, 3, 128, 3, 96, 3, 24, 3, 6, 3, 1, 131, 0, 97, 0, 51, 240, 126, 252, 31, 144, 1, 140, 0, 134, 0, 193, 128, 64, 192, 96, 32, 32, 24, 48, 4, 16, 3, 8, 0, 140, 0, 100, 0, 22, 0, 14, 0, 7, 0, 1, 0, 1, 128, 0, 128, 0, 192, 0, 96, 0, 32, 7, 254, 0, 255, 244, 1, 32, 9, 0, 128, 8, 0, 128, 8, 0, 192, 4, 0, 64, 4, 0, 64, 20, 0, 160, 7, 255, 224, 7, 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 48, 192, 48, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 7, 255, 255, 255, 128, 224, 48, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 48, 224, 28, 0, 68, 13, 132, 54, 4, 64, 7, 0] free_mono18pt7b_glyphs = [[0, 0, 0, 21, 0, 1], [0, 4, 22, 21, 8, -21], [11, 11, 10, 21, 5, -20], [25, 14, 24, 21, 3, -21], [67, 13, 26, 21, 4, -22], [110, 15, 21, 21, 3, -20], [150, 12, 18, 21, 4, -17], [177, 4, 10, 21, 8, -20], [182, 5, 25, 21, 10, -20], [198, 5, 25, 21, 6, -20], [214, 13, 12, 21, 4, -20], [234, 15, 17, 21, 3, -17], [266, 7, 10, 21, 5, -4], [275, 15, 1, 21, 3, -9], [277, 5, 5, 21, 8, -4], [281, 13, 26, 21, 4, -22], [324, 13, 21, 21, 4, -20], [359, 13, 21, 21, 4, -20], [394, 13, 21, 21, 3, -20], [429, 14, 21, 21, 3, -20], [466, 12, 21, 21, 4, -20], [498, 14, 21, 21, 3, -20], [535, 12, 21, 21, 5, -20], [567, 12, 21, 21, 4, -20], [599, 13, 21, 21, 4, -20], [634, 12, 21, 21, 5, -20], [666, 5, 15, 21, 8, -14], [676, 7, 20, 21, 5, -14], [694, 15, 16, 21, 3, -17], [724, 17, 6, 21, 2, -12], [737, 15, 16, 21, 3, -17], [767, 12, 20, 21, 5, -19], [797, 13, 23, 21, 4, -20], [835, 21, 20, 21, 0, -19], [888, 18, 20, 21, 1, -19], [933, 17, 20, 21, 2, -19], [976, 16, 20, 21, 2, -19], [1016, 17, 20, 21, 1, -19], [1059, 17, 20, 21, 1, -19], [1102, 17, 20, 21, 2, -19], [1145, 16, 20, 21, 2, -19], [1185, 13, 20, 21, 4, -19], [1218, 17, 20, 21, 3, -19], [1261, 18, 20, 21, 1, -19], [1306, 15, 20, 21, 3, -19], [1344, 19, 20, 21, 1, -19], [1392, 18, 20, 21, 1, -19], [1437, 17, 20, 21, 2, -19], [1480, 16, 20, 21, 1, -19], [1520, 17, 24, 21, 2, -19], [1571, 19, 20, 21, 1, -19], [1619, 14, 20, 21, 3, -19], [1654, 15, 20, 21, 3, -19], [1692, 17, 20, 21, 2, -19], [1735, 21, 20, 21, 0, -19], [1788, 19, 20, 21, 1, -19], [1836, 19, 20, 21, 1, -19], [1884, 17, 20, 21, 2, -19], [1927, 13, 20, 21, 4, -19], [1960, 5, 25, 21, 10, -20], [1976, 13, 26, 21, 4, -22], [2019, 5, 25, 21, 6, -20], [2035, 13, 9, 21, 4, -20], [2050, 21, 1, 21, 0, 4], [2053, 6, 5, 21, 5, -21], [2057, 16, 15, 21, 3, -14], [2087, 18, 21, 21, 1, -20], [2135, 15, 15, 21, 3, -14], [2164, 18, 21, 21, 2, -20], [2212, 16, 15, 21, 2, -14], [2242, 14, 21, 21, 4, -20], [2279, 17, 22, 21, 2, -14], [2326, 17, 21, 21, 1, -20], [2371, 14, 22, 21, 4, -21], [2410, 10, 29, 21, 5, -21], [2447, 16, 21, 21, 2, -20], [2489, 14, 21, 21, 4, -20], [2526, 19, 15, 21, 1, -14], [2562, 17, 15, 21, 1, -14], [2594, 15, 15, 21, 3, -14], [2623, 18, 22, 21, 1, -14], [2673, 18, 22, 21, 2, -14], [2723, 15, 15, 21, 3, -14], [2752, 13, 15, 21, 4, -14], [2777, 16, 20, 21, 1, -19], [2817, 17, 15, 21, 1, -14], [2849, 19, 15, 21, 1, -14], [2885, 19, 15, 21, 1, -14], [2921, 17, 15, 21, 2, -14], [2953, 17, 22, 21, 2, -14], [3000, 13, 15, 21, 4, -14], [3025, 8, 25, 21, 6, -20], [3050, 1, 25, 21, 10, -20], [3054, 8, 25, 21, 7, -20], [3079, 15, 5, 21, 3, -11]] free_mono18pt7b = [FreeMono18pt7bBitmaps, FreeMono18pt7bGlyphs, 32, 126, 35]
def intervalIntersection(A, B): aIndex = 0 bIndex = 0 toReturn = [] arg1 = A[aIndex] arg2 = B[bIndex] flag = True def compareArrs(aArr, bArr): signifyInd = "" zipComp = zip(aArr, bArr) compList = list(zipComp) lowIntSec = max(compList[0]) highIntSec = min(compList[1]) if aArr[0] > bArr[1]: signifyInd = "B" intersection = "NO INTERSECTION" elif bArr[0] > aArr[1]: signifyInd = "A" intersection = "NO INTERSECTION" else: if aArr[1] == highIntSec: signifyInd = "A" elif bArr[1] == highIntSec: signifyInd = "B" intersection = [lowIntSec, highIntSec] return [intersection, signifyInd] while flag: arg1 = A[aIndex] arg2 = B[bIndex] flag = False result = compareArrs(arg1, arg2) print(result) if result[0] == "NO INTERSECTION": pass else: toReturn.append(result[0]) if result[1] == "A": if aIndex == len(A)-1: print(toReturn) return toReturn else: aIndex += 1 print("aIndex", aIndex) flag = True elif result[1] == "B": if bIndex == len(B)-1: print(toReturn) return toReturn else: bIndex += 1 print("bIndex", bIndex) flag = True return toReturn A = [[0, 2], [5, 10], [13, 23], [24, 25]] B = [[1, 5], [8, 12], [15, 24], [25, 26]] intervalIntersection(A, B)
def interval_intersection(A, B): a_index = 0 b_index = 0 to_return = [] arg1 = A[aIndex] arg2 = B[bIndex] flag = True def compare_arrs(aArr, bArr): signify_ind = '' zip_comp = zip(aArr, bArr) comp_list = list(zipComp) low_int_sec = max(compList[0]) high_int_sec = min(compList[1]) if aArr[0] > bArr[1]: signify_ind = 'B' intersection = 'NO INTERSECTION' elif bArr[0] > aArr[1]: signify_ind = 'A' intersection = 'NO INTERSECTION' else: if aArr[1] == highIntSec: signify_ind = 'A' elif bArr[1] == highIntSec: signify_ind = 'B' intersection = [lowIntSec, highIntSec] return [intersection, signifyInd] while flag: arg1 = A[aIndex] arg2 = B[bIndex] flag = False result = compare_arrs(arg1, arg2) print(result) if result[0] == 'NO INTERSECTION': pass else: toReturn.append(result[0]) if result[1] == 'A': if aIndex == len(A) - 1: print(toReturn) return toReturn else: a_index += 1 print('aIndex', aIndex) flag = True elif result[1] == 'B': if bIndex == len(B) - 1: print(toReturn) return toReturn else: b_index += 1 print('bIndex', bIndex) flag = True return toReturn a = [[0, 2], [5, 10], [13, 23], [24, 25]] b = [[1, 5], [8, 12], [15, 24], [25, 26]] interval_intersection(A, B)
"""Hackerrank Problem: https://www.hackerrank.com/challenges/is-binary-search-tree/problem For the purposes of this challenge, we define a binary tree to be a binary search tree with the following ordering requirements: * The data value of every node in a node's left subtree is less than the data value of that node. * The data value of every node in a node's right subtree is greater than the data value of that node. Given the root node of a binary tree, can you determine if it's also a binary search tree? Complete the function in your editor below, which has 1 parameter: a pointer to the root of a binary tree. It must return a boolean denoting whether or not the binary tree is a binary search tree. You may have to write one or more helper functions to complete this challenge. """ """ Node is defined as class node: def __init__(self, data): self.data = data self.left = None self.right = None """ def inorder_traversal(root): """Function to traverse a binary tree inorder Args: root (Node): The root of a binary tree Returns: (list): List containing all the values of the tree from an inorder search """ res = [] if root: res = inorder_traversal(root.left) res.append(root.data) res = res + inorder_traversal(root.right) return res def check_binary_search_tree_(root): """Function to determine if the tree satisfies the condition to be a binary search tree Args: root (Node): The root of the binary tree to check Returns: (bool): Whether the tree is a binary search tree or not """ res = inorder_traversal(root) return res == sorted(res) and len(res) == len(set(res))
"""Hackerrank Problem: https://www.hackerrank.com/challenges/is-binary-search-tree/problem For the purposes of this challenge, we define a binary tree to be a binary search tree with the following ordering requirements: * The data value of every node in a node's left subtree is less than the data value of that node. * The data value of every node in a node's right subtree is greater than the data value of that node. Given the root node of a binary tree, can you determine if it's also a binary search tree? Complete the function in your editor below, which has 1 parameter: a pointer to the root of a binary tree. It must return a boolean denoting whether or not the binary tree is a binary search tree. You may have to write one or more helper functions to complete this challenge. """ ' Node is defined as\nclass node:\n def __init__(self, data):\n self.data = data\n self.left = None\n self.right = None\n' def inorder_traversal(root): """Function to traverse a binary tree inorder Args: root (Node): The root of a binary tree Returns: (list): List containing all the values of the tree from an inorder search """ res = [] if root: res = inorder_traversal(root.left) res.append(root.data) res = res + inorder_traversal(root.right) return res def check_binary_search_tree_(root): """Function to determine if the tree satisfies the condition to be a binary search tree Args: root (Node): The root of the binary tree to check Returns: (bool): Whether the tree is a binary search tree or not """ res = inorder_traversal(root) return res == sorted(res) and len(res) == len(set(res))
def test_no_metrics(run): tracking = run.tracking metrics = run.dict.pop("metrics") tracking.on_epoch_end(run) run.set(metrics=metrics)
def test_no_metrics(run): tracking = run.tracking metrics = run.dict.pop('metrics') tracking.on_epoch_end(run) run.set(metrics=metrics)
"""Top-level package for copyany.""" __author__ = """Natan Bro""" __email__ = 'code@natanbro.com' __version__ = '0.1.0'
"""Top-level package for copyany.""" __author__ = 'Natan Bro' __email__ = 'code@natanbro.com' __version__ = '0.1.0'
# -*- coding: utf-8 -*- VERSION_MAJOR = 0 VERSION_MINOR = 0 VERSION_MICRO = 4 VERSION = (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO) VERSION_STR = '.'.join(map(str, VERSION))
version_major = 0 version_minor = 0 version_micro = 4 version = (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO) version_str = '.'.join(map(str, VERSION))
#!/usr/bin/env python3 def fibs(): fib1, fib2 = 1, 1 while True: yield fib1 fib1, fib2 = fib2, fib1 + fib2 print(next(i for (i, f) in enumerate(fibs(), 1) if len(str(f)) == 1000))
def fibs(): (fib1, fib2) = (1, 1) while True: yield fib1 (fib1, fib2) = (fib2, fib1 + fib2) print(next((i for (i, f) in enumerate(fibs(), 1) if len(str(f)) == 1000)))
""" Given a list of integers and a number K, return which contiguous elements of the list sum to K. """ inp = [1,2,3,4,5] K = 9 def contiguous_sum(arr: list, k: int): start_index = 0 end_index = -1 current_sum = 0 for i in range(len(arr)): if current_sum < k: current_sum += arr[i] if current_sum > k: current_sum -= arr[start_index] start_index += 1 elif current_sum == k: end_index = i break if end_index != -1: return arr[start_index:end_index] else: return [] print(contiguous_sum(inp, K))
""" Given a list of integers and a number K, return which contiguous elements of the list sum to K. """ inp = [1, 2, 3, 4, 5] k = 9 def contiguous_sum(arr: list, k: int): start_index = 0 end_index = -1 current_sum = 0 for i in range(len(arr)): if current_sum < k: current_sum += arr[i] if current_sum > k: current_sum -= arr[start_index] start_index += 1 elif current_sum == k: end_index = i break if end_index != -1: return arr[start_index:end_index] else: return [] print(contiguous_sum(inp, K))
# Copyright 2018 Tensorforce Team. 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. # ============================================================================== def is_iterable(x): if isinstance(x, str): return False try: iter(x) return True except TypeError: return False class TensorforceError(Exception): """ Tensorforce error """ def __init__(self, message): if message[0].islower(): message = message[0].upper() + message[1:] if message[-1] != '.': message = message + '.' super().__init__(message) @staticmethod def unexpected(): return TensorforceError(message="Unexpected error!") @staticmethod def collision(name, value, group1, group2): return TensorforceError( message="{name} collision between {group1} and {group2}: {value}.".format( name=name, group1=group1, group2=group2, value=value ) ) @staticmethod def mismatch(name, value1, value2, argument=None): if argument is None: return TensorforceError( message="{name} mismatch: {value1} <-> {value2}.".format( name=name, value1=value1, value2=value2 ) ) else: return TensorforceError( message="{name} mismatch for argument {argument}: {value1} <-> {value2}.".format( name=name, argument=argument, value1=value1, value2=value2 ) ) @staticmethod def exists(name, value): return TensorforceError( message="{name} already exists: {value}.".format(name=name, value=value) ) @staticmethod def required(name, value): if is_iterable(x=value): value = ', '.join(str(x) for x in value) return TensorforceError( message="Missing {name} value: {value}.".format(name=name, value=value) ) @staticmethod def type(name, value, argument=None): if argument is None: return TensorforceError( message="Invalid {name} type: {type}.".format(name=name, type=type(value)) ) else: return TensorforceError( message="Invalid type for {name} argument {argument}: {type}.".format( name=name, argument=argument, type=type(value) ) ) @staticmethod def value(name, value, argument=None): if isinstance(value, dict): value = str(value) elif is_iterable(x=value): value = ', '.join(str(x) for x in value) if argument is None: return TensorforceError( message="Invalid {name} value: {value}.".format(name=name, value=value) ) else: return TensorforceError( message="Invalid value for {name} argument {argument}: {value}.".format( name=name, argument=argument, value=value ) )
def is_iterable(x): if isinstance(x, str): return False try: iter(x) return True except TypeError: return False class Tensorforceerror(Exception): """ Tensorforce error """ def __init__(self, message): if message[0].islower(): message = message[0].upper() + message[1:] if message[-1] != '.': message = message + '.' super().__init__(message) @staticmethod def unexpected(): return tensorforce_error(message='Unexpected error!') @staticmethod def collision(name, value, group1, group2): return tensorforce_error(message='{name} collision between {group1} and {group2}: {value}.'.format(name=name, group1=group1, group2=group2, value=value)) @staticmethod def mismatch(name, value1, value2, argument=None): if argument is None: return tensorforce_error(message='{name} mismatch: {value1} <-> {value2}.'.format(name=name, value1=value1, value2=value2)) else: return tensorforce_error(message='{name} mismatch for argument {argument}: {value1} <-> {value2}.'.format(name=name, argument=argument, value1=value1, value2=value2)) @staticmethod def exists(name, value): return tensorforce_error(message='{name} already exists: {value}.'.format(name=name, value=value)) @staticmethod def required(name, value): if is_iterable(x=value): value = ', '.join((str(x) for x in value)) return tensorforce_error(message='Missing {name} value: {value}.'.format(name=name, value=value)) @staticmethod def type(name, value, argument=None): if argument is None: return tensorforce_error(message='Invalid {name} type: {type}.'.format(name=name, type=type(value))) else: return tensorforce_error(message='Invalid type for {name} argument {argument}: {type}.'.format(name=name, argument=argument, type=type(value))) @staticmethod def value(name, value, argument=None): if isinstance(value, dict): value = str(value) elif is_iterable(x=value): value = ', '.join((str(x) for x in value)) if argument is None: return tensorforce_error(message='Invalid {name} value: {value}.'.format(name=name, value=value)) else: return tensorforce_error(message='Invalid value for {name} argument {argument}: {value}.'.format(name=name, argument=argument, value=value))
#-*-coding: utf-8 -*- ''' Base cache Adapter object. ''' class BaseAdapter(object): db = None def __init__(self, timeout = -1): self.timeout = timeout def get(self, key): raise NotImplementedError() def set(self, key, value): raise NotImplementedError() def remove(self, key): raise NotImplementedError() def flush(self): raise NotImplementedError()
""" Base cache Adapter object. """ class Baseadapter(object): db = None def __init__(self, timeout=-1): self.timeout = timeout def get(self, key): raise not_implemented_error() def set(self, key, value): raise not_implemented_error() def remove(self, key): raise not_implemented_error() def flush(self): raise not_implemented_error()
def repeated_word(string): # separate the string string = string.split(' ') separated_string = [] for word in string: if word not in separated_string: separated_string.append(word) for word in range(0, len(separated_string)): print(separated_string[word], 'appears', string.count(separated_string[word])) def main(): string = "mercedes mercedes mexico orange spoon orange gary gary" repeated_word(string) if __name__ == "__main__": main()
def repeated_word(string): string = string.split(' ') separated_string = [] for word in string: if word not in separated_string: separated_string.append(word) for word in range(0, len(separated_string)): print(separated_string[word], 'appears', string.count(separated_string[word])) def main(): string = 'mercedes mercedes mexico orange spoon orange gary gary' repeated_word(string) if __name__ == '__main__': main()
#Algorythm: Quicksort (sometimes called partition-exchange sort) #Description: In this file we are using the Hoare partition scheme, #you can seen other implementation in the other quicksort files #Source link: I saw the algorithm explanation on https://en.wikipedia.org/wiki/Quicksort #Use: It is used to sort, it is a comparison sort #Developer: Tony Hoare #Mathematical analysis: It takes O(n log n) comparisons to sort n items, in worst cases it takes O(n^2) #Name: swapValues #Description: This function is used to swap the values of two indexs in an array #Arguments: 3; array is the array where the values are, # x is an index to swap value # y is the other index to swap values #Return: Nothing #Example: swapValues(sampleArray,0,1) def swapValues(array,x,y): #I created this temporal var to avoid call len(array) several times len_arr=len(array) #Tese conditions are done to avoid out of array exceptions if len_arr>0 and x<len_arr and x>=0 and y>=0 and y<len_arr and x!=y: #Just used this for debugging purposes #print("Swap "+str(array[x])+" and "+str(array[y])) temp_var=array[y] array[y]=array[x] array[x]=temp_var #Name: partition #Description: Used to create a partition and order it, swapping values #Arguments: 3; array is the array where the values are, # min_index is the minimum index of the partition # max_index is the maximum index of the partition #Return: 1, an integer which is an index #Example: ret_value = partition(sampleArray,0,20) def partition(array,min_index,max_index): pivot_value = array[min_index] i = min_index - 1 j = max_index + 1 while True: #Since Python doesn't have a 'do'...'while' loop, #we emulate it with something like this i = i + 1 while array[i] < pivot_value: i = i +1 j = j - 1 while array[j] > pivot_value: j = j -1 if i >= j: return j swapValues(array,i,j) #Name: quicksort #Description: The algorithm itself, basically it is the Python implementation #of the Hoare partition scheme of Quicksort algorithm #Arguments: 3; array is the array where the values are, # min_index is the minimum index of the array (or the min # index we want to sort) # max_index is the maximum index of the array (or the max # index we want to sort) #Return: Nothing #Example: quicksort(sampleArray,0,len(sampleArray)-1) (it will sort the entire #sampleArray def quicksort(array,min_index,max_index): if min_index < max_index: p=partition(array,min_index,max_index) quicksort(array,min_index,p) quicksort(array,p+1,max_index) #This is just for testing if everything works arr=[2,7,3,1] print("Unsorted array:") print(arr) quicksort(arr,0,len(arr)-1) print("Sorted array:") print(arr)
def swap_values(array, x, y): len_arr = len(array) if len_arr > 0 and x < len_arr and (x >= 0) and (y >= 0) and (y < len_arr) and (x != y): temp_var = array[y] array[y] = array[x] array[x] = temp_var def partition(array, min_index, max_index): pivot_value = array[min_index] i = min_index - 1 j = max_index + 1 while True: i = i + 1 while array[i] < pivot_value: i = i + 1 j = j - 1 while array[j] > pivot_value: j = j - 1 if i >= j: return j swap_values(array, i, j) def quicksort(array, min_index, max_index): if min_index < max_index: p = partition(array, min_index, max_index) quicksort(array, min_index, p) quicksort(array, p + 1, max_index) arr = [2, 7, 3, 1] print('Unsorted array:') print(arr) quicksort(arr, 0, len(arr) - 1) print('Sorted array:') print(arr)
GET_ALL_GENRES = """ SELECT name FROM genres """ INSERT_GENRE = """ INSERT INTO genres (name) VALUES (:name) """
get_all_genres = '\nSELECT name\nFROM genres\n' insert_genre = '\nINSERT INTO genres (name) VALUES (:name)\n'
def admin_helper(admin) -> dict: return { "id": str(admin['_id']), "fullname": admin['fullname'], "email": admin['email'], } def state_count_helper(state_count) -> dict: return { "id": str(state_count['_id']), "date": state_count['date'], "state": state_count["state"], "ad_count": state_count["ad_count"], "avg_age": state_count["avg_age"], "email_count": state_count["email_count"], "phone_count": state_count["phone_count"] } def city_count_helper(city_count) -> dict: return { "id": str(city_count['_id']), "date": city_count['date'], "city": city_count["city"], "ad_count": city_count["ad_count"], "avg_age": city_count["avg_age"], "email_count": city_count["email_count"], "phone_count": city_count["phone_count"] }
def admin_helper(admin) -> dict: return {'id': str(admin['_id']), 'fullname': admin['fullname'], 'email': admin['email']} def state_count_helper(state_count) -> dict: return {'id': str(state_count['_id']), 'date': state_count['date'], 'state': state_count['state'], 'ad_count': state_count['ad_count'], 'avg_age': state_count['avg_age'], 'email_count': state_count['email_count'], 'phone_count': state_count['phone_count']} def city_count_helper(city_count) -> dict: return {'id': str(city_count['_id']), 'date': city_count['date'], 'city': city_count['city'], 'ad_count': city_count['ad_count'], 'avg_age': city_count['avg_age'], 'email_count': city_count['email_count'], 'phone_count': city_count['phone_count']}
def get_strings(city): city = city.lower().replace(" ", "") ans = [""] * 26 order = "" for i in city: if i not in order: order += i for i in city: ans[ord(i) - 97] += "*" return ",".join([i + ":" + ans[ord(i) - 97] for i in order]) print(get_strings("Chicago"))
def get_strings(city): city = city.lower().replace(' ', '') ans = [''] * 26 order = '' for i in city: if i not in order: order += i for i in city: ans[ord(i) - 97] += '*' return ','.join([i + ':' + ans[ord(i) - 97] for i in order]) print(get_strings('Chicago'))
n,a,b = map(int,input().split()) x = list(map(int,input().split())) answer = 0 for i in range(1, n): if a*(x[i]-x[i-1]) < b: answer += a*(x[i]-x[i-1]) else: answer += b print(answer)
(n, a, b) = map(int, input().split()) x = list(map(int, input().split())) answer = 0 for i in range(1, n): if a * (x[i] - x[i - 1]) < b: answer += a * (x[i] - x[i - 1]) else: answer += b print(answer)
# address of mongoDB MONGO_SERVER = 'mongodb://192.168.1.234:27017/' # MONGO_SERVER = 'mongodb://mongodb.test:27017/' SCHEDULER_DB = "scheduler" JOB_COLLECTION = "jobs" REGISTRY_URL = "registry.zilliz.com/milvus/milvus" IDC_NAS_URL = "//172.16.70.249/test" DEFAULT_IMAGE = "milvusdb/milvus:latest" SERVER_HOST_DEFAULT = "127.0.0.1" SERVER_PORT_DEFAULT = 19530 # milvus version, should be changed by manual SERVER_VERSION = "2.0.0-RC7" DEFUALT_DEPLOY_MODE = "single" HELM_NAMESPACE = "milvus" BRANCH = "master" DEFAULT_CPUS = 48 # path of NAS mount RAW_DATA_DIR = "/test/milvus/raw_data/" # nars log LOG_PATH = "/test/milvus/benchmark/logs/{}/".format(BRANCH) # Three deployment methods currently supported DEFAULT_DEPLOY_MODE = "single" SINGLE_DEPLOY_MODE = "single" CLUSTER_DEPLOY_MODE = "cluster" CLUSTER_3RD_DEPLOY_MODE = "cluster_3rd" NAMESPACE = "milvus" CHAOS_NAMESPACE = "chaos-testing" DEFAULT_API_VERSION = 'chaos-mesh.org/v1alpha1' DEFAULT_GROUP = 'chaos-mesh.org' DEFAULT_VERSION = 'v1alpha1' # minio config MINIO_HOST = "milvus-test-minio.qa-milvus.svc.cluster.local" MINIO_PORT = 9000 MINIO_ACCESS_KEY = "minioadmin" MINIO_SECRET_KEY = "minioadmin" MINIO_BUCKET_NAME = "test"
mongo_server = 'mongodb://192.168.1.234:27017/' scheduler_db = 'scheduler' job_collection = 'jobs' registry_url = 'registry.zilliz.com/milvus/milvus' idc_nas_url = '//172.16.70.249/test' default_image = 'milvusdb/milvus:latest' server_host_default = '127.0.0.1' server_port_default = 19530 server_version = '2.0.0-RC7' defualt_deploy_mode = 'single' helm_namespace = 'milvus' branch = 'master' default_cpus = 48 raw_data_dir = '/test/milvus/raw_data/' log_path = '/test/milvus/benchmark/logs/{}/'.format(BRANCH) default_deploy_mode = 'single' single_deploy_mode = 'single' cluster_deploy_mode = 'cluster' cluster_3_rd_deploy_mode = 'cluster_3rd' namespace = 'milvus' chaos_namespace = 'chaos-testing' default_api_version = 'chaos-mesh.org/v1alpha1' default_group = 'chaos-mesh.org' default_version = 'v1alpha1' minio_host = 'milvus-test-minio.qa-milvus.svc.cluster.local' minio_port = 9000 minio_access_key = 'minioadmin' minio_secret_key = 'minioadmin' minio_bucket_name = 'test'
def selection_sort(arr, simulation=False): """ Selection Sort Complexity: O(n^2) ##------------------------------------------------------------------- """ iteration = 0 if simulation: print("iteration", iteration, ":", *arr) for i in range(len(arr)): minimum = i for j in range(i + 1, len(arr)): # "Select" the correct value if arr[j] < arr[minimum]: minimum = j arr[minimum], arr[i] = arr[i], arr[minimum] if simulation: iteration = iteration + 1 print("iteration", iteration, ":", *arr) return arr
def selection_sort(arr, simulation=False): """ Selection Sort Complexity: O(n^2) ##------------------------------------------------------------------- """ iteration = 0 if simulation: print('iteration', iteration, ':', *arr) for i in range(len(arr)): minimum = i for j in range(i + 1, len(arr)): if arr[j] < arr[minimum]: minimum = j (arr[minimum], arr[i]) = (arr[i], arr[minimum]) if simulation: iteration = iteration + 1 print('iteration', iteration, ':', *arr) return arr
src = Split(''' tls_test.c ''') component = aos_component('tls_test', src) component.add_comp_deps('security/mbedtls')
src = split('\n tls_test.c\n') component = aos_component('tls_test', src) component.add_comp_deps('security/mbedtls')
NC_READ_REQUEST = 0 NC_READ_REPLY = 1 NC_HOT_READ_REQUEST = 2 NC_WRITE_REQUEST = 4 NC_WRITE_REPLY = 5 NC_UPDATE_REQUEST = 8 NC_UPDATE_REPLY = 9
nc_read_request = 0 nc_read_reply = 1 nc_hot_read_request = 2 nc_write_request = 4 nc_write_reply = 5 nc_update_request = 8 nc_update_reply = 9
""" string_util.py Miscellaneous string processing functions """ def title_case(sentence): """ Capitalize the first letter of every word in a sentence. Parameters ---------- sentence: string Sentence to be converted to title case Returns ------- result: string Input string converted to title case Example ------- >>> title_case('This iS a sampLe.') This Is A Sample. """ # error checking if not isinstance(sentence, str): raise TypeError('Input to title_case must be string') # convert entire sentence to lower case then split it into words words = (sentence.lower()).split() # capitalize each word for i in range(len(words)): words[i] = words[i].capitalize() # put the words back together into a sentence, separating them with spaces result = ' '.join(words) return result
""" string_util.py Miscellaneous string processing functions """ def title_case(sentence): """ Capitalize the first letter of every word in a sentence. Parameters ---------- sentence: string Sentence to be converted to title case Returns ------- result: string Input string converted to title case Example ------- >>> title_case('This iS a sampLe.') This Is A Sample. """ if not isinstance(sentence, str): raise type_error('Input to title_case must be string') words = sentence.lower().split() for i in range(len(words)): words[i] = words[i].capitalize() result = ' '.join(words) return result
""" Hello we are attempting to simulate the cochlea. The cochlea uses a concept called tonotopy i.e. low frequencies are processed at the apex and high frequencies are processed at the base. Furthermore sound travels to its point of transduction as a traveling wave """ def __self_description(): print("Simulation of a traveling wave...enjoy") if __name__ == "__main__": __self_description() else: "Using first.py as an import"
""" Hello we are attempting to simulate the cochlea. The cochlea uses a concept called tonotopy i.e. low frequencies are processed at the apex and high frequencies are processed at the base. Furthermore sound travels to its point of transduction as a traveling wave """ def __self_description(): print('Simulation of a traveling wave...enjoy') if __name__ == '__main__': __self_description() else: 'Using first.py as an import'
__author__ = 'olga' def scatterhist(ax, x, y): """ Create a scatterplot with histogram of the marginals, as in scatterhist() in Matlab but nicer. @param ax: @type ax: @param x: @type x: @param y: @type y: @return: hist_patches, scatter_points @rtype: matplotlib. """ raise NotImplementedError('Check out the "seaborn" plotting library for ' 'this.')
__author__ = 'olga' def scatterhist(ax, x, y): """ Create a scatterplot with histogram of the marginals, as in scatterhist() in Matlab but nicer. @param ax: @type ax: @param x: @type x: @param y: @type y: @return: hist_patches, scatter_points @rtype: matplotlib. """ raise not_implemented_error('Check out the "seaborn" plotting library for this.')
with open('input.txt') as f: input = f.readline() input = input.strip().split('-') input_min = int(input[0]) input_max = int(input[1]) def pwd_to_digits(pwd): digits = [] pwd_str = str(pwd) while len(pwd_str) > 0: digits.append(int(pwd_str[0])) pwd_str = pwd_str[1:] return digits def pwd_is_valid(pwd): digits = pwd_to_digits(pwd) prev_digit = -1 has_double = False has_decrease = False for next_digit in digits: if next_digit == prev_digit: has_double = True if next_digit < prev_digit: has_decrease = True prev_digit = next_digit return has_double and not has_decrease def new_pwd_is_valid(pwd): digits = pwd_to_digits(pwd) digits.append(-1) prev_digit = -1 group_len = 1 saw_double = False print("%d" % pwd) for next_digit in digits: if next_digit == prev_digit: group_len += 1 else: if group_len == 2: saw_double = True group_len = 1 prev_digit = next_digit print(" %d: %d" % (next_digit, group_len)) return saw_double pwds = [] for i in range(input_min, input_max+1): if pwd_is_valid(i): pwds.append(i) print("count == %d" % len(pwds)) new_pwds = [] for pwd in pwds: if new_pwd_is_valid(pwd): new_pwds.append(pwd) print("new_count == %d" % len(new_pwds))
with open('input.txt') as f: input = f.readline() input = input.strip().split('-') input_min = int(input[0]) input_max = int(input[1]) def pwd_to_digits(pwd): digits = [] pwd_str = str(pwd) while len(pwd_str) > 0: digits.append(int(pwd_str[0])) pwd_str = pwd_str[1:] return digits def pwd_is_valid(pwd): digits = pwd_to_digits(pwd) prev_digit = -1 has_double = False has_decrease = False for next_digit in digits: if next_digit == prev_digit: has_double = True if next_digit < prev_digit: has_decrease = True prev_digit = next_digit return has_double and (not has_decrease) def new_pwd_is_valid(pwd): digits = pwd_to_digits(pwd) digits.append(-1) prev_digit = -1 group_len = 1 saw_double = False print('%d' % pwd) for next_digit in digits: if next_digit == prev_digit: group_len += 1 else: if group_len == 2: saw_double = True group_len = 1 prev_digit = next_digit print(' %d: %d' % (next_digit, group_len)) return saw_double pwds = [] for i in range(input_min, input_max + 1): if pwd_is_valid(i): pwds.append(i) print('count == %d' % len(pwds)) new_pwds = [] for pwd in pwds: if new_pwd_is_valid(pwd): new_pwds.append(pwd) print('new_count == %d' % len(new_pwds))
class DrawflowNodeBase: def __init__(self): self.nodename = "basenode" self.nodetitle = "Basenode" self.nodeinputs = list() self.nodeoutputs = list() self.nodeicon = "" self.nodehtml = "<b>DO NOT USE THE BASE NODE!!!</b>" def name(self, name): self.nodename = name def title(self, title): self.nodetitle = title def input(self, varname, type): self.nodeinputs.append((varname, type)) def output(self, varname, type): self.nodeoutputs.append((varname, type)) def icon(self, html): self.nodeicon = html def html(self, html): self.nodehtml = html def getAsTuple(self): return (self.nodetitle, len(self.nodeinputs), len(self.nodeoutputs), self.nodeicon, self.nodename, self.nodehtml)
class Drawflownodebase: def __init__(self): self.nodename = 'basenode' self.nodetitle = 'Basenode' self.nodeinputs = list() self.nodeoutputs = list() self.nodeicon = '' self.nodehtml = '<b>DO NOT USE THE BASE NODE!!!</b>' def name(self, name): self.nodename = name def title(self, title): self.nodetitle = title def input(self, varname, type): self.nodeinputs.append((varname, type)) def output(self, varname, type): self.nodeoutputs.append((varname, type)) def icon(self, html): self.nodeicon = html def html(self, html): self.nodehtml = html def get_as_tuple(self): return (self.nodetitle, len(self.nodeinputs), len(self.nodeoutputs), self.nodeicon, self.nodename, self.nodehtml)
f = open("Files/Test.txt", mode="rt",encoding="utf-8") g = open("Files/fil1.txt", mode="rt",encoding="utf-8") h = open("Files/wasteland.txt", mode="rt",encoding="utf-8") # return type of read() method is str # To read specific number of character we have to pass the characters as arguments # print(f.read(25)) # To read the whole file we have to keep the argument of read() method empty print("Content in Test1.txt:\n",f.read()) print() print("Content in fil1.txt:\n",g.read()) print() print("Content in wasteland.txt:\n",h.read())
f = open('Files/Test.txt', mode='rt', encoding='utf-8') g = open('Files/fil1.txt', mode='rt', encoding='utf-8') h = open('Files/wasteland.txt', mode='rt', encoding='utf-8') print('Content in Test1.txt:\n', f.read()) print() print('Content in fil1.txt:\n', g.read()) print() print('Content in wasteland.txt:\n', h.read())
# -*- coding: utf-8 -*- """Unit test package for django-model-cleanup.""" # Having tests in a separate folder is a safe choice # You can have them mixed in the src but at some point you will get # problems with test discovery activating lazy objects and other import time # headaches. And if you fail to filter test during packaging you will get # similar problems in production.
"""Unit test package for django-model-cleanup."""
class Solution: def decompressRLElist(self, nums: List[int]) -> List[int]: ret = [] i = 0 while i < len(nums): j = 0 while j < nums[i]: ret.append(nums[i+1]) j += 1 i += 2 return ret
class Solution: def decompress_rl_elist(self, nums: List[int]) -> List[int]: ret = [] i = 0 while i < len(nums): j = 0 while j < nums[i]: ret.append(nums[i + 1]) j += 1 i += 2 return ret
# Given an array of numbers, find all the # pairs of numbers which sum upto `k` def find_pairs(num_array, k): pairs_array = [] for num in num_array: if (k - num) in num_array: pairs_array.append((num, (k - num))) return pairs_array result = find_pairs([0, 14, 0, 4, 7, 8, 3, 5, 7], 11) print(result)
def find_pairs(num_array, k): pairs_array = [] for num in num_array: if k - num in num_array: pairs_array.append((num, k - num)) return pairs_array result = find_pairs([0, 14, 0, 4, 7, 8, 3, 5, 7], 11) print(result)
class Solution: def champagneTower(self, poured: int, query_row: int, query_glass: int) -> float: filled = [[0.0] * (query_row + 2) for _ in range (query_row+2)] filled[0][0] = poured for row in range(query_row + 1): for col in range(query_row + 1): if (filled[row][col] > 1.0): overfill = filled[row][col] - 1.0 filled[row + 1][col] += overfill / 2.0 filled[row + 1][col +1] += overfill /2.0 # if needs to be here because we are not removing overfill from glasses that are overflowing, the maximum they can hold is 1 return filled[query_row][query_glass] if filled[query_row][query_glass] <= 1 else 1
class Solution: def champagne_tower(self, poured: int, query_row: int, query_glass: int) -> float: filled = [[0.0] * (query_row + 2) for _ in range(query_row + 2)] filled[0][0] = poured for row in range(query_row + 1): for col in range(query_row + 1): if filled[row][col] > 1.0: overfill = filled[row][col] - 1.0 filled[row + 1][col] += overfill / 2.0 filled[row + 1][col + 1] += overfill / 2.0 return filled[query_row][query_glass] if filled[query_row][query_glass] <= 1 else 1
class Headers: X_VOL_TENANT = "x-vol-tenant"; X_VOL_SITE = "x-vol-site"; X_VOL_CATALOG = "x-vol-catalog"; X_VOL_MASTER_CATALOG = "x-vol-master-catalog"; X_VOL_SITE_DOMAIN = "x-vol-site-domain"; X_VOL_TENANT_DOMAIN = "x-vol-tenant-domain"; X_VOL_CORRELATION = "x-vol-correlation"; X_VOL_HMAC_SHA256 = "x-vol-hmac-sha256"; X_VOL_APP_CLAIMS = "x-vol-app-claims"; X_VOL_USER_CLAIMS = "x-vol-user-claims"; X_VOL_LOCALE = "x-vol-locale"; X_VOL_CURRENCY = "x-vol-currency"; X_VOL_VERSION = "x-vol-version"; X_VOL_DATAVIEW_MODE = "x-vol-dataview-mode"; DATE = "Date"; CONTENT_TYPE = "Content-type"; ETAG = "ETag";
class Headers: x_vol_tenant = 'x-vol-tenant' x_vol_site = 'x-vol-site' x_vol_catalog = 'x-vol-catalog' x_vol_master_catalog = 'x-vol-master-catalog' x_vol_site_domain = 'x-vol-site-domain' x_vol_tenant_domain = 'x-vol-tenant-domain' x_vol_correlation = 'x-vol-correlation' x_vol_hmac_sha256 = 'x-vol-hmac-sha256' x_vol_app_claims = 'x-vol-app-claims' x_vol_user_claims = 'x-vol-user-claims' x_vol_locale = 'x-vol-locale' x_vol_currency = 'x-vol-currency' x_vol_version = 'x-vol-version' x_vol_dataview_mode = 'x-vol-dataview-mode' date = 'Date' content_type = 'Content-type' etag = 'ETag'
# -*- coding: utf-8 -*- """ Yet another static site generator. """
""" Yet another static site generator. """
''' Exercise 2: Write a function save_list2file(sentences, filename) that takes two parameters, where sentences is a list of string, and filename is a string representing the name of the file where the content of sentences must be saved. Each element of the list sentences should be written on its own line in the file filename. ''' def save_list2file(sentences, filename): with open(filename,'w') as x: for y in sentences: print(y, file=x) save_list2file(['yikes','lolxd'],'ayy')
""" Exercise 2: Write a function save_list2file(sentences, filename) that takes two parameters, where sentences is a list of string, and filename is a string representing the name of the file where the content of sentences must be saved. Each element of the list sentences should be written on its own line in the file filename. """ def save_list2file(sentences, filename): with open(filename, 'w') as x: for y in sentences: print(y, file=x) save_list2file(['yikes', 'lolxd'], 'ayy')
class Solution: def uniquePathsWithObstacles(self, grid: List[List[int]]) -> int: if grid[0][0] == 1: return 0 m = len(grid) n = len(grid[0]) grid[0][0] = 1 for i in range(1, m): if grid[i][0] == 0: grid[i][0] = grid[i - 1][0] else: grid[i][0] = 0 for i in range(1, n): if grid[0][i] == 0: grid[0][i] = grid[0][i - 1] else: grid[0][i] = 0 for i in range(1, m): for j in range(1, n): if grid[i][j] == 0: grid[i][j] = grid[i - 1][j] + grid[i][j - 1] else: grid[i][j] = 0 return grid[m - 1][n - 1]
class Solution: def unique_paths_with_obstacles(self, grid: List[List[int]]) -> int: if grid[0][0] == 1: return 0 m = len(grid) n = len(grid[0]) grid[0][0] = 1 for i in range(1, m): if grid[i][0] == 0: grid[i][0] = grid[i - 1][0] else: grid[i][0] = 0 for i in range(1, n): if grid[0][i] == 0: grid[0][i] = grid[0][i - 1] else: grid[0][i] = 0 for i in range(1, m): for j in range(1, n): if grid[i][j] == 0: grid[i][j] = grid[i - 1][j] + grid[i][j - 1] else: grid[i][j] = 0 return grid[m - 1][n - 1]
def categorical_cross_entropy(y_pred, y): x = np.multiply(y, np.log(y_pred)) loss = x.sum() return loss
def categorical_cross_entropy(y_pred, y): x = np.multiply(y, np.log(y_pred)) loss = x.sum() return loss
largest = None smallest = None while True: num = input("Enter a number: ") if num == "done": break try: inp=float(num) except: print("Invalid input") if smallest is None: smallest=inp elif inp < smallest: smallest=inp elif inp>largest: largest=inp continue print("Maximum", largest) print("Minimum", smallest)
largest = None smallest = None while True: num = input('Enter a number: ') if num == 'done': break try: inp = float(num) except: print('Invalid input') if smallest is None: smallest = inp elif inp < smallest: smallest = inp elif inp > largest: largest = inp continue print('Maximum', largest) print('Minimum', smallest)
""" Copyright (c) 2018-present, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. """ class BadConfigError(Exception): """ Indicates that test config for launching ryu apps is invalid """ pass class ServiceRunningError(Exception): """ Indicates that magma@pipelined service was running when trying to instantiate ryu apps """ pass
""" Copyright (c) 2018-present, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. """ class Badconfigerror(Exception): """ Indicates that test config for launching ryu apps is invalid """ pass class Servicerunningerror(Exception): """ Indicates that magma@pipelined service was running when trying to instantiate ryu apps """ pass
class Solution: def numTilePossibilities(self, tiles: str) -> int: def dfs(counterMap): currentSum = 0 for char in counterMap: if counterMap[char] > 0: currentSum += 1 counterMap[char] -= 1 currentSum += dfs(counterMap) counterMap[char] += 1 return currentSum return dfs(Counter(tiles))
class Solution: def num_tile_possibilities(self, tiles: str) -> int: def dfs(counterMap): current_sum = 0 for char in counterMap: if counterMap[char] > 0: current_sum += 1 counterMap[char] -= 1 current_sum += dfs(counterMap) counterMap[char] += 1 return currentSum return dfs(counter(tiles))
user1 = { "user": { "username": "akram", "email": "akram.mukasa@andela.com", "password": "Akram@100555" } } login1 = {"user": {"email": "akram.mukasa@andela.com", "password": "Akram@100555"}}
user1 = {'user': {'username': 'akram', 'email': 'akram.mukasa@andela.com', 'password': 'Akram@100555'}} login1 = {'user': {'email': 'akram.mukasa@andela.com', 'password': 'Akram@100555'}}
class Image: def __init__(self, name): self.name = name def register(self): raise NotImplementedError def getImg(self): raise NotImplementedError
class Image: def __init__(self, name): self.name = name def register(self): raise NotImplementedError def get_img(self): raise NotImplementedError
expected_output = { "five_sec_cpu_total": 13, "five_min_cpu": 15, "one_min_cpu": 23, "five_sec_cpu_interrupts": 0, }
expected_output = {'five_sec_cpu_total': 13, 'five_min_cpu': 15, 'one_min_cpu': 23, 'five_sec_cpu_interrupts': 0}
alg.aggregation ( [ "c_custkey", "c_name", "c_acctbal", "c_phone", "n_name", "c_address", "c_comment" ], [ ( Reduction.SUM, "rev", "revenue" ) ], alg.map ( "rev", scal.MulExpr ( scal.AttrExpr ( "l_extendedprice" ), scal.SubExpr ( scal.ConstExpr ( "1.0f", Type.FLOAT ), scal.AttrExpr ( "l_discount" ) ) ), alg.join ( ( "l_orderkey", "o_orderkey" ), alg.join ( ( "c_nationkey", "n_nationkey" ), alg.scan ( "nation" ), alg.join ( ( "o_custkey", "c_custkey" ), alg.selection ( scal.AndExpr ( scal.LargerEqualExpr ( scal.AttrExpr ( "o_orderdate" ), scal.ConstExpr ( "19931001", Type.DATE ) ), scal.SmallerExpr ( scal.AttrExpr ( "o_orderdate" ), scal.ConstExpr ( "19940101", Type.DATE ) ) ), alg.scan ( "orders" ) ), alg.scan ( "customer" ) ) ), alg.selection ( scal.EqualsExpr ( scal.AttrExpr ( "l_returnflag" ), scal.ConstExpr ( "R", Type.CHAR ) ), alg.scan ( "lineitem" ) ) ) ) )
alg.aggregation(['c_custkey', 'c_name', 'c_acctbal', 'c_phone', 'n_name', 'c_address', 'c_comment'], [(Reduction.SUM, 'rev', 'revenue')], alg.map('rev', scal.MulExpr(scal.AttrExpr('l_extendedprice'), scal.SubExpr(scal.ConstExpr('1.0f', Type.FLOAT), scal.AttrExpr('l_discount'))), alg.join(('l_orderkey', 'o_orderkey'), alg.join(('c_nationkey', 'n_nationkey'), alg.scan('nation'), alg.join(('o_custkey', 'c_custkey'), alg.selection(scal.AndExpr(scal.LargerEqualExpr(scal.AttrExpr('o_orderdate'), scal.ConstExpr('19931001', Type.DATE)), scal.SmallerExpr(scal.AttrExpr('o_orderdate'), scal.ConstExpr('19940101', Type.DATE))), alg.scan('orders')), alg.scan('customer'))), alg.selection(scal.EqualsExpr(scal.AttrExpr('l_returnflag'), scal.ConstExpr('R', Type.CHAR)), alg.scan('lineitem')))))
# -*- coding: utf-8 -*- """ """ def get_ratios(L1, L2): """ Assumes: L1 and L2 are lists of equal length of numbers Returns: a list containing L1[i]/L2[i] """ ratios = [] for index in range(len(L1)): try: ratios.append(L1[index]/float(L2[index])) except ZeroDivisionError: ratios.append(float('NaN')) #NaN = Not a Number except: raise ValueError('get_ratios called with bad arg') return ratios
""" """ def get_ratios(L1, L2): """ Assumes: L1 and L2 are lists of equal length of numbers Returns: a list containing L1[i]/L2[i] """ ratios = [] for index in range(len(L1)): try: ratios.append(L1[index] / float(L2[index])) except ZeroDivisionError: ratios.append(float('NaN')) except: raise value_error('get_ratios called with bad arg') return ratios
""" Exceptions to be called by service check plugins when the appropriate situations arrive. None of these have special behaviour. """ class ParamError(Exception): """To be thrown when user input causes the issue""" pass class ResultError(Exception): """To be thrown when the API/Metric Check returns either no result (when this isn't expected) or returns a result that is essentially unusable. """ pass class AssumedOK(Exception): """To be thrown when the status of the check cannot be identified. This is usually used when the check requires the result of a previous run and this is the first run.""" pass class InvalidMetricThreshold(Exception): """To be thrown when you pass a metric threshold with wrong syntax""" pass class InvalidMetricName(Exception): """To be thrown when you pass an invalid metric name.""" pass
""" Exceptions to be called by service check plugins when the appropriate situations arrive. None of these have special behaviour. """ class Paramerror(Exception): """To be thrown when user input causes the issue""" pass class Resulterror(Exception): """To be thrown when the API/Metric Check returns either no result (when this isn't expected) or returns a result that is essentially unusable. """ pass class Assumedok(Exception): """To be thrown when the status of the check cannot be identified. This is usually used when the check requires the result of a previous run and this is the first run.""" pass class Invalidmetricthreshold(Exception): """To be thrown when you pass a metric threshold with wrong syntax""" pass class Invalidmetricname(Exception): """To be thrown when you pass an invalid metric name.""" pass
class TracardiException(Exception): pass class StorageException(TracardiException): pass class ExpiredException(TracardiException): pass class UnauthorizedException(TracardiException): pass
class Tracardiexception(Exception): pass class Storageexception(TracardiException): pass class Expiredexception(TracardiException): pass class Unauthorizedexception(TracardiException): pass
def precedence(op): if op == '^': return 3 if op == '+' or op == '-': return 1 if op == '*' or op == '/': return 2 return 0 def applyOp(a, b, op): if op == '^': return a ** b if op == '+': return a + b if op == '-': return a - b if op == '*': return a * b if op == '/': return a // b def evaluate(tokens, x_set): values = [[] for _ in range(len(x_set))] ops = [] i = 0 while i < len(tokens): if tokens[i] == ' ': i += 1 continue elif tokens[i] == '(': ops.append(tokens[i]) elif tokens[i] in 'xX' : for index, x in enumerate(x_set): values[index].append(x) elif tokens[i].isdigit(): val = 0 while (i < len(tokens) and tokens[i].isdigit()): val = (val * 10) + int(tokens[i]) i += 1 i -= 1 for index, x in enumerate(x_set): values[index].append(val) elif tokens[i] == ')': while len(ops) != 0 and ops[-1] != '(': op = ops.pop() for index, x in enumerate(values): val2 = x.pop() val1 = x.pop() x.append(applyOp(val1, val2, op)) ops.pop() else: while (len(ops) != 0 and precedence(ops[-1]) >= precedence(tokens[i])): op = ops.pop() for index, x in enumerate(values): val2 = x.pop() val1 = x.pop() x.append(applyOp(val1, val2, op)) ops.append(tokens[i]) i += 1 while len(ops) != 0: op = ops.pop() for index, x in enumerate(values): val2 = x.pop() val1 = x.pop() x.append(applyOp(val1, val2, op)) values = [value.pop() for value in values] global one_one if len(list(set(values))) != len(values): one_one = False return values set1 =[int(x) for x in input('Enter comma separated domain: ').split(',')] set2 =[int(x) for x in input('Enter comma separated codomain: ').split(',')] expression = input('(+,-,*,/,^) Enter expression in terms of x: ') one_one = True try: results = evaluate(expression, set1) if set(results) == set(set2): print('ONTO') else: print('NOT ONTO') if one_one: print('ONE-ONE') else: print('NOT ONE-ONE') except: print('Invalid expression')
def precedence(op): if op == '^': return 3 if op == '+' or op == '-': return 1 if op == '*' or op == '/': return 2 return 0 def apply_op(a, b, op): if op == '^': return a ** b if op == '+': return a + b if op == '-': return a - b if op == '*': return a * b if op == '/': return a // b def evaluate(tokens, x_set): values = [[] for _ in range(len(x_set))] ops = [] i = 0 while i < len(tokens): if tokens[i] == ' ': i += 1 continue elif tokens[i] == '(': ops.append(tokens[i]) elif tokens[i] in 'xX': for (index, x) in enumerate(x_set): values[index].append(x) elif tokens[i].isdigit(): val = 0 while i < len(tokens) and tokens[i].isdigit(): val = val * 10 + int(tokens[i]) i += 1 i -= 1 for (index, x) in enumerate(x_set): values[index].append(val) elif tokens[i] == ')': while len(ops) != 0 and ops[-1] != '(': op = ops.pop() for (index, x) in enumerate(values): val2 = x.pop() val1 = x.pop() x.append(apply_op(val1, val2, op)) ops.pop() else: while len(ops) != 0 and precedence(ops[-1]) >= precedence(tokens[i]): op = ops.pop() for (index, x) in enumerate(values): val2 = x.pop() val1 = x.pop() x.append(apply_op(val1, val2, op)) ops.append(tokens[i]) i += 1 while len(ops) != 0: op = ops.pop() for (index, x) in enumerate(values): val2 = x.pop() val1 = x.pop() x.append(apply_op(val1, val2, op)) values = [value.pop() for value in values] global one_one if len(list(set(values))) != len(values): one_one = False return values set1 = [int(x) for x in input('Enter comma separated domain: ').split(',')] set2 = [int(x) for x in input('Enter comma separated codomain: ').split(',')] expression = input('(+,-,*,/,^) Enter expression in terms of x: ') one_one = True try: results = evaluate(expression, set1) if set(results) == set(set2): print('ONTO') else: print('NOT ONTO') if one_one: print('ONE-ONE') else: print('NOT ONE-ONE') except: print('Invalid expression')
""" Question 15 : Write a program that computes the values of a+aa+aaa+aaaa with a given digit as the value of a. Suppose the following input is supplied to the program : 9 Then, the output should be : 11106 Hints : In case of input data begin supplied to the question, it should be assumed to be a console input. """ # Solution : num = int(input("Enter a number : ")) n1 = int("%s" % num) n2 = int("%s%s" % (num, num)) n3 = int("%s%s%s" % (num,num,num)) n4 = int("%s%s%s%s" % (num,num,num,num)) print(n1+n2+n3+n4) """ Output : Enter a number : 9 11106 """
""" Question 15 : Write a program that computes the values of a+aa+aaa+aaaa with a given digit as the value of a. Suppose the following input is supplied to the program : 9 Then, the output should be : 11106 Hints : In case of input data begin supplied to the question, it should be assumed to be a console input. """ num = int(input('Enter a number : ')) n1 = int('%s' % num) n2 = int('%s%s' % (num, num)) n3 = int('%s%s%s' % (num, num, num)) n4 = int('%s%s%s%s' % (num, num, num, num)) print(n1 + n2 + n3 + n4) '\nOutput : \n Enter a number : 9\n 11106\n'
class ControlSys(): def __init__(self, fig, imdis, vol_tran, vol_fron, vol_sagi, ax_tran, ax_fron, ax_sagi): self.fig =fig self.imdis = imdis self.vol_tran = vol_tran self.vol_fron = vol_fron self.vol_sagi = vol_sagi self.ax_tran = ax_tran self.ax_fron = ax_fron self.ax_sagi = ax_sagi self.scroll_tran = None self.scroll_fron = None self.scroll_sagi = None self.lx_tran = ax_tran.axhline(color='b', linewidth=0.8) self.ly_tran = ax_tran.axvline(color='b', linewidth=0.8) self.lx_fron = ax_fron.axhline(color='b', linewidth=0.8) self.ly_fron = ax_fron.axvline(color='b', linewidth=0.8) self.lx_sagi = ax_sagi.axhline(color='b', linewidth=0.8) self.ly_sagi = ax_sagi.axvline(color='b', linewidth=0.8) self.txt_tran = ax_tran.text(0, -10, '', color='b') self.txt_fron = ax_fron.text(0, -10, '', color='b') self.txt_sagi = ax_sagi.text(0, -10, '', color='b') self.fig.canvas.mpl_connect('button_press_event', self.button_press_events) def button_press_events(self, event): if self.ax_tran.in_axes(event): self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_tran)) self.fig.canvas.mpl_connect('button_press_event', self.frontal_view(int(event.ydata))) self.fig.canvas.mpl_connect('button_press_event', self.sagittal_view(int(event.xdata))) # self.scroll_tran = self.fig.canvas.mpl_connect('scroll_event', self.transverse_scroll) # self.fig.canvas.mpl_disconnect(self.scroll_fron) # self.fig.canvas.mpl_disconnect(self.scroll_sagi) elif self.ax_fron.in_axes(event): self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_fron)) self.fig.canvas.mpl_connect('button_press_event', self.transverse_view(int(event.ydata))) self.fig.canvas.mpl_connect('button_press_event', self.sagittal_view(int(event.xdata))) # self.scroll_fron = self.fig.canvas.mpl_connect('scroll_event', self.frontal_scroll) # self.fig.canvas.mpl_disconnect(self.scroll_tran) # self.fig.canvas.mpl_disconnect(self.scroll_sagi) elif self.ax_sagi.in_axes(event): self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_sagi)) self.fig.canvas.mpl_connect('button_press_event', self.transverse_view(int(event.ydata))) self.fig.canvas.mpl_connect('button_press_event', self.frontal_view(int(event.xdata))) # self.scroll_sagi = self.fig.canvas.mpl_connect('scroll_event', self.sagittal_scroll) # self.fig.canvas.mpl_disconnect(self.scroll_tran) # self.fig.canvas.mpl_disconnect(self.scroll_fron) def transverse_view(self, index): self.ax_tran.index = index self.imdis.update_transverse_display(self.ax_tran.index) self.fig.canvas.draw_idle() def frontal_view(self, index): self.ax_fron.index = index self.imdis.update_frontal_display(self.ax_fron.index) self.fig.canvas.draw_idle() def sagittal_view(self, index): self.ax_sagi.index = index self.imdis.update_sagittal_display(self.ax_sagi.index) self.fig.canvas.draw_idle() def add_cursor(self, event, ax): if ax is self.ax_tran: x, y, z = event.xdata, event.ydata, self.ax_tran.index coord_tran = [x, y, z] coord_fron = [x, z, y] coord_sagi = [y, z, x] self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran) self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron) self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi) if ax is self.ax_fron: x, y, z = event.xdata, event.ydata, self.ax_fron.index coord_fron = [x, y, z] coord_tran = [x, z, y] coord_sagi = [z, y, x] self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran) self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron) self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi) if ax is self.ax_sagi: x, y, z = event.xdata, event.ydata, self.ax_sagi.index coord_sagi = [x, y, z] coord_tran = [z, x, y] coord_fron = [z, y, x] self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran) self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron) self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi) def plot_cursor(self, coord, lx, ly, txt): x, y, z = coord[0], coord[1], coord[2] lx.set_ydata(y) ly.set_xdata(x) txt.set_text('x=%1d y=%1d z=%1d' % (x, y, z)) self.fig.canvas.draw_idle() def transverse_scroll(self, event): if event.button == 'down': self.ax_tran.index -= 1 if event.button == 'up': self.ax_tran.index += 1 self.imdis.update_transverse_display(self.ax_tran.index) self.fig.canvas.draw_idle() def frontal_scroll(self, event): if event.button == 'down': self.ax_fron.index -= 1 if event.button == 'up': self.ax_fron.index += 1 self.imdis.update_frontal_display(self.ax_fron.index) self.fig.canvas.draw_idle() def sagittal_scroll(self, event): if event.button == 'down': self.ax_sagi.index -= 1 if event.button == 'up': self.ax_sagi.index += 1 self.imdis.update_sagittal_display(self.ax_sagi.index) self.fig.canvas.draw_idle()
class Controlsys: def __init__(self, fig, imdis, vol_tran, vol_fron, vol_sagi, ax_tran, ax_fron, ax_sagi): self.fig = fig self.imdis = imdis self.vol_tran = vol_tran self.vol_fron = vol_fron self.vol_sagi = vol_sagi self.ax_tran = ax_tran self.ax_fron = ax_fron self.ax_sagi = ax_sagi self.scroll_tran = None self.scroll_fron = None self.scroll_sagi = None self.lx_tran = ax_tran.axhline(color='b', linewidth=0.8) self.ly_tran = ax_tran.axvline(color='b', linewidth=0.8) self.lx_fron = ax_fron.axhline(color='b', linewidth=0.8) self.ly_fron = ax_fron.axvline(color='b', linewidth=0.8) self.lx_sagi = ax_sagi.axhline(color='b', linewidth=0.8) self.ly_sagi = ax_sagi.axvline(color='b', linewidth=0.8) self.txt_tran = ax_tran.text(0, -10, '', color='b') self.txt_fron = ax_fron.text(0, -10, '', color='b') self.txt_sagi = ax_sagi.text(0, -10, '', color='b') self.fig.canvas.mpl_connect('button_press_event', self.button_press_events) def button_press_events(self, event): if self.ax_tran.in_axes(event): self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_tran)) self.fig.canvas.mpl_connect('button_press_event', self.frontal_view(int(event.ydata))) self.fig.canvas.mpl_connect('button_press_event', self.sagittal_view(int(event.xdata))) elif self.ax_fron.in_axes(event): self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_fron)) self.fig.canvas.mpl_connect('button_press_event', self.transverse_view(int(event.ydata))) self.fig.canvas.mpl_connect('button_press_event', self.sagittal_view(int(event.xdata))) elif self.ax_sagi.in_axes(event): self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_sagi)) self.fig.canvas.mpl_connect('button_press_event', self.transverse_view(int(event.ydata))) self.fig.canvas.mpl_connect('button_press_event', self.frontal_view(int(event.xdata))) def transverse_view(self, index): self.ax_tran.index = index self.imdis.update_transverse_display(self.ax_tran.index) self.fig.canvas.draw_idle() def frontal_view(self, index): self.ax_fron.index = index self.imdis.update_frontal_display(self.ax_fron.index) self.fig.canvas.draw_idle() def sagittal_view(self, index): self.ax_sagi.index = index self.imdis.update_sagittal_display(self.ax_sagi.index) self.fig.canvas.draw_idle() def add_cursor(self, event, ax): if ax is self.ax_tran: (x, y, z) = (event.xdata, event.ydata, self.ax_tran.index) coord_tran = [x, y, z] coord_fron = [x, z, y] coord_sagi = [y, z, x] self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran) self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron) self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi) if ax is self.ax_fron: (x, y, z) = (event.xdata, event.ydata, self.ax_fron.index) coord_fron = [x, y, z] coord_tran = [x, z, y] coord_sagi = [z, y, x] self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran) self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron) self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi) if ax is self.ax_sagi: (x, y, z) = (event.xdata, event.ydata, self.ax_sagi.index) coord_sagi = [x, y, z] coord_tran = [z, x, y] coord_fron = [z, y, x] self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran) self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron) self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi) def plot_cursor(self, coord, lx, ly, txt): (x, y, z) = (coord[0], coord[1], coord[2]) lx.set_ydata(y) ly.set_xdata(x) txt.set_text('x=%1d y=%1d z=%1d' % (x, y, z)) self.fig.canvas.draw_idle() def transverse_scroll(self, event): if event.button == 'down': self.ax_tran.index -= 1 if event.button == 'up': self.ax_tran.index += 1 self.imdis.update_transverse_display(self.ax_tran.index) self.fig.canvas.draw_idle() def frontal_scroll(self, event): if event.button == 'down': self.ax_fron.index -= 1 if event.button == 'up': self.ax_fron.index += 1 self.imdis.update_frontal_display(self.ax_fron.index) self.fig.canvas.draw_idle() def sagittal_scroll(self, event): if event.button == 'down': self.ax_sagi.index -= 1 if event.button == 'up': self.ax_sagi.index += 1 self.imdis.update_sagittal_display(self.ax_sagi.index) self.fig.canvas.draw_idle()
s = input() words = ["dream", "dreamer", "erase", "eraser"] words = sorted(words, reverse=True) print() for word in words: if word in s: s = s.replace(word, "") if not s: ans = "YES" else: ans = "NO" print(ans)
s = input() words = ['dream', 'dreamer', 'erase', 'eraser'] words = sorted(words, reverse=True) print() for word in words: if word in s: s = s.replace(word, '') if not s: ans = 'YES' else: ans = 'NO' print(ans)
def read_safeguard_sql(cluster_descr, host_type): for schemas_descr in cluster_descr.schemas_list: if schemas_descr.schemas_type != host_type: continue safeguard_descr = schemas_descr.safeguard if safeguard_descr is None: continue yield from safeguard_descr.read_sql() # vi:ts=4:sw=4:et
def read_safeguard_sql(cluster_descr, host_type): for schemas_descr in cluster_descr.schemas_list: if schemas_descr.schemas_type != host_type: continue safeguard_descr = schemas_descr.safeguard if safeguard_descr is None: continue yield from safeguard_descr.read_sql()
def name_printer(user_name): print("Your name is", user_name) name = input("Please enter your name: ") name_printer(name)
def name_printer(user_name): print('Your name is', user_name) name = input('Please enter your name: ') name_printer(name)
# <auto-generated> # This code was generated by the UnitCodeGenerator tool # # Changes to this file will be lost if the code is regenerated # </auto-generated> def to_millilitres(value): return value * 4546.091879 def to_litres(value): return value * 4.546091879 def to_kilolitres(value): return value * 0.0045460918799 def to_teaspoons(value): return value * 768.0 def to_tablespoons(value): return value * 256.0 def to_quarts(value): return value * 4.0 def to_pints(value): return value * 8.0 def to_fluid_ounces(value): return value * 160.0 def to_u_s_teaspoons(value): return value / 0.00108421072977394606 def to_u_s_tablespoons(value): return value / 0.003252632189321838592 def to_u_s_quarts(value): return value / 0.20816846011659767808 def to_u_s_pints(value): return value / 0.10408423005829883904 def to_u_s_gallons(value): return value / 0.83267384046639071232 def to_u_s_fluid_ounces(value): return value / 0.006505264378643677184 def to_u_s_cups(value): return value / 0.052042115029149417472
def to_millilitres(value): return value * 4546.091879 def to_litres(value): return value * 4.546091879 def to_kilolitres(value): return value * 0.0045460918799 def to_teaspoons(value): return value * 768.0 def to_tablespoons(value): return value * 256.0 def to_quarts(value): return value * 4.0 def to_pints(value): return value * 8.0 def to_fluid_ounces(value): return value * 160.0 def to_u_s_teaspoons(value): return value / 0.001084210729773946 def to_u_s_tablespoons(value): return value / 0.0032526321893218387 def to_u_s_quarts(value): return value / 0.20816846011659768 def to_u_s_pints(value): return value / 0.10408423005829884 def to_u_s_gallons(value): return value / 0.8326738404663907 def to_u_s_fluid_ounces(value): return value / 0.006505264378643677 def to_u_s_cups(value): return value / 0.05204211502914942
# -*- coding: utf-8 -*- ''' Service support for Solaris 10 and 11, should work with other systems that use SMF also. (e.g. SmartOS) ''' __func_alias__ = { 'reload_': 'reload' } def __virtual__(): ''' Only work on systems which default to SMF ''' # Don't let this work on Solaris 9 since SMF doesn't exist on it. enable = set(( 'Solaris', 'SmartOS', )) if __grains__['os'] in enable: if __grains__['os'] == 'Solaris' and __grains__['kernelrelease'] == "5.9": return False return 'service' return False def get_enabled(): ''' Return the enabled services CLI Example: .. code-block:: bash salt '*' service.get_enabled ''' ret = set() cmd = 'svcs -H -o SVC,STATE -s SVC' lines = __salt__['cmd.run'](cmd).splitlines() for line in lines: comps = line.split() if not comps: continue if 'online' in line: ret.add(comps[0]) return sorted(ret) def get_disabled(): ''' Return the disabled services CLI Example: .. code-block:: bash salt '*' service.get_disabled ''' ret = set() cmd = 'svcs -aH -o SVC,STATE -s SVC' lines = __salt__['cmd.run'](cmd).splitlines() for line in lines: comps = line.split() if not comps: continue if not 'online' in line and not 'legacy_run' in line: ret.add(comps[0]) return sorted(ret) def available(name): ''' Return if the specified service is available CLI Example: .. code-block:: bash salt '*' service.available ''' return name in get_all() def get_all(): ''' Return all installed services CLI Example: .. code-block:: bash salt '*' service.get_all ''' ret = set() cmd = 'svcs -aH -o SVC,STATE -s SVC' lines = __salt__['cmd.run'](cmd).splitlines() for line in lines: comps = line.split() if not comps: continue ret.add(comps[0]) return sorted(ret) def start(name): ''' Start the specified service CLI Example: .. code-block:: bash salt '*' service.start <service name> ''' cmd = '/usr/sbin/svcadm enable -t {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def stop(name): ''' Stop the specified service CLI Example: .. code-block:: bash salt '*' service.stop <service name> ''' cmd = '/usr/sbin/svcadm disable -t {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def restart(name): ''' Restart the named service CLI Example: .. code-block:: bash salt '*' service.restart <service name> ''' cmd = '/usr/sbin/svcadm restart {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def reload_(name): ''' Reload the named service CLI Example: .. code-block:: bash salt '*' service.reload <service name> ''' cmd = '/usr/sbin/svcadm refresh {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def status(name, sig=None): ''' Return the status for a service, returns a bool whether the service is running. CLI Example: .. code-block:: bash salt '*' service.status <service name> ''' cmd = '/usr/bin/svcs -H -o STATE {0}'.format(name) line = __salt__['cmd.run'](cmd) if line == 'online': return True else: return False def enable(name, **kwargs): ''' Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name> ''' cmd = '/usr/sbin/svcadm enable {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def disable(name, **kwargs): ''' Disable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.disable <service name> ''' cmd = '/usr/sbin/svcadm disable {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def enabled(name): ''' Check to see if the named service is enabled to start on boot CLI Example: .. code-block:: bash salt '*' service.enabled <service name> ''' return name in get_enabled() def disabled(name): ''' Check to see if the named service is disabled to start on boot CLI Example: .. code-block:: bash salt '*' service.disabled <service name> ''' return name in get_disabled()
""" Service support for Solaris 10 and 11, should work with other systems that use SMF also. (e.g. SmartOS) """ __func_alias__ = {'reload_': 'reload'} def __virtual__(): """ Only work on systems which default to SMF """ enable = set(('Solaris', 'SmartOS')) if __grains__['os'] in enable: if __grains__['os'] == 'Solaris' and __grains__['kernelrelease'] == '5.9': return False return 'service' return False def get_enabled(): """ Return the enabled services CLI Example: .. code-block:: bash salt '*' service.get_enabled """ ret = set() cmd = 'svcs -H -o SVC,STATE -s SVC' lines = __salt__['cmd.run'](cmd).splitlines() for line in lines: comps = line.split() if not comps: continue if 'online' in line: ret.add(comps[0]) return sorted(ret) def get_disabled(): """ Return the disabled services CLI Example: .. code-block:: bash salt '*' service.get_disabled """ ret = set() cmd = 'svcs -aH -o SVC,STATE -s SVC' lines = __salt__['cmd.run'](cmd).splitlines() for line in lines: comps = line.split() if not comps: continue if not 'online' in line and (not 'legacy_run' in line): ret.add(comps[0]) return sorted(ret) def available(name): """ Return if the specified service is available CLI Example: .. code-block:: bash salt '*' service.available """ return name in get_all() def get_all(): """ Return all installed services CLI Example: .. code-block:: bash salt '*' service.get_all """ ret = set() cmd = 'svcs -aH -o SVC,STATE -s SVC' lines = __salt__['cmd.run'](cmd).splitlines() for line in lines: comps = line.split() if not comps: continue ret.add(comps[0]) return sorted(ret) def start(name): """ Start the specified service CLI Example: .. code-block:: bash salt '*' service.start <service name> """ cmd = '/usr/sbin/svcadm enable -t {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def stop(name): """ Stop the specified service CLI Example: .. code-block:: bash salt '*' service.stop <service name> """ cmd = '/usr/sbin/svcadm disable -t {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def restart(name): """ Restart the named service CLI Example: .. code-block:: bash salt '*' service.restart <service name> """ cmd = '/usr/sbin/svcadm restart {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def reload_(name): """ Reload the named service CLI Example: .. code-block:: bash salt '*' service.reload <service name> """ cmd = '/usr/sbin/svcadm refresh {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def status(name, sig=None): """ Return the status for a service, returns a bool whether the service is running. CLI Example: .. code-block:: bash salt '*' service.status <service name> """ cmd = '/usr/bin/svcs -H -o STATE {0}'.format(name) line = __salt__['cmd.run'](cmd) if line == 'online': return True else: return False def enable(name, **kwargs): """ Enable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.enable <service name> """ cmd = '/usr/sbin/svcadm enable {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def disable(name, **kwargs): """ Disable the named service to start at boot CLI Example: .. code-block:: bash salt '*' service.disable <service name> """ cmd = '/usr/sbin/svcadm disable {0}'.format(name) return not __salt__['cmd.retcode'](cmd) def enabled(name): """ Check to see if the named service is enabled to start on boot CLI Example: .. code-block:: bash salt '*' service.enabled <service name> """ return name in get_enabled() def disabled(name): """ Check to see if the named service is disabled to start on boot CLI Example: .. code-block:: bash salt '*' service.disabled <service name> """ return name in get_disabled()
n = int(input()) a = set(map(int, input().split())) m = int(input()) b = set(map(int, input().split())) inx = a.intersection(b) unx = a.union(b) x = unx.difference(inx) for i in sorted(x): print(i)
n = int(input()) a = set(map(int, input().split())) m = int(input()) b = set(map(int, input().split())) inx = a.intersection(b) unx = a.union(b) x = unx.difference(inx) for i in sorted(x): print(i)
class Simulation: def __init__(self, x, v, box, potentials, integrator): self.x = x self.v = v self.box = box self.potentials = potentials self.integrator = integrator
class Simulation: def __init__(self, x, v, box, potentials, integrator): self.x = x self.v = v self.box = box self.potentials = potentials self.integrator = integrator
# Hola 3 -> HolaHolaHola def repeticiones(n):#Funcion envolvente def repetidor(string):#funcion anidada assert type(string) == str, "Solo se pueden utilizar strings" #afirmamos que el valor ingresado es un entero, de lo contrario envia el mensaje de error return(string*n)# llama a scope superior return repetidor #regresa la funcion anidada def run(): repetir5 = repeticiones(5) print(repetir5("Hola")) repetir10 = repeticiones(10) print(repetir5("Chris")) if __name__ == '__main__': run()
def repeticiones(n): def repetidor(string): assert type(string) == str, 'Solo se pueden utilizar strings' return string * n return repetidor def run(): repetir5 = repeticiones(5) print(repetir5('Hola')) repetir10 = repeticiones(10) print(repetir5('Chris')) if __name__ == '__main__': run()
DATASET = "forest-2" CLASSES = 2 FEATURES = 54 NN_SIZE = 256 DIFFICULTY = 10000
dataset = 'forest-2' classes = 2 features = 54 nn_size = 256 difficulty = 10000
#!/usr/bin/env python3 class Case: def __init__(self, number_of_switches): self.number_of_switches = number_of_switches self.number_of_toggles = 0 def run(self): self.number_of_toggles = self.min_toggles_for(self.number_of_switches) def min_toggles_for(self, switches): """ If there are no switches, the toggles needed are 0. If there is only one switch, an unique toggle is needed. For two or more switches, the minimum number of toggles is two times the minimum number of toggles needed for one switch less, and for odd number of switches an additional toggle is necessary. """ if switches < 1: return 0 elif switches == 1: return 1 else: toggles = self.min_toggles_for(switches - 1) * 2 if switches % 2 == 1: # odd number of switches toggles += 1 return toggles class Input: def run(self): number_of_cases = int(input()) for c in range(number_of_cases): self.parse_case() def parse_case(self): number_of_switches = int(input()) switch_system = Case(number_of_switches) switch_system.run() print(switch_system.number_of_toggles) Input().run()
class Case: def __init__(self, number_of_switches): self.number_of_switches = number_of_switches self.number_of_toggles = 0 def run(self): self.number_of_toggles = self.min_toggles_for(self.number_of_switches) def min_toggles_for(self, switches): """ If there are no switches, the toggles needed are 0. If there is only one switch, an unique toggle is needed. For two or more switches, the minimum number of toggles is two times the minimum number of toggles needed for one switch less, and for odd number of switches an additional toggle is necessary. """ if switches < 1: return 0 elif switches == 1: return 1 else: toggles = self.min_toggles_for(switches - 1) * 2 if switches % 2 == 1: toggles += 1 return toggles class Input: def run(self): number_of_cases = int(input()) for c in range(number_of_cases): self.parse_case() def parse_case(self): number_of_switches = int(input()) switch_system = case(number_of_switches) switch_system.run() print(switch_system.number_of_toggles) input().run()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Schooner - Course Management System # University of Turku / Faculty of Technilogy / Department of Computing # (c) 2021, Jani Tammi <jasata@utu.fi> # # Submission.py - Data dictionary class for core.submission # 2021-08-27 Initial version. # 2021-09-03 Updated to more flexible version with .db_update(). # class Submission(dict): def __init__(self, cursor, submission_id: int = None): self.cursor = cursor # Primary key is whatever are the call parameters, minus the first two self.pkkeys = [k for k in locals().keys() if k not in ('self', 'cursor')] self.pkvals = locals() # to avoid KeyError while being used inside comprehensions self.pkvals = [self.pkvals[k] for k in self.pkkeys] SQL = f"SELECT * FROM core.{self.__class__.__name__} WHERE " if all(self.pkvals): SQL += " AND ".join([f"{pk}=%({pk})s" for pk in self.pkkeys]) else: SQL += "false" if cursor.execute(SQL, locals()).rowcount: self.update( dict( zip( [key[0] for key in cursor.description], cursor.fetchone() ) ) ) elif all([v is None for v in self.pkvals]): # (all) PKs are None -> Create empty dict self.update( dict( zip( [key[0] for key in cursor.description], [None] * len(cursor.description) ) ) ) else: raise ValueError( f"{self.__class__.__name__} (" + ", ".join(f"'{v}'" for v in self.pkvals) + ") not found!" ) def db_update(self, commit: bool = True) -> None: """Update database table to match. (Will not INSERT).""" issues = [] for k in self.pkkeys: if not self[k]: issues.append(k) if issues: raise ValueError( f"Primary key value(s) ({', '.join(issues)}) have NULL values!" ) SQL = f"UPDATE core.{self.__class__.__name__} SET " SQL += ", ".join([f"{k}=%({k})s" for k in self.keys() if k not in self.pkkeys]) SQL += " WHERE " SQL += " AND ".join([f"{pk}=%({pk})s" for pk in self.pkkeys]) if not self.cursor.execute(SQL, self).rowcount: raise Exception( f"Unable to UPDATE {self.__class__.__name__} (" + ", ".join(f"'{self[k]}'" for k in self.pkkeys) + ")!" ) if commit: self.cursor.connection.commit() # EOF
class Submission(dict): def __init__(self, cursor, submission_id: int=None): self.cursor = cursor self.pkkeys = [k for k in locals().keys() if k not in ('self', 'cursor')] self.pkvals = locals() self.pkvals = [self.pkvals[k] for k in self.pkkeys] sql = f'SELECT * FROM core.{self.__class__.__name__} WHERE ' if all(self.pkvals): sql += ' AND '.join([f'{pk}=%({pk})s' for pk in self.pkkeys]) else: sql += 'false' if cursor.execute(SQL, locals()).rowcount: self.update(dict(zip([key[0] for key in cursor.description], cursor.fetchone()))) elif all([v is None for v in self.pkvals]): self.update(dict(zip([key[0] for key in cursor.description], [None] * len(cursor.description)))) else: raise value_error(f'{self.__class__.__name__} (' + ', '.join((f"'{v}'" for v in self.pkvals)) + ') not found!') def db_update(self, commit: bool=True) -> None: """Update database table to match. (Will not INSERT).""" issues = [] for k in self.pkkeys: if not self[k]: issues.append(k) if issues: raise value_error(f"Primary key value(s) ({', '.join(issues)}) have NULL values!") sql = f'UPDATE core.{self.__class__.__name__} SET ' sql += ', '.join([f'{k}=%({k})s' for k in self.keys() if k not in self.pkkeys]) sql += ' WHERE ' sql += ' AND '.join([f'{pk}=%({pk})s' for pk in self.pkkeys]) if not self.cursor.execute(SQL, self).rowcount: raise exception(f'Unable to UPDATE {self.__class__.__name__} (' + ', '.join((f"'{self[k]}'" for k in self.pkkeys)) + ')!') if commit: self.cursor.connection.commit()
# -*- coding: utf-8 -*- def get_node_indice(self, coordinates=None): """Return a matrix of nodes coordinates. Parameters ---------- self : Mesh an Mesh object indices : list Indices of the targeted nodes. If None, return all. is_indice: bool Option to return the nodes indices (useful for unsorted Returns ------- coordinates: ndarray nodes coordinates indices : ndarray nodes indices """ if coordinates is None: return self.node.get_indice() else: pass # TODO Search for indice of a node from coordiantes
def get_node_indice(self, coordinates=None): """Return a matrix of nodes coordinates. Parameters ---------- self : Mesh an Mesh object indices : list Indices of the targeted nodes. If None, return all. is_indice: bool Option to return the nodes indices (useful for unsorted Returns ------- coordinates: ndarray nodes coordinates indices : ndarray nodes indices """ if coordinates is None: return self.node.get_indice() else: pass
class ContainerHypervisor(): def __init__(self): self.data = {} def parse(self, verbose=True): assert False, "Please use a subclass the implements this method." def retrieve_inputs(self, inputs, *args): assert False, "Please use a subclass the implements this method." def upload_outputs(self, outputs): assert False, "Please use a subclass the implements this method." def run_task(self, task, data, parameters): """ Returns the dictionary of outputs from the task. """ assert False, "Please use a subclass the implements this method."
class Containerhypervisor: def __init__(self): self.data = {} def parse(self, verbose=True): assert False, 'Please use a subclass the implements this method.' def retrieve_inputs(self, inputs, *args): assert False, 'Please use a subclass the implements this method.' def upload_outputs(self, outputs): assert False, 'Please use a subclass the implements this method.' def run_task(self, task, data, parameters): """ Returns the dictionary of outputs from the task. """ assert False, 'Please use a subclass the implements this method.'
class ImportError(Exception): pass class CatalogueImportError(Exception): pass
class Importerror(Exception): pass class Catalogueimporterror(Exception): pass
class Solution: def numberToWords(self, num: int) -> str: LESS_THAN_20 = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"] TENS = ["", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"] THOUSANDS = ["", "Thousand", "Million", "Billion"] def helper(num): if num == 0: return '' elif num < 20: return LESS_THAN_20[num] + ' ' elif num < 100: return TENS[num // 10] + ' ' + helper(num % 10) return LESS_THAN_20[num // 100] + ' Hundred ' + helper(num % 100) if num == 0: return 'Zero' res = '' i = 0 while num: if num % 1000: res = helper(num % 1000) + THOUSANDS[i] + ' ' + res i += 1 num //= 1000 return res.strip()
class Solution: def number_to_words(self, num: int) -> str: less_than_20 = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen'] tens = ['', 'Ten', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety'] thousands = ['', 'Thousand', 'Million', 'Billion'] def helper(num): if num == 0: return '' elif num < 20: return LESS_THAN_20[num] + ' ' elif num < 100: return TENS[num // 10] + ' ' + helper(num % 10) return LESS_THAN_20[num // 100] + ' Hundred ' + helper(num % 100) if num == 0: return 'Zero' res = '' i = 0 while num: if num % 1000: res = helper(num % 1000) + THOUSANDS[i] + ' ' + res i += 1 num //= 1000 return res.strip()
a = int(input()) b = int(input()) if(a > b): print(True) else: print(False)
a = int(input()) b = int(input()) if a > b: print(True) else: print(False)
class X: pass class Y: pass class Z: pass class A(X, Y): pass class B(Y, Z): pass class M(B, A, Z): pass # Output: # [<class '__main__.M'>, <class '__main__.B'>, # <class '__main__.A'>, <class '__main__.X'>, # <class '__main__.Y'>, <class '__main__.Z'>, # <class 'object'>] print(M.mro())
class X: pass class Y: pass class Z: pass class A(X, Y): pass class B(Y, Z): pass class M(B, A, Z): pass print(M.mro())
#Its a simple Rock paper scissor game print('...Rock...') print('...Paper...') print('...Scissor...') x = input('Enter Player 1 Choice ') print('No Cheating\n\n' * 20) y = input('Enter Play 2 Choice ') if x == 'paper' and y == 'rock': print('Player 1 won') elif x == 'rock' and y == 'paper': print('Player 2 wins') elif x == 'scissor' and y == 'paper': print('Player 1 wins') elif x == 'paper' and y == 'scissor': print('Player 2 wins ') elif x == 'rock' and y == 'scissor': print('Player 1 wins') elif x == 'scissor' and y == 'rock': print('Player 2 wins ') else: print('Something else went wrong')
print('...Rock...') print('...Paper...') print('...Scissor...') x = input('Enter Player 1 Choice ') print('No Cheating\n\n' * 20) y = input('Enter Play 2 Choice ') if x == 'paper' and y == 'rock': print('Player 1 won') elif x == 'rock' and y == 'paper': print('Player 2 wins') elif x == 'scissor' and y == 'paper': print('Player 1 wins') elif x == 'paper' and y == 'scissor': print('Player 2 wins ') elif x == 'rock' and y == 'scissor': print('Player 1 wins') elif x == 'scissor' and y == 'rock': print('Player 2 wins ') else: print('Something else went wrong')
def add(x,y): """Add two numer together""" return x + y def substract(x,y): """Substract x from y and return value """ return y - x
def add(x, y): """Add two numer together""" return x + y def substract(x, y): """Substract x from y and return value """ return y - x
# Program 70 : Function to print binary number using recursion def convertToBinary(n): if n > 1: convertToBinary(n//2) print(n % 2,end = '') # decimal number dec = int(input("Enter Decimal Number : ")) convertToBinary(dec) print()
def convert_to_binary(n): if n > 1: convert_to_binary(n // 2) print(n % 2, end='') dec = int(input('Enter Decimal Number : ')) convert_to_binary(dec) print()
def to_celsius(kelvin:float, round_digit=2) -> float: """Convert Kelvin to Celsius Args: kelvin (float): round_digit (int, optional): Defaults to 2. Returns: float: celcius """ return round(kelvin-273.15, round_digit) def fahr_to_celsius(fahr): cel=(fahr-32)*(5/9) return round(cel) def celsius_to_fahr(celsius): fahr=(9*celsius)/5+32 return round(fahr)
def to_celsius(kelvin: float, round_digit=2) -> float: """Convert Kelvin to Celsius Args: kelvin (float): round_digit (int, optional): Defaults to 2. Returns: float: celcius """ return round(kelvin - 273.15, round_digit) def fahr_to_celsius(fahr): cel = (fahr - 32) * (5 / 9) return round(cel) def celsius_to_fahr(celsius): fahr = 9 * celsius / 5 + 32 return round(fahr)
buffet = ('beef', 'chicken', 'fish', 'pork', 'lamb') for item in buffet: print(item, end=" ") print() buffet = ('wagyu', 'chicken', 'fish', 'squid', 'lamb') for item in buffet: print(item, end=" ")
buffet = ('beef', 'chicken', 'fish', 'pork', 'lamb') for item in buffet: print(item, end=' ') print() buffet = ('wagyu', 'chicken', 'fish', 'squid', 'lamb') for item in buffet: print(item, end=' ')
''' Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Output: Because nums[0] + nums[1] == 9, we return [0, 1]. Example 2: Input: nums = [3,2,4], target = 6 Output: [1,2] Example 3: Input: nums = [3,3], target = 6 Output: [0,1] Constraints: 2 <= nums.length <= 104 -109 <= nums[i] <= 109 -109 <= target <= 109 Only one valid answer exists. ''' class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: for num in nums: if (target - num) in nums: return [nums.index(num), nums.index(target - num)] else: continue
""" Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Output: Because nums[0] + nums[1] == 9, we return [0, 1]. Example 2: Input: nums = [3,2,4], target = 6 Output: [1,2] Example 3: Input: nums = [3,3], target = 6 Output: [0,1] Constraints: 2 <= nums.length <= 104 -109 <= nums[i] <= 109 -109 <= target <= 109 Only one valid answer exists. """ class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: for num in nums: if target - num in nums: return [nums.index(num), nums.index(target - num)] else: continue
SQLALCHEMY_DATABASE_URI = \ 'postgres+psycopg2://postgres:postgres@172.16.100.140/tdt2018' # 'postgres+psycopg2://postgres:postgres@localhost/tdt2018' SECRET_KEY = '\x88D\xf09\x91\x07\x98\x89\x87\x96\xa0A\xc68\xf9\xecJ:U\x17\xc5V\xbe\x8b\xef\xd7\xd8\xd3\xe6\x98*4'
sqlalchemy_database_uri = 'postgres+psycopg2://postgres:postgres@172.16.100.140/tdt2018' secret_key = '\x88Dð9\x91\x07\x98\x89\x87\x96\xa0AÆ8ùìJ:U\x17ÅV¾\x8bïרӿ\x98*4'
class Source(object): """Source is a data source capable of fetching and rendering data. To create your own custom data source, you should subclass this class and override it with your own fetch() and render() functions. aiohttp is provided to all Source classes to fetch data over HTTP. See httpcodesource.py for an example on how to build your own simple data Source class. """ def __init__(self, aio_session): self.session = aio_session async def fetch(self, *args, **kwargs): pass async def render(self, *args, **kwargs): pass
class Source(object): """Source is a data source capable of fetching and rendering data. To create your own custom data source, you should subclass this class and override it with your own fetch() and render() functions. aiohttp is provided to all Source classes to fetch data over HTTP. See httpcodesource.py for an example on how to build your own simple data Source class. """ def __init__(self, aio_session): self.session = aio_session async def fetch(self, *args, **kwargs): pass async def render(self, *args, **kwargs): pass