content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class ActiveDirectoryPrincipal(object): """Implementation of the 'ActiveDirectoryPrincipal' model. Specifies information about a single principal in an Active Directory. Attributes: domain (string): Specifies the domain name of the where th...
class Activedirectoryprincipal(object): """Implementation of the 'ActiveDirectoryPrincipal' model. Specifies information about a single principal in an Active Directory. Attributes: domain (string): Specifies the domain name of the where the principal' account is maintained. fu...
''' Deleting specific records By using a where() clause, you can target the delete statement to remove only certain records. For example, Jason deleted all columns from the employees table that had id 3 with the following delete statement: delete(employees).where(employees.columns.id == 3) Here you'll delete ALL row...
""" Deleting specific records By using a where() clause, you can target the delete statement to remove only certain records. For example, Jason deleted all columns from the employees table that had id 3 with the following delete statement: delete(employees).where(employees.columns.id == 3) Here you'll delete ALL row...
# # PySNMP MIB module TPLINK-pppoeConfig-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-pppoeConfig-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:18:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ...
#!/usr/bin/python def log(self,string): print(str(self.__class__.__name__)+": "+str(string))
def log(self, string): print(str(self.__class__.__name__) + ': ' + str(string))
_base_ = "./FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_Blender_01_ape.py" OUTPUT_DIR = "output/deepim/lmCropBlenderSO/FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_lmCropBlender_SO/duck" DATASETS = dict(TRAIN=("lm_blender_duck_train",), TEST=("lm_crop_duck_test",)) # bbnc9 # iter0 # objects duck Avg(1) # ad_2 ...
_base_ = './FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_Blender_01_ape.py' output_dir = 'output/deepim/lmCropBlenderSO/FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_lmCropBlender_SO/duck' datasets = dict(TRAIN=('lm_blender_duck_train',), TEST=('lm_crop_duck_test',))
infile='VisDrone2019-DET-val/val.txt' outfile='visdrone_val.txt' with open(outfile,'w') as w: with open(infile,'r') as r: filelist=r.readlines() for line in filelist: new_line=line.split('.')[0] w.write(new_line+'\n')
infile = 'VisDrone2019-DET-val/val.txt' outfile = 'visdrone_val.txt' with open(outfile, 'w') as w: with open(infile, 'r') as r: filelist = r.readlines() for line in filelist: new_line = line.split('.')[0] w.write(new_line + '\n')
"""Standard gate set for Orquestra. Convention for Gate objects currently supported: Gate.name: string Name of the quantum gate. Gate.qubits: [Qubit] List of Qubit objects, whose length depends on the number of qubits that the gate acts on. Gate.params: [float] List of gate parameters. For discr...
"""Standard gate set for Orquestra. Convention for Gate objects currently supported: Gate.name: string Name of the quantum gate. Gate.qubits: [Qubit] List of Qubit objects, whose length depends on the number of qubits that the gate acts on. Gate.params: [float] List of gate parameters. For discr...
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") print("yield Example1") def createGenerator(): yield 2 yield 3 yield 1 for i in createGenerator(): print(i) print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") print("yield Example2") def createGenerator2(): print("createGenerator2 2") yield 2 print("createGenerat...
print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') print('yield Example1') def create_generator(): yield 2 yield 3 yield 1 for i in create_generator(): print(i) print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') print('yield Example2') def create_generator2(): print('createGenerator2 2') yield 2 ...
class AssemblySimulatorVMConfigException(Exception): def __str__(self): return "[ERROR] Error: AssemblySimulatorConfigError, Response: {0}".format(super().__str__())
class Assemblysimulatorvmconfigexception(Exception): def __str__(self): return '[ERROR] Error: AssemblySimulatorConfigError, Response: {0}'.format(super().__str__())
def write_name_delbertina(input_turtle): # d input_turtle.right(90) input_turtle.forward(50) input_turtle.left(90) input_turtle.pendown() input_turtle.forward(30) input_turtle.left(90) input_turtle.forward(50) input_turtle.left(180) input_turtle.forward(30) input_turtle.right...
def write_name_delbertina(input_turtle): input_turtle.right(90) input_turtle.forward(50) input_turtle.left(90) input_turtle.pendown() input_turtle.forward(30) input_turtle.left(90) input_turtle.forward(50) input_turtle.left(180) input_turtle.forward(30) input_turtle.right(90) ...
""" Definition of TrieNode: class TrieNode: def __init__(self): # <key, value>: <Character, TrieNode> self.children = collections.OrderedDict() self.top10 = [] """ class TrieService: def __init__(self): self.root = TrieNode() def get_root(self): # Return root of tri...
""" Definition of TrieNode: class TrieNode: def __init__(self): # <key, value>: <Character, TrieNode> self.children = collections.OrderedDict() self.top10 = [] """ class Trieservice: def __init__(self): self.root = trie_node() def get_root(self): return self.root ...
class Solution: def threeEqualParts(self, A): """ :type A: List[int] :rtype: List[int] """ ones = A.count(1) one, rem = divmod(ones, 3) if rem: return [-1, -1] l, r = 0, len(A) - 1 n = len(A) cnt = 0 while l < len(A)...
class Solution: def three_equal_parts(self, A): """ :type A: List[int] :rtype: List[int] """ ones = A.count(1) (one, rem) = divmod(ones, 3) if rem: return [-1, -1] (l, r) = (0, len(A) - 1) n = len(A) cnt = 0 while l...
class TestUser: def test_list_no_user(self, client): """Test if db contains no user.""" headers = {"X-Api-Key": "123"} res = client.get("/api/user/list", headers=headers) json_data = res.get_json() assert json_data["code"] == 404 def test_crate_user(self, client): ...
class Testuser: def test_list_no_user(self, client): """Test if db contains no user.""" headers = {'X-Api-Key': '123'} res = client.get('/api/user/list', headers=headers) json_data = res.get_json() assert json_data['code'] == 404 def test_crate_user(self, client): ...
my_list=[22,333,412] sum =0 for number in my_list: sum += number print(sum)
my_list = [22, 333, 412] sum = 0 for number in my_list: sum += number print(sum)
#To accept 2 integers and display the largest among them a=int(input("Enter Number:")) b=int(input("Enter Number:")) if a>b: print (a,"is greater") elif a<b: print (b,"is greater") else: print ("Both Are Same Number")
a = int(input('Enter Number:')) b = int(input('Enter Number:')) if a > b: print(a, 'is greater') elif a < b: print(b, 'is greater') else: print('Both Are Same Number')
class DataGridViewBindingCompleteEventArgs(EventArgs): """ Provides data for the System.Windows.Forms.DataGridView.DataBindingComplete event. DataGridViewBindingCompleteEventArgs(listChangedType: ListChangedType) """ def Instance(self): """ This function has been arbitrarily put into the stubs""" r...
class Datagridviewbindingcompleteeventargs(EventArgs): """ Provides data for the System.Windows.Forms.DataGridView.DataBindingComplete event. DataGridViewBindingCompleteEventArgs(listChangedType: ListChangedType) """ def instance(self): """ This function has been arbitrarily put into the stubs""...
# == , != (Int, float, str, bool) x,y=6,7 p=6 print(x == y) #False print(p == x) #True print(p == 6.0) #True print('Hello' == 'Hello') #True #Chaining print(10 == 20 == 6 == 3) #False print(1 == 1 == 1 < 2) #True print(1 !=2 < 3 > 1) #True
(x, y) = (6, 7) p = 6 print(x == y) print(p == x) print(p == 6.0) print('Hello' == 'Hello') print(10 == 20 == 6 == 3) print(1 == 1 == 1 < 2) print(1 != 2 < 3 > 1)
#!python class BinaryTreeNode(object): def __init__(self, data): """Initialize this binary tree node with the given data.""" self.data = data self.left = None self.right = None def __repr__(self): """Return a string representation of this binary tree node.""" ...
class Binarytreenode(object): def __init__(self, data): """Initialize this binary tree node with the given data.""" self.data = data self.left = None self.right = None def __repr__(self): """Return a string representation of this binary tree node.""" return 'Bin...
bool1 = [[i*j for i in range(5)] for j in range(5)] print(bool1) for g in range(0,len(bool1[0])): i = 0 for j in range(g,len(bool1[0])): print(bool1[i][j]) i += 1
bool1 = [[i * j for i in range(5)] for j in range(5)] print(bool1) for g in range(0, len(bool1[0])): i = 0 for j in range(g, len(bool1[0])): print(bool1[i][j]) i += 1
def check(expected, obtained): try: a = float(expected) b = float(obtained) except ValueError: return False return abs(a - b) <= 1e-3
def check(expected, obtained): try: a = float(expected) b = float(obtained) except ValueError: return False return abs(a - b) <= 0.001
_base_ = '../yolox/yolox_l_8x8_300e_coco.py' model = dict( bbox_head=dict(num_classes=1) ) dataset_type = 'BasketballDetection' # data_root = '/mnt/nfs-storage/yujiannan/data/bas_data/train_data/' data_root = '/home/senseport0/data/train_data/' data = dict( samples_per_gpu=4, workers_per_gp...
_base_ = '../yolox/yolox_l_8x8_300e_coco.py' model = dict(bbox_head=dict(num_classes=1)) dataset_type = 'BasketballDetection' data_root = '/home/senseport0/data/train_data/' data = dict(samples_per_gpu=4, workers_per_gpu=1, train=dict(dataset=dict(type=dataset_type, ann_file=data_root + 'train_21.3.10_train.json' or 't...
# Python Program to print Unique Prime Factors of a Number Number = int(input(" Please Enter any Number: ")) i = 1 my=[] while(i <= Number): count = 0 if(Number % i == 0): j = 1 while(j <= i): if(i % j == 0): count = count + 1 j = j + 1 ...
number = int(input(' Please Enter any Number: ')) i = 1 my = [] while i <= Number: count = 0 if Number % i == 0: j = 1 while j <= i: if i % j == 0: count = count + 1 j = j + 1 if count == 2: my.append(i) i = i + 1 my = list(dict.fro...
# class describes one row in the Types sheet class Marker: def __init__(self, id: str, name: str, icon_name: str, prefix: str, marker_color: str, icon_color: str, spin: int, zoom_min: int, zoom_max: int, extra_classes: str, icon_url: str, shadow_url: str, icon_size: str, shadow_size: str, icon_anchor: str, shadow_...
class Marker: def __init__(self, id: str, name: str, icon_name: str, prefix: str, marker_color: str, icon_color: str, spin: int, zoom_min: int, zoom_max: int, extra_classes: str, icon_url: str, shadow_url: str, icon_size: str, shadow_size: str, icon_anchor: str, shadow_anchor: str, popup_anchor: str): self...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"Ability": "00_characters.ipynb", "Character": "00_characters.ipynb", "Mage": "00_characters.ipynb", "Demon": "00_characters.ipynb", "init_player": "01_game.ipynb", ...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'Ability': '00_characters.ipynb', 'Character': '00_characters.ipynb', 'Mage': '00_characters.ipynb', 'Demon': '00_characters.ipynb', 'init_player': '01_game.ipynb', 'combat': '01_game.ipynb', 'COMBAT_OPTIONS': '01_game.ipynb', 'game_loop': '01_game....
# Make strings collectable with gettext tools, but don't trnslate them here: _ = lambda x: x # Transaction types (TRXTYPE)... SALE, CREDIT, AUTHORIZATION, DELAYED_CAPTURE, VOID, DUPLICATE_TRANSACTION = ( 'S', 'C', 'A', 'D', 'V', 'N') # ...for humans trxtype_map = { SALE: _('Sale'), AUTHORIZATION: _('Autho...
_ = lambda x: x (sale, credit, authorization, delayed_capture, void, duplicate_transaction) = ('S', 'C', 'A', 'D', 'V', 'N') trxtype_map = {SALE: _('Sale'), AUTHORIZATION: _('Authorize'), CREDIT: _('Credit'), DELAYED_CAPTURE: _('Delayed capture'), VOID: _('Void'), DUPLICATE_TRANSACTION: _('Duplicate transaction')} (ban...
DATABASE_NAME = "devops" TABLE_NAME = "host_metrics" HT_TTL_HOURS = 24 CT_TTL_DAYS = 7
database_name = 'devops' table_name = 'host_metrics' ht_ttl_hours = 24 ct_ttl_days = 7
class _InitVarMeta(type): def __getitem__(self, params): return self class InitVar(metaclass=_InitVarMeta): pass def dataclass(_cls=None, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False): pass def field(*, default=MISSING, default_factory=MISSING, in...
class _Initvarmeta(type): def __getitem__(self, params): return self class Initvar(metaclass=_InitVarMeta): pass def dataclass(_cls=None, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False): pass def field(*, default=MISSING, default_factory=MISSING, init=True, repr=T...
token_symbols = { "DAI": {"address": 0x6B175474E89094C44DA98B954EEDEAC495271D0F, "decimals": 18}, "USDC": {"address": 0xA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48, "decimals": 6}, "MKR": {"address": 0x9F8F72AA9304C8B593D555F12EF6589CC3A579A2, "decimals": 18}, "LINK": {"address": 0x514910771AF9CA656AF840DF...
token_symbols = {'DAI': {'address': 611382286831621467233887798921843936019654057231, 'decimals': 18}, 'USDC': {'address': 917551056842671309452305380979543736893630245704, 'decimals': 6}, 'MKR': {'address': 910928527968400316125753109717913824688037263778, 'decimals': 18}, 'LINK': {'address': 4640576411622572235979131...
GRAM_FUNC_FEATURE = 'GramFunc' PRODUCTION_ID_FEATURE = 'ProdId' BRANCH_FEATURE = 'branch' POS_FEATURE = 'POS' INHERITED_FEATURE = 'inheritedFeature' BRANCH_FEATURE = 'branch' SLOT_FEATURE = 'slot' PERSONAL_FEATURE = "personal" INFLECTED_FEATURE = "inflected" STATUS_FEATURE = 'status' VCAT_FEATURE = 'vcat' NUMBER_FEATUR...
gram_func_feature = 'GramFunc' production_id_feature = 'ProdId' branch_feature = 'branch' pos_feature = 'POS' inherited_feature = 'inheritedFeature' branch_feature = 'branch' slot_feature = 'slot' personal_feature = 'personal' inflected_feature = 'inflected' status_feature = 'status' vcat_feature = 'vcat' number_featur...
# 1. Vorlesung mit Python (3. zu Skriptsprachen insges. -- 26.09.2020 - 1. PDF dazu) x = input ("Ihr Name? ") X = "Hallo " + x print (x) x = input ("Ihr Alter? ") x = int(x) - 5 print (x) # Seite 12 liste = "Hello World" print (liste) print (liste[2]) # Seite 17 strvar = "ABC" print (strvar) strvar = "ABC" * 5 ...
x = input('Ihr Name? ') x = 'Hallo ' + x print(x) x = input('Ihr Alter? ') x = int(x) - 5 print(x) liste = 'Hello World' print(liste) print(liste[2]) strvar = 'ABC' print(strvar) strvar = 'ABC' * 5 print(strvar) print(strvar)
host = "localhost" mongoPort = 27017 SOCKS5_PROXY_PORT = 1080 auth = "" passcode = "" # if proxy is not working please update the auth and passcode
host = 'localhost' mongo_port = 27017 socks5_proxy_port = 1080 auth = '' passcode = ''
floor=0 with open("input.txt") as dataFile: line = dataFile.readline().rstrip() for index,direction in enumerate(line): if direction == "(": floor +=1 else: floor -=1 if floor == -1: print("Basement index is : {}".format(index+1)) break
floor = 0 with open('input.txt') as data_file: line = dataFile.readline().rstrip() for (index, direction) in enumerate(line): if direction == '(': floor += 1 else: floor -= 1 if floor == -1: print('Basement index is : {}'.format(index + 1)) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-03-02 Last_modify: 2016-03-02 ****************************************** ''' ''' Given a collection of integers that might ...
""" ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-03-02 Last_modify: 2016-03-02 ****************************************** """ '\nGiven a collection of integers that might contain duplicates,\nnums, return all possible s...
""" @file : bst.py @brief : Binary Search Tree (bst) @details : BinarySearchTree TreeNode @author : Ernest Yeung ernestyalumni@gmail.com @date : 20170918 @ref : cf. http://interactivepython.org/runestone/static/pythonds/Trees/SearchTreeImplementation.html https://github.com/bnmnet...
""" @file : bst.py @brief : Binary Search Tree (bst) @details : BinarySearchTree TreeNode @author : Ernest Yeung ernestyalumni@gmail.com @date : 20170918 @ref : cf. http://interactivepython.org/runestone/static/pythonds/Trees/SearchTreeImplementation.html https://github.com/bnmnet...
"""Constants unsed in the tests.""" HANDLE_READ_VERSION_BATTERY = 0x38 HANDLE_READ_NAME = 0x03 HANDLE_READ_SENSOR_DATA = 0x35 HANDLE_WRITE_MODE_CHANGE = 0x33 DATA_MODE_CHANGE = bytes([0xA0, 0x1F]) TEST_MAC = '11:22:33:44:55:66' INVALID_DATA = b'\xaa\xbb\xcc\xdd\xee\xff\x99\x88\x77\x66\x00\x00\x00\x00\x00\x00'
"""Constants unsed in the tests.""" handle_read_version_battery = 56 handle_read_name = 3 handle_read_sensor_data = 53 handle_write_mode_change = 51 data_mode_change = bytes([160, 31]) test_mac = '11:22:33:44:55:66' invalid_data = b'\xaa\xbb\xcc\xdd\xee\xff\x99\x88wf\x00\x00\x00\x00\x00\x00'
def parse(data): for line in data.split("\n"): add, val = line.split(" = ") if add == "mask": yield -1, int(val.replace("X", "1"), 2) yield -2, int(val.replace("X", "0"), 2) else: yield int(add.split("[")[-1][:-1]), int(val) def aoc(data): mem = {-1:...
def parse(data): for line in data.split('\n'): (add, val) = line.split(' = ') if add == 'mask': yield (-1, int(val.replace('X', '1'), 2)) yield (-2, int(val.replace('X', '0'), 2)) else: yield (int(add.split('[')[-1][:-1]), int(val)) def aoc(data): mem...
# # PySNMP MIB module ANS-COMMON-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ANS-COMMON-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:06:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, constraints_union, single_value_constraint) ...
class Animal(object): #Initialization function def __init__(self, arm_length, leg_length, eyes, tail, furry): self.arm_length = arm_length self.leg_length = leg_length self.eyes = eyes self.tail = tail self.furry = furry #Function to print out and describe the data members def describe(self):...
class Animal(object): def __init__(self, arm_length, leg_length, eyes, tail, furry): self.arm_length = arm_length self.leg_length = leg_length self.eyes = eyes self.tail = tail self.furry = furry def describe(self): print('Length of the arms: ', self.arm_length)...
""" This file contains the base wrapper class for Mujoco environments. Wrappers are useful for data collection and logging. Highly recommended. """ class Wrapper: """ Base class for all wrappers in robosuite. Args: env (MujocoEnv): The environment to wrap. """ def __init__(self, env): ...
""" This file contains the base wrapper class for Mujoco environments. Wrappers are useful for data collection and logging. Highly recommended. """ class Wrapper: """ Base class for all wrappers in robosuite. Args: env (MujocoEnv): The environment to wrap. """ def __init__(self, env): ...
# Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Androguard is distributed in the hope that it will be useful, #...
dvm_permissions = {'MANIFEST_PERMISSION': {'SEND_SMS': ['dangerous', 'send SMS messages', 'Allows application to send SMS messages. Malicious applications may cost you money by sending messages without your confirmation.'], 'SEND_SMS_NO_CONFIRMATION': ['signatureOrSystem', 'send SMS messages', 'send SMS messages via th...
dayOfWeek = input("What day of the week is it? ").lower() print(dayOfWeek == "Monday") ### BAD CODE Use ELSE if (dayOfWeek == "monday"): print ("It is Monday!") if (dayOfWeek != "monday"): print("Keep on going!") if (dayOfWeek == "monday"): print ("It is Monday!") elif (dayOfWeek == "tuesday"): ...
day_of_week = input('What day of the week is it? ').lower() print(dayOfWeek == 'Monday') if dayOfWeek == 'monday': print('It is Monday!') if dayOfWeek != 'monday': print('Keep on going!') if dayOfWeek == 'monday': print('It is Monday!') elif dayOfWeek == 'tuesday': print('It is Tuesday!') else: prin...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ThomasHuke' class Person(object): def __len__(arg): return 200 a = Person() a1 = len(a) print(a1)
__author__ = 'ThomasHuke' class Person(object): def __len__(arg): return 200 a = person() a1 = len(a) print(a1)
class Node: def __init__(self,data): self.data=data self.nref=None self.pref=None class doubly: def __init__(self): self.head=None def forward(self): n=self.head if(n is None): print("List is empty, you cant do any forward traversal") else...
class Node: def __init__(self, data): self.data = data self.nref = None self.pref = None class Doubly: def __init__(self): self.head = None def forward(self): n = self.head if n is None: print('List is empty, you cant do any forward traversal')...
""" Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Output: "hello" Example 2: Input: "here" Output: "here" Example 3: Input: "LOVELY" Output: "lovely" """ class Solution: def toLowerCase(self, string): """ ...
""" Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Output: "hello" Example 2: Input: "here" Output: "here" Example 3: Input: "LOVELY" Output: "lovely" """ class Solution: def to_lower_case(self, string): """ ...
class Solution: def toGoatLatin(self, S: str) -> str: S = S.split() vowels = set("aeiouAEIOU") def f(i, word): if word[0] in vowels: word += "ma" else: word = word[1:] + word[0] + "ma" word += "a" ...
class Solution: def to_goat_latin(self, S: str) -> str: s = S.split() vowels = set('aeiouAEIOU') def f(i, word): if word[0] in vowels: word += 'ma' else: word = word[1:] + word[0] + 'ma' word += 'a' * i return ...
""" Parameters of the agent. The meaning of the different parameters are described below. Setting debug_run = True allows a shorter run, only for debugging purposes. """ debug_run = False env_seed = 13 random_seed = env_seed+1 nb_training_steps = int(5e6) if not debug_run else int(2e5) # Number of training steps s...
""" Parameters of the agent. The meaning of the different parameters are described below. Setting debug_run = True allows a shorter run, only for debugging purposes. """ debug_run = False env_seed = 13 random_seed = env_seed + 1 nb_training_steps = int(5000000.0) if not debug_run else int(200000.0) save_freq = 50000 i...
class StringBuffer(str): def __init__(self, str=''): self.str = str def __len__(self): return len(self.str) def __contains__(self, obj): return str(obj) in self.str def __iter__(self): self.curr = 0 return iter(self.str) def __next__(self): self.curr += 1 if self.curr == len(self.str): raise StopIterati...
class Stringbuffer(str): def __init__(self, str=''): self.str = str def __len__(self): return len(self.str) def __contains__(self, obj): return str(obj) in self.str def __iter__(self): self.curr = 0 return iter(self.str) def __next__(self): self.c...
class SemaphoreAuditRule(AuditRule): """ Represents a set of access rights to be audited for a user or group. This class cannot be inherited. SemaphoreAuditRule(identity: IdentityReference,eventRights: SemaphoreRights,flags: AuditFlags) """ @staticmethod def __new__(self,identity,eventRights,flags): ...
class Semaphoreauditrule(AuditRule): """ Represents a set of access rights to be audited for a user or group. This class cannot be inherited. SemaphoreAuditRule(identity: IdentityReference,eventRights: SemaphoreRights,flags: AuditFlags) """ @staticmethod def __new__(self, identity, eventRights, flag...
# from .project_files import ProjectFiles # from .google_cloud_storage import GoogleCloudStorage __all__ = [ # 'ProjectFiles', # 'GoogleCloudStorage', ]
__all__ = []
# Data sources database( thermoLibraries=['surfaceThermoNi111', 'surfaceThermoPt111', 'primaryThermoLibrary', 'thermo_DFT_CCSDTF12_BAC'], reactionLibraries = [('Surface/Deutschmann_Ni', True)], # when Pt is used change the library to Surface/CPOX_Pt/Deutschmann2006 seedMechanisms = [], kineticsDeposito...
database(thermoLibraries=['surfaceThermoNi111', 'surfaceThermoPt111', 'primaryThermoLibrary', 'thermo_DFT_CCSDTF12_BAC'], reactionLibraries=[('Surface/Deutschmann_Ni', True)], seedMechanisms=[], kineticsDepositories=['training'], kineticsFamilies=['surface', 'default'], kineticsEstimator='rate rules') catalyst_properti...
""" mod1 """ def decorator(f): return f @decorator def func1(a, b): """ this is func1 """ return a, b @decorator class Class1(object): """ this is Class1 """ class Class3(object): """ this is Class3 """ class_attr = 42 """this is the class attribute class_attr...
""" mod1 """ def decorator(f): return f @decorator def func1(a, b): """ this is func1 """ return (a, b) @decorator class Class1(object): """ this is Class1 """ class Class3(object): """ this is Class3 """ class_attr = 42 'this is the class attribute class_attr'
class Credentials: ''' Class for generating account credentials,passwords and save this information ''' credentials_list=[] def __init__(self,site_name,account_name,account_password): ''' method to define the properties each user object will hold ''' self.site_...
class Credentials: """ Class for generating account credentials,passwords and save this information """ credentials_list = [] def __init__(self, site_name, account_name, account_password): """ method to define the properties each user object will hold """ self.site_n...
def foo(bar): class Foo: call(bar)
def foo(bar): class Foo: call(bar)
""" Python 3.6 meta_obj.py Class to hold key model output file metadata. Matt Nicholson 19 May 2020 """ class MetaObj: """ Simple class to hold key metadata for a model output file. Instance Attributes ------------------- * dataset: str Dataset (or model) that produced t...
""" Python 3.6 meta_obj.py Class to hold key model output file metadata. Matt Nicholson 19 May 2020 """ class Metaobj: """ Simple class to hold key metadata for a model output file. Instance Attributes ------------------- * dataset: str Dataset (or model) that produced the data file. ...
# -*- coding: utf-8 -*- BOT_NAME = 'wsj' SPIDER_MODULES = ['wsj.spiders'] NEWSPIDER_MODULE = 'wsj.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent #USER_AGENT = 'wsj (+http://www.yourdomain.com)' # Obey robots.txt rules ROBOTSTXT_OBEY = True # Configure maximum concurrent r...
bot_name = 'wsj' spider_modules = ['wsj.spiders'] newspider_module = 'wsj.spiders' robotstxt_obey = True item_pipelines = {'wsj.pipelines.CompanyListStorePipeline': 300} autothrottle_enabled = True autothrottle_start_delay = 5 autothrottle_max_delay = 60 autothrottle_target_concurrency = 1.0
# -*- coding: utf-8 -*- # Scrapy settings for politikdokumente project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/en/latest/topics/settings.html # BOT_NAME = 'politikdokumente' SPIDER_MODULES = ['poli...
bot_name = 'politikdokumente' spider_modules = ['politikdokumente.spiders'] newspider_module = 'politikdokumente.spiders' download_delay = 0.2 log_file = 'scrapy.log' log_level = 'INFO'
vowels = set('aeiou') word = input("Provide a word to search for vowels:") found = vowels.intersection(set(word)) for vowel in found: print(vowel)
vowels = set('aeiou') word = input('Provide a word to search for vowels:') found = vowels.intersection(set(word)) for vowel in found: print(vowel)
EXPERIMENT_XML = """<?xml version="1.0" encoding="UTF-8"?> <ROOT request="DRX001563&amp;display=xml"> <EXPERIMENT accession="DRX001563" center_name="RIKEN_CDB" alias="DRX001563" broker_name="DDBJ"> <IDENTIFIERS> <PRIMARY_ID>DRX001563</PRIMARY_ID> <SUBMITTER_ID namespace="RIKEN_CDB">DRX001563</S...
experiment_xml = '<?xml version="1.0" encoding="UTF-8"?>\n<ROOT request="DRX001563&amp;display=xml">\n<EXPERIMENT accession="DRX001563" center_name="RIKEN_CDB" alias="DRX001563" broker_name="DDBJ">\n <IDENTIFIERS>\n <PRIMARY_ID>DRX001563</PRIMARY_ID>\n <SUBMITTER_ID namespace="RIKEN_CDB">DRX001563...
description = 'XYZ-Omega sample table' group = 'lowlevel' excludes = ['samplechanger'] devices = dict( x_m = device('nicos.devices.generic.VirtualMotor', description = 'X axis sample table motor', abslimits = (0, 200), speed = 5, lowlevel = True, unit = 'mm', ), x ...
description = 'XYZ-Omega sample table' group = 'lowlevel' excludes = ['samplechanger'] devices = dict(x_m=device('nicos.devices.generic.VirtualMotor', description='X axis sample table motor', abslimits=(0, 200), speed=5, lowlevel=True, unit='mm'), x=device('nicos.devices.generic.Axis', description='X translation of the...
""" this directory contains objects which directly access the various databases we use. Normally, these objects should be loaded into a service object rather than called directly. """ __author__ = 'ars62917'
""" this directory contains objects which directly access the various databases we use. Normally, these objects should be loaded into a service object rather than called directly. """ __author__ = 'ars62917'
# 039 - Write a Python program to compute the future value of a specified principal amount, rate of interest, and a number of years. def futureValue(pValue, pRate, pYears): return round(pValue * ((1 + (0.01 * pRate)) ** pYears), 2) print(futureValue(10000, 3.5, 7))
def future_value(pValue, pRate, pYears): return round(pValue * (1 + 0.01 * pRate) ** pYears, 2) print(future_value(10000, 3.5, 7))
VERSION = '0.2.0' ## ModBus/TCP MODBUS_PORT = 502 ## Modbus mode MODBUS_TCP = 1 MODBUS_RTU = 2 ## Modbus function code # standard READ_COILS = 0x01 READ_DISCRETE_INPUTS = 0x02 READ_HOLDING_REGISTERS = 0x03 READ_INPUT_REGISTERS = 0x04 WRITE_SINGLE_COIL = 0x05 WRITE_SINGLE_REGISTER = 0x06 WRITE_MULTIPLE_COILS = 0x0F WRIT...
version = '0.2.0' modbus_port = 502 modbus_tcp = 1 modbus_rtu = 2 read_coils = 1 read_discrete_inputs = 2 read_holding_registers = 3 read_input_registers = 4 write_single_coil = 5 write_single_register = 6 write_multiple_coils = 15 write_multiple_registers = 16 modbus_encapsulated_interface = 43 exp_none = 0 exp_illega...
draw = [] boards = [] drawn_boards = [] def parse_input(file): """ Parses this day's input data. The first line will contain a random sequence of numbers. After that, matrices of random numbers will follow, separated by a blank line. """ with open(file, "r") as fp: ...
draw = [] boards = [] drawn_boards = [] def parse_input(file): """ Parses this day's input data. The first line will contain a random sequence of numbers. After that, matrices of random numbers will follow, separated by a blank line. """ with open(file, 'r') as fp: nums = fp.readline...
REQUEST_BODY_JSON = """ { "id_token": "string", "limit": 1, "offset": 1 } """ RESPONSE_200_JSON = """ { "balance": 1.1, "past_transactions": [ { "transaction_description": "string", "amount": 1.1, "transaction_datetime": "2099-12-31 00:00:00", ...
request_body_json = '\n{\n "id_token": "string", \n "limit": 1, \n "offset": 1\n}\n' response_200_json = '\n{\n "balance": 1.1, \n "past_transactions": [\n {\n "transaction_description": "string", \n "amount": 1.1, \n "transaction_datetime": "2099-12-31 00:00:00", ...
nstrips = 100 width = 1/nstrips integral = 0 for point in range(nstrips): height = (1 - (point/nstrips)**2)**(1/2) integral = integral + width * height print("The value is", integral)
nstrips = 100 width = 1 / nstrips integral = 0 for point in range(nstrips): height = (1 - (point / nstrips) ** 2) ** (1 / 2) integral = integral + width * height print('The value is', integral)
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you m...
class Mockconcept: def __init__(self, id): self.id = id class Mocktype(MockConcept): def __init__(self, id, label, base_type): super().__init__(id) self._label = label assert base_type in {'ENTITY', 'RELATION', 'ATTRIBUTE'} self.base_type = base_type def label(sel...
class Postions: def __init__(self): self.postions = [ "GK", "CB", "RCB", "LCB", "CDM", "CM", "CAM", "CF", "RB", "LB", "RWB", "LWB", "RM", "L...
class Postions: def __init__(self): self.postions = ['GK', 'CB', 'RCB', 'LCB', 'CDM', 'CM', 'CAM', 'CF', 'RB', 'LB', 'RWB', 'LWB', 'RM', 'LM', 'RW', 'LW', 'RF', 'LF', 'RS', 'LS', 'ST', 'MS'] def is_position(self, postion) -> bool: if postion in self.postions: return True re...
class Path(object): @staticmethod def getPath(dataset): if dataset == 'QUBIQ': return r'/home/qingqiao/bAttenUnet_test/qubiq' if dataset == 'uncertain-brats': return r'/home/qingqiao/bAttenUnet_test/qubiq' if dataset == 'brats': return '/home/cvip/data...
class Path(object): @staticmethod def get_path(dataset): if dataset == 'QUBIQ': return '/home/qingqiao/bAttenUnet_test/qubiq' if dataset == 'uncertain-brats': return '/home/qingqiao/bAttenUnet_test/qubiq' if dataset == 'brats': return '/home/cvip/data...
class Chunks: HEADER = 0x0 MESHES = 0x1 SLOTS = 0x2 class LevelDetails: pass class DetailsTransform: def __init__(self): self.x = None self.y = None class DetailsHeader: def __init__(self): self.format_version = None self.slot_size = 2.0 self.slot_ha...
class Chunks: header = 0 meshes = 1 slots = 2 class Leveldetails: pass class Detailstransform: def __init__(self): self.x = None self.y = None class Detailsheader: def __init__(self): self.format_version = None self.slot_size = 2.0 self.slot_half = se...
# Topic 1: Basics of programming - Excercise 1 # Gerhard van der Linde # Copied from Ian McLoughlin # A program that displays Fibonacci numbers. # # Re: Fibonacci exercise responses # by GERHARD VAN DER LINDE - Monday, 22 January 2018, 4:14 PM # # My name is Gerhard, so the first and last letter of my name # (G + D ...
def fib(n): """This function returns the nth Fibonacci number.""" i = 0 j = 1 n = n - 1 while n >= 0: (i, j) = (j, i + j) n = n - 1 return i name = '"van der Linde"' first = name[1] last = name[-2] firstno = ord(first) lastno = ord(last) x = firstno + lastno ans = fib(x) print('M...
posicao= int(input('Digite um numero: ')) seq=0 a=1 b=0 aux=0 while posicao != seq: print(aux, end=' ') aux= a+b a=b b= aux seq +=1
posicao = int(input('Digite um numero: ')) seq = 0 a = 1 b = 0 aux = 0 while posicao != seq: print(aux, end=' ') aux = a + b a = b b = aux seq += 1
class Permission: ADMIN = 1 USER = 21 LIST_USERS = 22 ADD_USER = 23 Edit_USER = 24 DELETE_USER = 25 BLOCK_USER = 26
class Permission: admin = 1 user = 21 list_users = 22 add_user = 23 edit_user = 24 delete_user = 25 block_user = 26
# -*- coding: utf-8 -*- """ Ochrona-cli :author: ascott """ class OchronaException(Exception): pass class OchronaFileException(OchronaException): pass class OchronaImportException(OchronaException): pass
""" Ochrona-cli :author: ascott """ class Ochronaexception(Exception): pass class Ochronafileexception(OchronaException): pass class Ochronaimportexception(OchronaException): pass
img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) max_scale, min_scale = 1024, 512 train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations'), dict(type='Resize', img_scale=(max_scale, min_scale), keep_ratio=True), dict(type='RandomF...
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) (max_scale, min_scale) = (1024, 512) train_pipeline = [dict(type='LoadImageFromFile'), dict(type='LoadAnnotations'), dict(type='Resize', img_scale=(max_scale, min_scale), keep_ratio=True), dict(type='RandomFlip', flip_ratio=0....
# testing importing of modules and functions def make_pizza(size, *toppings): """Summarize the pizza we are about to make.""" print(f"\nMaking a {size}-inch pizza with the following toppings:") for topping in toppings: print(f"- {topping}")
def make_pizza(size, *toppings): """Summarize the pizza we are about to make.""" print(f'\nMaking a {size}-inch pizza with the following toppings:') for topping in toppings: print(f'- {topping}')
PROC_FUNC_DICT = dict() def register_forward_proc_func(func): PROC_FUNC_DICT[func.__name__] = func return func @register_forward_proc_func def forward_batch_only(model, sample_batch, targets=None, supp_dict=None): return model(sample_batch) @register_forward_proc_func def forward_batch_target(model, s...
proc_func_dict = dict() def register_forward_proc_func(func): PROC_FUNC_DICT[func.__name__] = func return func @register_forward_proc_func def forward_batch_only(model, sample_batch, targets=None, supp_dict=None): return model(sample_batch) @register_forward_proc_func def forward_batch_target(model, samp...
w = 105 x = 78658965235632 y = -256 z = 0b00110011 print(type(w)) # <class 'int'> print(type(x)) # <class 'int'> print(type(y)) # <class 'int'> print(type(z)) # <class 'int'>
w = 105 x = 78658965235632 y = -256 z = 51 print(type(w)) print(type(x)) print(type(y)) print(type(z))
class StackOverflowSpider(scrapy.Spider): name = 'casa' start_urls = ['http://homelovers.pt/index.php/component/jak2filter/?Itemid=114&isc=1&category_id=2&xf_7_range=0|1200&ordering=order'] def parse(self, response): for href in response.css('.question-summary h3 a::attr(href)'): full...
class Stackoverflowspider(scrapy.Spider): name = 'casa' start_urls = ['http://homelovers.pt/index.php/component/jak2filter/?Itemid=114&isc=1&category_id=2&xf_7_range=0|1200&ordering=order'] def parse(self, response): for href in response.css('.question-summary h3 a::attr(href)'): full_u...
# # PySNMP MIB module HM2-LICENSE-MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-LICENSE-MGMT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:18:51 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint, constraints_union) ...
#!/usr/bin/python3 """Module to find the max integer in a list """ def max_integer(list=[]): """Function to find and return the max integer in a list of integers If the list is empty, the function returns None """ if len(list) == 0: return None result = list[0] i = 1 while i < ...
"""Module to find the max integer in a list """ def max_integer(list=[]): """Function to find and return the max integer in a list of integers If the list is empty, the function returns None """ if len(list) == 0: return None result = list[0] i = 1 while i < len(list): i...
def get_bittrex_rates(self, queue, pairs): base = pairs['base'] markets = pairs['markets'] rates = dict() for market in markets: ticker = "{}-{}".format(base, market) symbol_info = self.get_ticker(ticker) price = symbol_info['result']['Last'] symbol = "{}{}".format(ma...
def get_bittrex_rates(self, queue, pairs): base = pairs['base'] markets = pairs['markets'] rates = dict() for market in markets: ticker = '{}-{}'.format(base, market) symbol_info = self.get_ticker(ticker) price = symbol_info['result']['Last'] symbol = '{}{}'.format(market...
""" Copyright (c) 2016 Marshall Farrier license http://opensource.org/licenses/MIT Constants related to the MongoDB schema """ SPREADS = [ { 'key': 'dgb', 'desc': 'Diagonal butterfly'}, { 'key': 'dblcal', 'desc': 'Double calendar'}, ]
""" Copyright (c) 2016 Marshall Farrier license http://opensource.org/licenses/MIT Constants related to the MongoDB schema """ spreads = [{'key': 'dgb', 'desc': 'Diagonal butterfly'}, {'key': 'dblcal', 'desc': 'Double calendar'}]
# Visit https://www.reddit.com/prefs/apps/ for credential keys # For additional detail, visit praw's own document: https://praw.readthedocs.io/en/latest/getting_started/quick_start.html credentials = { 'client_id' : 'Your client key here', 'client_secret' : 'Your client secret here', 'user_agent' : "Your u...
credentials = {'client_id': 'Your client key here', 'client_secret': 'Your client secret here', 'user_agent': 'Your user agent here'}
# Lesson 3 class Person: def __init__(self, fname, lname): self._fname = fname self._lname = lname # properties allow us to emulate member variables with correctional logic @property def full_name(self): return self._fname + ' ' + self._lname # we can also use them to asser...
class Person: def __init__(self, fname, lname): self._fname = fname self._lname = lname @property def full_name(self): return self._fname + ' ' + self._lname @full_name.setter def full_name(self, name): if name is None: return parts = name.split...
ZOMATO_API_KEY = 'your key here' GOOGLE_MAPS_V3_KEY = 'your key here' ZOMATO_API_URL = '/api/v2.1/search?' ZOMATO_BASE_URL = 'developers.zomato.com' ZOMATO_MAX_RESULT = 10
zomato_api_key = 'your key here' google_maps_v3_key = 'your key here' zomato_api_url = '/api/v2.1/search?' zomato_base_url = 'developers.zomato.com' zomato_max_result = 10
class Solution: def videoStitching(self, clips: List[List[int]], T: int) -> int: index, cnt, maxn = 0, 0, 0 while index < T: flag = 0 for l in clips: if l[0] <= index: tmp = maxn maxn = max(maxn, l[1]) if maxn != tmp: flag = 1 if flag == 0: ...
class Solution: def video_stitching(self, clips: List[List[int]], T: int) -> int: (index, cnt, maxn) = (0, 0, 0) while index < T: flag = 0 for l in clips: if l[0] <= index: tmp = maxn maxn = max(maxn, l[1]) ...
""" Author: Michel Peltriaux Organization: Spatial data infrastructure Rhineland-Palatinate, Germany Contact: michel.peltriaux@vermkv.rlp.de Created on: 28.05.19 """
""" Author: Michel Peltriaux Organization: Spatial data infrastructure Rhineland-Palatinate, Germany Contact: michel.peltriaux@vermkv.rlp.de Created on: 28.05.19 """
test_data = [ { "float_features": { "engines": 2, "passenger_capacity": 4, "crew": 3, "company_rating": 1, "review_scores_rating": 96 }, "categorical_features": { "d_check_complete": "False", "moon_cl...
test_data = [{'float_features': {'engines': 2, 'passenger_capacity': 4, 'crew': 3, 'company_rating': 1, 'review_scores_rating': 96}, 'categorical_features': {'d_check_complete': 'False', 'moon_clearance_complete': 'False', 'iata_approved': 'True'}}, {'float_features': {'engines': 4, 'passenger_capacity': 8, 'crew': 5, ...
class RescTypeError(TypeError): pass class RescValueError(ValueError): pass class RescAttributeError(AttributeError): pass class RescKeyError(KeyError): pass class RescServerError(Exception): pass class RescCronError(Exception): pass
class Resctypeerror(TypeError): pass class Rescvalueerror(ValueError): pass class Rescattributeerror(AttributeError): pass class Resckeyerror(KeyError): pass class Rescservererror(Exception): pass class Resccronerror(Exception): pass
print('Who do you think I am?') input() print('How old are you?') input() print('Oh, yes!')
print('Who do you think I am?') input() print('How old are you?') input() print('Oh, yes!')
''' Created on Jun 7, 2015 @author: dave ''' class ContextSet: # ContextSet ''' The context has composed one or more trigger words. These trigger words will be the spec of another command. That other command will be consumed by the ContextSeeker and will not be executed. ''' def __init__(se...
""" Created on Jun 7, 2015 @author: dave """ class Contextset: """ The context has composed one or more trigger words. These trigger words will be the spec of another command. That other command will be consumed by the ContextSeeker and will not be executed. """ def __init__(self, specTrigger...
src = Split(''' mqtt-example.c ''') component = aos_component('mqttapp', src) macro_tmp = Split(''' MQTT_TEST ALIOT_DEBUG IOTX_DEBUG USE_LPTHREAD ''') for i in macro_tmp: component.add_global_macros(i) dependencis = Split(''' tools/cli framework/connectivity/mqtt utility/cjson ...
src = split('\n mqtt-example.c\n') component = aos_component('mqttapp', src) macro_tmp = split('\n MQTT_TEST\n ALIOT_DEBUG \n IOTX_DEBUG\n USE_LPTHREAD\n') for i in macro_tmp: component.add_global_macros(i) dependencis = split('\n tools/cli \n framework/connectivity/mqtt\n utility/cjson \n ...
class heap(list): """docstring for heap""" def __init__(self): super(heap, self).__init__() self.heap_size = 0 def parent(i): return ((i+1) / 2) - 1 def left(i): return 2*i+1 def right(i): return 2*i+2 def min_heapify(A, i): l = left(i) r = left(i) minmum = i if l < A.heap_size and A[l] < A[i]: mi...
class Heap(list): """docstring for heap""" def __init__(self): super(heap, self).__init__() self.heap_size = 0 def parent(i): return (i + 1) / 2 - 1 def left(i): return 2 * i + 1 def right(i): return 2 * i + 2 def min_heapify(A, i): l = left(i) r = left(i) minmum = i...
def computeCost(arr, X): cost = 0 for i in range(len(arr)): cost += abs(arr[i] - X) return cost def computeTriangularCost(arr, X): cost = 0 for i in range(len(arr)): cost += sum(range(abs(arr[i] - X) + 1)) return cost def centerDistance(inputList, fdist): inputLength = len(inputList) if inpu...
def compute_cost(arr, X): cost = 0 for i in range(len(arr)): cost += abs(arr[i] - X) return cost def compute_triangular_cost(arr, X): cost = 0 for i in range(len(arr)): cost += sum(range(abs(arr[i] - X) + 1)) return cost def center_distance(inputList, fdist): input_length =...
print("\t",end="") for i in range(10): for j in range(0,i): print("*",end="") print("") l = [i%2 for i in range(10)] print(l)
print('\t', end='') for i in range(10): for j in range(0, i): print('*', end='') print('') l = [i % 2 for i in range(10)] print(l)
expected_output = { "instance": { "master": { "areas": { "0.0.0.1": { "interfaces": { "ge-0/0/0.0": { "state": "PtToPt", "dr_id": "0.0.0.0", "bdr_id": "...
expected_output = {'instance': {'master': {'areas': {'0.0.0.1': {'interfaces': {'ge-0/0/0.0': {'state': 'PtToPt', 'dr_id': '0.0.0.0', 'bdr_id': '0.0.0.0', 'nbrs_count': 1}, 'ge-0/0/1.0': {'state': 'PtToPt', 'dr_id': '0.0.0.0', 'bdr_id': '0.0.0.0', 'nbrs_count': 1}}}}}}}
class Compressor: NUM_COLOR_CHANNELS = 3 MAX_TIMES = 8 # For 3 bits to represent repeats def feed(self, data): data_size = len(data) assert data_size % self.NUM_COLOR_CHANNELS == 0, \ "Size of color data frames must be a multiple 3 which is the no. of color channels!" ...
class Compressor: num_color_channels = 3 max_times = 8 def feed(self, data): data_size = len(data) assert data_size % self.NUM_COLOR_CHANNELS == 0, 'Size of color data frames must be a multiple 3 which is the no. of color channels!' data = list(map(lambda x: x >> 3 << 3, data)) ...
""" A line item for a bulk food order has description, weight and price fields:: >>> raisins = LineItem('Golden raisins', 10, 6.95) >>> raisins.weight, raisins.description, raisins.price (10, 'Golden raisins', 6.95) A ``subtotal`` method gives the total price for that line item:: >>> raisins.subtota...
""" A line item for a bulk food order has description, weight and price fields:: >>> raisins = LineItem('Golden raisins', 10, 6.95) >>> raisins.weight, raisins.description, raisins.price (10, 'Golden raisins', 6.95) A ``subtotal`` method gives the total price for that line item:: >>> raisins.subtota...
''' Given an integer array nums, handle multiple queries of the following type: Calculate the sum of the elements of nums between indices left and right inclusive where left <= right. Implement the NumArray class: NumArray(int[] nums) Initializes the object with the integer array nums. int sumRange(int left, int righ...
""" Given an integer array nums, handle multiple queries of the following type: Calculate the sum of the elements of nums between indices left and right inclusive where left <= right. Implement the NumArray class: NumArray(int[] nums) Initializes the object with the integer array nums. int sumRange(int left, int righ...
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/xavier_ssd/TrekBot/TrekBot2_WS/devel/.private/robot_localization/include;/xavier_ssd/TrekBot/TrekBot2_WS/src/robot_localization/include;/usr/include/eigen3".split(';') if "/xavier_ssd/TrekBot/TrekBot2...
catkin_package_prefix = '' project_pkg_config_include_dirs = '/xavier_ssd/TrekBot/TrekBot2_WS/devel/.private/robot_localization/include;/xavier_ssd/TrekBot/TrekBot2_WS/src/robot_localization/include;/usr/include/eigen3'.split(';') if '/xavier_ssd/TrekBot/TrekBot2_WS/devel/.private/robot_localization/include;/xavier_ssd...