content
stringlengths
7
1.05M
""" First class definition""" class Cat: pass class RaceCar: pass cat1 = Cat() cat2 = Cat() cat3 = Cat()
# We can transition on native options using this # //command_line_option:<option-name> syntax _BUILD_SETTING = "//command_line_option:test_arg" def _test_arg_transition_impl(settings, attr): _ignore = (settings, attr) return {_BUILD_SETTING: ["new arg"]} _test_arg_transition = transition( implementation = _test_arg_transition_impl, inputs = [], outputs = [_BUILD_SETTING], ) def _test_transition_rule_impl(ctx): # We need to copy the executable because starlark doesn't allow # providing an executable not created by the rule executable_src = ctx.executable.actual_test executable_dst = ctx.actions.declare_file(ctx.label.name) ctx.actions.run_shell( tools = [executable_src], outputs = [executable_dst], command = "cp %s %s" % (executable_src.path, executable_dst.path), ) runfiles = ctx.attr.actual_test[0][DefaultInfo].default_runfiles return [DefaultInfo(runfiles = runfiles, executable = executable_dst)] transition_rule_test = rule( implementation = _test_transition_rule_impl, attrs = { "actual_test": attr.label(cfg = _test_arg_transition, executable = True), "_allowlist_function_transition": attr.label( default = "@bazel_tools//tools/allowlists/function_transition_allowlist", ), }, test = True, ) def test_arg_cc_test(name, **kwargs): cc_test_name = name + "_native_test" transition_rule_test( name = name, actual_test = ":%s" % cc_test_name, ) native.cc_test(name = cc_test_name, **kwargs)
balance = 700 papers=[100, 50, 10, 5,4,3,2,1] def withdraw(balance, request): if balance < request : print('Sorry, you are try withdraw: {0}, but Your balance just : {1}'.format(request, balance)) else: print ('your balance >>', balance) orgnal_request = request while request > 0: for i in papers: while request >= i: print('give', i) request-=i balance -= orgnal_request return balance def withdraw1(balance, request): give = 0 if balance < request : print('Sorry, you are try withdraw: {0}, but Your balance just : {1}'.format(request, balance)) else: print ('your balance >>', balance) balance -= request while request > 0: if request >= 100: give = 100 elif request >= 50: give = 50 elif request >= 10: give = 10 elif request >= 5: give = 5 else : give = request print('give',give) request -= give return balance balance = withdraw(balance, 777) balance = withdraw(balance, 276) balance = withdraw1(balance, 276) balance = withdraw(balance, 34) balance = withdraw1(balance, 5) balance = withdraw1(balance, 500)
x = float(input('Qual o valor da casa que quer comprar? ')) y = int(input("em quantos anos quer comprar a casa? ")) z = int(input("Qual seu salario? ")) w = y*12 if x / w > (z/100)*30: print("Voce não pode comprar a casa") else: print('Voce pode comprar a casa a parcela é de {:.2f}'.format(x/y))
"""Top-level package for Feature Flag Server SDK.""" __author__ = """Enver Bisevac""" __email__ = "enver@bisevac.com" __version__ = "0.1.0"
arr_1 = ["1","2","3","4","5","6","7"] arr_2 = [] for n in arr_1: arr_2.insert(0,n) print(arr_2)
"""Top-level package for z2z Metadata analysis.""" __author__ = """Isthmus // Mitchell P. Krawiec-Thayer""" __email__ = 'project_z2z_metadata@mitchellpkt.com' __version__ = '0.0.1'
class Player(object): """Player class Attributes: name (str): Player name """ def __init__(self, name): """Initialize player Args: name (str): Player name """ self.name = name def place_troops(self, board, n_troops): """Place troops on territories Args: board (Gameboard): The gameboard n_troops (int): Number of new troops to deploy Returns: (dict(str, int)): Dictionary of territories with number of troops to be deployed """ raise NotImplementedError('place_troops not implemented') def do_attack(self, board): """Decide whether or not to continue attacking Args: board (Gameboard): The gameboard Returns: (bool): Whether or not to continue attacking """ raise NotImplementedError('do_attack not implemented') def attack(self, board): """Attack phase Args: board (Gameboard): The gameboard Returns: (str, str): from_territory, to_territory """ raise NotImplementedError('attack not implemented') def do_move_troops(self, board): """Decide whether or not to move troops Args: board (Gameboard): The gameboard Returns: (bool): Whether or not to move troops """ raise NotImplementedError('do_move_troops not implemented') def move_troops(self, board): """Troop movement phase Args: board (Gameboard): The gameboard Returns: (str, str, int): from_territory, to_territory, n_troops """ raise NotImplementedError('move_troops not implemented')
n=int(input("Nhap vao mot so:")) d=dict() for i in range(1, n+1): d[i]=i*i print(d)
#!/usr/bin/env python # Copyright 2008-2010 Isaac Gouy # Copyright (c) 2013, 2014, Regents of the University of California # Copyright (c) 2017, 2018, Oracle and/or its affiliates. # All rights reserved. # # Revised BSD license # # This is a specific instance of the Open Source Initiative (OSI) BSD license # template http://www.opensource.org/licenses/bsd-license.php # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # Neither the name of "The Computer Language Benchmarks Game" nor the name of # "The Computer Language Shootout Benchmarks" nor the name "nanobench" nor the # name "bencher" nor the names of its contributors may be used to endorse or # promote products derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #runas solve() #unittest.skip recursive generator #pythran export solve() # 01/08/14 modified for benchmarking by Wei Zhang COINS = [1, 2, 5, 10, 20, 50, 100, 200] # test def _sum(iterable): sum = None for i in iterable: if sum is None: sum = i else: sum += i return sum def balance(pattern): return _sum(COINS[x]*pattern[x] for x in range(0, len(pattern))) def gen(pattern, coinnum, num): coin = COINS[coinnum] for p in range(0, num//coin + 1): newpat = pattern[:coinnum] + (p,) bal = balance(newpat) if bal > num: return elif bal == num: yield newpat elif coinnum < len(COINS)-1: for pat in gen(newpat, coinnum+1, num): yield pat def solve(total): ''' In England the currency is made up of pound, P, and pence, p, and there are eight coins in general circulation: 1p, 2p, 5p, 10p, 20p, 50p, P1 (100p) and P2 (200p). It is possible to make P2 in the following way: 1 P1 + 1 50p + 2 20p + 1 5p + 1 2p + 3 1p How many different ways can P2 be made using any number of coins? ''' return _sum(1 for pat in gen((), 0, total)) def measure(num): result = solve(num) print('total number of different ways: ', result) def __benchmark__(num=200): measure(num)
# Problem: Student Attendance Record I # Difficulty: Easy # Category: String # Leetcode 551: https://leetcode.com/problems/student-attendance-record-i/#/description # Description: """ You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rewarded if his attendance record doesn't contain more than one 'A' (absent) or more than two continuous 'L' (late). You need to return whether the student could be rewarded according to his attendance record. Example 1: Input: "PPALLP" Output: True Example 2: Input: "PPALLL" Output: False """ class Solution(object): def check_record(self, s): absent = True late = True abscn = 0 i = 0 while i < len(s) and absent and late: if abscn > 1: absent = False if s[i] == 'A': abscn += 1 if s[i] == 'L' and i + 3 <= len(s) and set(s[i:i+3]) == {'L'}: late = False i += 1 if abscn > 1: absent = False return absent and late obj = Solution() s1 = 'PPALLP' s2 = 'PPALLL' s3 = 'ALLLPPPLLPL' s4 = 'AA' print(obj.check_record(s1)) print(obj.check_record(s2)) print(obj.check_record(s3)) print(obj.check_record(s4))
#2. Пользователь вводит время в секундах. # Переведите время в часы, минуты и секунды и выведите в формате чч:мм:сс. # Используйте форматирование строк. time = int(input("Введите время в секундах ")) hours = time // 3600 minutes = (time - hours * 3600) // 60 seconds = time - (hours * 3600 + minutes * 60) print(f"Время в формате чч:мм:сс {hours} : {minutes} : {seconds}")
# ---------------------------------------------------------------------------- # CLASSES: nightly # # Test Case: missingdata.py # # Tests: missing data # # Programmer: Brad Whitlock # Date: Thu Jan 19 09:49:15 PST 2012 # # Modifications: # # ---------------------------------------------------------------------------- def SetTheView(): v = GetView2D() v.viewportCoords = (0.02, 0.98, 0.25, 1) SetView2D(v) def test0(datapath): TestSection("Missing data") OpenDatabase(pjoin(datapath,"earth.nc")) AddPlot("Pseudocolor", "height") DrawPlots() SetTheView() Test("missingdata_0_00") ChangeActivePlotsVar("carbon_particulates") Test("missingdata_0_01") ChangeActivePlotsVar("seatemp") Test("missingdata_0_02") ChangeActivePlotsVar("population") Test("missingdata_0_03") # Pick on higher zone numbers to make sure pick works. PickByNode(domain=0, element=833621) TestText("missingdata_0_04", GetPickOutput()) DeleteAllPlots() def test1(datapath): TestSection("Expressions and missing data") OpenDatabase(pjoin(datapath,"earth.nc")) DefineScalarExpression("meaningless", "carbon_particulates + seatemp") AddPlot("Pseudocolor", "meaningless") DrawPlots() SetTheView() Test("missingdata_1_00") DeleteAllPlots() DefineVectorExpression("color", "color(red,green,blue)") AddPlot("Truecolor", "color") DrawPlots() ResetView() SetTheView() Test("missingdata_1_01") DefineVectorExpression("color2", "color(population*0.364,green,blue)") ChangeActivePlotsVar("color2") v1 = GetView2D() v1.viewportCoords = (0.02, 0.98, 0.02, 0.98) v1.windowCoords = (259.439, 513.299, 288.93, 540) #25.466) SetView2D(v1) Test("missingdata_1_02") def main(): datapath = data_path("netcdf_test_data") test0(datapath) test1(datapath) main() Exit()
n1 = int(input('Digite um número entre 0 e 9999: ')) u = n1 // 1 % 10 d = n1 // 10 % 10 c = n1 // 100 % 10 m = n1 // 1000 % 10 print(f'Analisando o número {n1}') print(f'unidade: {u}') print(f'dezena: {d}') print(f'centena: {c}') print(f'milhar: {m}')
""" 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 nums[0] + nums[1] = 2 + 7 = 9 所以返回 [0, 1] """ # %% class Solution: def twoSum(self, nums, target): S = set(nums) for num in S: pre = target - num if num == pre: if nums.count(num) > 1: index1 = nums.index(num) return [index1, nums.index(num, index1+1)] elif pre in S: return [nums.index(num), nums.index(target - num)] nums = [2, 2, 7, 11, 15] target = 9 print(Solution().twoSum(nums, target)) nums = [2, 5, 5, 11] target = 10 print(Solution().twoSum(nums, target))
class SerialNumber: def __init__(self, serialNumber): if not (len(serialNumber) == 6): raise ValueError('Serial Number must be 6 digits long') self._serialNumber = serialNumber def __str__(self): return 'S/N: {}'.format(self._serialNumber) def __repr__(self): return 'SerialNumber: {}'.format(self._serialNumber) def getSerialNumber(self): return self._serialNumber def containsVowel(self): VOWELS = ['a', 'e', 'i', 'o', 'u'] for character in self._serialNumber: if character in VOWELS: return True return False def lastDigitOdd(self): try: lastDigitValue = int(self._serialNumber[-1]) except ValueError: return False return lastDigitValue % 2 == 1 def lastDigitEven(self): try: lastDigitValue = int(self._serialNumber[-1]) except ValueError: return False return lastDigitValue % 2 == 0
# # BitBake Graphical GTK User Interface # # Copyright (C) 2012 Intel Corporation # # Authored by Shane Wang <shane.wang@intel.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. class HobColors: WHITE = "#ffffff" PALE_GREEN = "#aaffaa" ORANGE = "#eb8e68" PALE_RED = "#ffaaaa" GRAY = "#aaaaaa" LIGHT_GRAY = "#dddddd" SLIGHT_DARK = "#5f5f5f" DARK = "#3c3b37" BLACK = "#000000" PALE_BLUE = "#53b8ff" DEEP_RED = "#aa3e3e" KHAKI = "#fff68f" OK = WHITE RUNNING = PALE_GREEN WARNING = ORANGE ERROR = PALE_RED
'''input 4 8 3 4 5 6 7 8 3 8 2 3 4 7 8 2 9 100 2 3 4 5 6 7 8 9 ''' # -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem B if __name__ == '__main__': a, b, k = list(map(int, input().split())) if (b - a + 1) <= 2 * k: for i in range(a, b + 1): print(i) else: for j in range(a, a + k): print(j) for j in range(b - k + 1, b + 1): print(j)
class Authenticator(object): def authenticate(self, credentials): raise NotImplementedError()
class Node(): def __init__(self, id: int, value = None, right: 'Node' = None, left: 'Node' = None): self.id = id self.value = value self.right = right self.left = left self.parent: 'Node' = None def add(self, node: 'Node'): if not node: raise ValueError('node value invalid') if node.id == self.id: raise ValueError('The id sent is alredy on the tree') if node.id > self.id: if not self.right: node.parent = self self.right = node else: self.right.add(node) if node.id < self.id: if not self.left: node.parent = self self.left = node else: self.left.add(node) def get_size(self): size_l = self.left.get_size() if self.left else 0 size_r = self.right.get_size() if self.right else 0 return 1 + size_l + size_r def get_height(self): h_l = self.left.get_height() if self.left else 0 h_r = self.right.get_height() if self.right else 0 if h_r > h_l: return 1 + h_r return 1 + h_l def get_node(self, id: int): if self.id == id: return self if id > self.id: if self.right: return self.right.get_node(id) if id < self.id: if self.left: return self.left.get_node(id) return None def get_min_node(self): if not self.left: return self return self.left.get_min_node() def get_max_node(self): if not self.right: return self return self.right.get_max_node() def get_sorted_list(self, max_size: int=None, ascending: bool=True): if max_size == None: return self.__get_list(ascending) return self.__get_list_by_size(max_size, ascending) def __get_list(self, ascending: bool): list_e = self.left.__get_list(ascending) if self.left else [] list_d = self.right.__get_list(ascending) if self.right else [] if ascending: return list_e + [self.id] + list_d return list_d + [self.id] + list_e def __get_list_by_size(self, max_size: int, ascending: bool): if ascending: st = 'left' fi = 'right' else: st = 'right' fi = 'left' list_st = self[st].__get_list_by_size(max_size=max_size, ascending=ascending) if self[st] else [] if max_size <= len(list_st): return list_st elif max_size <= len(list_st) + 1: return list_st + [self.id] else: curr_size = len(list_st) + 1 list_fi = self[fi].__get_list_by_size(max_size=max_size-curr_size, ascending=ascending) if self[fi] else [] return list_st + [self.id] + list_fi def __getitem__(self, name): return getattr(self, name) def __setitem__(self, name, value): return setattr(self, name, value) def __str__(self): str_e = self.left.__str__() if self.left else None str_d = self.right.__str__() if self.right else None if not (str_e or str_d): return f'[({self.id})]' return f'[({self.id}) {str_e}, {str_d}]'
"""Module docstring!""" a = 1 b = 2 @bleh @blah def greet( name: str, age: int, *args, test='oh yeah', **kwargs ) -> ({a: 1, b: 2} ): """Generic short description Longer description of this function that does nothing :param arg1: Desc for arg1 :type arg1: arg1_type :returns: Desc for return :rtype: `return_type` :raises: RaisesError """ pass def greet2(name: str, age: int, *args, test='oh yeah', **kwargs) -> {a: 1, b: 2}: return 1 """This should not be considered a docstring. :param arg1: Desc for arg1 :type arg1: arg1_type """
class Solution(object): def coinChange(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ dp = [0] + [2 ** 31 - 1] * amount for i in xrange(1, amount + 1): for coin in coins: if i >= coin and dp[i - coin] != (2 ** 31 - 1): dp[i] = min(dp[i], dp[i - coin] + 1) return dp[amount] if dp[amount] != (2 ** 31 - 1) else -1
# -*- coding: utf-8 -*- __author__ = 'lundberg' class EduIDGroupDBError(Exception): pass class VersionMismatch(EduIDGroupDBError): pass class MultipleReturnedError(EduIDGroupDBError): pass class MultipleUsersReturned(MultipleReturnedError): pass class MultipleGroupsReturned(MultipleReturnedError): pass
""" Basic type definitions. """
""" Ingest Package Config """ # The list of entities that will be loaded into the target service. These # should be class_name values of your target API config's target entity # classes. target_service_entities = [ "family", "participant", "diagnosis", "phenotype", "outcome", "biospecimen", "read_group", "sequencing_experiment", "genomic_file", "biospecimen_genomic_file", "sequencing_experiment_genomic_file", "read_group_genomic_file", ] # All paths are relative to the directory this file is in extract_config_dir = "extract_configs" transform_function_path = "transform_module.py" # TODO - Replace this with your own unique identifier for the project. This # will become CONCEPT.PROJECT.ID during the Load stage. project = "SD_ME0WME0W"
string_input = "amazing" vowels = "aeiou" answer = [char for char in string_input if char not in vowels] print(answer)
class Nodo: elemento = None Siguiente = None def __init__(self, elemento, siguiente): self.elemento = elemento self.Siguiente = siguiente class Pila: tamano = 0 top = None def apilar(self, elemento): """ Agrega un elemento al tope de la pila :param elemento: Cualquier elemento :return: None """ nuevo_nodo = Nodo(elemento, self.top) self.top = nuevo_nodo self.tamano += 1 def desapilar(self): """ Retorna el elemento del Tope de la pila y lo elimina :return: El elemento del tope de la pila """ if self.tamano > 0: elemento_auxiliar = self.top.elemento self.top = self.top.Siguiente self.tamano -= 1 return elemento_auxiliar raise IndexError('La pila esta vacía') def mirar(self): """ Ve el elemento del tope de la pila sin eliminarlo :return: El elemento del tope de la pila """ return self.top.elemento def es_vacia(self): return self.tamano == 0 def invertir(self): auxiliar = Pila() nodo_auxiliar = self.top for i in range(self.tamano): auxiliar.apilar(nodo_auxiliar.elemento) nodo_auxiliar = nodo_auxiliar.Siguiente return auxiliar def copiar(self): return self.invertir().invertir() def __repr__(self): resultado = [] auxiliar = self while not auxiliar.es_vacia(): resultado.append(auxiliar.desapilar()) resultado.reverse() return str(resultado)
class Solution(object): def deleteDuplicates(self, head): initial = head while head: if head.next and head.val == head.next.val: head.next = head.next.next else: head = head.next head = initial return head
# set random number generator np.random.seed(2020) # initialize step_end and v step_end = int(t_max / dt) v = el t = 0 with plt.xkcd(): # initialize the figure plt.figure() plt.title('$V_m$ with random I(t)') plt.xlabel('time (s)') plt.ylabel(r'$V_m$ (V)') # loop for step_end steps for step in range(step_end): t = step * dt plt.plot(t, v, 'k.') i = i_mean * (1 + 0.1 * (t_max / dt)**(0.5) * (2 * np.random.random() - 1)) v = v + (dt / tau) * (el - v + r * i) plt.show()
#author SANKALP SAXENA def arrays(arr): arr.reverse() l = numpy.array(arr, float) return l
def get_ts_struct(ts): y=ts&0x3f ts=ts>>6 m=ts&0xf ts=ts>>4 d=ts&0x1f ts=ts>>5 hh=ts&0x1f ts=ts>>5 mm=ts&0x3f ts=ts>>6 ss=ts&0x3f ts=ts>>6 wd=ts&0x8 ts=ts>>3 yd=ts&0x1ff ts=ts>>9 ms=ts&0x3ff ts=ts>>10 pid=ts&0x3ff return y,m,d,hh,mm,ss,wd,yd,ms,pid
class DispositivoEntrada: def __init__(self, marca, tipo_entrada): self._marca = marca self.tipo_entrada = tipo_entrada
# Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. LIMIT_EXCEEDED_ERROR_MASSAGE = 'Instance limit exceeded. A new one will be launched as soon as free space will be available.' LIMIT_EXCEEDED_EXIT_CODE = 6 class AbstractInstanceProvider(object): def run_instance(self, is_spot, bid_price, ins_type, ins_hdd, ins_img, ins_key, run_id, kms_encyr_key_id, num_rep, time_rep, kube_ip, kubeadm_token): pass def find_and_tag_instance(self, old_id, new_id): pass def verify_run_id(self, run_id): pass def check_instance(self, ins_id, run_id, num_rep, time_rep): pass def get_instance_names(self, ins_id): pass def find_instance(self, run_id): pass def terminate_instance(self, ins_id): pass def terminate_instance_by_ip(self, node_internal_ip, node_name): pass def find_nodes_with_run_id(self, run_id): instance = self.find_instance(run_id) return [instance] if instance is not None else []
c = float(input("Enter Amount Between 0-99 :")) print(c // 20, "Twenties") c = c % 20 print(c // 10, "Tens") c = c % 10 print(c // 5, "Fives") c = c % 5 print(c // 1, "Ones") c = c % 1 print(c // 0.25, "Quarters") c = c % 0.25 print(c // 0.1, "Dimes") c = c % 0.1 print(c // 0.05, "Nickles") c = c % 0.05 print(c // 0.01, "Pennies")
class Cita: def __init__(self,id,solicitante,fecha,hora,motivo,estado,doctor): self.id = id self.solicitante = solicitante self.fecha = fecha self.hora = hora self.motivo = motivo self.estado = estado self.doctor = doctor def getId(self): return self.id def getSolicitante(self): return self.solicitante def getFecha(self): return self.fecha def getHora(self): return self.hora def getMotivo(self): return self.motivo def getEstado(self): return self.estado def getDoctor(self): return self.doctor def setSolicitante(self,solicitante): self.solicitante = solicitante def setFecha(self,fecha): self.fecha = fecha def setHora(self,hora): self.hora = hora def setMotivo(self,motivo): self.motivo = motivo def setEstado(self,estado): self.estado = estado def setDoctor(self,doctor): self.doctor = doctor
#! /usr/bin/env python # Copyright (c) 2017, Cuichaowen. All rights reserved. # -*- coding: utf-8 -*- # ops helper dictionary class Dictionary(object): """ Dictionary for op param which needs to be combined """ def __init__(self): self.__dict__ = {} def set_attr(self, **kwargs): """ set dict from kwargs """ for key in kwargs.keys(): if type(kwargs[key]) == type(dict()): for key_inner in kwargs[key].keys(): self.__dict__[key_inner] = kwargs[key][key_inner] else: self.__dict__[key] = kwargs[key] return self def __call__(self): """ call class function to generate dictionary param """ ret = {key: self.__dict__[key] for key in self.__dict__.keys()} return ret ########### Object track and detection helper (for adu(caffe layer type)) Op io define ############# # NMSSSDParameter nms_param = Dictionary().set_attr(need_nms=bool(), overlap_ratio=list(), top_n=list(), add_score=bool(), max_candidate_n=list(), use_soft_nms=list(), nms_among_classes=bool(), voting=list(), vote_iou=list(), nms_gpu_max_n_per_time=int()) # BBoxRegParameter bbox_reg_param = Dictionary().set_attr(bbox_mean=list(), bbox_std=list()) # GenerateAnchorParameter gen_anchor_param = Dictionary().set_attr(base_size=float(), ratios=list(), scales=list(), anchor_width=list(), anchor_height=list(), anchor_x1=list(), anchor_y1=list(), anchor_x2=list(), anchor_y2=list(), zero_anchor_center=bool()) # KPTSParameter kpts_param = Dictionary().set_attr(kpts_exist_bottom_idx=int(), kpts_reg_bottom_idx=int(), kpts_reg_as_classify=bool(), kpts_classify_width=int(), kpts_classify_height=int(), kpts_reg_norm_idx_st=int(), kpts_st_for_each_class=list(), kpts_ed_for_each_class=list(), kpts_classify_pad_ratio=float()) # ATRSParameter # enum NormType { # NONE, # WIDTH, # HEIGHT, # WIDTH_LOG, # HEIGHT_LOG # } atrs_param = Dictionary().set_attr(atrs_reg_bottom_idx=int(), atrs_reg_norm_idx_st=int(), atrs_norm_type=str()) # FTRSParameter ftrs_param = Dictionary().set_attr(ftrs_bottom_idx=int()) # SPMPParameter spmp_param = Dictionary().set_attr(spmp_bottom_idx=int(), spmp_class_aware=list(), spmp_label_width=list(), spmp_label_height=list(), spmp_pad_ratio=list()) # Cam3dParameter cam3d_param = Dictionary().set_attr(cam3d_bottom_idx=int()) # DetectionOutputSSDParameter # enum MIN_SIZE_MODE { # HEIGHT_AND_WIDTH, # HEIGHT_OR_WIDTH # } detection_output_ssd_param = Dictionary().set_attr(nms=nms_param(), threshold=list(), channel_per_scale=int(), class_name_list=str(), num_class=int(), refine_out_of_map_bbox=bool(), class_indexes=list(), heat_map_a=list(), heat_map_b=list(), threshold_objectness=float(), proposal_min_sqrt_area=list(), proposal_max_sqrt_area=list(), bg_as_one_of_softmax=bool(), use_target_type_rcnn=bool(), im_width=float(), im_height=float(), rpn_proposal_output_score=bool(), regress_agnostic=bool(), gen_anchor=gen_anchor_param(), allow_border=float(), allow_border_ratio=float(), bbox_size_add_one=bool(), read_width_scale=float(), read_height_scale=float(), read_height_offset=int(), min_size_h=float(), min_size_w=float(), min_size_mode="HEIGHT_AND_WIDTH", kpts=kpts_param(), atrs=atrs_param(), ftrs=ftrs_param(), spmp=spmp_param(), cam3d=cam3d_param()) # DFMBPSROIPoolingParameter dfmb_psroi_pooling_param = Dictionary().set_attr(heat_map_a=float(), heat_map_b=float(), pad_ratio=float(), output_dim=int(), trans_std=float(), sample_per_part=int(), group_height=int(), group_width=int(), pooled_height=int(), pooled_width=int(), part_height=int(), part_width=int()) # ProposalImgScaleToCamCoordsParameter # # enum NormType { # HEIGHT, # HEIGHT_LOG # } # # enum OrienType { # PI, # PI2 # } proposal_img_scale_to_cam_coords_param = Dictionary().set_attr(num_class=int(), sub_class_num_class=list(), sub_class_bottom_idx=list(), prj_h_norm_type=str(), has_size3d_and_orien3d=bool(), orien_type=str(), cls_ids_zero_size3d_w=list(), cls_ids_zero_size3d_l=list(), cls_ids_zero_orien3d=list(), cmp_pts_corner_3d=bool(), cmp_pts_corner_2d=bool(), ctr_2d_means=list(), ctr_2d_stds=list(), prj_h_means=list(), prj_h_stds=list(), real_h_means=list(), real_h_stds=list(), real_w_means=list(), real_w_stds=list(), real_l_means=list(), real_l_stds=list(), sin_means=list(), sin_stds=list(), cos_means=list(), cos_stds=list(), cam_info_idx_st_in_im_info=int(), im_width_scale=float(), im_height_scale=float(), cords_offset_x=float(), cords_offset_y=float(), bbox_size_add_one=bool(), rotate_coords_by_pitch=bool(), #refine_coords_by_bbox=bool(), #refine_min_dist=float(), #refine_dist_for_height_ratio_one=float(), #max_3d2d_height_ratio_for_min_dist=float(), with_trunc_ratio=bool(), regress_ph_rh_as_whole=bool(), real_h_means_as_whole=list(), real_h_stds_as_whole=list()) # RPNProposalSSD parameter RPNProposalSSD_param = Dictionary().set_attr(detection_output_ssd=detection_output_ssd_param(), bbox_reg=bbox_reg_param())
"""Kata: Find the Duplicated Number in a Consecutive Unsorted List - Finds and returns the duplicated number from the list #1 Best Practices Solution by SquishyStrawberry def find_dup(arr): return (i for i in arr if arr.count(i) > 1).next() """ def find_dup(arr): """This will find the duplicated int in the list""" dup = set([x for x in arr if arr.count(x) > 1]) answer = list(dup) return answer[0]
class Calculator: def add(self,a,b): return a+b def subtract(self,a,b): return a-b def multiply(self,a,b): return a*b def divide(self,a,b): return a/b
""" This package contains modules built specifically for the project in question. Below are decribed the modules and packages used in the notebooks of this project. Modules ----------- polynomials: | This module groups functions and classes for generating polynomials | whether fitting data or directly ortogonal polynomials | (Legendre polynomials). plotter: | This module groups functions for visualizations presented throughout the notebooks. functk: | This module exits outside this package and contains utilities functions. """
start = '''You wake up one morning and find yourself in a big crisis. Trouble has arised and your worst fears have come true. Zoom is out to destroy the world for good. However, a castrophe has happened and now the love of your life is in danger. Which do you decide to save today?''' print(start) done = False print(" Type 'Flash to save the world' or 'Flash to save the love of his life' ") user_input = input() while not done: if user_input == "world": print (" Flash has to fight zoom to save the world. ") done = True print("Should Flash use lightening to attack Zoom or read his mind?") user_input = input() if user_input == "lightening": print("Flash defeats Zoom and saves the world!") done = True elif user_input == "mind": print("Flash might be able to defeat Zoom, but is still a disadvantage. ") done = True print("Flash is able to save the world.") elif user_input == "love": print ("In order to save the love of his life, Flash has to choose between two options. ") done = True print("Should Flash give up his power or his life in order to save the love of his life?") user_input = input() if user_input == "power": print("The Flash's speed is gone. But he is given the love of his life back into his hands. ") done = True elif user_input == "life": print("The Flash will die, but he sees that the love of his life is no longer in danger.") done = True print("No matter the circumstances, Flash is still alive. ")
{'application':{'type':'Application', 'name':'codeEditor', 'backgrounds': [ {'type':'Background', 'name':'bgCodeEditor', 'title':'Code Editor R PythonCard Application', 'size':(400, 300), 'statusBar':1, 'visible':0, 'style':['resizeable'], 'visible':0, 'menubar': {'type':'MenuBar', 'menus': [ {'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ {'type':'MenuItem', 'name':'menuFileNewWindow', 'label':'New Window', }, {'type':'MenuItem', 'name':'menuFileNew', 'label':'&New\tCtrl+N', }, {'type':'MenuItem', 'name':'menuFileOpen', 'label':'&Open\tCtrl+O', }, {'type':'MenuItem', 'name':'menuFileSave', 'label':'&Save\tCtrl+S', }, {'type':'MenuItem', 'name':'menuFileSaveAs', 'label':'Save &As...', }, {'type':'MenuItem', 'name':'fileSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuFileCheckSyntax', 'label':'&Check Syntax (Module)\tAlt+F5', 'command':'checkSyntax', }, {'type':'MenuItem', 'name':'menuFileRun', 'label':'&Run\tCtrl+R', 'command':'fileRun', }, {'type':'MenuItem', 'name':'menuFileRunWithInterpreter', 'label':'Run with &interpreter\tCtrl+Shift+R', 'command':'fileRunWithInterpreter', }, {'type':'MenuItem', 'name':'menuFileRunOptions', 'label':'Run Options...', 'command':'fileRunOptions', }, {'type':'MenuItem', 'name':'fileSep2', 'label':'-', }, {'type':'MenuItem', 'name':'menuFilePageSetup', 'label':'Page Set&up...', }, {'type':'MenuItem', 'name':'menuFilePrint', 'label':'&Print...\tCtrl+P', }, {'type':'MenuItem', 'name':'menuFilePrintPreview', 'label':'Print Pre&view', }, {'type':'MenuItem', 'name':'fileSep2', 'label':'-', }, {'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', 'command':'exit', }, ] }, {'type':'Menu', 'name':'Edit', 'label':'&Edit', 'items': [ {'type':'MenuItem', 'name':'menuEditUndo', 'label':'&Undo\tCtrl+Z', }, {'type':'MenuItem', 'name':'menuEditRedo', 'label':'&Redo\tCtrl+Y', }, {'type':'MenuItem', 'name':'editSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuEditCut', 'label':'Cu&t\tCtrl+X', }, {'type':'MenuItem', 'name':'menuEditCopy', 'label':'&Copy\tCtrl+C', }, {'type':'MenuItem', 'name':'menuEditPaste', 'label':'&Paste\tCtrl+V', }, {'type':'MenuItem', 'name':'editSep2', 'label':'-', }, {'type':'MenuItem', 'name':'menuEditFind', 'label':'&Find...\tCtrl+F', 'command':'doEditFind', }, {'type':'MenuItem', 'name':'menuEditFindNext', 'label':'&Find Next\tF3', 'command':'doEditFindNext', }, {'type':'MenuItem', 'name':'menuEditFindFiles', 'label':'Find in Files...\tAlt+F3', 'command':'findFiles', }, {'type':'MenuItem', 'name':'menuEditReplace', 'label':'&Replace...\tCtrl+H', 'command':'doEditFindReplace', }, {'type':'MenuItem', 'name':'menuEditGoTo', 'label':'&Go To...\tCtrl+G', 'command':'doEditGoTo', }, {'type':'MenuItem', 'name':'editSep3', 'label':'-', }, {'type':'MenuItem', 'name':'menuEditReplaceTabs', 'label':'&Replace tabs with spaces', 'command':'doEditReplaceTabs', }, {'type':'MenuItem', 'name':'editSep3', 'label':'-', }, {'type':'MenuItem', 'name':'menuEditClear', 'label':'Cle&ar\tDel', }, {'type':'MenuItem', 'name':'menuEditSelectAll', 'label':'Select A&ll\tCtrl+A', }, {'type':'MenuItem', 'name':'editSep4', 'label':'-', }, {'type':'MenuItem', 'name':'menuEditIndentRegion', 'label':'&Indent Region', 'command':'indentRegion', }, {'type':'MenuItem', 'name':'menuEditDedentRegion', 'label':'&Dedent Region', 'command':'dedentRegion', }, {'type':'MenuItem', 'name':'menuEditCommentRegion', 'label':'Comment &out region\tAlt+3', 'command':'commentRegion', }, {'type':'MenuItem', 'name':'menuEditUncommentRegion', 'label':'U&ncomment region\tShift+Alt+3', 'command':'uncommentRegion', }, ] }, {'type':'Menu', 'name':'menuView', 'label':'&View', 'items': [ {'type':'MenuItem', 'name':'menuViewWhitespace', 'label':'&Whitespace', 'checkable':1, }, {'type':'MenuItem', 'name':'menuViewIndentationGuides', 'label':'Indentation &guides', 'checkable':1, }, {'type':'MenuItem', 'name':'menuViewRightEdgeIndicator', 'label':'&Right edge indicator', 'checkable':1, }, {'type':'MenuItem', 'name':'menuViewEndOfLineMarkers', 'label':'&End-of-line markers', 'checkable':1, }, {'type':'MenuItem', 'name':'menuViewFixedFont', 'label':'&Fixed Font', 'enabled':0, 'checkable':1, }, {'type':'MenuItem', 'name':'viewSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuViewLineNumbers', 'label':'&Line Numbers', 'checkable':1, 'checked':1, }, {'type':'MenuItem', 'name':'menuViewCodeFolding', 'label':'&Code Folding', 'checkable':1, 'checked':0, }, ] }, {'type':'Menu', 'name':'menuFormat', 'label':'F&ormat', 'items': [ {'type':'MenuItem', 'name':'menuFormatStyles', 'label':'&Styles...', 'command':'doSetStyles', }, {'type':'MenuItem', 'name':'menuFormatWrap', 'label':'&Wrap Lines', 'checkable':1, }, ] }, {'type':'Menu', 'name':'menuScriptlet', 'label':'&Shell', 'items': [ {'type':'MenuItem', 'name':'menuScriptletShell', 'label':'&Shell Window\tF5', }, {'type':'MenuItem', 'name':'menuScriptletNamespace', 'label':'&Namespace Window\tF6', }, {'type':'MenuItem', 'name':'scriptletSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuScriptletSaveShellSelection', 'label':'Save Shell Selection...', }, {'type':'MenuItem', 'name':'menuScriptletRunScriptlet', 'label':'Run Scriptlet...', }, ] }, {'type':'Menu', 'name':'menuHelp', 'label':'&Help', 'items': [ {'type':'MenuItem', 'name':'menuShellDocumentation', 'label':'&Shell Documentation...', 'command':'showShellDocumentation', }, {'type':'MenuItem', 'name':'menuPythonCardDocumentation', 'label':'&PythonCard Documentation...\tF1', 'command':'showPythonCardDocumentation', }, {'type':'MenuItem', 'name':'menuPythonDocumentation', 'label':'Python &Documentation...', 'command':'showPythonDocumentation', }, {'type':'MenuItem', 'name':'helpSep1', 'label':'-', }, {'type':'MenuItem', 'name':'menuHelpAbout', 'label':'&About codeEditor...', 'command':'doHelpAbout', }, ] }, ] }, 'strings': { 'saveAs':'Save As', 'about':'About codeEditor...', 'saveAsWildcard':'All files (*.*)|*.*|Python scripts (*.py;*.pyw)|*.pyw;*.PY;*.PYW;*.py|Text files (*.txt;*.text)|*.text;*.TXT;*.TEXT;*.txt|HTML and XML files (*.htm;*.html;*.xml)|*.htm;*.xml;*.HTM;*.HTML;*.XML;*.html', 'chars':'chars', 'gotoLine':'Goto line', 'lines':'lines', 'gotoLineNumber':'Goto line number:', 'documentChangedPrompt':'The text in the %s file has changed.\n\nDo you want to save the changes?', 'untitled':'Untitled', 'sample':'codeEditor sample', 'codeEditor':'codeEditor', 'replaced':'Replaced %d occurances', 'words':'words', 'openFile':'Open file', 'scriptletWildcard':'Python files (*.py)|*.py|All Files (*.*)|*.*', 'document':'Document', }, 'components': [ {'type':'Choice', 'name':'popComponentNames', }, {'type':'Choice', 'name':'popComponentEvents', }, {'type':'CodeEditor', 'name':'document', 'position':(0, 0), 'size':(250, 100), }, ] # end components } # end background ] # end backgrounds } }
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. class TimexRelativeConvert: @staticmethod def convert_timex_to_string_relative(timex): return ''
#!/bin/python3 h = 0 t = int(input().strip()) for a0 in range(t): n = int(input().strip()) if n%2 == 1: h = 2 ** (int(n/2) + 2) - 2 elif n%2 == 0: h = 2 ** (int(n/2) + 1) - 1 print(h)
#print ("Hello World") #counties=["Arapahoes","Denver","Jefferson"] #if counties[1]=='Denver': # print(counties[1]) #counties = ["Arapahoe","Denver","Jefferson"] #if "El Paso" in counties: # print("El Paso is in the list of counties.") #else: # print("El Paso is not the list of counties.") #if "Arapahoe" in counties and "El Paso" in counties: # print("Arapahoe and El Paso are in the list of counties.") #else: # print("Arapahoe or El Paso is not in the list of counties.") #if "Arapahoe" in counties or "El Paso" in counties: # print("Arapahoe or El Paso is in the list of counties.") #else: # print("Arapahoe and El Paso are not in the list of counties.") #counties_dict = {"Arapahoe": 422829, "Denver": 463353, "Jefferson": 432438} #for county in counties: # print(county) #for county in counties_dict.keys(): # print(county) #for voters in counties_dict.values(): # print(voters) #for county in counties_dict: # print(counties_dict[county]) #for county, voters in counties_dict.items(): #print(f"{county} county has {voters} registered voters.") voting_data = [{"county":"Arapahoe", "registered_voters": 422829}, {"county":"Denver", "registered_voters": 463353}, {"county":"Jefferson", "registered_voters": 432438}] #prints as a continuous list #print(voting_data) #prints as a stack. prints 1 under the other #for county_dict in voting_data: #print(county_dict) #3.2.10 says this will iterarte and print the counties. #I understand the for loop but dont understand the print line. #how does the module expect us to know this if we didn't cover it. #['county'] is throwing me off #for i in range(len(voting_data)): #print(voting_data[i]['county']) #for i in range(len(voting_data)): #print(voting_data[i]['registered_voters']) #why doesnt this work with registered_voters_dict. neither_dict are defined #for county_dict in voting_data: #for value in county_dict.values(): #print(value) #candidate_votes = int (input("How many votes did the candidate get in the election?")) #total_votes = int(input("What is the total number of votes in the election?")) #message_to_candidate = ( #f"You received {candidate_votes:,} number of votes. " #f"The total number of votes in the election was {total_votes:,}. " #f"You received {candidate_votes / total_votes * 100:.2f}% of the votes") #print(message_to_candidate) #f'{value:{width},.{precision}}' #width=number of characters #precision=.#'sf where # is the decimal places #skill drill #for county, voters in counties_dict.items(): #print(f"{county} county has {voters:,} registered voters.") #skill drill--need help solving #for county_dict in voting_data: #print(f"{county} county has {voters} registered voters.") for county, voters in voting_data: print (f"{'county'} county has {'voters'} registered voters")
#first exercise #This code asks the user for hours and rate for hour, calculate total pay and print it. hrs = input("Enter Hours:") rate = input("Enter Rate:") pay = float(hrs) * float(rate) print("Pay:", pay) #second exercise #This code asks the user for hours and rate for hour, calculate total pay and print it. #If more than 40 hours, the rate is 1.5 the initial rate. hrs = input("Enter Hours:") rate = input("Enter Rate:") try: h = float(hrs) r = float(rate) except: print("Insert numbers") if h>40: p = 40 * r + (((h-40)*1.5)*r) else: p = h * r p= float(p) print(p)
ANGULAR_PACKAGES_CONFIG = [ ("@angular/animations", struct(entry_points = ["browser"])), ("@angular/common", struct(entry_points = ["http/testing", "http", "testing"])), ("@angular/compiler", struct(entry_points = ["testing"])), ("@angular/core", struct(entry_points = ["testing"])), ("@angular/forms", struct(entry_points = [])), ("@angular/platform-browser", struct(entry_points = ["testing", "animations"])), ("@angular/platform-browser-dynamic", struct(entry_points = ["testing"])), ("@angular/router", struct(entry_points = [])), ] ANGULAR_PACKAGES = [ struct( name = name[len("@angular/"):], entry_points = config.entry_points, platform = config.platform if hasattr(config, "platform") else "browser", module_name = name, ) for name, config in ANGULAR_PACKAGES_CONFIG ]
# Implement a class to hold room information. This should have name and # description attributes. class Room: def __init__(self, number, world, name, description, enemies, enemyHP, enemy_diff, companion=[], item=[] ,enemy_description=[] ): self.number = number self.name = name self.world = world self.description = description self.item = item self.enemies = enemies self.enemyHP = enemyHP self.enemy_description = enemy_description self.enemy_diff = enemy_diff self.companion = companion self.n_to = None self.w_to = None self.e_to = None self.s_to = None self.magic_to = None self.fly_to = None def __str__(self): return str(self.__class__) + ": " + str(self.__dict__) class Monster: def __init__(self, name, ability): self.name = name self.ability = ability def __str__(self): return str(self.__class__) + ": " + str(self.__dict__) class MagicRoom(Room): def __init__(self, name, description, enemies, enemyHP, enemy_diff, companion, item=[] ,enemy_description=[]): super().__init__ (name, description, enemies, enemyHP, enemy_diff, item=[], enemy_description=[] ) self.companion = companion self.n_to = None self.w_to = None self.e_to = None self.s_to = None self.magic_to = None self.fly_to = None Map = { 1: [2,0,0,0,0,0], 2: [3,1,4,0,0, 0], 3: [0,2,0,0,0, 0], 4: [5,0,0,2,0, 0], 5: [6,4,0,0,0, 0], 6: [0,5,7,0,0, 0], \ 7: [0,0,0,6,8, 0], 8: [9,0,10,0,7, 0], 9: [0,8,0,0,0, 11], 10: [0,0,0,8,0, 0], 11: [0,0,12,0,0, 9], 12: [14,0,0,0,13, 0], \ 13: [0,0,0,0,0, 0], 14: [15,12,0,0,0, 0], 15: [16,14,0,0,0, 0], 16: [0,15,0,0,0, 0], 17: [18,0,0,0,0, 0], 18: [0,17,0,0,0, 0]\ }
""" Utility functions. """ def load_tf_names(path): """ :param path: the path of the transcription factor list file. :return: a list of transcription factor names read from the file. """ with open(path) as file: tfs_in_file = [line.strip() for line in file.readlines()] return tfs_in_file
class User: """ Class that generates new instances of users. """ user_list = [] def __init__(self,tUsername,iUsername,email,sUsername): self.tUsername=tUsername self.iUsername=iUsername self.email=email self.sUsername=sUsername def save_user(self): User.user_list.append(self) def delete_user(self): User.user_list.remove(self) @classmethod def from_input(cls): return cls( input('Twitter username: '), input('Instagram username: '), input('Email address: '), input('Snapchat username: '), ) user=User.from_input()
# faça um programa que mostre a tabuada de varios numeros # um de cada vez, para cada valor digitado # o programa sera interrompido quando for solicityado um numero negativo while True: multiplicado = int(input('Digite um numero para ver sua tabuada: ')) for tab in range(1, 11): print(f'{multiplicado}x{tab}={multiplicado * tab}') continuacao = str(input('Quer ver outra tabuada? [S/N]')) if continuacao in 'Nn': break print('cabo nego')
#多分支结构 score=int(input('请输入成绩')) #判断 if score>=90 and score<=100: print('A') elif score>=80 and score<=89: print('B') elif score>=70 and score<=79: print('C') elif score>=60 and score<=69: print('D') elif score>=0 and score<=59: print('E') else: print('无效')
# -*- coding: utf-8 -*- r""" ================================================================ Morphing source estimates: Moving data from one brain to another ================================================================ Morphing refers to the operation of transferring :ref:`source estimates <sphx_glr_auto_tutorials_plot_object_source_estimate.py>` from one anatomy to another. It is commonly referred as realignment in fMRI literature. This operation is necessary for group studies as one needs then data in a common space. In this tutorial we will morph different kinds of source estimation results between individual subject spaces using :class:`mne.SourceMorph` object. We will use precomputed data and morph surface and volume source estimates to a reference anatomy. The common space of choice will be FreeSurfer's 'fsaverage' See :ref:`sphx_glr_auto_tutorials_plot_background_freesurfer.py` for more information. Method used for cortical surface data in based on spherical registration [1]_ and Symmetric Diffeomorphic Registration (SDR) for volumic data [2]_. Furthermore we will convert our volume source estimate into a NIfTI image using :meth:`morph.apply(..., output='nifti1') <mne.SourceMorph.apply>`. In order to morph :class:`labels <mne.Label>` between subjects allowing the definition of labels in a one brain and transforming them to anatomically analogous labels in another use :func:`mne.Label.morph`. .. contents:: :local: Why morphing? ============= Modern neuroimaging techniques, such as source reconstruction or fMRI analyses, make use of advanced mathematical models and hardware to map brain activity patterns into a subject specific anatomical brain space. This enables the study of spatio-temporal brain activity. The representation of spatio-temporal brain data is often mapped onto the anatomical brain structure to relate functional and anatomical maps. Thereby activity patterns are overlaid with anatomical locations that supposedly produced the activity. Anatomical MR images are often used as such or are transformed into an inflated surface representations to serve as "canvas" for the visualization. In order to compute group level statistics, data representations across subjects must be morphed to a common frame, such that anatomically and functional similar structures are represented at the same spatial location for *all subjects equally*. Since brains vary, morphing comes into play to tell us how the data produced by subject A, would be represented on the brain of subject B. See also this :ref:`tutorial on surface source estimation <sphx_glr_auto_tutorials_plot_mne_solutions.py>` or this :ref:`example on volumetric source estimation <sphx_glr_auto_examples_inverse_plot_compute_mne_inverse_volume.py>`. Morphing **volume** source estimates ==================================== A volumetric source estimate represents functional data in a volumetric 3D space. The difference between a volumetric representation and a "mesh" ( commonly referred to as "3D-model"), is that the volume is "filled" while the mesh is "empty". Thus it is not only necessary to morph the points of the outer hull, but also the "content" of the volume. In MNE-Python, volumetric source estimates are represented as :class:`mne.VolSourceEstimate`. The morph was successful if functional data of Subject A overlaps with anatomical data of Subject B, in the same way it does for Subject A. Setting up :class:`mne.SourceMorph` for :class:`mne.VolSourceEstimate` ---------------------------------------------------------------------- Morphing volumetric data from subject A to subject B requires a non-linear registration step between the anatomical T1 image of subject A to the anatomical T1 image of subject B. MNE-Python uses the Symmetric Diffeomorphic Registration [2]_ as implemented in dipy_ [3]_ (See `tutorial <http://nipy.org/dipy/examples_built/syn_registration_3d.html>`_ from dipy_ for more details). :class:`mne.SourceMorph` uses segmented anatomical MR images computed using :ref:`FreeSurfer <sphx_glr_auto_tutorials_plot_background_freesurfer.py>` to compute the transformations. In order tell SourceMorph which MRIs to use, ``subject_from`` and ``subject_to`` need to be defined as the name of the respective folder in FreeSurfer's home directory. See :ref:`sphx_glr_auto_examples_inverse_plot_morph_volume_stc.py` usage and for more details on: - How to create a SourceMorph object for volumetric data - Apply it to VolSourceEstimate - Get the output is NIfTI format - Save a SourceMorph object to disk Morphing **surface** source estimates ===================================== A surface source estimate represents data relative to a 3-dimensional mesh of the cortical surface computed using FreeSurfer. This mesh is defined by its vertices. If we want to morph our data from one brain to another, then this translates to finding the correct transformation to transform each vertex from Subject A into a corresponding vertex of Subject B. Under the hood :ref:`FreeSurfer <sphx_glr_auto_tutorials_plot_background_freesurfer.py>` uses spherical representations to compute the morph, as relies on so called *morphing maps*. The morphing maps ----------------- The MNE software accomplishes morphing with help of morphing maps which can be either computed on demand or precomputed. The morphing is performed with help of the registered spherical surfaces (``lh.sphere.reg`` and ``rh.sphere.reg`` ) which must be produced in FreeSurfer. A morphing map is a linear mapping from cortical surface values in subject A (:math:`x^{(A)}`) to those in another subject B (:math:`x^{(B)}`) .. math:: x^{(B)} = M^{(AB)} x^{(A)}\ , where :math:`M^{(AB)}` is a sparse matrix with at most three nonzero elements on each row. These elements are determined as follows. First, using the aligned spherical surfaces, for each vertex :math:`x_j^{(B)}`, find the triangle :math:`T_j^{(A)}` on the spherical surface of subject A which contains the location :math:`x_j^{(B)}`. Next, find the numbers of the vertices of this triangle and set the corresponding elements on the *j* th row of :math:`M^{(AB)}` so that :math:`x_j^{(B)}` will be a linear interpolation between the triangle vertex values reflecting the location :math:`x_j^{(B)}` within the triangle :math:`T_j^{(A)}`. It follows from the above definition that in general .. math:: M^{(AB)} \neq (M^{(BA)})^{-1}\ , *i.e.*, .. math:: x_{(A)} \neq M^{(BA)} M^{(AB)} x^{(A)}\ , even if .. math:: x^{(A)} \approx M^{(BA)} M^{(AB)} x^{(A)}\ , *i.e.*, the mapping is *almost* a bijection. Morphing maps can be computed on the fly or read with :func:`mne.read_morph_map`. Precomputed maps are located in ``$SUBJECTS_DIR/morph-maps``. The names of the files in ``$SUBJECTS_DIR/morph-maps`` are of the form: <*A*> - <*B*> -``morph.fif`` , where <*A*> and <*B*> are names of subjects. These files contain the maps for both hemispheres, and in both directions, *i.e.*, both :math:`M^{(AB)}` and :math:`M^{(BA)}`, as defined above. Thus the files <*A*> - <*B*> -``morph.fif`` or <*B*> - <*A*> -``morph.fif`` are functionally equivalent. The name of the file produced depends on the role of <*A*> and <*B*> in the analysis. About smoothing --------------- The current estimates are normally defined only in a decimated grid which is a sparse subset of the vertices in the triangular tessellation of the cortical surface. Therefore, any sparse set of values is distributed to neighboring vertices to make the visualized results easily understandable. This procedure has been traditionally called smoothing but a more appropriate name might be smudging or blurring in accordance with similar operations in image processing programs. In MNE software terms, smoothing of the vertex data is an iterative procedure, which produces a blurred image :math:`x^{(N)}` from the original sparse image :math:`x^{(0)}` by applying in each iteration step a sparse blurring matrix: .. math:: x^{(p)} = S^{(p)} x^{(p - 1)}\ . On each row :math:`j` of the matrix :math:`S^{(p)}` there are :math:`N_j^{(p - 1)}` nonzero entries whose values equal :math:`1/N_j^{(p - 1)}`. Here :math:`N_j^{(p - 1)}` is the number of immediate neighbors of vertex :math:`j` which had non-zero values at iteration step :math:`p - 1`. Matrix :math:`S^{(p)}` thus assigns the average of the non-zero neighbors as the new value for vertex :math:`j`. One important feature of this procedure is that it tends to preserve the amplitudes while blurring the surface image. Once the indices non-zero vertices in :math:`x^{(0)}` and the topology of the triangulation are fixed the matrices :math:`S^{(p)}` are fixed and independent of the data. Therefore, it would be in principle possible to construct a composite blurring matrix .. math:: S^{(N)} = \prod_{p = 1}^N {S^{(p)}}\ . However, it turns out to be computationally more effective to do blurring with an iteration. The above formula for :math:`S^{(N)}` also shows that the smudging (smoothing) operation is linear. From theory to practice ----------------------- In MNE-Python, surface source estimates are represented as :class:`mne.SourceEstimate` or :class:`mne.VectorSourceEstimate`. Those can be used together with :class:`mne.SourceSpaces` or without. The morph was successful if functional data of Subject A overlaps with anatomical surface data of Subject B, in the same way it does for Subject A. See :ref:`sphx_glr_auto_examples_inverse_plot_morph_surface_stc.py` usage and for more details: - How to create a :class:`mne.SourceMorph` object using :func:`mne.compute_source_morph` for surface data - Apply it to :class:`mne.SourceEstimate` or :class:`mne.VectorSourceEstimate` - Save a :class:`mne.SourceMorph` object to disk Please see also Gramfort *et al.* (2013) [4]_. References ========== .. [1] Greve D. N., Van der Haegen L., Cai Q., Stufflebeam S., Sabuncu M. R., Fischl B., Brysbaert M. A Surface-based Analysis of Language Lateralization and Cortical Asymmetry. Journal of Cognitive Neuroscience 25(9), 1477-1492, 2013. .. [2] Avants, B. B., Epstein, C. L., Grossman, M., & Gee, J. C. (2009). Symmetric Diffeomorphic Image Registration with Cross- Correlation: Evaluating Automated Labeling of Elderly and Neurodegenerative Brain, 12(1), 26-41. .. [3] Garyfallidis E, Brett M, Amirbekian B, Rokem A, van der Walt S, Descoteaux M, Nimmo-Smith I and Dipy Contributors (2014). DIPY, a library for the analysis of diffusion MRI data. Frontiers in Neuroinformatics, vol.8, no.8. .. [4] Gramfort A., Luessi M., Larson E., Engemann D. A., Strohmeier D., Brodbeck C., Goj R., Jas. M., Brooks T., Parkkonen L. & Hämäläinen, M. (2013). MEG and EEG data analysis with MNE-Python. Frontiers in neuroscience, 7, 267. .. _dipy: http://nipy.org/dipy/ """ # noqa: E501
load("//flatbuffers/internal:string_utils.bzl", "capitalize_first_char") def _include_args_from_depset(includes_depset): # Always include the workspace root. include_args = ["-I", "."] for include in includes_depset.to_list(): include_args.append("-I") include_args.append(include) return include_args def run_flatc( ctx, fbs_toolchain, fbs_lang_toolchain, srcs, srcs_transitive, includes_transitive, outputs): flatc = fbs_toolchain.flatc.files_to_run.executable include_args = _include_args_from_depset(includes_transitive) output_prefix = ctx.genfiles_dir.path + "/" + ctx.label.package mnemonic = "Flatbuffers{}Gen".format(capitalize_first_char(fbs_lang_toolchain.lang_shortname)) progress_message = "Generating flatbuffers {} file for {}:".format( fbs_lang_toolchain.lang_shortname, ctx.label, ) genrule_args = \ fbs_lang_toolchain.flatc_args + \ ["-o", output_prefix] + \ include_args + \ [src.path for src in srcs] ctx.actions.run( inputs = srcs_transitive, outputs = outputs, executable = flatc, tools = [flatc], arguments = genrule_args, mnemonic = mnemonic, progress_message = progress_message, )
"""Top-level package for Calendário dos Vestibulares do Brasil.""" __author__ = """Ana_Isaac_Marina""" __email__ = 'marinalara170303@gmail.com' __version__ = '0.0.1'
# node class for develping linked list class Node: def __init__(self, data=None, pointer=None): self.data = data self.pointer = pointer def set_data(self, data): self.data = data def get_data(self): return self.data def set_pointer(self, pointer): self.pointer = pointer def get_pointer(self): return self.pointer def __str__(self): return f'(data: {self.data} & pointer: {self.pointer})' class Stack: def __init__(self, buttom=None, top=None): self.buttom = buttom self.top = top # push operation def push(self, data): if self.buttom == None: self.buttom = self.top = Node(data) else: new_node = Node(data, self.top) self.top = new_node return self # pop operation def pop(self): if self.top == None: return None data = self.top.get_data() self.top = self.top.get_pointer() return data # peek operation def peek(self): return self.top.get_data() # returns stack as list def as_list(self): curr_node = self.top stack_list = list() while curr_node.get_pointer() != None: stack_list.append(curr_node.get_data()) curr_node = curr_node.get_pointer() stack_list.append(curr_node.get_data()) return stack_list # returns True if stack empty and False if its not def is_empty(self): if self.top: return False else: return True def __str__(self): return f'top: {self.top} & buttom: {self.buttom}' if __name__ == '__main__': stack = Stack() stack.push('Google') stack.push('Udemy') stack.push('Facebook') # print(stack.peek()) stack.pop() print(stack.peek()) print(stack.as_list())
print("hello") while True: print("Infinite loop")
# This file is automatically generated __version__ = '0.10.3.2' __comments__ = """too many spaces :/ Merge pull request #1848 from swryan/work""" __date__ = '2014-11-15 09:50:34 -0500' __commit__ = '97c66aaecfad3451bc6a0b1cae1fce4c0595037a'
""" 文件名:hachina.py. 演示程序,三行代码创建一个新设备. """ def setup(hass, config): """HomeAssistant在配置文件中发现hachina域的配置后,会自动调用hachina.py文件中的setup函数.""" # 设置实体hachina.Hello_World的状态。 # 注意1:实体并不需要被创建,只要设置了实体的状态,实体就自然存在了 # 注意2:实体的状态可以是任何字符串 hass.states.set("hachina.hello_world", "太棒了!") # 返回True代表初始化成功 return True
def division(a, b): b = float(b) if b == 0: c = 0 print('Cannot divide by 0.') return c else: a = float(a) c = round(a / b, 9) return c
""" aula sobre lista 18 repare como as listas podem ser incluidas dentro de uma lista. """ teste = [] teste.append('Álamo') teste.append(26) galera = [] galera.append(teste[:]) # é preciso fazer uma cópia com [:] para o sistema não duplicar teste[0] = 'Francielli' teste[1] = 22 galera.append(teste) print(galera[:]) " another way" galera2 = [['joão', 19], ['Ana', 33], ['Joaquim', 13], ['Maria', 45]] print(galera2[0]) # desse modo eu mostro apenas o elemento 0 da principal lista print(galera2[0][0]) # desse modo eu mando mostrar apenas o elementeo 0 da lista 0 print('usando o for para mostrar as os dados') for p in galera2: print(p[0]) galera3 = [] dado = list() totmai = totmen = 0 for c in range(0, 3): dado.append(str(input('Nome: '))) dado.append(int(input('Idade: '))) galera3.append(dado[:]) # cuidado pra nçao esquecer do [:] pois ele cria uma cópia dos dados, se não eu apagaria # as duas listas dado.clear() # aqui eu limpo a lista dado print(galera3) for dados in galera3: # somar maiores de idade if dados[1] >= 21: # se o dado 1 [idade] print(f'{dados[0]} é maior de idade. ') totmai += 1 else: print(f'{dados[0]} é menor de idade ') totmen += 1 print(f'Temos {totmai} maiores e {totmen} menores de idade. ')
wordle = open("Wordle.txt", "r") wordList = [] for line in wordle: stripped_line = line.strip() wordList.append(stripped_line) mutableList = [] outcomeList = [] def blackLetter(letter, list): for word in list: if letter in word: list.remove(word) def greenLetter(letter, location, greenList): for word in greenList: if word[location] == letter: mutableList.append(word) continue elif word in mutableList: mutableList.remove(word) #greenList.remove(word) def moreGreenLetter(letter, location, greenList): for word in greenList: if word[location] == letter: #mutableList.append(word) continue elif word[location] != letter: mutableList.remove(word) #greenList.remove(word) greenLetter("z", 4, wordList) moreGreenLetter("r", 1, mutableList) print(wordList) print(mutableList) # def checkforyellow(yellowIn, yellowOut, wordCheck=0): # for word in yellowIn: # if blackSet.isdisjoint(word): # for key in yellowKeys: # if wordCheck == len(yellowKeys): # print(word) # yellowOut.append(word) # break # elif word[yellowDict[key]] == key: # break # elif key not in word: # break # elif key in word: # print(word) # wordCheck += 1 # else: break # # # def checkforgreen(greenIn, greenOut, wordCheck=0): # for word in greenIn: # for key in greenKeys: # if word[greenDict[key]] != key: # break # elif wordCheck < len(greenKeys): # wordCheck += 1 # continue # else: # greenOut.append(word) # break
weight = [] diff = 0 n = int(input()) for i in range(n): q, c = map(int, input().split()) if c == 2: q *= -1 weight.append(q) diff += q min_diff = abs(diff) for i in range(n): if abs(diff - 2*weight[i]) < min_diff: min_diff = abs(diff - 2*weight[i]) for j in range(i+1, n): if abs(diff - 2*(weight[i] + weight[j])) < min_diff: min_diff = abs(diff - 2*(weight[i] + weight[j])) print(min_diff)
""" In HiCal, a meeting is stored as tuples of integers (start_time, end_time). / These integers represent the number of 30-minute blocks past 9:00am. / For example: / (2, 3) # meeting from 10:00 - 10:30 am / (6, 9) # meeting from 12:00 - 1:30 pm / Write a function merge_ranges() that / takes a list of meeting time ranges as a parameter / and returns a list of condensed ranges. / >>> merge_ranges([(3, 5), (4, 8), (10, 12), (9, 10), (0, 1)]) / [(0, 1), (3, 8), (9, 12)] / >>> merge_ranges([(0, 3), (3, 5), (4, 8), (10, 12), (9, 10)]) / [(0, 8), (9, 12)] / >>> merge_ranges([(0, 3), (3, 5)]) / [(0, 5)] / >>> merge_ranges([(0, 3), (3, 5), (7, 8)]) / [(0, 5), (7, 8)] / >>> merge_ranges([(1, 5), (2, 3)]) / [(1, 5)] / """
def counting_sort(arr): # Find min and max values min_value = min(arr) max_value = max(arr) counting_arr = [0]*(max_value-min_value+1) for num in arr: counting_arr[num-min_value] += 1 index = 0 for i, count in enumerate(counting_arr): for _ in range(count): arr[index] = min_value + i index += 1 test_array = [3, 3, 2, 6, 4, 7, 9, 7, 8] counting_sort(test_array) print(test_array)
# [8 kyu] Grasshopper - Terminal Game Move Function # # Author: Hsins # Date: 2019/12/20 def move(position, roll): return position + 2 * roll
# Go to new line using \n print('-------------------------------------------------------') print("My name is\nMaurizio Petrelli") # Inserting characters using octal values print('-------------------------------------------------------') print("\100 \136 \137 \077 \176") # Inserting characters using hex values print('-------------------------------------------------------') print("\x23 \x24 \x25 \x26 \x2A") print('-------------------------------------------------------') '''Output: ------------------------------------------------------- My name is Maurizio Petrelli ------------------------------------------------------- @ ^ _ ? ~ ------------------------------------------------------- # $ % & * ------------------------------------------------------- '''
class RetryOptions: def __init__(self, firstRetry: int, maxNumber: int): self.backoffCoefficient: int self.maxRetryIntervalInMilliseconds: int self.retryTimeoutInMilliseconds: int self.firstRetryIntervalInMilliseconds: int = firstRetry self.maxNumberOfAttempts: int = maxNumber if self.firstRetryIntervalInMilliseconds <= 0: raise ValueError("firstRetryIntervalInMilliseconds value" "must be greater than 0.")
""" This Code is Contributed by Arpit Bhushan Sharma Codechef-@koderarpit Github - @arpit1920 Kaggle - arpit3043 Mail - arpit3043@gmail.com Two integers A and B are the inputs. Write a program to find GCD and LCM of A and B. Input The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer A and B. Output Display the GCD and LCM of A and B separated by space respectively. The answer for each test case must be displayed in a new line. Constraints 1 ≤ T ≤ 1000 1 ≤ A,B ≤ 1000000 Example Input 3 120 140 10213 312 10 30 Output 20 840 1 3186456 10 30 """ # cook your dish here def gcd(a,b): if (a%b==0): return b return gcd(b, a%b) for i in range(int(input())): a,b=map(int,input().split()) if (a<b): a,b=b,a HCF = gcd(a,b) LCM = (a*b)//HCF print(HCF, LCM)
def rotations(l): out = [] for i in range(len(l)): a = shift(l, i) out += [a] return out def shift(l, n): return l[n:] + l[:n] if __name__ == '__main__': l = [0,1,2,3,4] for x in rotations(l): print(x)
class GitrackException(Exception): """ General giTrack's exception """ pass class ConfigException(GitrackException): """ Exception related to Config functionality. """ pass class InitializedRepoException(GitrackException): """ Raised when user tries to initialized repo that has been already initialized before. """ pass class UninitializedRepoException(GitrackException): """ Raised when giTrack invoke in Git repository that has not been initialized. """ pass class UnknownShell(GitrackException): pass class PromptException(GitrackException): pass class ProviderException(GitrackException): def __init__(self, provider_name, message, *args, **kwargs): self.message = message self.provider_name = provider_name super().__init__(*args, **kwargs) def __str__(self): return 'Provider \'{}\': {}'.format(self.provider_name, self.message) class RunningEntry(ProviderException): pass
def make_cut(l): smallest = min(l) return [ x - smallest for x in l if x - smallest > 0 ] length = int(input()) current = list( map( int, input().split() ) ) while current: print(len(current)) current = make_cut(current)
#!/usr/bin/env python3 # https://codeforces.com/problemset/problem/1023/A def f(ll): n,k = ll #1e14 f = k//2 + 1 e = min(k-1,n) return max(0,e-f+1) l = list(map(int,input().split())) print(f(l))
'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/80C4285C-779E-DD11-9889-001617E30CA4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/A83BF5EE-6E9E-DD11-8082-000423D94700.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/8266853E-999E-DD11-8B73-001D09F2432B.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/2AAFE9A9-A19E-DD11-821B-000423D99F3E.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/067E98F3-489F-DD11-B309-000423D996B4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/64C1D6F5-489F-DD11-90B7-000423D986A8.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0012/3C084F93-679C-DD11-A361-000423D9989E.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/9C14E69F-069D-DD11-AC41-001617DBCF1E.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/5439B4CA-309D-DD11-84E5-000423D944F8.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/D20BB375-AE9D-DD11-BF49-000423D944FC.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/E2E8FE03-A69D-DD11-8699-000423D98750.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/B40C29EC-B69D-DD11-A665-000423D6A6F4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/843C7874-1F9F-DD11-8E03-000423D98804.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/7EB3DF8E-0E9F-DD11-A451-001D09F29146.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/CEB001F9-169F-DD11-A5E6-000423D94494.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/382BAEE2-D39E-DD11-A0A4-000423D98EC8.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/CC5B37A1-A99E-DD11-816F-001617DBD230.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/6EDD168B-2F9F-DD11-ADF5-001617C3B79A.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/EE4B4C82-999C-DD11-86EC-000423D99F3E.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/1CC8332F-459E-DD11-BFE1-001617C3B65A.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/7A6A133C-999E-DD11-9155-001D09F2462D.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/F292BE7F-409F-DD11-883A-001617C3B6FE.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/B870AA81-409F-DD11-B549-001617C3B78C.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/9003F328-899C-DD11-83D7-000423D986C4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/500B13D3-6F9C-DD11-8745-001617DC1F70.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/4CBAEDCC-309D-DD11-A617-001617E30D06.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/AED19458-399D-DD11-B9AC-000423D9A2AE.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/A6688D1F-959D-DD11-B5B7-000423D6A6F4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/F0076F20-F59E-DD11-8B57-000423D944F0.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/EC6C6EA4-499D-DD11-AC7D-000423D98DB4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/DA099105-639D-DD11-9C3E-001617E30F50.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/2E40EDED-1A9E-DD11-9014-001617DBD5AC.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/7647004C-F19D-DD11-8BAA-001617DBD224.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/38881706-5E9E-DD11-B487-000423D98868.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/1098901B-569E-DD11-BE60-000423D985E4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/5E4E7508-919C-DD11-AEB1-000423D9853C.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/060DD475-179D-DD11-A003-000423D94908.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/8A563E55-289D-DD11-BA24-000423D6BA18.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/545F9B54-D09D-DD11-A58B-000423D6B5C4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/68795DEE-D79D-DD11-ADB7-000423D98DB4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/3AD49E1B-F59E-DD11-81C4-000423D94700.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/548891AB-8C9D-DD11-8989-001617C3B69C.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/745CD91D-529D-DD11-8908-000423D6B48C.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/3EF1CC87-2F9F-DD11-9EFC-001617DF785A.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/FCB4F2BA-3C9E-DD11-82C7-000423D99160.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/ECC4D018-569E-DD11-80C4-001617C3B6FE.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/20C97175-669E-DD11-8ADD-00161757BF42.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/52683098-A99E-DD11-BCD0-000423D94AA8.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/F6C17BA7-A19E-DD11-B57C-000423D98634.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/D844B765-519F-DD11-96F9-001617E30D0A.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/02EB3FD3-6F9C-DD11-8C35-001617C3B6FE.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/0EB355C8-309D-DD11-85B7-001617C3B64C.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/8E478481-BA9E-DD11-9573-000423D6B358.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/A4775BE3-739D-DD11-843D-001617C3B778.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/8E8B21C6-F99D-DD11-BF05-000423D986A8.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/0EF20D52-139E-DD11-9473-000423D6B5C4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/7C00B404-389F-DD11-AB81-000423D985E4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/AE67CFF1-279F-DD11-B6DC-000423D98804.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/7400A101-389F-DD11-B540-000423D60FF6.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/2A630CF2-279F-DD11-942A-000423D985E4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/1CD3DEA6-F59C-DD11-986D-000423D98BC4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/D809EECD-7F9E-DD11-B4D7-00161757BF42.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/64451F65-779E-DD11-869D-001617E30D40.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/BA532E6C-519F-DD11-8DE7-000423D98FBC.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/021AEBFE-7A9F-DD11-863E-0019DB29C620.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/CA5A90F6-489F-DD11-8F60-000423D6B2D8.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/028578E0-809C-DD11-AF7D-001617C3B6E8.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0012/08A6038E-679C-DD11-A4B9-001617E30D0A.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0012/18BA3290-679C-DD11-B9A1-001617C3B77C.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/B0CD45DB-D39E-DD11-BC03-000423D985E4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/125FE86B-CB9E-DD11-B054-000423DD2F34.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/6E783236-849D-DD11-A9FF-001617C3B654.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/800FA4BD-5A9D-DD11-ACBB-001617DBD5AC.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/760FB963-7C9D-DD11-B812-001D09F231C9.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/52CBD0DE-0A9E-DD11-B583-000423D6B358.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/905B1953-349E-DD11-8022-001D09F2AD7F.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/7A7A6D05-389F-DD11-9D08-000423D98804.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/C223029D-E59C-DD11-A125-001617E30D40.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/3293D2A6-4D9E-DD11-81D1-000423D98B5C.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/4E5AEDFC-5D9E-DD11-BD7D-001617C3B5F4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/2A9CA4B8-909E-DD11-857B-001617E30D38.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/9E30F47D-409F-DD11-A947-001617C3B6E8.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/745BB069-519F-DD11-A8F9-000423D94700.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/4493CD28-899C-DD11-AF14-000423D6CA02.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/0085D14F-289D-DD11-862E-000423D6006E.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/841A2D63-E09D-DD11-BDA5-001617DF785A.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/5658C98B-9D9D-DD11-9B46-000423D99F1E.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/3ABEFDFB-169F-DD11-94E3-000423D98BC4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/FC20EEFC-059F-DD11-A7CA-001617C3B5F4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/CE7B883A-ED9E-DD11-A737-0019DB29C614.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/4261BA6C-CB9E-DD11-AE94-000423D986A8.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/9A134C3C-849D-DD11-8A1C-000423D98C20.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/FE7A7A73-1F9F-DD11-A841-001617DBD230.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/6097BB22-FE9C-DD11-AA3C-000423D944F0.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/F4AE9DE3-DC9C-DD11-9223-000423D6B42C.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/3CA664CA-309D-DD11-A642-000423D951D4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/2C9D3EE0-C79D-DD11-AAF0-000423D94534.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/7E81C76A-BF9D-DD11-9970-001617E30F50.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/4EA98C8F-0E9F-DD11-A48E-001D09F253FC.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/0A4BBAF5-C29E-DD11-967D-0016177CA778.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/4253601B-B29E-DD11-9725-001617DBD224.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/E00BC4D5-D39E-DD11-861A-001617C3B5E4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/EA733333-419D-DD11-9B49-000423D99660.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/40A87664-239E-DD11-8ABC-000423D944F8.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/DA448F60-239E-DD11-8347-000423D98DD4.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/0E9D6303-389F-DD11-8C22-001617E30D0A.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/8A40053E-889E-DD11-9442-000423D944F0.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/082ED767-999E-DD11-962C-0019B9F70607.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/205DAE07-0F9D-DD11-9FD4-000423D9890C.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/041B05FD-059F-DD11-871E-001617E30D52.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/FE7823F2-C29E-DD11-81F1-0019DB29C614.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/BC834BD5-2B9E-DD11-A8D9-001617C3B706.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0013/966DFADC-E89D-DD11-A90E-000423D99264.root', 'rfio:///?svcClass=cmscaf&path=/castor/cern.ch/cms/store/data/Commissioning08/Cosmics/ALCARECO/CRAFT_V2P_StreamALCARECOTkAlCosmics0T_v7/0014/B4FD3F7C-409F-DD11-8F2B-001617DBCF90.root'
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def deno_repository(): # Get Deno archive http_archive( name = "deno-amd64", build_file = "//ext/deno:BUILD", sha256 = "7b883e3c638d21dd1875f0108819f2f13647b866ff24965135e679c743013f46", type = "zip", urls = ["https://github.com/denoland/deno/releases/download/v1.17.3/deno-x86_64-unknown-linux-gnu.zip"], )
# 127. Word Ladder # ttungl@gmail.com # Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that: # Only one letter can be changed at a time. # Each transformed word must exist in the word list. Note that beginWord is not a transformed word. # For example, # Given: # beginWord = "hit" # endWord = "cog" # wordList = ["hot","dot","dog","lot","log","cog"] # As one shortest transformation is "hit" -> "hot" -> "dot" -> "dog" -> "cog", # return its length 5. # Note: # Return 0 if there is no such transformation sequence. # All words have the same length. # All words contain only lowercase alphabetic characters. # You may assume no duplicates in the word list. # You may assume beginWord and endWord are non-empty and are not the same. # UPDATE (2017/1/20): # The wordList parameter had been changed to a list of strings (instead of a set of strings). Please reload the code definition to get the latest changes. class Solution(object): def ladderLength(self, beginWord, endWord, wordList): """ :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int """ # sol 1: # BFS iterative # time O(n*m) space O(n) # runtime: 804ms wordList = set(wordList) queue = collections.deque([(beginWord, 1)]) while queue: # O(n) word, length = queue.popleft() # O(1) if word == endWord: return length for i in range(len(word)): for c in string.ascii_lowercase: next_word = word[:i] + c + word[i+1:] if next_word in wordList: wordList.remove(next_word) queue.append((next_word, length + 1)) return 0
class Allergies(object): ALLERGY_SCORES = { 'eggs': 1, 'peanuts': 2, 'shellfish': 4, 'strawberries': 8, 'tomatoes': 16, 'chocolate': 32, 'pollen': 64, 'cats': 128 } def __init__(self, score): if score is None or not isinstance(score, int): raise TypeError("Score must be an integer") self.score = score def is_allergic_to(self, allergen): """ Checks if Tom is allergic to this particular allergen. Does a bitwise AND to perform the check :param allergen: the allergen to check for :return: True/False if Tom is allergic :rtype: bool """ return self.ALLERGY_SCORES[allergen] & self.score def allergies(self): """ Sorts the list of allergies in alphabetic order and returns them :return: a sorted list of all the allergies :rtype: list """ return sorted(list(allergy for allergy in self.ALLERGY_SCORES if self.is_allergic_to(allergy)))
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") def libevent(): http_archive( name = "libevent", build_file = "//bazel/deps/libevent:build.BUILD", sha256 = "9b436b404793be621c6e01cea573e1a06b5db26dad25a11c6a8c6f8526ed264c", strip_prefix = "libevent-eee26deed38fc7a6b6780b54628b007a2810efcd", urls = [ "https://github.com/Unilang/libevent/archive/eee26deed38fc7a6b6780b54628b007a2810efcd.tar.gz", ], patches = [ "//bazel/deps/libevent/patches:p1.patch", ], patch_args = [ "-p1", ], patch_cmds = [ "find . -type f -name '*.c' -exec sed -i 's/#include <stdlib.h>/#include <stdlib.h>\n#include <stdint.h>\n/g' {} \\;", ], )
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jan 21 08:20:55 2021 @author: silasjimmy """ def count_words(s, n): s = s.split(' ') counted_words = [(w, s.count((w))) for w in set(s)] counted_words.sort(key = lambda x: (-x[1], x[0])) top_n = counted_words[:n] return top_n def test_run(): print(count_words('cat bat mat cat bat cat', 3)) print(count_words('betty bought a bit of butter but the butter was bitter', 3)) if __name__ == '__main__': test_run()
# jumlah segitiga n = 123 # panjang alas sebuah segitiga alas = 30 # tinggi sebuah segitiga tinggi = 18 # hitung luas sebuah segitiga luas = alas * tinggi * 1/2 # hitung luas total luastotal = n * luas print('luas total : ', luastotal,'satuan luas')
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. class Partitioner(object): """ Base class for a partitioner """ def __init__(self, partitions): """ Initialize the partitioner Arguments: partitions: A list of available partitions (during startup) """ self.partitions = partitions def partition(self, key, partitions=None): """ Takes a string key and num_partitions as argument and returns a partition to be used for the message Arguments: key: the key to use for partitioning partitions: (optional) a list of partitions. """ raise NotImplementedError('partition function has to be implemented')
# http://codingbat.com/prob/p193507 def string_times(str, n): result = "" for i in range(0, n): result += str return result
def alternate_case(s): # Like a Giga Chad return "".join([char.lower() if char.isupper() else char.upper() for char in s]) # Like a Beta Male # return s.swapcase() # EXAMPLE AND TESTING # input = ["Hello World", "cODEwARS"] for item in input: print("\nInput: {0}\nAlternate Case: {1}".format(item, alternate_case(item))) assert alternate_case("Hello World") == "hELLO wORLD" # Simple Unit Tests assert alternate_case("cODEwARS") == "CodeWars" # Simple Unit Tests
"""A json-like master list of workflows and steps.""" # NOTE: Create a json-like dictionary in the form of: # WF_STEPS = { # env1: { # 1st condition defined in next_steps: { # 2nd condition defined in next_steps: (Workflow Name, Step Name), # }, # }, # } WF_STEPS = {}
#!/usr/bin/python3 list = ["Armitage", "Backdoor Factory", "BeEF","cisco-auditing-tool", "cisco-global-exploiter","cisco-ocs","cisco-torch","Commix","crackle", "exploitdb","jboss-autopwn","Linux Exploit Suggester","Maltego Teeth", "Metasploit Framework","MSFPC","RouterSploit","SET","ShellNoob","sqlmap", "THC-IPV6","Yersinia"]
def get_max_coins_helper(matrix, crow, ccol, rows, cols): cval = matrix[crow][ccol] if crow == rows - 1 and ccol == cols - 1: return cval down, right = cval, cval if crow < rows - 1: down += get_max_coins_helper( matrix, crow + 1, ccol, rows, cols) if ccol < cols - 1: right += get_max_coins_helper( matrix, crow, ccol + 1, rows, cols) return max(down, right) def get_max_coins(matrix): if matrix: return get_max_coins_helper( matrix, 0, 0, len(matrix), len(matrix[0])) coins = [[0, 3, 1, 1], [2, 0, 0, 4], [1, 5, 3, 1]] assert get_max_coins(coins) == 12 coins = [[0, 3, 1, 1], [2, 8, 9, 4], [1, 5, 3, 1]] assert get_max_coins(coins) == 25
class NEC: def __init__( self ): self.prompt = '(.*)' self.timeout = 60 def show(self, *options, **def_args ): '''Possible Options :[' access-filter ', ' accounting ', ' acknowledgments ', ' auto-config ', ' axrp ', ' cfm ', ' channel-group ', ' clock ', ' config-lock-status ', ' cpu ', ' dhcp ', ' dot1x ', ' dumpfile ', ' efmoam ', ' environment ', ' file ', ' flash ', ' gsrp ', ' history ', ' igmp-snooping ', ' interfaces ', ' ip ', ' ip-dual ', ' ipv6-dhcp ', ' license ', ' lldp ', ' logging ', ' loop-detection ', ' mac-address-table ', ' mc ', ' memory ', ' mld-snooping ', ' netconf ', ' netstat ', ' ntp ', ' oadp ', ' openflow ', ' port ', ' power ', ' processes ', ' qos ', ' qos-flow ', ' sessions ', ' sflow ', ' spanning-tree ', ' ssh ', ' system ', ' tcpdump ', ' tech-support ', ' track ', ' version ', ' vlan ', ' vrrpstatus ', ' whoami ']''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_ip(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show ip "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_mc(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show mc "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_cfm(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show cfm "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_ntp(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show ntp "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_ssh(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show ssh "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_qos(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show qos "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_cpu(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show cpu "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_vlan(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show vlan "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_lldp(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show lldp "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_dhcp(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show dhcp "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_axrp(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show axrp "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_oadp(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show oadp "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_gsrp(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show gsrp "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_port(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show port "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_file(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show file "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_power(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show power "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_clock(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show clock "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_dot1x(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show dot1x "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_sflow(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show sflow "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_track(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show track "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_flash(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show flash "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_system(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show system "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_whoami(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show whoami "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_efmoam(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show efmoam "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_memory(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show memory "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_tcpdump(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show tcpdump "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_history(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show history "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_logging(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show logging "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_license(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show license "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_netstat(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show netstat "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_version(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show version "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_netconf(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show netconf "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_ipdual(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show ip-dual "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_sessions(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show sessions "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_qosflow(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show qos-flow "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_openflow(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show openflow "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_dumpfile(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show dumpfile "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_ipv6dhcp(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show ipv6-dhcp "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_processes(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show processes "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_vrrpstatus(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show vrrpstatus "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_interfaces(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show interfaces "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_environment(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show environment "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_autoconfig(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show auto-config "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_techsupport(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show tech-support "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_mldsnooping(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show mld-snooping "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_igmpsnooping(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show igmp-snooping "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_channelgroup(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show channel-group "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_spanningtree(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show spanning-tree "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_loopdetection(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show loop-detection "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_acknowledgments(self, *options, **def_args ): '''Possible Options :[' interface ']''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show acknowledgments "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_macaddresstable(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show mac-address-table "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_configlockstatus(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show config-lock-status "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE def show_acknowledgments_interface(self, *options, **def_args ): '''Possible Options :[]''' arguments= '' for option in options: arguments = arguments + option +' ' prompt = def_args.setdefault('prompt',self.prompt) timeout = def_args.setdefault('timeout',self.timeout) self.execute( cmd= "show acknowledgments interface "+ arguments, prompt = prompt, timeout = timeout ) return main.TRUE
#! /usr/bin/env python # -*- coding: utf-8 -*- # __author__ = 'CwT' # document.body.innerHTML += '<form id="dynForm" action="http://example.com/" method="post"> # <input type="hidden" name="q" value="a"></form>'; # document.getElementById("dynForm").submit(); POST_JS = '<form id=\\"dynamicform\\" action=\\"%s\\" method=\\"post\\">%s</form>' INPUT_JS = '<input type=\\"hidden\\" name=\\"%s\\" value=%s>' EXECUTE_JS = 'document.body.innerHTML = "%s"; document.getElementById("dynamicform").submit();' def post_js(url, data): input = "" for key, value in data.items(): if isinstance(value, int): input += INPUT_JS % (key, str(value)) else: input += INPUT_JS % (key, "\\\"%s\\\"" % value) form = POST_JS % (url, input) return EXECUTE_JS % form
# data hiding - encapsulation # this can be achieve by making the attribute or method private # python doesn't have private keyword so precede # the attribute/method identifier with an underscore or a double # this is more effective if object in import or used as a module # it isn't that effective # no underscore = public # single underscore = protected # double underscore = private class Person: __name = '' __age = 0 def __init__(self, name, age): self.__name = name self.__age = age me = Person("John Doe", 32) print(me._Person__name)
# Instruksi: # Buatlah komentar di garis pertama, # Buat variabel bernama jumlah_pacar yang isinya angka (bukan desimal), # Buat variabel bernama lagi_galau yang isinya boolean, # Buat variabel dengan nama terserah anda dan gunakan salah satu dari operator matematika yang telah kita pelajari. #variabel untuk menyimpan data # tipe data boolean dan angka # spasi: pentingnya spasi dalam python # komentar: untuk menjelaskan kode #operasi matematika: mulai dari penambahan sampai modulus jumlah_pacar = 1 lagi_galau = False umur = 20
# About: Implementation of the accumulator program # in python 3 specialization # ask to enter string phrase = input("Enter a string: ") # initialize total variable with zero tot = 0 # iterate through the string for char in phrase : if char != " " : tot += 1 # print the result print(tot)
class MapHash: def __init__(self, maxsize=6): self.maxsize = maxsize # Real scenario 64. self.hash = [None] * self.maxsize # Will be a 2D list def _get_hash_key(self, key): hash = sum(ord(k) for k in key) return hash % self.maxsize def add(self, key, value): hash_key = self._get_hash_key(key) # Hash key hash_value = [key, value] # ADD if self.hash[hash_key] is None: self.hash[hash_key] = [hash_value] # Key-value(IS a list) return True else: # Update for pair in self.hash[hash_key]: # Update-value if pair[0] == key: pair[1] = value # Update-value return True # append new Key in same hash key self.hash[hash_key].append(hash_value) def get(self, key): hash_key = self._get_hash_key(key) if self.hash[hash_key] is not None: for k, v in self.hash[hash_key]: if k == key: return v return "Key Error" def delete(self, key): hash_key = self._get_hash_key(key) if self.hash[hash_key] is not None: for i in range(len(self.hash[hash_key])): if self.hash[hash_key][i][0] == key: self.hash[hash_key].pop(i) return True else: return "Key Error" def __str__(self): return str(self.hash) def pprint(self): for item in self.hash: if item is not None: print(str(item)) data = MapHash() data.add('CaptainAmerica', '567-8888') data.add('Thor', '293-6753') data.add('Thor', '333-8233') data.add('IronMan', '293-8625') data.add('BlackWidow', '852-6551') data.add('Hulk', '632-4123') data.add('Spiderman', '567-2188') data.add('BlackPanther', '777-8888') print(data) print(data.get('BlackPanther')) print(data.delete('BlackPanther')) print(data.pprint())
#Refer AlexNet implementation code, returns last fully connected layer fc7 = AlexNet(resized, feature_extract=True) shape = (fc7.get_shape().as_list()[-1], 43) fc8_weight = tf.Variable(tf.truncated_normal(shape, stddev=1e-2)) fc8_b = tf.Variable(tf.zeros(43)) logits = tf.nn.xw_plus_b(fc7, fc8_weight, fc8_b) probs = tf.nn.softmax(logits)
def isSubsetSum(arr, n, sum): ''' Returns true if there exists a subset with given sum in arr[] ''' # The value of subset[i%2][j] will be true # if there exists a subset of sum j in # arr[0, 1, ...., i-1] subset = [[False for j in range(sum + 1)] for i in range(3)] for i in range(n + 1): for j in range(sum + 1): # A subset with sum 0 is always possible if (j == 0): subset[i % 2][j] = True # If there exists no element no sum # is possible elif (i == 0): subset[i % 2][j] = False elif (arr[i - 1] <= j): subset[i % 2][j] = subset[ (i + 1) % 2][j - arr[i - 1]] or subset[(i + 1) % 2][j] else: subset[i % 2][j] = subset[(i + 1) % 2][j] return subset[n % 2][sum] # Driver code arr = [6, 2, 5] sum = 7 n = len(arr) if (isSubsetSum(arr, n, sum) is True): print("There exists a subset with given sum") else: print("No subset exists with given sum")
tup = ('a','b',1,2,3) print(tup[0]) print(tup[1]) print(tup[2]) print(tup[3]) print(tup[4])
"""Exercício Python 64: Crie um programa que leia vários números inteiros pelo teclado. O programa só vai parar quando o usuário digitar o valor 999, que é a condição de parada. No final, mostre quantos números foram digitados e qual foi a soma entre eles (desconsiderando o flag (999)).""" q = 0 s = 0 print('[Digite 999 para parar o programa]') # se colocar o flag[999] antes do whale, quando ele for 'acionado' ele não entrará no algoritmo n = int(input('Digite um número: ')) while n != 999: q = q + 1 s = s + n n = int(input('Digite um número: ')) print('') print('Foram digitados {} números;'.format(q)) print('A soma dos números foi de {}.'.format(s))
class Solution: def XXX(self, nums: List[int]) -> List[List[int]]: final = list() # ---------------------------------------------------- if len(nums)==1: return [[],nums] if len(nums)==0: return [] # ------------------------------------------------------ def pop(cut): if not cut: return else: for i in range(len(cut)): tmp = copy.deepcopy(cut) tmp.pop(i) if tmp not in final: final.append(tmp) pop(tmp) pop(nums) if nums: final.append(nums) return final
metros = float(input('Quantos metros de piso vc deseja? ')) preco = 70 total = metros*preco print('O preço total do pedido é: R$ %.2f' % (total))
# -*- coding: utf-8 -*- # @Time: 2020/7/3 10:21 # @Author: GraceKoo # @File: interview_33.py # @Desc: https://leetcode-cn.com/problems/chou-shu-lcof/ class Solution: def nthUglyNumber(self, n: int) -> int: if n <= 0: return 0 dp, a, b, c = [1] * n, 0, 0, 0 for i in range(1, n): min_ugly = min(dp[a] * 2, dp[b] * 3, dp[c] * 5) dp[i] = min_ugly if min_ugly == dp[a] * 2: a += 1 if min_ugly == dp[b] * 3: b += 1 if min_ugly == dp[c] * 5: c += 1 return dp[-1] so = Solution() print(so.nthUglyNumber(10))
# Solution for the SafeCracker 50 Puzzle from Creative Crafthouse # By: Eric Pollinger # 9/11/2016 # # Function to handle the addition of a given slice def add(slice): if row1Outer[(index1 + slice) % 16] != -1: valRow1 = row1Outer[(index1 + slice) % 16] else: valRow1 = row0Inner[slice] if row2Outer[(index2 + slice) % 16] != -1: valRow2 = row2Outer[(index2 + slice) % 16] else: valRow2 = row1Inner[(index1 + slice) % 16] if row3Outer[(index3 + slice) % 16] != -1: valRow3 = row3Outer[(index3 + slice) % 16] else: valRow3 = row2Inner[(index2 + slice) % 16] if row4[(index4 + slice) % 16] != -1: valRow4 = row4[(index4 + slice) % 16] else: valRow4 = row3Inner[(index3 + slice) % 16] return row0Outer[slice] + valRow1 + valRow2 + valRow3 + valRow4 if __name__ == "__main__": # Raw data (Row0 = base of puzzle) row0Outer = [10,1,10,4,5,3,15,16,4,7,0,16,8,4,15,7] row0Inner = [10,10,10,15,7,19,18,2,9,27,13,11,13,10,18,10] row1Outer = [-1,10,-1,8,-1,10,-1,9,-1,8,-1,8,-1,9,-1,6] row1Inner = [1,24,8,10,20,7,20,12,1,10,12,22,0,5,8,5] row2Outer = [0,-1,11,-1,8,-1,8,-1,8,-1,10,-1,11,-1,10,-1] row2Inner = [20,8,19,10,15,20,12,20,13,13,0,22,19,10,0,5] row3Outer = [10,-1,14,-1,11,-1,8,-1,12,-1,11,-1,3,-1,8,-1] row3Inner = [6,18,8,17,4,20,4,14,4,5,1,14,10,17,10,5] row4 = [8,-1,8,-1,16,-1,19,-1,8,-1,17,-1,6,-1,6,-1] count = 0 for index1 in range(0,16): for index2 in range(0,16): for index3 in range(0,16): for index4 in range(0,16): if add(0) == 50: solution = True for sl in range(1,16): if add(sl) != 50: solution = False if solution == True: count = count + 1 # Print Solution print('Solution with index values: ' + str(index1) + ' ' + str(index2) + ' ' + str(index3) + ' ' + str(index4) + ' for a total number of solutions: ' + str(count)) for i in range(0, 5): print('Solution with Slice ' + str(i) + ' values:\t ' + str(row1Outer[(index1 + i) % 16]) + '\t\t' + str( row2Outer[(index2 + i) % 16]) + '\t\t' + str(row3Outer[(index3 + i) % 16]) + '\t\t' + str(row4[(index4 + i) % 16])) if count == 0: print("No Solution Found")
# test __getattr__ on module # ensure that does_not_exist doesn't exist to start with this = __import__(__name__) try: this.does_not_exist assert False except AttributeError: pass # define __getattr__ def __getattr__(attr): if attr == 'does_not_exist': return False raise AttributeError # do feature test (will also test functionality if the feature exists) if not hasattr(this, 'does_not_exist'): print('SKIP') raise SystemExit # check that __getattr__ works as expected print(this.does_not_exist)