content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def numTrees(self, n): """ :type n: int :rtype: int """ G = [0]*(n+1) G[0], G[1] = 1, 1 for i in range(2, n+1): for j in range(1, i+1): G[i] += G[j-1] * G[i-j] return G[n] class MathSolution(object): ...
class Solution: def num_trees(self, n): """ :type n: int :rtype: int """ g = [0] * (n + 1) (G[0], G[1]) = (1, 1) for i in range(2, n + 1): for j in range(1, i + 1): G[i] += G[j - 1] * G[i - j] return G[n] class Mathsolutio...
# # PySNMP MIB module PACKETFRONT-SMI (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PACKETFRONT-SMI # Produced by pysmi-0.3.4 at Wed May 1 14:36:10 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint, constraints_union) ...
#!/bin/python3 def generate_prime_numbers(lim): """ Generates prime numbers above 100 10**100 """ start = 10**100 l = [] for num in range(start, lim): for n in range(2, num): if num % n == 0: print("Not found") break else: # If the mo...
def generate_prime_numbers(lim): """ Generates prime numbers above 100 10**100 """ start = 10 ** 100 l = [] for num in range(start, lim): for n in range(2, num): if num % n == 0: print('Not found') break else: print(num) ...
""" Board class that the game takes place in/against/on """ class Board(object): """The game Board""" def __init__(self): brown = ('Mediterranean Avenue', 'Baltic Avenue') lightBlue = ('Oriential Avenue', 'Vermont Avenue', 'Connecticut Avenue') pink = ('St. Charles PLace', 'States Avenue...
""" Board class that the game takes place in/against/on """ class Board(object): """The game Board""" def __init__(self): brown = ('Mediterranean Avenue', 'Baltic Avenue') light_blue = ('Oriential Avenue', 'Vermont Avenue', 'Connecticut Avenue') pink = ('St. Charles PLace', 'States Ave...
"""Rules for ANTLR 3.""" def imports(folder): """ Returns the grammar and token files found below the given lib directory. """ return (native.glob(["{0}/*.g".format(folder)]) + native.glob(["{0}/*.g3".format(folder)]) + native.glob(["{0}/*.tokens".format(folder)])) def _get_lib_dir(imports): ...
"""Rules for ANTLR 3.""" def imports(folder): """ Returns the grammar and token files found below the given lib directory. """ return native.glob(['{0}/*.g'.format(folder)]) + native.glob(['{0}/*.g3'.format(folder)]) + native.glob(['{0}/*.tokens'.format(folder)]) def _get_lib_dir(imports): """ Determines ...
class Error(Exception): """ Base class for other exceptions """ def __init__(self, *args): if args: self.message = args[0] else: self.message = None def __str__(self): return self.message if self.message else " " class DatabaseError(Error): de...
class Error(Exception): """ Base class for other exceptions """ def __init__(self, *args): if args: self.message = args[0] else: self.message = None def __str__(self): return self.message if self.message else ' ' class Databaseerror(Error): de...
# Python Program to find Perfect Number using For loop Number = int(input(" Please Enter any Number: ")) Sum = 0 for i in range(1, Number): if(Number % i == 0): Sum = Sum + i if (Sum == Number): print(" %d is a Perfect Number" %Number) else: print(" %d is not a Perfect Number" %Number)
number = int(input(' Please Enter any Number: ')) sum = 0 for i in range(1, Number): if Number % i == 0: sum = Sum + i if Sum == Number: print(' %d is a Perfect Number' % Number) else: print(' %d is not a Perfect Number' % Number)
## Copyright (c) 2022, Team FirmWire ## SPDX-License-Identifier: BSD-3-Clause TASKNAMES_LTE = [ "ERT", "EMACDL", "EL2H", "EL2", "ERRC", "EMM", "EVAL", "ETC", "LPP", "IMC", "SDM", "VDM", "IWLAN", "WO", "EL1", "EL1_MPC", "MLL1", "SIMMNGR", "L1ADT...
tasknames_lte = ['ERT', 'EMACDL', 'EL2H', 'EL2', 'ERRC', 'EMM', 'EVAL', 'ETC', 'LPP', 'IMC', 'SDM', 'VDM', 'IWLAN', 'WO', 'EL1', 'EL1_MPC', 'MLL1', 'SIMMNGR', 'L1ADT', 'SSDS'] tasknames_2_g3_g = ['RRLP', 'RATCM', 'MRS', 'URR', 'UL2', 'TL2', 'UL2D', 'TL2D', 'GL1_PCORE', 'RSVA', 'MM', 'CC', 'CISS', 'SMS', 'SIM', 'SIM2', ...
def helper(N): if (N <= 2): print ("NO") return value = (N * (N + 1)) // 2 if(value%2==1): print ("NO") return s1 = [] s2 = [] if (N%2==0): shift = True start = 1 last = N while (start < last): if (shift): ...
def helper(N): if N <= 2: print('NO') return value = N * (N + 1) // 2 if value % 2 == 1: print('NO') return s1 = [] s2 = [] if N % 2 == 0: shift = True start = 1 last = N while start < last: if shift: s1....
ls=[12,3,9,4,1] a=len(ls) l=[] for i in reversed(range(a)): l.append(ls[i]) print(l)
ls = [12, 3, 9, 4, 1] a = len(ls) l = [] for i in reversed(range(a)): l.append(ls[i]) print(l)
html = """\ <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>$title</title> <style media="screen"> html { background-color: #dfdfdf; color: #333; } body { max-width: 750px; margin: ...
html = '<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8">\n <title>$title</title>\n <style media="screen">\n html {\n background-color: #dfdfdf;\n color: #333;\n }\n body {\n max-width: 750px;\n ...
def test_alert_message(alert_message): """Use this for check message in different cases:Incorrectly username/password, only username, only password by parameters """ print(alert_message) assert 'No match for Username and/or Password.' in alert_message
def test_alert_message(alert_message): """Use this for check message in different cases:Incorrectly username/password, only username, only password by parameters """ print(alert_message) assert 'No match for Username and/or Password.' in alert_message
class Solution(object): def maxArea(self, height): """ :type height: List[int] :rtype: int """ n = len(height) d = [0] * n for i in range(n): d[i] = height[i] for i in range(1, n): avg = d[i-1] / (i * 1.0) ...
class Solution(object): def max_area(self, height): """ :type height: List[int] :rtype: int """ n = len(height) d = [0] * n for i in range(n): d[i] = height[i] for i in range(1, n): avg = d[i - 1] / (i * 1.0) if hei...
""" Function to retrieve location of a key in nested data structure """ def locate_element(data, look_up_elem): ''' Function to locate the exact location of a an element in a data structure ''' data_orig = data loc_list = [] #### Step 1: Create loop: while look_up_elem not in loc_list whil...
""" Function to retrieve location of a key in nested data structure """ def locate_element(data, look_up_elem): """ Function to locate the exact location of a an element in a data structure """ data_orig = data loc_list = [] while look_up_elem not in loc_list: data = data_orig i...
#default def printx(name,age): print(name) print(age) return; printx(name='miki',age=96) #keyword def printm(str): print(str) return; printm(str='sandy') #required def printme(str): print(str) return; printme()
def printx(name, age): print(name) print(age) return printx(name='miki', age=96) def printm(str): print(str) return printm(str='sandy') def printme(str): print(str) return printme()
# Add Bold Tag in String # Given a string s and a list of strings words, you need to add a closed pair of bold tag # <b> and </b> to wrap the substrings in s that exist in dict. # If two such substrings overlap, you need to wrap them together by only one pair of closed bold tag. # Also, if two substrings wrapped by bol...
class Solution(object): def add_bold_tag(self, s, words): """ :type s: str :type words: List[str] :rtype: str """ bold = [False] * len(s) right = -1 for i in range(len(s)): for word in words: if s.startswith(word, i): ...
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( arr , n , k ) : count = 0 for i in range ( 0 , n ) : if ( arr [ i ] <= k ) : count = co...
def f_gold(arr, n, k): count = 0 for i in range(0, n): if arr[i] <= k: count = count + 1 bad = 0 for i in range(0, count): if arr[i] > k: bad = bad + 1 ans = bad j = count for i in range(0, n): if j == n: break if arr[i] > k...
def is_leap(year): leap = False if year%400==0: return True if year%4==0 and year%100!=0: return True return leap year = int(input()) print(is_leap(year))
def is_leap(year): leap = False if year % 400 == 0: return True if year % 4 == 0 and year % 100 != 0: return True return leap year = int(input()) print(is_leap(year))
""" 'The module for first_inside_quotes' Arthur Wayne asw263 September 22 2020 """ def first_inside_quotes(s): """ Returns the first substring of s between two (double) quotes A quote character is one that is inside a string, not one that delimits it. We typically use...
""" 'The module for first_inside_quotes' Arthur Wayne asw263 September 22 2020 """ def first_inside_quotes(s): """ Returns the first substring of s between two (double) quotes A quote character is one that is inside a string, not one that delimits it. We typically use single quotes ...
""" A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. """ # Definition for singly-linked list with a random pointer. # class RandomListNode(object): # def __init__(self, x): # self.label = x # ...
""" A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. """ class Solution(object): def copy_random_list(self, head): """ :type head: RandomListNode :rtype: RandomListNode ...
with open("inp1.txt") as file: data = file.read() depths = [int(line) for line in data.splitlines()] depth_inc_cnt = 0 for i in range(1, len(depths)): if depths[i] > depths[i - 1]: depth_inc_cnt += 1 print(f"Part 1: {depth_inc_cnt}") assert depth_inc_cnt == 1832 depth_windowed_inc_cnt = 0 for i in...
with open('inp1.txt') as file: data = file.read() depths = [int(line) for line in data.splitlines()] depth_inc_cnt = 0 for i in range(1, len(depths)): if depths[i] > depths[i - 1]: depth_inc_cnt += 1 print(f'Part 1: {depth_inc_cnt}') assert depth_inc_cnt == 1832 depth_windowed_inc_cnt = 0 for i in range...
class ListNode: def __init__ (self, val, next = None): self.val = val self.next = next class Solution: def swapPairs(self, head): dummy = ListNode(0) curr = dummy dummy.next = head while curr.next and curr.next.next: tmp = curr.next tmp2 ...
class Listnode: def __init__(self, val, next=None): self.val = val self.next = next class Solution: def swap_pairs(self, head): dummy = list_node(0) curr = dummy dummy.next = head while curr.next and curr.next.next: tmp = curr.next tmp2 ...
# UVa 11450 - Wedding Shopping - Bottom Up (faster than Top Down) def main(): TC = int(input()) for tc in range(TC): MAX_gm = 30 # 20 garments at most and 20 models per garment at most MAX_M = 210 # maximum budget i...
def main(): tc = int(input()) for tc in range(TC): max_gm = 30 max_m = 210 price = [[-1 for i in range(MAX_gm)] for j in range(MAX_gm)] reachable = [[False for i in range(MAX_M)] for j in range(2)] (m, c) = [int(x) for x in input().split(' ')] for g in range(C): ...
LOVE = 'this' def lover(): """ docstring """ print(LOVE) def print_nothing(): """ printing nothing """ print('nothing') def print_nothings(): """ printing nothings """ print('nothings') class All(): """ Some doc right here """ def __init__(self): ...
love = 'this' def lover(): """ docstring """ print(LOVE) def print_nothing(): """ printing nothing """ print('nothing') def print_nothings(): """ printing nothings """ print('nothings') class All: """ Some doc right here """ def __init__(self): ...
price_list = { 1 : 4.0, 2 : 4.5, 3 : 5.0, 4 : 2.0, 5 : 1.5} values = input() product_code, price_product = [int(value) for value in values.split(' ')] print('Total: R$ {:.2f}'.format(price_list[product_code] * price_product))
price_list = {1: 4.0, 2: 4.5, 3: 5.0, 4: 2.0, 5: 1.5} values = input() (product_code, price_product) = [int(value) for value in values.split(' ')] print('Total: R$ {:.2f}'.format(price_list[product_code] * price_product))
# try out the Python stack functions # TODO: create a new empty stack stack = [] # TODO: push items onto the stack stack.append(1) stack.append(2) stack.append(3) stack.append(4) # TODO: print the stack contents print(stack) #TODO: pop an item off the stack x = stack.pop() print(x) print(stack)
stack = [] stack.append(1) stack.append(2) stack.append(3) stack.append(4) print(stack) x = stack.pop() print(x) print(stack)
class Sword(): def __init__(self, name, damage): self.damage = damage self.name = name @staticmethod def showAbilities(): print("Swords can only attack orcs and elves, and do zero damage agains magic armour.") Sword.showAbilities()
class Sword: def __init__(self, name, damage): self.damage = damage self.name = name @staticmethod def show_abilities(): print('Swords can only attack orcs and elves, and do zero damage agains magic armour.') Sword.showAbilities()
class EdsError(Exception): """EDS base exception.""" class DuplicateIncludeError(Exception): """Raised when a duplicate include occurs.""" class PluginNameNotFoundError(EdsError): """Raised when a specific plugin is not found.""" class PluginNameMismatchError(EdsError): """Raised when a plugin na...
class Edserror(Exception): """EDS base exception.""" class Duplicateincludeerror(Exception): """Raised when a duplicate include occurs.""" class Pluginnamenotfounderror(EdsError): """Raised when a specific plugin is not found.""" class Pluginnamemismatcherror(EdsError): """Raised when a plugin name d...
''' instantiating a class The process of creating a an object from a class. '''
""" instantiating a class The process of creating a an object from a class. """
# # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD # # SPDX-License-Identifier: Apache-2.0 # SOC_IRAM_LOW = 0x4037c000 SOC_IRAM_HIGH = 0x403e0000 SOC_DRAM_LOW = 0x3fc80000 SOC_DRAM_HIGH = 0x3fce0000 SOC_RTC_DRAM_LOW = 0x50000000 SOC_RTC_DRAM_HIGH = 0x50002000 SOC_RTC_DATA_LOW = 0x50000000 SOC_RTC_DAT...
soc_iram_low = 1077395456 soc_iram_high = 1077805056 soc_dram_low = 1070071808 soc_dram_high = 1070465024 soc_rtc_dram_low = 1342177280 soc_rtc_dram_high = 1342185472 soc_rtc_data_low = 1342177280 soc_rtc_data_high = 1342185472
# greaseweazle/image/hfe.py # # Written & released by Keir Fraser <keir.xen@gmail.com> # # This is free and unencumbered software released into the public domain. # See the file COPYING for more details, or visit <http://unlicense.org>. class HFE: def __init__(self, start_cyl, nr_sides): self.start_cyl = ...
class Hfe: def __init__(self, start_cyl, nr_sides): self.start_cyl = start_cyl self.nr_sides = nr_sides self.nr_revs = None self.track_list = [] @classmethod def from_file(cls, dat): hfe = cls(0, 2) return hfe def get_track(self, cyl, side, writeout=Fal...
# ------------------------------------------------------------------------------ # Access to the CodeHawk Binary Analyzer Analysis Results # Author: Henny Sipma # ------------------------------------------------------------------------------ # The MIT License (MIT) # # Copyright (c) 2016-2020 Kestrel Technology LLC # #...
class Jumptable(object): def __init__(self, app, x): self.app = app self.x = x self.base = self.x.get('start') self.tgts = [n.get('a') for n in self.x.findall('tgt')] def get_targets(self): return self.tgts def __str__(self): lines = [] lines.append...
# @desc By Anay '24 def check_age(age): if age < 21: return age return age + 5 def main(): print(check_age(5)) print(check_age(29)) print(check_age(42)) print(check_age(15)) print(check_age(0.38)) print(check_age(21)) if __name__ == '__main__': main()
def check_age(age): if age < 21: return age return age + 5 def main(): print(check_age(5)) print(check_age(29)) print(check_age(42)) print(check_age(15)) print(check_age(0.38)) print(check_age(21)) if __name__ == '__main__': main()
# https://projecteuler.net/problem=91 # Fast enough """ Note that: OP^2 = X_P^2 + Y_P^2 OQ^2 = X_Q^2 + Y_Q^2 PQ^2 = (X_P - X_Q)^2 + (Y_P - Y_Q)^2 There are 3 cases: 1. OP^2 + OQ^2 = PQ^2 -> X_P * X_Q + Y_P * Y_Q = 0 2. OP^2 + PQ^2 = OQ^2 -> X_P^2 + Y_P^2 - X_P * X_Q - Y_P * Y_Q = 0...
""" Note that: OP^2 = X_P^2 + Y_P^2 OQ^2 = X_Q^2 + Y_Q^2 PQ^2 = (X_P - X_Q)^2 + (Y_P - Y_Q)^2 There are 3 cases: 1. OP^2 + OQ^2 = PQ^2 -> X_P * X_Q + Y_P * Y_Q = 0 2. OP^2 + PQ^2 = OQ^2 -> X_P^2 + Y_P^2 - X_P * X_Q - Y_P * Y_Q = 0 3. OQ^2 + PQ^2 = OP^2 -> X_Q^2 + Y_Q^2 - ...
#test print('==================================') print(' this is just a test ') print('==================================') num = int(input('insert a number: ')) print((num * 5) % 3)
print('==================================') print(' this is just a test ') print('==================================') num = int(input('insert a number: ')) print(num * 5 % 3)
def is_isogram(word): word_dict = dict() for c in word: c = c.lower() if ord('a') <= ord(c) <= ord('z'): word_dict[c] = word_dict.get(c, 0) + 1 if word_dict[c] >= 2: return False return True
def is_isogram(word): word_dict = dict() for c in word: c = c.lower() if ord('a') <= ord(c) <= ord('z'): word_dict[c] = word_dict.get(c, 0) + 1 if word_dict[c] >= 2: return False return True
class Vector3f(object,IEquatable[Vector3f],IComparable[Vector3f],IComparable,IEpsilonFComparable[Vector3f]): """ Vector3f(x: Single,y: Single,z: Single) """ @staticmethod def Add(point,vector): """ Add(point: Point3f,vector: Vector3f) -> Point3f """ pass def CompareTo(self,other): """ CompareTo(self: V...
class Vector3F(object, IEquatable[Vector3f], IComparable[Vector3f], IComparable, IEpsilonFComparable[Vector3f]): """ Vector3f(x: Single,y: Single,z: Single) """ @staticmethod def add(point, vector): """ Add(point: Point3f,vector: Vector3f) -> Point3f """ pass def compare_to(self, other...
option = None def pytest_addoption(parser): parser.addoption('--nproc', help='run tests on n processes', type=int, default=1) parser.addoption('--lsf', help='run tests on with lsf clusters', action="store_true") parser.addoption('--specs', help='test specs') parser.addoption('--cases', help='test case ...
option = None def pytest_addoption(parser): parser.addoption('--nproc', help='run tests on n processes', type=int, default=1) parser.addoption('--lsf', help='run tests on with lsf clusters', action='store_true') parser.addoption('--specs', help='test specs') parser.addoption('--cases', help='test case ...
class ListNode: def __init__(self, x): self.val = x self.next = None def merge_list(head1, head2): if head1 is None: return head2 if head2 is None: return head1 if head2.val < head1.val: head1, head2 = head2, head1 head1.next = merge_list(head1.next, head2) ...
class Listnode: def __init__(self, x): self.val = x self.next = None def merge_list(head1, head2): if head1 is None: return head2 if head2 is None: return head1 if head2.val < head1.val: (head1, head2) = (head2, head1) head1.next = merge_list(head1.next, hea...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def nextLargerNodes(self, head): """ :type head: ListNode :rtype: List[int] """ array = [] stack = []...
class Solution(object): def next_larger_nodes(self, head): """ :type head: ListNode :rtype: List[int] """ array = [] stack = [] while head: array.append(0) while stack and stack[-1][1] < head.val: array[stack.pop()[0]] ...
first_number = int(input()) second_number = int(input()) large_number = max(first_number, second_number) small_number = min(first_number, second_number) remaining_number = 0 gcd = 0 while True: times = large_number // small_number remain = large_number - ( small_number * times ) if 0 == remain: ...
first_number = int(input()) second_number = int(input()) large_number = max(first_number, second_number) small_number = min(first_number, second_number) remaining_number = 0 gcd = 0 while True: times = large_number // small_number remain = large_number - small_number * times if 0 == remain: gcd = sm...
# # PySNMP MIB module HM2-TRAFFICMGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-TRAFFICMGMT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:19:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ...
def find(s): if s > 0 : for i in range(9): if s + i == 10: return i else : return 0 s = 0 t = int(input()) for _ in range(int(t)): n = int(input()) f = n while(n>0): d = n%10 s += d n = n//10 x = find(s) print(str(f)+str(x)) d = 0 s = 0
def find(s): if s > 0: for i in range(9): if s + i == 10: return i else: return 0 s = 0 t = int(input()) for _ in range(int(t)): n = int(input()) f = n while n > 0: d = n % 10 s += d n = n // 10 x = find(s) print(str(f) + st...
REQUEST_BODY_JSON = """ { "customer_ids": [ "string" ] } """ RESPONSE_200_JSON = """ { "customers_balance": [ { "balance": 1.1, "customer_id": "string" } ] } """
request_body_json = '\n{\n "customer_ids": [\n "string"\n ]\n}\n' response_200_json = '\n{\n "customers_balance": [\n {\n "balance": 1.1, \n "customer_id": "string"\n }\n ]\n}\n'
def get_hello(name: str) -> tuple: # noqa: E501 """ # noqa: E501 :param name: :type name: str :rtype: None """ return {"response": f" ola {name}. bem vindo ao clube"}, 200 # import aiohttp # from connexion.lifecycle import ConnexionResponse # async def get_hello(name: str) -> tuple...
def get_hello(name: str) -> tuple: """ # noqa: E501 :param name: :type name: str :rtype: None """ return ({'response': f' ola {name}. bem vindo ao clube'}, 200)
x=int(input()) if x < 0: print(-x) else: print(x)
x = int(input()) if x < 0: print(-x) else: print(x)
students = int(input()) students_dict = {} top_students = {} for _ in range(students): name = input() grade = float(input()) if name in students_dict: students_dict[name].append(grade) else: students_dict[name] = [grade] # for key, item in students_dict.items(): # if sum(item) / le...
students = int(input()) students_dict = {} top_students = {} for _ in range(students): name = input() grade = float(input()) if name in students_dict: students_dict[name].append(grade) else: students_dict[name] = [grade] top_students = {k: sum(v) / len(v) for (k, v) in students_dict.item...
TASKS = { "binary_classification": 1, "multi_class_classification": 2, "entity_extraction": 4, "extractive_question_answering": 5, "summarization": 8, "single_column_regression": 10, "speech_recognition": 11, } DATASETS_TASKS = ["text-classification", "question-answering-extractive"]
tasks = {'binary_classification': 1, 'multi_class_classification': 2, 'entity_extraction': 4, 'extractive_question_answering': 5, 'summarization': 8, 'single_column_regression': 10, 'speech_recognition': 11} datasets_tasks = ['text-classification', 'question-answering-extractive']
# enable: C0103 class FooClass: """ Attribute names should be in mixed case, with the first letter lower case, each word separated by having its first letter capitalized just like method names. And all private names should begin with an underscore. """ def __init__(self): """ ...
class Fooclass: """ Attribute names should be in mixed case, with the first letter lower case, each word separated by having its first letter capitalized just like method names. And all private names should begin with an underscore. """ def __init__(self): """ A init of ...
class GuiAbstractObject: def is_clicked(self, mouse): area = (self.position[0] * self.screen.engine.settings.graphic['screen']['resolution_scale'][0], self.position[1] * self.screen.engine.settings.graphic['screen']['resolution_scale'][1], (self.position[0] + self.position[2...
class Guiabstractobject: def is_clicked(self, mouse): area = (self.position[0] * self.screen.engine.settings.graphic['screen']['resolution_scale'][0], self.position[1] * self.screen.engine.settings.graphic['screen']['resolution_scale'][1], (self.position[0] + self.position[2]) * self.screen.engine.settings...
class NagiosException(Exception): pass class NagiosUnexpectedResultError(Exception): pass
class Nagiosexception(Exception): pass class Nagiosunexpectedresulterror(Exception): pass
#!/usr/bin/env python log_dir = os.environ['LOG_DIR'] admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS'] admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT'] admin_username = os.environ['ADMIN_USERNAME'] admin_password = os.environ['ADMIN_PASSWORD'] managed_server_name = os.environ[...
log_dir = os.environ['LOG_DIR'] admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS'] admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT'] admin_username = os.environ['ADMIN_USERNAME'] admin_password = os.environ['ADMIN_PASSWORD'] managed_server_name = os.environ['MANAGED_SERVER_NAME'] d...
print("Choose from below options:") print("1.Celsius to Fahrenheit.") print("2.Fahrenheit to Celsius.") o=int(input("option(1/2):")) if(o==1): c=float(input("Temperature in Celsius:")) f=1.8*(c)+32.0 f=round(f,1) #temperature in fahrenheit precise to 1 decimal place print("Temperature in Fahrenheit:",f)...
print('Choose from below options:') print('1.Celsius to Fahrenheit.') print('2.Fahrenheit to Celsius.') o = int(input('option(1/2):')) if o == 1: c = float(input('Temperature in Celsius:')) f = 1.8 * c + 32.0 f = round(f, 1) print('Temperature in Fahrenheit:', f) elif o == 2: f = float(input('Temper...
#!/usr/bin/env python # $Revision: 1.1.1.12 $ $Date: 2007/01/08 14:40:09 $ kgm """Monitor 1.8 This dummy module is only provided for backward compatibility. It does nothing. class Monitor is now part of Simulation and SimulationXXX.""" __version__ ='1.8 $Revision: 1.1.1.12 $ $Date: 2007/01/08 14:40:09 $' pass
"""Monitor 1.8 This dummy module is only provided for backward compatibility. It does nothing. class Monitor is now part of Simulation and SimulationXXX.""" __version__ = '1.8 $Revision: 1.1.1.12 $ $Date: 2007/01/08 14:40:09 $' pass
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # */AIPND-revision/intropyproject-classify-pet-images/adjust_results4_isadog.py # # PROGRAMMER: Sotirios Zikas # DATE CREATED: April 16, 2019 def adjust_results4_...
def adjust_results4_isadog(results_dic, dogfile): """ Adjusts the results dictionary to determine if classifier correctly classified images 'as a dog' or 'not a dog' especially when not a match. Demonstrates if model architecture correctly classifies dog images even if it gets dog breed wrong (not...
# This is a single line comment in Python print("Hello World!") # This is a single comment """ For multi-line comments use three double quotes ... """
print('Hello World!') ' For multi-line\ncomments use three\ndouble quotes\n...\n'
""" A rnd component generator. """ class RandomComponent: def __init__(self, gen, str, var, par): """ Create a new RandomComponent. :param gen: the random generator. :param str: (dict) streams configuration. :param var: (dict) variates configuration. :param par: (di...
""" A rnd component generator. """ class Randomcomponent: def __init__(self, gen, str, var, par): """ Create a new RandomComponent. :param gen: the random generator. :param str: (dict) streams configuration. :param var: (dict) variates configuration. :param par: (di...
__author__ = 'Nils Schmidt' def memoize_pos_args(fun): """ Memoize the functions positional arguments and return the same result for it """ # arguments, result memo = {} def wrapper(*args, **kwargs): if args in memo: return memo[args] else: memoize = True ...
__author__ = 'Nils Schmidt' def memoize_pos_args(fun): """ Memoize the functions positional arguments and return the same result for it """ memo = {} def wrapper(*args, **kwargs): if args in memo: return memo[args] else: memoize = True if kwargs.get('no_...
class Symbol: def __init__(self,S,sign=1): if type(S) != str: raise TypeError("Symbols must be strings") if S not in "abcdefghijklmnopqrstuvwxyz": raise ValueError("Symbols must be lowercase letters") self.S = S self.sign = sign def __str__(self): ...
class Symbol: def __init__(self, S, sign=1): if type(S) != str: raise type_error('Symbols must be strings') if S not in 'abcdefghijklmnopqrstuvwxyz': raise value_error('Symbols must be lowercase letters') self.S = S self.sign = sign def __str__(self): ...
# Enter your code here. Read input from STDIN. Print output to STDOUT n=int(input()) roll_n=set(map(int,input().split())) m=int(input()) roll_m=set(map(int,input().split())) s=roll_n|roll_m print(len(s))
n = int(input()) roll_n = set(map(int, input().split())) m = int(input()) roll_m = set(map(int, input().split())) s = roll_n | roll_m print(len(s))
logLevel = 0 def log(msg): if logLevel > 0: print(msg) else: pass def setLogLevel(value): global logLevel logLevel = value
log_level = 0 def log(msg): if logLevel > 0: print(msg) else: pass def set_log_level(value): global logLevel log_level = value
def solution(moves): moves = list(moves) programs = [chr(s) for s in range(ord("a"), ord("a") + 16)] hashmap = {program: position for position, program in enumerate(programs)} movemap = {"s": spin, "x": exchange, "p": partner} seen = [] s = "".join(programs) while s not in seen: see...
def solution(moves): moves = list(moves) programs = [chr(s) for s in range(ord('a'), ord('a') + 16)] hashmap = {program: position for (position, program) in enumerate(programs)} movemap = {'s': spin, 'x': exchange, 'p': partner} seen = [] s = ''.join(programs) while s not in seen: se...
# The Nexus software is licensed under the BSD 2-Clause license. # # You should have recieved a copy of this license with the software. # If you did not, you can find one at the following link. # # http://opensource.org/licenses/bsd-license.php if len(parts) < 5: self.client.sendServerMessage("For Make-a-Mob plea...
if len(parts) < 5: self.client.sendServerMessage('For Make-a-Mob please use:') self.client.sendServerMessage('/entity var blocktype MovementBehavior NearBehavior') self.client.sendServerMessage('MovementBehavior: follow engulf pet random none') self.client.sendServerMessage('NearBehavior: kill explode n...
del_items(0x80122D48) SetType(0x80122D48, "struct THEME_LOC themeLoc[50]") del_items(0x80123490) SetType(0x80123490, "int OldBlock[4]") del_items(0x801234A0) SetType(0x801234A0, "unsigned char L5dungeon[80][80]") del_items(0x80123130) SetType(0x80123130, "struct ShadowStruct SPATS[37]") del_items(0x80123234) SetType(0x...
del_items(2148674888) set_type(2148674888, 'struct THEME_LOC themeLoc[50]') del_items(2148676752) set_type(2148676752, 'int OldBlock[4]') del_items(2148676768) set_type(2148676768, 'unsigned char L5dungeon[80][80]') del_items(2148675888) set_type(2148675888, 'struct ShadowStruct SPATS[37]') del_items(2148676148) set_ty...
''' some other implementations: recursive: def binary_search(array, key, start, end): if end < start: return -1 else: midpoint = start + (end - start) // 2 if key < array[midpoint]: return binary_search(array, key, start, midpoint - 1...
""" some other implementations: recursive: def binary_search(array, key, start, end): if end < start: return -1 else: midpoint = start + (end - start) // 2 if key < array[midpoint]: return binary_search(array, key, start, midpoint - 1) ...
bil = -4 if (bil > 0): print("Bilangan positif") else: print("Bilangan negatif atau nol")
bil = -4 if bil > 0: print('Bilangan positif') else: print('Bilangan negatif atau nol')
input_name: str = input() if input_name == 'Johnny': print('Hello, my love!') else: print(f'Hello, {input_name}!')
input_name: str = input() if input_name == 'Johnny': print('Hello, my love!') else: print(f'Hello, {input_name}!')
def binary_search(array, target): first = 0 last = len(array) - 1 while first <= last: midpoint = (first + last) // 2 if array[midpoint] == target: return midpoint elif array[midpoint] < target: first = midpoint + 1 elif array[midpoint] > target: ...
def binary_search(array, target): first = 0 last = len(array) - 1 while first <= last: midpoint = (first + last) // 2 if array[midpoint] == target: return midpoint elif array[midpoint] < target: first = midpoint + 1 elif array[midpoint] > target: ...
def next_bigger(n): """Finds the next bigger number with the same digits.""" # Convert n to a string and a list in reverse for ease. n_string = str(n)[::-1] n_list = [int(x) for x in n_string] # Go through each digit and identify when there is a lower digit. number_previous = n_list[0] ...
def next_bigger(n): """Finds the next bigger number with the same digits.""" n_string = str(n)[::-1] n_list = [int(x) for x in n_string] number_previous = n_list[0] for (position, number) in enumerate(n_list): if number_previous > number: n_list_piece = n_list[:position + 1] ...
class Solution: def heightChecker(self, heights: List[int]) -> int: expected = sorted(heights) indices=0 for i in range(len(heights)): if(heights[i] != expected[i]): indices += 1 return indices
class Solution: def height_checker(self, heights: List[int]) -> int: expected = sorted(heights) indices = 0 for i in range(len(heights)): if heights[i] != expected[i]: indices += 1 return indices
"""Top-level package for Nearest Neigbor Similarity.""" __author__ = """Shivam Ralli""" __email__ = 'shivamralli167@gmail.com' __version__ = '0.1.0'
"""Top-level package for Nearest Neigbor Similarity.""" __author__ = 'Shivam Ralli' __email__ = 'shivamralli167@gmail.com' __version__ = '0.1.0'
def Plus(a,b): return a + b def Minus(a,b): return a - b def Times(a,b): return a*b def Divide(a,b): return a/b
def plus(a, b): return a + b def minus(a, b): return a - b def times(a, b): return a * b def divide(a, b): return a / b
def filesFunctionField2list(files, func, field): theList = [] for file in files: record = { "name": file, field: func(file) } theList.append(record) return theList def filesClassFunctionField2list(files, Class, functionString, field): theList = [] for file in files: myClass = Class(file) method =...
def files_function_field2list(files, func, field): the_list = [] for file in files: record = {'name': file, field: func(file)} theList.append(record) return theList def files_class_function_field2list(files, Class, functionString, field): the_list = [] for file in files: my_...
"""PostgreSQL helpers.""" # Use pgcrypto, instead of uuid-ossp # Also create a function uuid_generate_v4 for backward compatibility UUID_SUPPORT_STMT = """CREATE EXTENSION IF NOT EXISTS "pgcrypto"; CREATE OR REPLACE FUNCTION uuid_generate_v4() RETURNS uuid AS ' BEGIN RETURN gen_random_uuid(); END' LANGUAGE 'plpgsql'; ...
"""PostgreSQL helpers.""" uuid_support_stmt = 'CREATE EXTENSION IF NOT EXISTS "pgcrypto";\nCREATE OR REPLACE FUNCTION uuid_generate_v4()\nRETURNS uuid\nAS \'\nBEGIN\nRETURN gen_random_uuid();\nEND\'\nLANGUAGE \'plpgsql\';\n'
cancerlist = ["ACC", "BLCA", "BRCA", "CESC", "CHOL", "COAD", "DLBC", "ESCA", "GBM", "HNSC", "KICH", "KIRC", "KIRP", "LGG", "LIHC", "LUAD", "LUSC", "MESO", "OV", "PAAD", "PCPG", "PRAD", "READ", "SARC", "SKCM", "STAD", "TGCT", "THCA", "THYM", "UCEC", "UCS", "UVM"] input_data_path = "/ngs/data3/public_data/TCGA_FireBrows...
cancerlist = ['ACC', 'BLCA', 'BRCA', 'CESC', 'CHOL', 'COAD', 'DLBC', 'ESCA', 'GBM', 'HNSC', 'KICH', 'KIRC', 'KIRP', 'LGG', 'LIHC', 'LUAD', 'LUSC', 'MESO', 'OV', 'PAAD', 'PCPG', 'PRAD', 'READ', 'SARC', 'SKCM', 'STAD', 'TGCT', 'THCA', 'THYM', 'UCEC', 'UCS', 'UVM'] input_data_path = '/ngs/data3/public_data/TCGA_FireBrowse...
N, L = map(int, input().split()) ans = 0 margin = float("inf") for i in range(1, N + 1): tar = 0 for j in range(1, N + 1): tar += L + j - 1 res = 0 for j in range(1, N + 1): if j == i: continue else: res += L + j - 1 if abs(tar - res) < margin: ...
(n, l) = map(int, input().split()) ans = 0 margin = float('inf') for i in range(1, N + 1): tar = 0 for j in range(1, N + 1): tar += L + j - 1 res = 0 for j in range(1, N + 1): if j == i: continue else: res += L + j - 1 if abs(tar - res) < margin: ...
#!/usr/bin/python3 def max_integer(my_list=[]): if (len(my_list) == 0): return (None) a = my_list[0] for i in range(0, len(my_list)): if (my_list[i] > a): a = my_list[i] return (a)
def max_integer(my_list=[]): if len(my_list) == 0: return None a = my_list[0] for i in range(0, len(my_list)): if my_list[i] > a: a = my_list[i] return a
"""Global constants module.""" GDRIVE_URL = 'https://drive.google.com' DATASET_URL = '{0}/uc?id=1xABlWE790uWmT0mMxbDjn9KZlNUB6Y57'.format(GDRIVE_URL) # dataset LABEL_COLS = ('Jp', 'Becca', 'Katy') # ignore resize NO_RESIZE = (0, 0)
"""Global constants module.""" gdrive_url = 'https://drive.google.com' dataset_url = '{0}/uc?id=1xABlWE790uWmT0mMxbDjn9KZlNUB6Y57'.format(GDRIVE_URL) label_cols = ('Jp', 'Becca', 'Katy') no_resize = (0, 0)
# Enter your code here def triple(num): num = num*3 print(num) triple(6) triple(99)
def triple(num): num = num * 3 print(num) triple(6) triple(99)
""" Some exception classes for the ondevice client """ class _Exception(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args) self.msg = args[0] for k,v in kwargs.items(): setattr(self, k, v) class ConfigurationError(_Exception): """ Indicates a m...
""" Some exception classes for the ondevice client """ class _Exception(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args) self.msg = args[0] for (k, v) in kwargs.items(): setattr(self, k, v) class Configurationerror(_Exception): """ Indicates...
EMBED_SIZE = 200 NUM_LAYERS = 2 LR = 0.0001 MAX_GRAD_NORM = 5.0 PAD_ID = 0 UNK_ID = 1 START_ID = 2 EOS_ID = 3 CONV_SIZE = 3 # sanity # BUCKETS = [(55, 50)] # BATCH_SIZE = 10 # NUM_EPOCHS = 50 # NUM_SAMPLES = 498 # HIDDEN_SIZE = 400 # test BUCKETS = [(30, 30), (55, 50)] BATCH_SIZE = 20 NUM_EPOCHS = 3 NUM_SAMPLES = ...
embed_size = 200 num_layers = 2 lr = 0.0001 max_grad_norm = 5.0 pad_id = 0 unk_id = 1 start_id = 2 eos_id = 3 conv_size = 3 buckets = [(30, 30), (55, 50)] batch_size = 20 num_epochs = 3 num_samples = 498 hidden_size = 400
# a = 42 # print(type(a)) # a = str(a) # print(type(a)) a = 42.3 print(type(a)) a = str(a) print(type(a))
a = 42.3 print(type(a)) a = str(a) print(type(a))
# # PySNMP MIB module ENTERASYS-IEEE802DOT11EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-IEEE802DOT11EXT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:49:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ...
class Solution: def longestCommonSub(self, a, n, b, m): dp = [[0]*(m+1) for i in range(n+1)] for i in range(1, n+1): for j in range(1, m+1): if a[i-1] == b[j-1]: dp[i][j] = dp[i-1][j-1] + 1 else: dp[i][j] = max(dp[i...
class Solution: def longest_common_sub(self, a, n, b, m): dp = [[0] * (m + 1) for i in range(n + 1)] for i in range(1, n + 1): for j in range(1, m + 1): if a[i - 1] == b[j - 1]: dp[i][j] = dp[i - 1][j - 1] + 1 else: ...
""" Code for training prototype segmentation model on Cityscapes dataset https://www.cityscapes-dataset.com/ """
""" Code for training prototype segmentation model on Cityscapes dataset https://www.cityscapes-dataset.com/ """
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. load("//antlir/bzl:shape.bzl", "shape") load("//antlir/bzl:target_tagger.shape.bzl", "target_tagged_image_source_t") tarball_t = shape.shap...
load('//antlir/bzl:shape.bzl', 'shape') load('//antlir/bzl:target_tagger.shape.bzl', 'target_tagged_image_source_t') tarball_t = shape.shape(force_root_ownership=shape.field(bool, optional=True), into_dir=shape.path, source=target_tagged_image_source_t)
# -*- coding: utf-8 -*- if __name__ == '__main__': a = u'\u5f53\u524d\u4e91\u533a\u57df\u6ca1\u6709\u53ef\u7528\u7684' # PROXY\uff0c\u8bf7\u5148\u68c0\u67e5\u5e76\u5b89\u88c5', u'\u76f4\u8fde\u533a\u57df\uff0c\u4e0d\u80fd\u5b89\u88c5PROXY\u548cPAGENT' print(a)
if __name__ == '__main__': a = u'当前云区域没有可用的' print(a)
if condition: ... else: ...
if condition: ... else: ...
r"""Two example systems. The :py:mod:`~example_systems.beryllium` module contains a calculation of the process matrices for a :math:`^9\text{Be}^+` ion addressed by a laser resonant with the :math:`^2S_{1/2}, F=2, m_F=2 \leftrightarrow ^2P_{3/2}, m_J=3/2` level, with perfect :math:`\sigma^+` polarization. The :py:mod...
"""Two example systems. The :py:mod:`~example_systems.beryllium` module contains a calculation of the process matrices for a :math:`^9\\text{Be}^+` ion addressed by a laser resonant with the :math:`^2S_{1/2}, F=2, m_F=2 \\leftrightarrow ^2P_{3/2}, m_J=3/2` level, with perfect :math:`\\sigma^+` polarization. The :py:m...
# # PySNMP MIB module Juniper-DNS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-DNS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:51:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_size_constraint, constraints_union, value_range_constraint) ...
# I have no idea if this is actually functioning. def line_intersection(l1, l2): xdiff = (l1[0][0] - l1[1][0], l2[0][0] - l2[1][0]) ydiff = (l1[0][1] - l1[1][1], l2[0][1] - l2[1][1]) def det(a, b): return a[0] * b[1] - a[1] * b[0] div = det(xdiff, ydiff) if div == 0: return False ...
def line_intersection(l1, l2): xdiff = (l1[0][0] - l1[1][0], l2[0][0] - l2[1][0]) ydiff = (l1[0][1] - l1[1][1], l2[0][1] - l2[1][1]) def det(a, b): return a[0] * b[1] - a[1] * b[0] div = det(xdiff, ydiff) if div == 0: return False d = (det(*l1), det(*l2)) x = det(d, xdiff) /...
fr = input('Frase: ') for i in range(len(fr) -1,-1,-1): print(fr[i], end='')
fr = input('Frase: ') for i in range(len(fr) - 1, -1, -1): print(fr[i], end='')
""" Fundamental Template for LinkedList """ # General Definition of a node class ListNode: def __init__(self, x): self.val = x self.next = None class LinkedList: def __init__(self): self.head = None self.tail = None return def push_elements(self...
""" Fundamental Template for LinkedList """ class Listnode: def __init__(self, x): self.val = x self.next = None class Linkedlist: def __init__(self): self.head = None self.tail = None return def push_elements(self, item): """ :param item: Push el...
def solve(arr, k): cur=float("-inf") ans=tuple() total=sum(arr) for i in range(len(arr), k-1, -1): temp=compute(arr, total, i) if temp[0]>cur: cur=temp[0] ans=(temp[1], i) total-=arr[i-1] return ans def compute(arr, total, k): cur=total index=0...
def solve(arr, k): cur = float('-inf') ans = tuple() total = sum(arr) for i in range(len(arr), k - 1, -1): temp = compute(arr, total, i) if temp[0] > cur: cur = temp[0] ans = (temp[1], i) total -= arr[i - 1] return ans def compute(arr, total, k): ...
# Move all xeroes to right N = int(input('')) array = list(map(int, input().split(' ')[:N])) flag = 0 # BRING/REPLACE ALL NON-ZEROES TO LEFT for index in range(0, len(array)): if(array[index] != 0): array[flag] = array[index] flag = flag+1 # NOW ADD ALL ZEROS TOWARDS RIGHT for index in range(flag...
n = int(input('')) array = list(map(int, input().split(' ')[:N])) flag = 0 for index in range(0, len(array)): if array[index] != 0: array[flag] = array[index] flag = flag + 1 for index in range(flag, len(array)): array[index] = 0 print(array)
# Space : O(n) # Time : O(n) class Solution: def reverseWords(self, s: str) -> str: l = s.split(" ") for i in range(len(l)): l[i] = l[i][::-1] return " ".join(l)
class Solution: def reverse_words(self, s: str) -> str: l = s.split(' ') for i in range(len(l)): l[i] = l[i][::-1] return ' '.join(l)
inputTemplates = { "M3": { "QCD": [ [ 0.0, 0.0004418671450315185, 0.01605229202018541, 0.05825334528354453, 0.08815209477081883, 0.1030093733105401, 0.10513254530282935, ...
input_templates = {'M3': {'QCD': [[0.0, 0.0004418671450315185, 0.01605229202018541, 0.05825334528354453, 0.08815209477081883, 0.1030093733105401, 0.10513254530282935, 0.09543913272896494, 0.08512520799056993, 0.07489480051367764, 0.06022183314704696, 0.05275434234820922, 0.04426859109280948, 0.03513151550399711, 0.0299...
def expand_as_one_hot(input, C, ignore_index=None): """ Converts NxDxHxW label image to NxCxDxHxW, where each label gets converted to its corresponding one-hot vector :param input: 4D input image (NxDxHxW) :param C: number of channels/labels :param ignore_index: ignore index to be kept during the ex...
def expand_as_one_hot(input, C, ignore_index=None): """ Converts NxDxHxW label image to NxCxDxHxW, where each label gets converted to its corresponding one-hot vector :param input: 4D input image (NxDxHxW) :param C: number of channels/labels :param ignore_index: ignore index to be kept during the ex...
class HtmlWriter(): def __init__(self, filename): self.filename = filename self.html_file = open(self.filename, 'w') self.html_file.write( """<!DOCTYPE html>\n""" + \ """<html>\n<body>\n<table border="1" style="width:100%"> \n""") def add_element(self, co...
class Htmlwriter: def __init__(self, filename): self.filename = filename self.html_file = open(self.filename, 'w') self.html_file.write('<!DOCTYPE html>\n' + '<html>\n<body>\n<table border="1" style="width:100%"> \n') def add_element(self, col_dict): self.html_file.write(' <...
# AT Commands MAKE = 'at+cgmi' MODEL = 'at+cgmm' STATUS = 'at!gstatus?' BANDMASK = 'at!gband?' SIGNALQ = 'at+csq' PWRMODE = { 'reboot': 'at!reset', 'lowpower': 'at+cfun=4', 'fullpower': 'at+cfun=1'}
make = 'at+cgmi' model = 'at+cgmm' status = 'at!gstatus?' bandmask = 'at!gband?' signalq = 'at+csq' pwrmode = {'reboot': 'at!reset', 'lowpower': 'at+cfun=4', 'fullpower': 'at+cfun=1'}