content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Right click functions and operators def dump(obj, text): print('-'*40, text, '-'*40) for attr in dir(obj): if hasattr( obj, attr ): print( "obj.%s = %s" % (attr, getattr(obj, attr))) def split_path(str): """Splits a data path into rna + id. This is the core of creating controls f...
def dump(obj, text): print('-' * 40, text, '-' * 40) for attr in dir(obj): if hasattr(obj, attr): print('obj.%s = %s' % (attr, getattr(obj, attr))) def split_path(str): """Splits a data path into rna + id. This is the core of creating controls for properties. """ (rna, path...
# alternative characters T = input() lst = [] results = [] if T >= 1 and T <= 10: for i in range(T): lst.append(raw_input()) lst = filter(lambda x: len(x) >= 1 and len(x) <= 10**5, lst) for cst in lst: delct = 0 for j in range(len(cst)-1): if cst[j] == cst[j+1]: ...
t = input() lst = [] results = [] if T >= 1 and T <= 10: for i in range(T): lst.append(raw_input()) lst = filter(lambda x: len(x) >= 1 and len(x) <= 10 ** 5, lst) for cst in lst: delct = 0 for j in range(len(cst) - 1): if cst[j] == cst[j + 1]: delct += 1 ...
a = int(input()) c = int(input()) s = True for b in range(a - 1): if int(input()) >= c: s = False if s: print("YES") else: print("NO")
a = int(input()) c = int(input()) s = True for b in range(a - 1): if int(input()) >= c: s = False if s: print('YES') else: print('NO')
n, m = map(int, input().split()) shops = [tuple(map(int, input().split())) for _ in range(n)] shops.sort(key=lambda x: x[0]) ans = 0 for a, b in shops: if m <= b: ans += a * m break else: ans += a * b m -= b print(ans)
(n, m) = map(int, input().split()) shops = [tuple(map(int, input().split())) for _ in range(n)] shops.sort(key=lambda x: x[0]) ans = 0 for (a, b) in shops: if m <= b: ans += a * m break else: ans += a * b m -= b print(ans)
''' Power of Two Solution Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: Input: 16 Output: true Explanation: 24 = 16 Example 3: Input: 218 Output: false''' n = int(input()) if n <= 0 : print('false')...
""" Power of Two Solution Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: Input: 16 Output: true Explanation: 24 = 16 Example 3: Input: 218 Output: false""" n = int(input()) if n <= 0: print('false') while n % 2 == 0: ...
# Copyright 2017 Lawrence Kesteloot # # 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...
class Photo(object): def __init__(self, id, hash_back, rotation, rating, date, display_date, label): self.id = id self.hash_back = hash_back self.rotation = rotation self.rating = rating self.date = date self.display_date = display_date self.label = label ...
# eerste negen cijfers van ISBN-10 code inlezen en omzetten naar integers x1 = int(input()) x2 = int(input()) x3 = int(input()) x4 = int(input()) x5 = int(input()) x6 = int(input()) x7 = int(input()) x8 = int(input()) x9 = int(input()) # controlecijfer berekenen x10 = (x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 + 6 * x6 +...
x1 = int(input()) x2 = int(input()) x3 = int(input()) x4 = int(input()) x5 = int(input()) x6 = int(input()) x7 = int(input()) x8 = int(input()) x9 = int(input()) x10 = (x1 + 2 * x2 + 3 * x3 + 4 * x4 + 5 * x5 + 6 * x6 + 7 * x7 + 8 * x8 + 9 * x9) % 11 print(x10)
def get_attr_or_callable(obj, name): target = getattr(obj, name) if callable(target): return target() return target
def get_attr_or_callable(obj, name): target = getattr(obj, name) if callable(target): return target() return target
SAMPLE_NRTM_V3 = """ % NRTM v3 contains serials per object. % Another comment %START Version: 3 TEST 11012700-11012701 ADD 11012700 person: NRTM test address: NowhereLand source: TEST DEL 11012701 inetnum: 192.0.2.0 - 192.0.2.255 source: TEST %END TEST """ # NRTM v1 has no serials per object SAMPLE_NRTM_V1 = ""...
sample_nrtm_v3 = '\n% NRTM v3 contains serials per object.\n\n% Another comment\n\n%START Version: 3 TEST 11012700-11012701\n\nADD 11012700\n\nperson: NRTM test\naddress: NowhereLand\nsource: TEST\n\nDEL 11012701\n\ninetnum: 192.0.2.0 - 192.0.2.255\nsource: TEST\n\n%END TEST\n' sample_nrtm_v1 = '%START Version: 1 TEST ...
class Packager: """ Packager class. This class is used to generate the required XML to send back to the client. """ def __init__(self): self.xml_version = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" self.begin_root = "<kevlar>" self.end_root = "</kevlar>" def generate_...
class Packager: """ Packager class. This class is used to generate the required XML to send back to the client. """ def __init__(self): self.xml_version = '<?xml version="1.0" encoding="UTF-8"?>' self.begin_root = '<kevlar>' self.end_root = '</kevlar>' def generate_acco...
# These are the "Tableau 20" colors as RGB. tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120), (44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150), (148, 103, 189), (197, 176, 213), (140, 86, 75), (196, 156, 148), (227, 119, 1...
tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120), (44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150), (148, 103, 189), (197, 176, 213), (140, 86, 75), (196, 156, 148), (227, 119, 194), (247, 182, 210), (127, 127, 127), (199, 199, 199), (188, 189, 34), (219, 219, 141), (23, 190, ...
"""Utility functions for RtMidi backend. These are in a separate file so they can be tested without the `python-rtmidi` package. """ def expand_alsa_port_name(port_names, name): """Expand ALSA port name. RtMidi/ALSA includes client name and client:port number in the port name, for example: TiM...
"""Utility functions for RtMidi backend. These are in a separate file so they can be tested without the `python-rtmidi` package. """ def expand_alsa_port_name(port_names, name): """Expand ALSA port name. RtMidi/ALSA includes client name and client:port number in the port name, for example: TiMi...
# -*- coding: utf-8 -*- # Which templates don't you want to generate? (You can use regular expressions here!) # Use strings (with single or double quotes), and separate each template/regex in a line terminated with a comma. IGNORE_JINJA_TEMPLATES = [ '.*base.jinja', '.*tests/.*' ] # Do you have any additional...
ignore_jinja_templates = ['.*base.jinja', '.*tests/.*'] extra_variables = {'test_type': 'Array', 'name': 'float', 'dim': 3, 'type': 'float', 'suffix': 'f', 'extends': '[3]'} output_options = {'extension': '3_arr.cpp', 'remove_double_extension': False}
class Solution(object): # def removeDuplicates(self, nums): # """ # :type nums: List[int] # :rtype: int # """ # ls = len(nums) # if ls <= 1: # return ls # last = nums[0] # pos = 1 # for t in nums[1:]: # ...
class Solution(object): def remove_duplicates(self, nums): if len(nums) == 0: return 0 left = 0 for i in range(1, len(nums)): if nums[left] == nums[i]: continue else: left += 1 nums[left] = nums[i] r...
class Solution: def combine(self, n: int, k: int) -> List[List[int]]: results = [] def dfs (elements, start: int, k: int): if k == 0: results.append(elements[:]) for i in range (start, n+1): elements....
class Solution: def combine(self, n: int, k: int) -> List[List[int]]: results = [] def dfs(elements, start: int, k: int): if k == 0: results.append(elements[:]) for i in range(start, n + 1): elements.append(i) dfs(elements, i ...
load( "@build_bazel_rules_apple//apple:providers.bzl", "AppleBundleInfo", "AppleResourceInfo", "IosFrameworkBundleInfo", ) load( "@build_bazel_rules_apple//apple/internal:resources.bzl", "resources", ) load( "//rules:providers.bzl", "AvoidDepsInfo", ) load( "@build_bazel_rules_apple/...
load('@build_bazel_rules_apple//apple:providers.bzl', 'AppleBundleInfo', 'AppleResourceInfo', 'IosFrameworkBundleInfo') load('@build_bazel_rules_apple//apple/internal:resources.bzl', 'resources') load('//rules:providers.bzl', 'AvoidDepsInfo') load('@build_bazel_rules_apple//apple/internal/providers:embeddable_info.bzl'...
text = 'Writing to a file which\n' fileis = open('hello.txt', 'w') fileis.write(text) fileis.close()
text = 'Writing to a file which\n' fileis = open('hello.txt', 'w') fileis.write(text) fileis.close()
def gcd(p, q): pTrue = isinstance(p,int) qTrue = isinstance(q,int) if pTrue and qTrue: if q == 0: return p r = p%q return gcd(q,r) else: print("Error!") return 0
def gcd(p, q): p_true = isinstance(p, int) q_true = isinstance(q, int) if pTrue and qTrue: if q == 0: return p r = p % q return gcd(q, r) else: print('Error!') return 0
# -*- coding: utf-8 -*- keywords = { "abbrev", "abs", "abstime", "abstimeeq", "abstimege", "abstimegt", "abstimein", "abstimele", "abstimelt", "abstimene", "abstimeout", "abstimerecv", "abstimesend", "aclcontains", "aclinsert", "aclitemeq", "aclitemin...
keywords = {'abbrev', 'abs', 'abstime', 'abstimeeq', 'abstimege', 'abstimegt', 'abstimein', 'abstimele', 'abstimelt', 'abstimene', 'abstimeout', 'abstimerecv', 'abstimesend', 'aclcontains', 'aclinsert', 'aclitemeq', 'aclitemin', 'aclitemout', 'aclremove', 'acos', 'add_months', 'aes128', 'aes256', 'age', 'all', 'alloc_r...
# 231A - Team # http://codeforces.com/problemset/problem/231/A n = int(input()) c = 0 for i in range(n): arr = [x for x in input().split() if int(x) == 1] if len(arr) >= 2: c += 1 print(c)
n = int(input()) c = 0 for i in range(n): arr = [x for x in input().split() if int(x) == 1] if len(arr) >= 2: c += 1 print(c)
"""Base class for Node and LinkedLists""" class BaseLinkedList: def __init__(self): pass class BaseNode: def __init__(self, val=0, next_node=None): self._val = val self._next_node = next_node def __repr__(self): return f"Node({self.val, self._next_node})"
"""Base class for Node and LinkedLists""" class Baselinkedlist: def __init__(self): pass class Basenode: def __init__(self, val=0, next_node=None): self._val = val self._next_node = next_node def __repr__(self): return f'Node({(self.val, self._next_node)})'
description = 'XCCM' group = 'basic' includes = [ # 'source', # 'table', # 'detector', 'virtual_sample_motors', 'virtual_detector_motors', 'virtual_optic_motors', 'virtual_IOcard', 'optic_tool_switch', 'virtual_capillary_motors', 'capillary_selector' ]
description = 'XCCM' group = 'basic' includes = ['virtual_sample_motors', 'virtual_detector_motors', 'virtual_optic_motors', 'virtual_IOcard', 'optic_tool_switch', 'virtual_capillary_motors', 'capillary_selector']
""" https://www.hackerrank.com/challenges/binary-search-tree-insertion/problem """ # CODE PROVIDED BY TASK STARTS class Node: def __init__(self, info): self.info = info self.left = None self.right = None self.level = None def __str__(self): return str(self.info) def...
""" https://www.hackerrank.com/challenges/binary-search-tree-insertion/problem """ class Node: def __init__(self, info): self.info = info self.left = None self.right = None self.level = None def __str__(self): return str(self.info) def pre_order(root): if root is ...
"""Triples are a way to define information about a platform/system. This module provides a way to convert a triple string into a well structured object to avoid constant string parsing in starlark code. Triples can be described at the following link: https://clang.llvm.org/docs/CrossCompilation.html#target-triple """...
"""Triples are a way to define information about a platform/system. This module provides a way to convert a triple string into a well structured object to avoid constant string parsing in starlark code. Triples can be described at the following link: https://clang.llvm.org/docs/CrossCompilation.html#target-triple """...
# -*- coding:utf-8 -*- """ Description: Script OP Code Usage: from AntShares.Core.Scripts.ScriptOp import ScriptOp """ class ScriptOp(object): # Constants OP_0 = 0x00 # An empty array of bytes is pushed onto the stack. (This is not a no-op: an item is added to the stack.) OP_FALSE = OP_0 OP_PU...
""" Description: Script OP Code Usage: from AntShares.Core.Scripts.ScriptOp import ScriptOp """ class Scriptop(object): op_0 = 0 op_false = OP_0 op_pushbytes1 = 1 op_pushbytes75 = 75 op_pushdata1 = 76 op_pushdata2 = 77 op_pushdata4 = 78 op_1_negate = 79 op_1 = 81 op_true...
def triplewise(it): try: a, b = next(it), next(it) except StopIteration: return for c in it: yield a, b, c a, b = b, c def inc_count(values): last = None count = 0 for v in values: if last is not None and v > last: count += 1 last = v...
def triplewise(it): try: (a, b) = (next(it), next(it)) except StopIteration: return for c in it: yield (a, b, c) (a, b) = (b, c) def inc_count(values): last = None count = 0 for v in values: if last is not None and v > last: count += 1 ...
definitions = { "StringArray": { "type": "array", "items": { "type": "string", } }, "AudioEncoding": { "type": "string", "enum": ["LINEAR16", "ALAW", "MULAW", "LINEAR32F", "RAW_OPUS", "MPEG_AUDIO"] }, "VoiceActivityDetectionConfig": { "type...
definitions = {'StringArray': {'type': 'array', 'items': {'type': 'string'}}, 'AudioEncoding': {'type': 'string', 'enum': ['LINEAR16', 'ALAW', 'MULAW', 'LINEAR32F', 'RAW_OPUS', 'MPEG_AUDIO']}, 'VoiceActivityDetectionConfig': {'type': 'object', 'properties': {'min_speech_duration': {'type': 'number'}, 'max_speech_durati...
""" Module: 'esp32' on esp32 1.11.0 """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-324-g40844fd27 on 2019-07-17', machine='ESP32 module with ESP32') # Stubber: 1.2.0 class ULP: '' RESERVE_MEM = 0 def load_binary(): pass def run(): pass def set_wake...
""" Module: 'esp32' on esp32 1.11.0 """ class Ulp: """""" reserve_mem = 0 def load_binary(): pass def run(): pass def set_wakeup_period(): pass wakeup_all_low = None wakeup_any_high = None def hall_sensor(): pass def raw_temperature(): pass def wake_on_ext0(): ...
def isEscapePossible(self, blocked, source, target): blocked = set(map(tuple, blocked)) def dfs(x, y, target, seen): if ( not (0 <= x < 10 ** 6 and 0 <= y < 10 ** 6) or (x, y) in blocked or (x, y) in seen ): return False seen.add((x, y)) ...
def is_escape_possible(self, blocked, source, target): blocked = set(map(tuple, blocked)) def dfs(x, y, target, seen): if not (0 <= x < 10 ** 6 and 0 <= y < 10 ** 6) or (x, y) in blocked or (x, y) in seen: return False seen.add((x, y)) if len(seen) > 20000 or [x, y] == targe...
# (c) Copyright IBM Corp. 2019. All Rights Reserved. """Class to handle manipulating the ServiceNow Records Data Table""" class ServiceNowRecordsDataTable(object): """Class that handles the sn_records_dt datatable""" def __init__(self, res_client, incident_id): self.res_client = res_client self...
"""Class to handle manipulating the ServiceNow Records Data Table""" class Servicenowrecordsdatatable(object): """Class that handles the sn_records_dt datatable""" def __init__(self, res_client, incident_id): self.res_client = res_client self.incident_id = incident_id self.api_name = '...
def compute(dna_string1: str, dna_string2: str) -> int: hamming_distance = 0 for index in range(0, len(dna_string1)): if dna_string1[index] is not dna_string2[index]: hamming_distance += 1 return hamming_distance
def compute(dna_string1: str, dna_string2: str) -> int: hamming_distance = 0 for index in range(0, len(dna_string1)): if dna_string1[index] is not dna_string2[index]: hamming_distance += 1 return hamming_distance
class Graph(): def __init__(self): self.numberOfNodes = 0 self.adjacentList = {} def __str__(self): return str(self.__dict__) def addVertex(self, node): self.adjacentList[node] = [] self.numberOfNodes += 1 def addEdge(self, nodeA, nodeB): self.adjacentList[nodeA].append(nodeB) self.adjacentList[no...
class Graph: def __init__(self): self.numberOfNodes = 0 self.adjacentList = {} def __str__(self): return str(self.__dict__) def add_vertex(self, node): self.adjacentList[node] = [] self.numberOfNodes += 1 def add_edge(self, nodeA, nodeB): self.adjacent...
""" # -*- coding: UTF-8 -*- # **********************************************************************************# # File: CONSTANT file. # Author: Myron # **********************************************************************************# """ AVAILABLE_DATA_FIELDS = [ 'cadd', 'cadw', 'cadm', 'cadq', 'scdh1'...
""" # -*- coding: UTF-8 -*- # **********************************************************************************# # File: CONSTANT file. # Author: Myron # **********************************************************************************# """ available_data_fields = ['cadd', 'cadw', 'cadm', 'cadq', 'scdh1', 'scdh...
message = "zulkepretest make simpletes cpplest" translate = '' i = len(message) - 1 while i >= 0: translate = translate + message[i] i = i - 1 print("enc message is :"+ translate) print("message :"+ message)
message = 'zulkepretest make simpletes cpplest' translate = '' i = len(message) - 1 while i >= 0: translate = translate + message[i] i = i - 1 print('enc message is :' + translate) print('message :' + message)
def whats_up_world(): print("What's up world?") if __name__ == "__main__": whats_up_world()
def whats_up_world(): print("What's up world?") if __name__ == '__main__': whats_up_world()
# -*- coding: utf-8 -*- featureInfo = dict() featureInfo['m21']=[ ['P22','Quality','Set to 0 if the key signature indicates that a recording is major, set to 1 if it indicates that it is minor and set to 0 if key signature is unknown. Music21 addition: if no key mode is found in the piece, analyze the piece to discove...
feature_info = dict() featureInfo['m21'] = [['P22', 'Quality', 'Set to 0 if the key signature indicates that a recording is major, set to 1 if it indicates that it is minor and set to 0 if key signature is unknown. Music21 addition: if no key mode is found in the piece, analyze the piece to discover what mode it is mos...
class Animal: def __init__(self, age, name): self.age = age # public attribute self.name = name # public attribute def saluda(self, saludo='Hola', receptor = 'nuevo amigo'): print(saludo + " " + receptor) @staticmethod def add(a, b): if isinstance(a, int) and isinstance(...
class Animal: def __init__(self, age, name): self.age = age self.name = name def saluda(self, saludo='Hola', receptor='nuevo amigo'): print(saludo + ' ' + receptor) @staticmethod def add(a, b): if isinstance(a, int) and isinstance(b, int): return a + b ...
""" Undefined-Complete-Key A key whose binding is Empty. """ class UndefinedCompleteKey( CompleteKey, ): pass
""" Undefined-Complete-Key A key whose binding is Empty. """ class Undefinedcompletekey(CompleteKey): pass
class Filenames: class models: base = './res/models/player/' player = base + 'bicycle.obj' base = './res/models/oponents/' player = base + 'bicycle.obj' class textures: base = './res/textures/' floor_tile = base + 'floor.png' ...
class Filenames: class Models: base = './res/models/player/' player = base + 'bicycle.obj' base = './res/models/oponents/' player = base + 'bicycle.obj' class Textures: base = './res/textures/' floor_tile = base + 'floor.png' wall_tile = base + 'rim_wall...
#!/usr/bin/env python # -*- coding: utf-8 -*- class PodiumEventDevice(object): """ Object that represents a device at an event. **Attributes:** **eventdevice_id** (str): Unique id for device at this event **uri** (str): URI for this device at this event. **channels** (l...
class Podiumeventdevice(object): """ Object that represents a device at an event. **Attributes:** **eventdevice_id** (str): Unique id for device at this event **uri** (str): URI for this device at this event. **channels** (list): List of channels of data. Can be sensors or ...
"""Exceptions for event processor.""" class EventProcessorError(BaseException): """General exception for the event-processor library.""" class FilterError(EventProcessorError): """Exception for failures related to filters.""" class InvocationError(EventProcessorError): """Exception for failures in inv...
"""Exceptions for event processor.""" class Eventprocessorerror(BaseException): """General exception for the event-processor library.""" class Filtererror(EventProcessorError): """Exception for failures related to filters.""" class Invocationerror(EventProcessorError): """Exception for failures in invoca...
class Recursion: def PalindromeCheck(self, strVal, i, j): if i>j: return True return self.PalindromeCheck(strVal, i + 1, j - 1) if strVal[i] == strVal[j] else False strVal = "q2eeeq" obj = Recursion() print(obj.PalindromeCheck(strVal, 0, len(strVal)-1))
class Recursion: def palindrome_check(self, strVal, i, j): if i > j: return True return self.PalindromeCheck(strVal, i + 1, j - 1) if strVal[i] == strVal[j] else False str_val = 'q2eeeq' obj = recursion() print(obj.PalindromeCheck(strVal, 0, len(strVal) - 1))
# Identity vs. Equality # - is vs. == # - working with literals # - isinstance() a = 1 b = 1.0 c = "1" print(a == b) print(a is b) print(c == "1") print(c is "1") print(b == 1) print(b is 1) print(b == 1 and isinstance(b, int)) print(a == 1 and isinstance(a, int)) # d = 100000000000000000000000000000000 d = float...
a = 1 b = 1.0 c = '1' print(a == b) print(a is b) print(c == '1') print(c is '1') print(b == 1) print(b is 1) print(b == 1 and isinstance(b, int)) print(a == 1 and isinstance(a, int)) d = float(10) e = float(10) print(id(d)) print(id(e)) print(d == e) print(d is e) b = int(b) print(b) print(b == 1 and isinstance(b, int...
# 54. Spiral Matrix # O(n) time | O(n) space class Solution: def spiralOrder(self, matrix: [[int]]) -> [int]: """ Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Input: [ [ 1, 2, 3 ], [...
class Solution: def spiral_order(self, matrix: [[int]]) -> [int]: """ Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Input: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ...
age=input("How old ara you?") height=input("How tall are you?") weight=input("How much do you weigth?") print("So ,you're %r old , %r tall and %r heavy ." %(age,height,weight))
age = input('How old ara you?') height = input('How tall are you?') weight = input('How much do you weigth?') print("So ,you're %r old , %r tall and %r heavy ." % (age, height, weight))
class Room(): """ A room to give lectures in. """ def __init__(self, number, lectures, timeslots): """ Constructor """ self.number = number self._lectures = lectures self._timeslots = timeslots def can_be_used_for(self, lecture): """ ...
class Room: """ A room to give lectures in. """ def __init__(self, number, lectures, timeslots): """ Constructor """ self.number = number self._lectures = lectures self._timeslots = timeslots def can_be_used_for(self, lecture): """ Is...
def compute_bag_of_words(dataset,lang,domain_stopwords=[]): d = [] for index,row in dataset.iterrows(): text = row['title'] #texto do evento text2 = remove_stopwords(text, lang,domain_stopwords) text3 = stemming(text2, lang) d.append(text3) matrix = CountVectorizer(max_features=1000) X = m...
def compute_bag_of_words(dataset, lang, domain_stopwords=[]): d = [] for (index, row) in dataset.iterrows(): text = row['title'] text2 = remove_stopwords(text, lang, domain_stopwords) text3 = stemming(text2, lang) d.append(text3) matrix = count_vectorizer(max_features=1000) ...
def generator(): try: yield except RuntimeError as e: print(e) yield 'hello after first yield' g = generator() next(g) result = g.throw(RuntimeError, 'Broken') assert result == 'hello after first yield'
def generator(): try: yield except RuntimeError as e: print(e) yield 'hello after first yield' g = generator() next(g) result = g.throw(RuntimeError, 'Broken') assert result == 'hello after first yield'
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
x = layers.Conv2D(32, (3, 3), strides=(2, 2), padding='same')(input) x = layers.Conv2D(32, (3, 3), strides=(1, 1), padding='same')(x) x = layers.Conv2D(64, (3, 3), strides=(1, 1), padding='same')(x) x = layers.MaxPooling2D((3, 3), strides=(2, 2), padding='same')(x) x = layers.Conv2D(80, (1, 1), strides=(1, 1), padding=...
favorite_fruits = ['apple', 'orange', 'pineapple'] if 'apple' in favorite_fruits: print("You really like apples!") if 'grapefruit' in favorite_fruits: print("You really like grapefruits!") else: print("Why don't you like grapefruits?") if 'orange' not in favorite_fruits: print("Why don't you like ora...
favorite_fruits = ['apple', 'orange', 'pineapple'] if 'apple' in favorite_fruits: print('You really like apples!') if 'grapefruit' in favorite_fruits: print('You really like grapefruits!') else: print("Why don't you like grapefruits?") if 'orange' not in favorite_fruits: print("Why don't you like orange...
expected_output = { "vrf": { "default": { "local_label": { 24: { "outgoing_label_or_vc": { "No Label": { "prefix_or_tunnel_id": { "10.23.120.0/24": { ...
expected_output = {'vrf': {'default': {'local_label': {24: {'outgoing_label_or_vc': {'No Label': {'prefix_or_tunnel_id': {'10.23.120.0/24': {'outgoing_interface': {'GigabitEthernet2.120': {'next_hop': '10.12.120.2', 'bytes_label_switched': 0}, 'GigabitEthernet3.120': {'next_hop': '10.13.120.3', 'bytes_label_switched': ...
#============================================================= # modules for HSPICE sim #============================================================= #============================================================= # varmap definition #------------------------------------------------------------- # This ...
class Varmap: def __init__(self): self.n_smlcycle = 1 self.last = 0 self.smlcy = 0 self.vv = 0 self.vf = 1 self.nvar = 0 def get_var(self, name, start, end, step): if self.nvar == 0: self.map = [None] self.comblist = [None] ...
"""This module holds string constants to be used in conjunction with API calls to MapRoulette.""" # Query string parameters QUERY_PARAMETER_Q = "q" QUERY_PARAMETER_PARENT_IDENTIFIER = "parentId" QUERY_PARAMETER_LIMIT = "limit" QUERY_PARAMETER_PAGE = "page" QUERY_PARAMETER_ONLY_ENABLED = "onlyEnabled" # Common URIs URI...
"""This module holds string constants to be used in conjunction with API calls to MapRoulette.""" query_parameter_q = 'q' query_parameter_parent_identifier = 'parentId' query_parameter_limit = 'limit' query_parameter_page = 'page' query_parameter_only_enabled = 'onlyEnabled' uri_find = 's/find' uri_project_get_by_name ...
print("Programa que imprime a tabuada") numero = 5 while numero <= 255: print("\n\n\n") for n in range(1, 11): resultado = numero * n print(numero, "X", n, "=", resultado) numero = numero + 1 print("Fim do programa")
print('Programa que imprime a tabuada') numero = 5 while numero <= 255: print('\n\n\n') for n in range(1, 11): resultado = numero * n print(numero, 'X', n, '=', resultado) numero = numero + 1 print('Fim do programa')
""" quest-0 t - number of tests c - number of packages k - capacity w - package weight """ t = int(input()) for i in range(t): task_input = input().split() task_input = [float(variable) for variable in task_input] c, k, w = task_input[0], task_input[1], task_input[2], if c * w <= k: print("yes...
""" quest-0 t - number of tests c - number of packages k - capacity w - package weight """ t = int(input()) for i in range(t): task_input = input().split() task_input = [float(variable) for variable in task_input] (c, k, w) = (task_input[0], task_input[1], task_input[2]) if c * w <= k: print('ye...
# This sample tests the special-case handle of the multi-parameter # form of the built-in "type" call. # pyright: strict X1 = type("X1", (object,), {}) X2 = type("X2", (object,), {}) class A(X1): ... class B(X2, A): ... # This should generate an error because the first arg is not a stri...
x1 = type('X1', (object,), {}) x2 = type('X2', (object,), {}) class A(X1): ... class B(X2, A): ... x3 = type(34, (object,)) x4 = type('X4', 34) x5 = type('X5', (3,))
# Copyright (c) 2014 Brocade Communications Systems, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
"""NOS NETCONF XML Configuration Command Templates. Interface Configuration Commands """ create_vlan_interface = '\n <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">\n <interface-vlan xmlns="urn:brocade.com:mgmt:brocade-interface">\n <interface>\n <vlan>\n ...
#!/usr/bin/env python3 # Python 3.5.3 (default, Jan 19 2017, 14:11:04) # [GCC 6.3.0 20170118] on linux def fibo(n): W = [1, 1] for i in range(n): W.append(W[i] + W[i+1]) return(W) def inpt(): n = int(input("steps: ")) print(fibo(n)) inpt()
def fibo(n): w = [1, 1] for i in range(n): W.append(W[i] + W[i + 1]) return W def inpt(): n = int(input('steps: ')) print(fibo(n)) inpt()
'''Find the area of the largest rectangle inside histogram''' def pop_stack(current_max, pos, stack): '''Remove item from stack and return area and start position''' start, height = stack.pop() return max(current_max, height * (pos - start)), start def largest_rectangle(hist): '''Find area of largest ...
"""Find the area of the largest rectangle inside histogram""" def pop_stack(current_max, pos, stack): """Remove item from stack and return area and start position""" (start, height) = stack.pop() return (max(current_max, height * (pos - start)), start) def largest_rectangle(hist): """Find area of larg...
""" Provides a series of solutions to the challenge provided at the following link: https://therenegadecoder.com/code/how-to-iterate-over-multiple-lists-at-the-same-time-in-python/#challenge """ def next_pokemon_1(pokemon, levels, fainted): best_level = -1 best_choice = pokemon[0] for curr_pokemon, level,...
""" Provides a series of solutions to the challenge provided at the following link: https://therenegadecoder.com/code/how-to-iterate-over-multiple-lists-at-the-same-time-in-python/#challenge """ def next_pokemon_1(pokemon, levels, fainted): best_level = -1 best_choice = pokemon[0] for (curr_pokemon, level,...
# MIT License # ----------- # Copyright (c) 2021 Sorn Zupanic Maksumic (https://www.usn.no) # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitatio...
class Vector2: def __init__(self, x, y): self.x = x self.y = y def magnitude(self): return pow(self.x * self.x + self.y * self.y, 0.5) def __sub__(self, other): return vector2(self.x - other.x, self.y - other.y) def dot(self, other): return self.x * other.x + ...
pd = int(input()) num = pd while True : rev = 0 temp = num + 1 while temp>0 : rem = temp%10; rev = rev*10 + rem temp = temp//10 if rev == num+1 : print(num+1) break num += 1
pd = int(input()) num = pd while True: rev = 0 temp = num + 1 while temp > 0: rem = temp % 10 rev = rev * 10 + rem temp = temp // 10 if rev == num + 1: print(num + 1) break num += 1
DAL_VIEW_PY = """# generated by appcreator from django.db.models import Q from dal import autocomplete from . models import * {% for x in data %} class {{ x.model_name }}AC(autocomplete.Select2QuerySetView): def get_queryset(self): qs = {{ x.model_name }}.objects.all() if self.q: qs = ...
dal_view_py = '# generated by appcreator\nfrom django.db.models import Q\nfrom dal import autocomplete\nfrom . models import *\n\n{% for x in data %}\nclass {{ x.model_name }}AC(autocomplete.Select2QuerySetView):\n def get_queryset(self):\n qs = {{ x.model_name }}.objects.all()\n\n if self.q:\n ...
""" https://adventofcode.com/2018/day/14 """ def readFile(): with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f: return f.read() def part1(vals): border = int(vals) scores = [3, 7] elf1 = 0 elf2 = 1 i = 2 while i < border + 10: new = scores[elf1] + scores[elf2] ...
""" https://adventofcode.com/2018/day/14 """ def read_file(): with open(f"{__file__.rstrip('code.py')}input.txt", 'r') as f: return f.read() def part1(vals): border = int(vals) scores = [3, 7] elf1 = 0 elf2 = 1 i = 2 while i < border + 10: new = scores[elf1] + scores[elf2] ...
n=int(input()) count=n sumnum=0 if n==0: print("No Data") else: while count>0: num=float(input()) sumnum+=num count-=1 print(sumnum/n)
n = int(input()) count = n sumnum = 0 if n == 0: print('No Data') else: while count > 0: num = float(input()) sumnum += num count -= 1 print(sumnum / n)
__config_version__ = 1 GLOBALS = { 'serializer': '{{major}}.{{minor}}.{{patch}}{{status if status}}', } FILES = [{ 'path': 'README.rst', 'serializer': '{{major}}.{{minor}}.{{patch}}'}, 'docs/conf.py', 'setup.py', 'src/oemof/tabular/__init__.py'] VERSION = ['major', 'minor', 'patch', ...
__config_version__ = 1 globals = {'serializer': '{{major}}.{{minor}}.{{patch}}{{status if status}}'} files = [{'path': 'README.rst', 'serializer': '{{major}}.{{minor}}.{{patch}}'}, 'docs/conf.py', 'setup.py', 'src/oemof/tabular/__init__.py'] version = ['major', 'minor', 'patch', {'name': 'status', 'type': 'value_list',...
#!/bin/python3 """What is the first Fibonacci number to contain N digits""" #https://www.hackerrank.com/contests/projecteuler/challenges/euler025/problem #First line T number of test cases, then T lines of N values #Constraints: 1 <= T <= 5000; 2 <= N <= 5000 #fibNums = [1,1] fibIndex = [1] #fibIndex[n-1] has the ind...
"""What is the first Fibonacci number to contain N digits""" fib_index = [1] def generate_fibonacci_indexes(): """if the last number in fibNums isnt long enough, keep appending new ones until it is""" 'Return True if we had to add numbers (so our answer is the last one)' appended = False a = 1 b = ...
__version__ = '0.1.2' NAME = 'atlasreader' MAINTAINER = 'Michael Notter' EMAIL = 'michaelnotter@hotmail.com' VERSION = __version__ LICENSE = 'MIT' DESCRIPTION = ('A toolbox for generating cluster reports from statistical ' 'maps') LONG_DESCRIPTION = ('') URL = 'http://github.com/miykael/{name}'.format(n...
__version__ = '0.1.2' name = 'atlasreader' maintainer = 'Michael Notter' email = 'michaelnotter@hotmail.com' version = __version__ license = 'MIT' description = 'A toolbox for generating cluster reports from statistical maps' long_description = '' url = 'http://github.com/miykael/{name}'.format(name=NAME) download_url ...
# -*- coding: utf-8 -*- class BaseError(Exception): """Base Error in project """ pass
class Baseerror(Exception): """Base Error in project """ pass
def apply_mode(module, mode): if mode == 'initialize' and 'reset_parameters' in dir(module): module.reset_parameters() for param in module.parameters(): if mode == 'freeze': param.requires_grad = False elif mode in ['fine-tune', 'initialize']: param.requires_grad...
def apply_mode(module, mode): if mode == 'initialize' and 'reset_parameters' in dir(module): module.reset_parameters() for param in module.parameters(): if mode == 'freeze': param.requires_grad = False elif mode in ['fine-tune', 'initialize']: param.requires_grad ...
reactions_irreversible = [ # FIXME Automatic irreversible for: Cl- {"CaCl2": -1, "Ca++": 1, "Cl-": 2, "type": "irrev", "id_db": -1}, {"NaCl": -1, "Na+": 1, "Cl-": 1, "type": "irrev", "id_db": -1}, {"KCl": -1, "K+": 1, "Cl-": 1, "type": "irrev", "id_db": -1}, {"KOH": -1, "K+": 1, "OH-": 1, "type": "i...
reactions_irreversible = [{'CaCl2': -1, 'Ca++': 1, 'Cl-': 2, 'type': 'irrev', 'id_db': -1}, {'NaCl': -1, 'Na+': 1, 'Cl-': 1, 'type': 'irrev', 'id_db': -1}, {'KCl': -1, 'K+': 1, 'Cl-': 1, 'type': 'irrev', 'id_db': -1}, {'KOH': -1, 'K+': 1, 'OH-': 1, 'type': 'irrev', 'id_db': -1}, {'MgCl2': -1, 'Mg++': 1, 'Cl-': 2, 'type...
class FirstOrderFilter: # first order filter def __init__(self, x0, rc, dt, initialized=True): self.x = x0 self.dt = dt self.update_alpha(rc) self.initialized = initialized def update_alpha(self, rc): self.alpha = self.dt / (rc + self.dt) def update(self, x): if self.initialized: ...
class Firstorderfilter: def __init__(self, x0, rc, dt, initialized=True): self.x = x0 self.dt = dt self.update_alpha(rc) self.initialized = initialized def update_alpha(self, rc): self.alpha = self.dt / (rc + self.dt) def update(self, x): if self.initialize...
# Move to the treasure room and defeat all the ogres. while True: hero.moveUp(4) hero.moveRight(4) hero.moveDown(3) hero.moveLeft() enemy = hero.findNearestEnemy() hero.attack(enemy) hero.attack(enemy) enemy2 = hero.findNearestEnemy() hero.attack(enemy2) hero.attack(enemy2) e...
while True: hero.moveUp(4) hero.moveRight(4) hero.moveDown(3) hero.moveLeft() enemy = hero.findNearestEnemy() hero.attack(enemy) hero.attack(enemy) enemy2 = hero.findNearestEnemy() hero.attack(enemy2) hero.attack(enemy2) enemy3 = hero.findNearestEnemy() hero.attack(enemy3...
# Copyright 2017 Intel Corporation # # 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 wri...
class Simpleblock: """Use a simpler data structure to save memory in the event the graph gets large and to simplify operations on blocks.""" def __init__(self, num, ident, previous): self.num = num self.ident = ident self.previous = previous @classmethod def from_block_dict...
class Solution: def numUniqueEmails(self, emails): """ :type emails: List[str] :rtype: int """ res = [] for email in emails: at_index = email.find("@") temp = email[:at_index].replace(".","") + email[at_index:] at_index = temp.find(...
class Solution: def num_unique_emails(self, emails): """ :type emails: List[str] :rtype: int """ res = [] for email in emails: at_index = email.find('@') temp = email[:at_index].replace('.', '') + email[at_index:] at_index = temp.f...
class SqlAlchemyMediaException(Exception): """ The base class for all exceptions """ pass class MaximumLengthIsReachedError(SqlAlchemyMediaException): """ Indicates the maximum allowed file limit is reached. """ def __init__(self, max_length: int): super().__init__( ...
class Sqlalchemymediaexception(Exception): """ The base class for all exceptions """ pass class Maximumlengthisreachederror(SqlAlchemyMediaException): """ Indicates the maximum allowed file limit is reached. """ def __init__(self, max_length: int): super().__init__('Cannot stor...
#! /usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) CloudZero, Inc. All rights reserved. # Licensed under the MIT License. See LICENSE file in the project root for full license information. """ `cloudzero-awstools` tests package. """
""" `cloudzero-awstools` tests package. """
# SPDX-FileCopyrightText: 2021 Carter Nelson for Adafruit Industries # # SPDX-License-Identifier: MIT # This file is where you keep secret settings, passwords, and tokens! # If you put them in the code you risk committing that info or sharing it secrets = { # tuples of name, sekret key, color 't...
secrets = {'totp_keys': [('Github', 'JBSWY3DPEHPK3PXP', 8860328), ('Discord', 'JBSWY3DPEHPK3PXQ', 3319966), ('Slack', 'JBSWY5DZEHPK3PXR', 16549406), ('Basecamp', 'JBSWY6DZEHPK3PXS', 5620300), ('Gmail', 'JBSWY7DZEHPK3PXT', 3156479), None, None, None, None, ('Hello Kitty', 'JBSWY7DZEHPK3PXU', 15537743), None, None]}
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") def python3(): http_archive( name = "python3", build_file...
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_file') def python3(): http_archive(name='python3', build_file='//bazel/deps/python3:build.BUILD', sha256='36592ee2910b399c68bf0ddad1625f2c6a359ab9a8253d676d44531500e475d4', strip_prefix='...
# Python program that uses classes and objects to represent realworld entities class Book(): # A class is a custom datatype template or blueprint title="" # Attribute author="" pages=0 book1 = Book() # An object is an instance of a class book2 = Book() book1.title = "Harry Potter" # The objects attribute ...
class Book: title = '' author = '' pages = 0 book1 = book() book2 = book() book1.title = 'Harry Potter' book1.author = 'JK Rowling' book1.pages = 500 book2.title = 'Lord of the Rings' book2.author = 'Tolkien' book2.pages = 700 print('\nTitle:\t', book1.title, '\nAuthor:\t', book1.author, '\nPages:\t', book1...
note = """ I do not own the pictures, I simply provide for you a connection from your Discord server to Gelbooru using both legal and free APIs. I am not responsible in any way for the content that GelBot will send to the chat. Keep in mind YOU are the one who type the tags. """ help = """ The usage of GelBot is simp...
note = '\nI do not own the pictures, I simply provide for you a connection\nfrom your Discord server to Gelbooru using both legal and free APIs.\n\nI am not responsible in any way for the content that GelBot will send to\nthe chat. Keep in mind YOU are the one who type the tags.\n' help = "\nThe usage of GelBot is simp...
# INSERTION OF NODE AT END , BEGGINING AND AT GIVEN POS VALUE class linkedListNode: def __init__(self, value, nextNode=None): self.value = value self.nextNode = nextNode class linkedList: def __init__(self, head=None): self.head = head def printList(self): currentNode =...
class Linkedlistnode: def __init__(self, value, nextNode=None): self.value = value self.nextNode = nextNode class Linkedlist: def __init__(self, head=None): self.head = head def print_list(self): current_node = self.head while currentNode is not None: ...
# -*- coding: utf-8 -*- # This file is generated from NI-FAKE API metadata version 1.2.0d9 functions = { 'Abort': { 'codegen_method': 'public', 'documentation': { 'description': 'Aborts a previously initiated thingie.' }, 'parameters': [ { 'dir...
functions = {'Abort': {'codegen_method': 'public', 'documentation': {'description': 'Aborts a previously initiated thingie.'}, 'parameters': [{'direction': 'in', 'documentation': {'description': 'Identifies a particular instrument session.'}, 'name': 'vi', 'type': 'ViSession'}], 'returns': 'ViStatus'}, 'AcceptListOfDur...
word = "Python" assert "Python" == word[:2] + word[2:] assert "Python" == word[:4] + word[4:] assert "Py" == word[:2] assert "on" == word[4:] assert "on" == word[-2:] assert "Py" == word[:-4] # assert "Py" == word[::2] assert "Pto" == word[::2] assert "yhn" == word[1::2] assert "Pt" == word[:4:2] assert "yh" == word...
word = 'Python' assert 'Python' == word[:2] + word[2:] assert 'Python' == word[:4] + word[4:] assert 'Py' == word[:2] assert 'on' == word[4:] assert 'on' == word[-2:] assert 'Py' == word[:-4] assert 'Pto' == word[::2] assert 'yhn' == word[1::2] assert 'Pt' == word[:4:2] assert 'yh' == word[1:4:2]
a=input() a=a.lower() if(a==a[::-1]): print("String is a PALINDROME") else: print("String NOT a PALINDROME")
a = input() a = a.lower() if a == a[::-1]: print('String is a PALINDROME') else: print('String NOT a PALINDROME')
class BaseFilter: """The base class to define unified interface.""" def hard_judge(self, infer_result=None): """predict function, and it must be implemented by different methods class. :param infer_result: prediction result :return: `True` means hard sample, `False` mea...
class Basefilter: """The base class to define unified interface.""" def hard_judge(self, infer_result=None): """predict function, and it must be implemented by different methods class. :param infer_result: prediction result :return: `True` means hard sample, `False` means not a...
# GIS4WRF (https://doi.org/10.5281/zenodo.1288569) # Copyright (c) 2018 D. Meyer and M. Riechert. Licensed under MIT. geo_datasets = { "topo_10m": ("USGS GTOPO DEM", 0.16666667), "topo_5m": ("USGS GTOPO DEM", 0.08333333), "topo_2m": ("USGS GTOPO DEM", 0.03333333), "topo_30s": ("USGS GTOPO DEM", 0.00833...
geo_datasets = {'topo_10m': ('USGS GTOPO DEM', 0.16666667), 'topo_5m': ('USGS GTOPO DEM', 0.08333333), 'topo_2m': ('USGS GTOPO DEM', 0.03333333), 'topo_30s': ('USGS GTOPO DEM', 0.00833333), 'topo_gmted2010_30s': ('USGS GMTED2010 DEM', 0.03333333), 'lake_depth': ('Lake Depth', 0.03333333), 'landuse_10m': ('24-category U...
class Solution: def minRemoveToMakeValid(self, s: str) -> str: # step 1: 1st pass, traverse the string from left to right lcounter = 0 rcounter = 0 marker = 0 toremove1 = [] for i,char in enumerate(s): if char == '(': lcou...
class Solution: def min_remove_to_make_valid(self, s: str) -> str: lcounter = 0 rcounter = 0 marker = 0 toremove1 = [] for (i, char) in enumerate(s): if char == '(': lcounter += 1 elif char == ')': rcounter += 1 ...
a = int(input()) b = int(input()) r = a * b while True: if b == 0: break print(a * (b % 10)) b //= 10 print(r)
a = int(input()) b = int(input()) r = a * b while True: if b == 0: break print(a * (b % 10)) b //= 10 print(r)
""" This program displays 'Hello World' on the console by Bailey Nichols dated 1-29-2021 """ print('Hello World')
""" This program displays 'Hello World' on the console by Bailey Nichols dated 1-29-2021 """ print('Hello World')
class ReportGenerator(object): u""" Top-level class that needs to be subclassed to provide a report generator. """ filename_template = 'report-%s-to-%s.csv' mimetype = 'text/csv' code = '' description = '<insert report description>' def __init__(self, **kwargs): if...
class Reportgenerator(object): u""" Top-level class that needs to be subclassed to provide a report generator. """ filename_template = 'report-%s-to-%s.csv' mimetype = 'text/csv' code = '' description = '<insert report description>' def __init__(self, **kwargs): if 'start_d...
# Copyright 2014 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
load('@io_bazel_rules_go//go/private:mode.bzl', 'NORMAL_MODE') load('@io_bazel_rules_go//go/private:providers.bzl', 'get_library', 'get_searchpath') load('@io_bazel_rules_go//go/private:actions/action.bzl', 'action_with_go_env', 'bootstrap_action') def emit_compile(ctx, go_toolchain, sources=None, importpath='', golib...
# Interface for the data source used in queries. # Currently only includes query capabilities. class Source: def __init__(self): None def isQueryable(self): return False # Check if the source will support the execution of an expression, # given that clauses have already been pushed into it. def su...
class Source: def __init__(self): None def is_queryable(self): return False def supports(self, clauses, expr, visible_vars): return False class Rdbmstable(Source): def is_queryable(self): return True
# me - this DAT # par - the Par object that has changed # val - the current value # prev - the previous value # # Make sure the corresponding toggle is enabled in the Parameter Execute DAT. def onValueChange(par, prev): if par.name == 'Heartbeatrole': parent().Role_setup(par) else: pass return def onPuls...
def on_value_change(par, prev): if par.name == 'Heartbeatrole': parent().Role_setup(par) else: pass return def on_pulse(par): return def on_expression_change(par, val, prev): return def on_export_change(par, val, prev): return def on_enable_change(par, val, prev): return ...
def fibonacci(n): if n == 0: return 0 elif n == 1: return 1 fn1 = 0 fn2 = 1 for i in range(1, n): tmp = fn2 fn2 = fn1 + fn2 fn1 = tmp return fn2 if __name__ == '__main__': print(fibonacci(100))
def fibonacci(n): if n == 0: return 0 elif n == 1: return 1 fn1 = 0 fn2 = 1 for i in range(1, n): tmp = fn2 fn2 = fn1 + fn2 fn1 = tmp return fn2 if __name__ == '__main__': print(fibonacci(100))
# -*- coding: utf-8 -*- # Settings_Export: control which project settings are exposed to templates # See: https://github.com/jakubroztocil/django-settings-export SETTINGS_EXPORT = [ "SITE_NAME", "DEBUG", "ENV" ] # Settings can be accessed in templates via `{{ '{{' }} settings.<KEY> {{ '}}' }}`.
settings_export = ['SITE_NAME', 'DEBUG', 'ENV']
# Dataset information LABELS = [ 'Atelectasis', 'Cardiomegaly', 'Effusion', 'Infiltration', 'Mass', 'Nodule', 'Pneumonia', 'Pneumothorax', 'Consolidation', 'Edema', 'Emphysema', 'Fibrosis', 'Pleural_Thickening', 'Hernia' ] USE_COLUMNS = ['Image Index', 'Finding Labels', 'Patient ID'] N_CLASSES = len(LABELS)...
labels = ['Atelectasis', 'Cardiomegaly', 'Effusion', 'Infiltration', 'Mass', 'Nodule', 'Pneumonia', 'Pneumothorax', 'Consolidation', 'Edema', 'Emphysema', 'Fibrosis', 'Pleural_Thickening', 'Hernia'] use_columns = ['Image Index', 'Finding Labels', 'Patient ID'] n_classes = len(LABELS) random_seed = 42 dataset_image_size...
#!/bin/python3 DISK_SIZE = 272 INIT_STATE = '00111101111101000' def fill_disk(state, max_size): if len(state) > max_size: return state[:max_size] temp_state = state state += '0' for i in range(1, len(temp_state)+1): state += str(abs(int(temp_state[-i])-1)) return fill_disk(state...
disk_size = 272 init_state = '00111101111101000' def fill_disk(state, max_size): if len(state) > max_size: return state[:max_size] temp_state = state state += '0' for i in range(1, len(temp_state) + 1): state += str(abs(int(temp_state[-i]) - 1)) return fill_disk(state, max_size) de...
## Valid Phone Number Checker def num_only(): ''' returns the user inputed phone number in the form of only ten digits, and prints the string 'Thanks!' if the number is inputted in a correct format or prints the string 'Invalid number.' if the input is not in correct form num_only: None -> Str...
def num_only(): """ returns the user inputed phone number in the form of only ten digits, and prints the string 'Thanks!' if the number is inputted in a correct format or prints the string 'Invalid number.' if the input is not in correct form num_only: None -> Str examples: >>> num...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 9 14:20:17 2019 @author: Sven Serneels, Ponalytics """ __name__ = "dicomo" __author__ = "Sven Serneels" __license__ = "MIT" __version__ = "1.0.2" __date__ = "2020-12-20"
""" Created on Wed Jul 9 14:20:17 2019 @author: Sven Serneels, Ponalytics """ __name__ = 'dicomo' __author__ = 'Sven Serneels' __license__ = 'MIT' __version__ = '1.0.2' __date__ = '2020-12-20'