content
stringlengths
7
1.05M
# -*- coding: utf-8 -*- # 修改默认抓取数据,进行数据优化 class ElementConstant: def __init__(self): self.data_constant = {} self.init_source_data() index = 0 def init_source_data(self): # #self.data_constant['序号'] = 0 # 第一个需要进行排序操作 # 链家编号 链家编号 self.data_constant['链家编号'] = 1 # self.data_constant['状态'] = 2 # 状态需要进行手动输入判断 # 每平方售价 单价(元/平米) self.data_constant['单价(元/平米)'] = 3 # 建筑面积 建筑面积:平米 self.data_constant['建筑面积:平米'] = 4 # 挂牌时间 挂牌时间 self.data_constant['挂牌时间'] = 5 # 上次交易 上次交易时间 self.data_constant['上次交易时间'] = 6 # 房子类型 建成时间:年 注释:房屋类型包含  1990年建/塔楼 需要进行元组分割 self.data_constant['建成时间:年'] = 7 # self.data_constant['城市'] = 8 # 城市需要进行默认转化 # 详细区域 '朝阳 垡头 四至五环' 以空格区分进行匹配 # example :所属下辖区 朝阳 # 所属商圈 垡头 # 所属环线 四至五环 self.data_constant['所属下辖区'] = 9 self.data_constant['所属商圈'] = 10 # 小区名称 所属小区 self.data_constant['所属小区'] = 11 self.data_constant['所属环线'] = 12 # 房屋户型 户型 self.data_constant['房屋户型'] = 13 # 朝向 朝向 self.data_constant['房屋朝向'] = 14 # 梯户比例 梯户比例 self.data_constant['梯户比例'] = 15 # 房屋用途 房屋用途 15 self.data_constant['房屋用途'] = 16 # 产权年限 产权年限 self.data_constant['产权年限'] = 17 # 建筑类型 建筑类型 self.data_constant['建筑类型'] = 18 # 交易权属 交易权属 self.data_constant['交易权属'] = 19 # 装修情况 装修情况 self.data_constant['装修情况'] = 20 # 建筑结构 建筑结构 self.data_constant['建筑结构'] = 21 # 供暖方式 供暖方式 self.data_constant['供暖方式'] = 22 # 产权所属 产权所属 self.data_constant['房权所属'] = 23 # 户型结构 户型结构 23 self.data_constant['户型结构'] = 24 # 配备电梯 配备电梯 self.data_constant['配备电梯'] = 25 # 所在楼层 楼层 self.data_constant['所在楼层'] = 26 # 房屋年限 房屋年限 self.data_constant['房屋年限'] = 27 # 标题 标题 self.data_constant['标题'] = 28 # 网址 网址 self.data_constant['网址'] = 29 # 关注房源 关注(人) self.data_constant['关注(人)'] = 30 # 看过房源 看过房源:人 self.data_constant['带看(次)'] = 31 self.data_constant['挂牌价格(万)'] = 32 self.data_constant['成交周期(天)'] = 33 self.data_constant['调价(次)'] = 34 self.data_constant['浏览(次)'] = 35 self.data_constant['套内面积'] = 36 self.data_constant['成交时间'] = 37 self.data_constant['售价(万)'] = 38 def column_position(self, temp_data): return self.data_constant.get(temp_data) # 检测匹配是否包含 def unit_check_name(self, temp_data): if self.data_constant.has_key(temp_data): return temp_data else: if temp_data == '每平方售价': return '单价(元/平米)' if temp_data == '建筑面积': return '建筑面积:平米' if temp_data == '上次交易': return '上次交易时间' if temp_data == '房子类型': return '建成时间:年' if temp_data == '小区名称': return '所属小区' if temp_data == '房屋户型': return '户型' # if temp_data == '所在楼层': # return '楼层' if temp_data == '关注房源': return '关注(人)' if temp_data == '看过房源': return '看过房源:人' # Element_Constant = ElementConstant() # Element_Constant.excleTest()
class Receiver1: # action def step_left(self): print("Receiver1 steps left") def step_right(self): print("Receiver1 steps right") class Receiver2: # action def step_forward(self): print("Receiver2 steps forward") def step_backward(self): print("Receiver2 steps backwards")
l1 = int(input('Digite o lado L1: ')) l2 = int(input('Digite o lado L2: ')) l3 = int(input('Digite o lado L3: ')) if l1 + l2 > l3 and l1 + l3 > l2 and l2 + l3 > l1: resp = 'Sim, pode formar um triângulo.' if (l1 == l2 and l1 != l3) or (l1 == l3 and l2 != l3) or (l2 == l3 and l2 != l1): resp2 = 'Triângulo isóceles.' elif l1 == l2 == l3: resp2 = 'Triângulo equilátero.' else: resp2 = 'Triângulo escaleno.' else: resp = 'Não, não pode formar um triângulo' resp2 = '' print(resp, resp2)
numero = int(input('Digite um numero: ')) if numero % 5 == 0: print('Buzz') else: print(numero)
class WinData(): def __init__(self, wins=0, games=0): assert games >= wins self.wins = wins self.games = games def win_pct(self): return f'{self.wins/self.games:.3%}' if self.games > 0 else 'N/A' def incre_wins(self): self.wins += 1 def incre_games(self): self.games += 1
# -*- coding: utf-8 -*- """ Created on Tue Oct 12 17:32:07 2021 @author: JohnZhong """ #Mad libs generator 2021/10/12 print("Tell us something about you and we can create a story just for you!") print("Let's begin!") noun1 = input("Enter a pet: ") noun2 = input("Enter a noun: ") if noun1 in ["dog", "DOG", "Dog"]: story = "Five little " + noun1 + "s" + " went out oneday" + "\nOver the " + noun2 + " " + "and far away" + "\nMother " + noun1 + " " + "said wan wan wan" + "\nBut only four little " + noun1 + "s" + " came back" print(story) elif noun1 in ["cat", "CAT", "Cat"]: story = "Five little " + noun1 + "s" + " went out oneday" + "\nOver the " + noun2 + " " + "and far away" + "\nMother " + noun1 + " " + "said miao miao miao" + "\nBut only four little " + noun1 + "s" + " came back" print(story) elif noun1 in ["Duck", "DUCK", "Duck", "Goose", "GOOSE", "goose"]: story = "Five little " + noun1 + "s" + " went out oneday" + "\nOver the " + noun2 + " " + "and far away" + "\nMother " + noun1 + " " + "said quack quack quack" + "\nBut only four little " + noun1 + "s" + " came back" print(story) elif noun1 in ["Bird", "BIRD", "bird"]: story = "Five little " + noun1 + "s" + " went out oneday" + "\nOver the " + noun2 + " " + "and far away" + "\nMother " + noun1 + " " + "said chir chir chir" + "\nBut only four little " + noun1 + "s" + " came back" print(story) elif noun1 in ["pig", "PIG", "Pig"]: story = "Five little " + noun1 + "s" + " went out oneday" + "\nOver the " + noun2 + " " + "and far away" + "\nMother " + noun1 + " " + "said oink oink oink" + "\nBut only four little " + noun1 + "s" + " came back" print(story) else: story = "Five little " + noun1 + "s" + " went out oneday" + "\nOver the " + noun2 + " " + "and far away" + "\nMother " + noun1 + " " + "said hmn hmn hmn" + "\nBut only four little " + noun1 + "s" + " came back" print(story)
#https://aonecode.com/amazon-online-assessment-zombie-matrix ZOMBIE = 1 HUMAN = 0 DIRECTIONS = [[-1, 0], [1, 0], [0, -1], [0, 1]] def humanDays(matrix): """ :type matrix: List[List[int]] :rtype: int """ M = len(matrix) if (M == 0): return -1 N = len(matrix[0]) if (N == 0): return -1 days = -1 queue = [] for i in range(M): for j in range(N): if matrix[i][j] == ZOMBIE: queue.append([i,j]) while len(queue) > 0: numNodes = len(queue) while (numNodes > 0): [curI, curJ] = queue.pop(0) numNodes -= 1 if (matrix[curI][curJ] != ZOMBIE): continue for [iDelta, jDelta] in DIRECTIONS: nextI = curI + iDelta nextJ = curJ + jDelta if (nextI < 0 or nextJ < 0 or nextI >= M or nextJ >= N): continue if matrix[nextI][nextJ] == HUMAN: queue.append([nextI, nextJ]) matrix[nextI][nextJ] = ZOMBIE days += 1 return days print(humanDays([ [0, 1, 1, 0, 1], [0, 1, 0, 1, 0], [0, 0, 0, 0, 1], [0, 1, 0, 0, 0]])) #2 print(humanDays([[0,0]])) #-1
def exibirLista(lista): for item in lista: print(item) numeros = [1, 56, 5, 7, 29] exibirLista(numeros) print("Ordenados") numeros.sort() exibirLista(numeros)
class Solution: def fib(self, n: int) -> int: fib_0, fib_1 = 0, 1 if n == 0: return 0 if n == 1: return 1 for i in range(2, n+1): fib_0, fib_1 = fib_1, fib_0+fib_1 return fib_1
# # PySNMP MIB module GRPSVCEXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GRPSVCEXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:19:53 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # grpsvcExt, = mibBuilder.importSymbols("APENT-MIB", "grpsvcExt") ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") iso, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, MibIdentifier, ModuleIdentity, IpAddress, NotificationType, Integer32, ObjectIdentity, Bits, Counter64, Unsigned32, Counter32, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "MibIdentifier", "ModuleIdentity", "IpAddress", "NotificationType", "Integer32", "ObjectIdentity", "Bits", "Counter64", "Unsigned32", "Counter32", "TimeTicks") TextualConvention, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "DisplayString") apGrpsvcExtMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 2467, 1, 19, 1)) if mibBuilder.loadTexts: apGrpsvcExtMib.setLastUpdated('9710092000Z') if mibBuilder.loadTexts: apGrpsvcExtMib.setOrganization('ArrowPoint Communications Inc.') if mibBuilder.loadTexts: apGrpsvcExtMib.setContactInfo(' Postal: ArrowPoint Communications Inc. 50 Nagog Park Acton, Massachusetts 01720 Tel: +1 978-206-3000 option 1 E-Mail: support@arrowpoint.com') if mibBuilder.loadTexts: apGrpsvcExtMib.setDescription('The MIB module used to describe the ArrowPoint Communications content rule table') apGrpsvcTable = MibTable((1, 3, 6, 1, 4, 1, 2467, 1, 19, 2), ) if mibBuilder.loadTexts: apGrpsvcTable.setStatus('current') if mibBuilder.loadTexts: apGrpsvcTable.setDescription('A list of group rule entries.') apGrpsvcEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2467, 1, 19, 2, 1), ).setIndexNames((0, "GRPSVCEXT-MIB", "apGrpsvcGrpName"), (0, "GRPSVCEXT-MIB", "apGrpsvcSvcName")) if mibBuilder.loadTexts: apGrpsvcEntry.setStatus('current') if mibBuilder.loadTexts: apGrpsvcEntry.setDescription('A group of information to uniquely identify a source grouping.') apGrpsvcGrpName = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 19, 2, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 31))).setMaxAccess("readcreate") if mibBuilder.loadTexts: apGrpsvcGrpName.setStatus('current') if mibBuilder.loadTexts: apGrpsvcGrpName.setDescription('The name of the content rule.') apGrpsvcSvcName = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 19, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 31))).setMaxAccess("readcreate") if mibBuilder.loadTexts: apGrpsvcSvcName.setStatus('current') if mibBuilder.loadTexts: apGrpsvcSvcName.setDescription('The name of the service.') apGrpsvcStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 19, 2, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: apGrpsvcStatus.setStatus('current') if mibBuilder.loadTexts: apGrpsvcStatus.setDescription('Status entry for this row ') apGrpDestSvcTable = MibTable((1, 3, 6, 1, 4, 1, 2467, 1, 19, 3), ) if mibBuilder.loadTexts: apGrpDestSvcTable.setStatus('current') if mibBuilder.loadTexts: apGrpDestSvcTable.setDescription('A list of group destination service entries.') apGrpDestSvcEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2467, 1, 19, 3, 1), ).setIndexNames((0, "GRPSVCEXT-MIB", "apGrpDestSvcGrpName"), (0, "GRPSVCEXT-MIB", "apGrpDestSvcSvcName")) if mibBuilder.loadTexts: apGrpDestSvcEntry.setStatus('current') if mibBuilder.loadTexts: apGrpDestSvcEntry.setDescription('A group of information to uniquely identify a source grouping by a destination service.') apGrpDestSvcGrpName = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 19, 3, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 31))).setMaxAccess("readcreate") if mibBuilder.loadTexts: apGrpDestSvcGrpName.setStatus('current') if mibBuilder.loadTexts: apGrpDestSvcGrpName.setDescription('The name of the source group destination service.') apGrpDestSvcSvcName = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 19, 3, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 31))).setMaxAccess("readcreate") if mibBuilder.loadTexts: apGrpDestSvcSvcName.setStatus('current') if mibBuilder.loadTexts: apGrpDestSvcSvcName.setDescription('The name of the destination service.') apGrpDestSvcStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 19, 3, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: apGrpDestSvcStatus.setStatus('current') if mibBuilder.loadTexts: apGrpDestSvcStatus.setDescription('Status entry for this row ') mibBuilder.exportSymbols("GRPSVCEXT-MIB", apGrpDestSvcTable=apGrpDestSvcTable, apGrpDestSvcStatus=apGrpDestSvcStatus, apGrpsvcEntry=apGrpsvcEntry, PYSNMP_MODULE_ID=apGrpsvcExtMib, apGrpsvcStatus=apGrpsvcStatus, apGrpDestSvcEntry=apGrpDestSvcEntry, apGrpDestSvcGrpName=apGrpDestSvcGrpName, apGrpDestSvcSvcName=apGrpDestSvcSvcName, apGrpsvcTable=apGrpsvcTable, apGrpsvcSvcName=apGrpsvcSvcName, apGrpsvcExtMib=apGrpsvcExtMib, apGrpsvcGrpName=apGrpsvcGrpName)
class TracableObject: def __init__(self, object_id, centroid): # store the object ID, then initialize a list of centroids # using the current centroid self.object_id = object_id self.centroids = [centroid] # initializa a boolean used to indicate if the object has # already been counted or not self.counted = False
# Pytathon if Stement # if Statement sandwich_order = "Ham Roll" if sandwich_order == "Ham Roll": print("Price: $1.75") # if else Statement tab = 29.95 if tab > 20: print("This user has a tab over $20 that needs to be paid.") else: print("This user's tab is below $20 that does not require immediate payment.") # elif Statement sandwich_order = "Bacon Roll" if sandwich_order == "Ham Roll": print("Price: $1.75") elif sandwich_order == "Cheese Roll": print("Price: $1.80") elif sandwich_order == "Bacon Roll": print("Price: $2.10") else: print("Price: $2.00") # Nested if Statement sandwich_order = "Other Filled Roll" if sandwich_order != "Other Filled Roll": if sandwich_order == "Ham Roll": print("Price: $1.75") if sandwich_order == "Cheese Roll": print("Price: $1.80") elif sandwich_order == "Bacon Roll": print("Price: $2.10") else: print("Price: $2.00")
""" MOTOR PARAMETERS """ b_step_per_mm = 80 d_step_per_mm = 80 p_step_per_mm = 80 step_len_us = 1 # NOT CURRENTLY USED disp_move_mm = 104 disp_vel_mmps = 50 disp_acc_mmps2 = 100 pusher_move_mm = 68 pusher_vel_mmps = 520 pusher_acc_mmps2 = 12500 bin_vel_mmps = 400 bin_acc_mmps2 = 3500 bin_heights_load_mm = [2.5, 10.2, 17.9, 25.6, 33.3, 41.0, 48.7, 56.4] # bin 0 (bottom) to bin n (top) bin_unload_shift_mm = 30 """ DISPENSE PARAMETERS """ dc_motor_spin_down_dwell_s = 0.4 min_time_between_dispenses_s = 0.3 servo_min_pwm = 25 servo_max_pwm = 160 dispense_timeout_ms = 600 current_detect_freq_hz = 500 current_detect_window_ms = 100 current_threshold_factor = 1500 # Multiply by 1000, must be int servo_return_time_ms = 500 dispense_max_attempts = 3 """ SHUFFLING PARAMETERS """ cards_per_shuffle_loop = 20 # Too many and it may fail to dispense shuffle_loops = 4 max_cards_per_bin = 10 planned_shuffle_timeout = 150 # If this many cards were trashed and deck still isn't in order, give up """ CAMERA PARAMETERS """ # Cropped region of card window H_MIN = 75 H_MAX = 700 W_MIN = 550 W_MAX = 775 IMAGE_RESOLUTION = (1920,1080) IMAGE_ROTATION_DEGS = 0 """ DETECTION PARAMETERS """ RANK_DIFF_MAX = 2000 SUIT_DIFF_MAX = 1000 RANK_WIDTH = 70 RANK_HEIGHT = 125 SUIT_WIDTH = 70 SUIT_HEIGHT = 100 MAX_CONTOURS_TO_CHECK = 5 USE_CAL_IMAGE = True BW_THRESH = 15 """ FEATHER COMM PARAMETERS """ # Chars used for setting parameters on feather. All vars here must be int Feather_Parameter_Chars = { 'a': step_len_us, 'b': servo_min_pwm, 'c': servo_max_pwm, 'd': dispense_timeout_ms, 'e': current_detect_freq_hz, 'f': current_detect_window_ms, 'g': current_threshold_factor, 'h': servo_return_time_ms, 'i': dispense_max_attempts } """ DEBUG PARAMS """ DEBUG_MODE = False
# Leetcode 198. House Robber # # Link: https://leetcode.com/problems/house-robber/ # Difficulty: Medium # Solution using DP # Complexity: # O(N) time | where N represent the number of homes # O(1) space class Solution: def rob(self, nums: List[int]) -> int: rob1, rob2 = 0, 0 for n in nums: rob1, rob2 = rob2, max(rob1 + n, rob2) return rob2
# %% [6. ZigZag Conversion](https://leetcode.com/problems/zigzag-conversion/) class Solution: def convert(self, s: str, numRows: int) -> str: lst = [[] for _ in range(numRows)] for cc in use(s, numRows): for i, c in enumerate(cc): lst[i].append(c) return "".join("".join(i) for i in lst) def use(s, numRows): p, n = 0, len(s) while p < n: yield [s[p + i] if p + i < n else "" for i in range(numRows)] p += numRows for i in range(1, numRows - 1): if p < n: yield [""] * (numRows - i - 1) + [s[p]] + [""] * i p += 1
# Desafio 022 -> Crie um programa que leia o nome completo de uma pessoa e mostre: # O nome com todas as letras maiúsculas # O nome com todas minúsculas # Quantas letras ao to do (sem considerar espaços). # quantas letras tem o primeiro nome nco = (input('Digite seu nome completo: ')).strip() ncou = nco.upper() ncol = nco.lower() ncose = nco.count(' ') ncoc = len(nco) - ncose ncosp = nco.split() #tambem pode procurar o primeiro espaço, que vai jogar o valor do tamanho do nome completo # ncosp = nco.find(' ') daí print(ncosp) print('O nome com todas as letras maiúscula: {}\n' 'O nome com todas as letras minúsculas: {}\n' 'A quantidade de letras ao todo: {}\n' 'A quantidade de letras do primeiro nome ({}) : {}'.format(ncou, ncol, ncoc, ncosp[0], len(ncosp[0])))
""" Response to https://www.reddit.com/r/Python/comments/fwq1f3/procedurally_generated_object_attribute/ """ class Products(object): """Sale unit object for GoodPaws' products. """ def __init__(self): self.df = get_sheets(scopes, sheet_id, range_name, creds_path) self.df = self.df.set_index('order_id') dct_sku_dtype = {sku:'int64' for sku in lst_sku} self.df = self.df.astype(dct_sku_dtype) ##Walee walee = [ 't001_walee_S', 't001_walee_M', 't001_walee_L', 't001_walee_XL', 't001_walee_XXL' ] blues = [ 't001_walee_S', 't001_walee_M', 't001_walee_L', 't001_walee_XL' , 't001_walee_XXL' ] inventory = { 'walee': walee, 'blues' : blues } def total(self, inventory_index): """Total of a particular item. Arguments: inventory_index - a key into the inventory index (e.g. 'walee' or 'blues' for now. Sample usage: self.walee_total = self.total('walee') self.blues_total = self.total('blues') """ sum = 0 for key in self.inventory[inventory_index]: sum += np.sum(self.df.loc[:, key].values) return sum
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. def get_tensor_shape(tensor): shape = [] for dim in tensor.type.tensor_type.shape.dim: shape.append(dim.dim_value) if len(shape) == 4: shape = [shape[0], shape[2], shape[3], shape[1]] return shape
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_content(pluginname, "/app/home/skins/default/style.css")
def hormigon(): cantidad = float(input("¿Cuántos metros cúbicos de hormigón quieres?:")) cantidad_por_metro = [322,689,1177,156] tipo_material = ["Cemento","Arena","Grava","Agua"] materiales = {} for i in tipo_material: materiales[i] = cantidad_por_metro[tipo_material.index(i)]*cantidad return materiales materiales = hormigon() print(materiales)
class PluginNotInitialisableException(BaseException): pass class PluginNotActivatableException(BaseException): pass class PluginNotDeactivatableException(BaseException): pass class PluginAttributeMissingException(BaseException): pass class PluginRegistrationException(BaseException): pass
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/xtark/ros_ws/install/include;/home/xtark/ros_ws/devel/lib/rtabmap-0.19/../../include/rtabmap-0.19;/opt/ros/kinetic/include/opencv-3.3.1-dev;/opt/ros/kinetic/include/opencv-3.3.1-dev/opencv".split(';') if "/home/xtark/ros_ws/install/include;/home/xtark/ros_ws/devel/lib/rtabmap-0.19/../../include/rtabmap-0.19;/opt/ros/kinetic/include/opencv-3.3.1-dev;/opt/ros/kinetic/include/opencv-3.3.1-dev/opencv" != "" else [] PROJECT_CATKIN_DEPENDS = "cv_bridge;roscpp;rospy;sensor_msgs;std_msgs;std_srvs;nav_msgs;geometry_msgs;visualization_msgs;image_transport;tf;tf_conversions;tf2_ros;eigen_conversions;laser_geometry;pcl_conversions;pcl_ros;nodelet;dynamic_reconfigure;message_filters;class_loader;rosgraph_msgs;stereo_msgs;move_base_msgs;image_geometry;costmap_2d;rviz".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "-lrtabmap_ros;/home/xtark/ros_ws/devel/lib/librtabmap_core.so;/home/xtark/ros_ws/devel/lib/librtabmap_utilite.so;/home/xtark/ros_ws/devel/lib/librtabmap_gui.so;/usr/lib/arm-linux-gnueabihf/libz.so;/usr/local/lib/libg2o_core.so;/usr/local/lib/libg2o_types_slam2d.so;/usr/local/lib/libg2o_types_slam3d.so;/usr/local/lib/libg2o_types_sba.so;/usr/local/lib/libg2o_stuff.so;/usr/local/lib/libg2o_solver_csparse.so;/usr/local/lib/libg2o_csparse_extension.so;/usr/lib/arm-linux-gnueabihf/libcxsparse.so;/usr/local/lib/libg2o_solver_cholmod.so;/usr/lib/arm-linux-gnueabihf/libcholmod.so;/usr/lib/libOpenNI2.so;/opt/ros/kinetic/lib/liboctomap.so;/opt/ros/kinetic/lib/liboctomath.so;/opt/ros/kinetic/lib/libopencv_calib3d3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_core3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_dnn3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_features2d3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_flann3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_highgui3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_imgcodecs3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_imgproc3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_ml3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_objdetect3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_photo3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_shape3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_stitching3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_superres3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_video3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_videoio3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_videostab3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_viz3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_aruco3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_bgsegm3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_bioinspired3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_ccalib3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_cvv3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_datasets3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_dpm3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_face3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_fuzzy3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_hdf3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_img_hash3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_line_descriptor3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_optflow3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_phase_unwrapping3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_plot3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_reg3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_rgbd3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_saliency3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_stereo3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_structured_light3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_surface_matching3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_text3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_tracking3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_xfeatures2d3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_ximgproc3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_xobjdetect3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_xphoto3.so.3.3.1".split(';') if "-lrtabmap_ros;/home/xtark/ros_ws/devel/lib/librtabmap_core.so;/home/xtark/ros_ws/devel/lib/librtabmap_utilite.so;/home/xtark/ros_ws/devel/lib/librtabmap_gui.so;/usr/lib/arm-linux-gnueabihf/libz.so;/usr/local/lib/libg2o_core.so;/usr/local/lib/libg2o_types_slam2d.so;/usr/local/lib/libg2o_types_slam3d.so;/usr/local/lib/libg2o_types_sba.so;/usr/local/lib/libg2o_stuff.so;/usr/local/lib/libg2o_solver_csparse.so;/usr/local/lib/libg2o_csparse_extension.so;/usr/lib/arm-linux-gnueabihf/libcxsparse.so;/usr/local/lib/libg2o_solver_cholmod.so;/usr/lib/arm-linux-gnueabihf/libcholmod.so;/usr/lib/libOpenNI2.so;/opt/ros/kinetic/lib/liboctomap.so;/opt/ros/kinetic/lib/liboctomath.so;/opt/ros/kinetic/lib/libopencv_calib3d3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_core3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_dnn3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_features2d3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_flann3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_highgui3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_imgcodecs3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_imgproc3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_ml3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_objdetect3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_photo3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_shape3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_stitching3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_superres3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_video3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_videoio3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_videostab3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_viz3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_aruco3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_bgsegm3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_bioinspired3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_ccalib3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_cvv3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_datasets3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_dpm3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_face3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_fuzzy3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_hdf3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_img_hash3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_line_descriptor3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_optflow3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_phase_unwrapping3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_plot3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_reg3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_rgbd3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_saliency3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_stereo3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_structured_light3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_surface_matching3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_text3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_tracking3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_xfeatures2d3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_ximgproc3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_xobjdetect3.so.3.3.1;/opt/ros/kinetic/lib/libopencv_xphoto3.so.3.3.1" != "" else [] PROJECT_NAME = "rtabmap_ros" PROJECT_SPACE_DIR = "/home/xtark/ros_ws/install" PROJECT_VERSION = "0.19.3"
class Typography(object): """ Provides access to a rich set of OpenType typography properties. """ @staticmethod def GetAnnotationAlternates(element): """ GetAnnotationAlternates(element: DependencyObject) -> int Returns the value of the System.Windows.Documents.Typography.AnnotationAlternates�attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.AnnotationAlternates property. Returns: The current value of the System.Windows.Documents.TextElement.FontFamily attached property on the specified dependency object. """ pass @staticmethod def GetCapitals(element): """ GetCapitals(element: DependencyObject) -> FontCapitals Returns the value of the System.Windows.Documents.Typography.Capitals�attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.Capitals property. Returns: The current value of the System.Windows.Documents.Typography.Capitals attached property on the specified dependency object. """ pass @staticmethod def GetCapitalSpacing(element): """ GetCapitalSpacing(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.CapitalSpacing� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.CapitalSpacing property. Returns: The current value of the System.Windows.Documents.Typography.CapitalSpacing attached property on the specified dependency object. """ pass @staticmethod def GetCaseSensitiveForms(element): """ GetCaseSensitiveForms(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.CaseSensitiveForms� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.CaseSensitiveForms property. Returns: The current value of the System.Windows.Documents.Typography.CaseSensitiveForms attached property on the specified dependency object. """ pass @staticmethod def GetContextualAlternates(element): """ GetContextualAlternates(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.ContextualAlternates�attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.ContextualAlternates property. Returns: The current value of the System.Windows.Documents.Typography.ContextualAlternates attached property on the specified dependency object. """ pass @staticmethod def GetContextualLigatures(element): """ GetContextualLigatures(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.ContextualLigatures�attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.ContextualLigatures property. Returns: The current value of the System.Windows.Documents.Typography.ContextualLigatures attached property on the specified dependency object. """ pass @staticmethod def GetContextualSwashes(element): """ GetContextualSwashes(element: DependencyObject) -> int Returns the value of the System.Windows.Documents.Typography.ContextualSwashes� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.ContextualSwashes property. Returns: The current value of the System.Windows.Documents.Typography.ContextualSwashes attached property on the specified dependency object. """ pass @staticmethod def GetDiscretionaryLigatures(element): """ GetDiscretionaryLigatures(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.DiscretionaryLigatures�attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.DiscretionaryLigatures property. Returns: The current value of the System.Windows.Documents.Typography.DiscretionaryLigatures attached property on the specified dependency object. """ pass @staticmethod def GetEastAsianExpertForms(element): """ GetEastAsianExpertForms(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.EastAsianExpertForms�attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.EastAsianExpertForms property. Returns: The current value of the System.Windows.Documents.Typography.EastAsianExpertForms attached property on the specified dependency object. """ pass @staticmethod def GetEastAsianLanguage(element): """ GetEastAsianLanguage(element: DependencyObject) -> FontEastAsianLanguage Returns the value of the System.Windows.Documents.Typography.EastAsianLanguage� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.EastAsianLanguage property. Returns: The current value of the System.Windows.Documents.Typography.EastAsianLanguage attached property on the specified dependency object. """ pass @staticmethod def GetEastAsianWidths(element): """ GetEastAsianWidths(element: DependencyObject) -> FontEastAsianWidths Returns the value of the System.Windows.Documents.Typography.EastAsianWidths� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.EastAsianWidths property. Returns: The current value of the System.Windows.Documents.Typography.EastAsianWidths attached property on the specified dependency object. """ pass @staticmethod def GetFraction(element): """ GetFraction(element: DependencyObject) -> FontFraction Returns the value of the System.Windows.Documents.Typography.Fraction�attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.Fraction property. Returns: The current value of the System.Windows.Documents.Typography.Fraction attached property on the specified dependency object. """ pass @staticmethod def GetHistoricalForms(element): """ GetHistoricalForms(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.HistoricalForms� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.HistoricalForms property. Returns: The current value of the System.Windows.Documents.Typography.HistoricalForms attached property on the specified dependency object. """ pass @staticmethod def GetHistoricalLigatures(element): """ GetHistoricalLigatures(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.HistoricalLigatures�attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.HistoricalLigatures property. Returns: The current value of the System.Windows.Documents.Typography.HistoricalLigatures attached property on the specified dependency object. """ pass @staticmethod def GetKerning(element): """ GetKerning(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.Kerning�attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.Kerning property. Returns: The current value of the System.Windows.Documents.Typography.Kerning attached property on the specified dependency object. """ pass @staticmethod def GetMathematicalGreek(element): """ GetMathematicalGreek(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.MathematicalGreek� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.MathematicalGreek property. Returns: The current value of the System.Windows.Documents.Typography.MathematicalGreek attached property on the specified dependency object. """ pass @staticmethod def GetNumeralAlignment(element): """ GetNumeralAlignment(element: DependencyObject) -> FontNumeralAlignment Returns the value of the System.Windows.Documents.Typography.NumeralAlignment� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.NumeralAlignment property. Returns: The current value of the System.Windows.Documents.Typography.NumeralAlignment attached property on the specified dependency object. """ pass @staticmethod def GetNumeralStyle(element): """ GetNumeralStyle(element: DependencyObject) -> FontNumeralStyle Returns the value of the System.Windows.Documents.Typography.NumeralStyle� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.NumeralStyle property. Returns: The current value of the System.Windows.Documents.Typography.NumeralStyle attached property on the specified dependency object. """ pass @staticmethod def GetSlashedZero(element): """ GetSlashedZero(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.SlashedZero� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.SlashedZero property. Returns: The current value of the System.Windows.Documents.Typography.SlashedZero attached property on the specified dependency object. """ pass @staticmethod def GetStandardLigatures(element): """ GetStandardLigatures(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StandardLigatures� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StandardLigatures property. Returns: The current value of the System.Windows.Documents.Typography.StandardLigatures attached property on the specified dependency object. """ pass @staticmethod def GetStandardSwashes(element): """ GetStandardSwashes(element: DependencyObject) -> int Returns the value of the System.Windows.Documents.Typography.StandardSwashes� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StandardSwashes property. Returns: The current value of the System.Windows.Documents.Typography.StandardSwashes attached property on the specified dependency object. """ pass @staticmethod def GetStylisticAlternates(element): """ GetStylisticAlternates(element: DependencyObject) -> int Returns the value of the System.Windows.Documents.Typography.StylisticAlternates�attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticAlternates property. Returns: The current value of the System.Windows.Documents.Typography.StylisticAlternates attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet1(element): """ GetStylisticSet1(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet1� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet1 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet1 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet10(element): """ GetStylisticSet10(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet10� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet10 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet10 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet11(element): """ GetStylisticSet11(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet11� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet11 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet11 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet12(element): """ GetStylisticSet12(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet12� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet12 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet12 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet13(element): """ GetStylisticSet13(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet13� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet13 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet13 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet14(element): """ GetStylisticSet14(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet14� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet14 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet14 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet15(element): """ GetStylisticSet15(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet15� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet15 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet15 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet16(element): """ GetStylisticSet16(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet16� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet16 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet16 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet17(element): """ GetStylisticSet17(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet17� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet17 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet17 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet18(element): """ GetStylisticSet18(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet18� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet18 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet18 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet19(element): """ GetStylisticSet19(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet19� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet19 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet19 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet2(element): """ GetStylisticSet2(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet2� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet2 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet2 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet20(element): """ GetStylisticSet20(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet20� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet20 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet20 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet3(element): """ GetStylisticSet3(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet3� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet3 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet3 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet4(element): """ GetStylisticSet4(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet4� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet4 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet4 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet5(element): """ GetStylisticSet5(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet5� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet5 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet5 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet6(element): """ GetStylisticSet6(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet6� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet6 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet6 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet7(element): """ GetStylisticSet7(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet7� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet7 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet7 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet8(element): """ GetStylisticSet8(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet8� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet8 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet8 attached property on the specified dependency object. """ pass @staticmethod def GetStylisticSet9(element): """ GetStylisticSet9(element: DependencyObject) -> bool Returns the value of the System.Windows.Documents.Typography.StylisticSet8� attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.StylisticSet8 property. Returns: The current value of the System.Windows.Documents.Typography.StylisticSet8 attached property on the specified dependency object. """ pass @staticmethod def GetVariants(element): """ GetVariants(element: DependencyObject) -> FontVariants Returns the value of the System.Windows.Documents.Typography.Variants�attached property for a specified dependency object. element: The dependency object for which to retrieve the value of the System.Windows.Documents.Typography.Variants property. Returns: The current value of the System.Windows.Documents.Typography.Variants attached property on the specified dependency object. """ pass @staticmethod def SetAnnotationAlternates(element,value): """ SetAnnotationAlternates(element: DependencyObject,value: int) Sets the value of the System.Windows.Documents.Typography.AnnotationAlternates� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.AnnotationAlternates property. value: The new value to set the property to. """ pass @staticmethod def SetCapitals(element,value): """ SetCapitals(element: DependencyObject,value: FontCapitals) Sets the value of the System.Windows.Documents.Typography.Capitals�attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.Capitals property. value: The new value to set the property to. """ pass @staticmethod def SetCapitalSpacing(element,value): """ SetCapitalSpacing(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.CapitalSpacing� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.CapitalSpacing property. value: The new value to set the property to. """ pass @staticmethod def SetCaseSensitiveForms(element,value): """ SetCaseSensitiveForms(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.CaseSensitiveForms� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.CaseSensitiveForms property. value: The new value to set the property to. """ pass @staticmethod def SetContextualAlternates(element,value): """ SetContextualAlternates(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.ContextualAlternates� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.ContextualAlternates property. value: The new value to set the property to. """ pass @staticmethod def SetContextualLigatures(element,value): """ SetContextualLigatures(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.ContextualLigatures� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.ContextualLigatures property. value: The new value to set the property to. """ pass @staticmethod def SetContextualSwashes(element,value): """ SetContextualSwashes(element: DependencyObject,value: int) Sets the value of the System.Windows.Documents.Typography.ContextualSwashes� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.ContextualSwashes property. value: The new value to set the property to. """ pass @staticmethod def SetDiscretionaryLigatures(element,value): """ SetDiscretionaryLigatures(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.DiscretionaryLigatures�attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.DiscretionaryLigatures property. value: The new value to set the property to. """ pass @staticmethod def SetEastAsianExpertForms(element,value): """ SetEastAsianExpertForms(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.EastAsianExpertForms� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.EastAsianExpertForms property. value: The new value to set the property to. """ pass @staticmethod def SetEastAsianLanguage(element,value): """ SetEastAsianLanguage(element: DependencyObject,value: FontEastAsianLanguage) Sets the value of the System.Windows.Documents.Typography.EastAsianLanguage� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.EastAsianLanguage property. value: The new value to set the property to. """ pass @staticmethod def SetEastAsianWidths(element,value): """ SetEastAsianWidths(element: DependencyObject,value: FontEastAsianWidths) Sets the value of the System.Windows.Documents.Typography.EastAsianWidths� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.EastAsianWidths property. value: The new value to set the property to. """ pass @staticmethod def SetFraction(element,value): """ SetFraction(element: DependencyObject,value: FontFraction) Sets the value of the System.Windows.Documents.Typography.Fraction�attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.Fraction property. value: The new value to set the property to. """ pass @staticmethod def SetHistoricalForms(element,value): """ SetHistoricalForms(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.HistoricalForms� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.HistoricalForms property. value: The new value to set the property to. """ pass @staticmethod def SetHistoricalLigatures(element,value): """ SetHistoricalLigatures(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.HistoricalLigatures� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.HistoricalLigatures property. value: The new value to set the property to. """ pass @staticmethod def SetKerning(element,value): """ SetKerning(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.Kerning�attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.Kerning property. value: The new value to set the property to. """ pass @staticmethod def SetMathematicalGreek(element,value): """ SetMathematicalGreek(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.MathematicalGreek� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.MathematicalGreek property. value: The new value to set the property to. """ pass @staticmethod def SetNumeralAlignment(element,value): """ SetNumeralAlignment(element: DependencyObject,value: FontNumeralAlignment) Sets the value of the System.Windows.Documents.Typography.NumeralAlignment� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.NumeralAlignment property. value: The new value to set the property to. """ pass @staticmethod def SetNumeralStyle(element,value): """ SetNumeralStyle(element: DependencyObject,value: FontNumeralStyle) Sets the value of the System.Windows.Documents.Typography.NumeralStyle�attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.NumeralStyle property. value: The new value to set the property to. """ pass @staticmethod def SetSlashedZero(element,value): """ SetSlashedZero(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.SlashedZero�attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.SlashedZero property. value: The new value to set the property to. """ pass @staticmethod def SetStandardLigatures(element,value): """ SetStandardLigatures(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StandardLigatures� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StandardLigatures property. value: The new value to set the property to. """ pass @staticmethod def SetStandardSwashes(element,value): """ SetStandardSwashes(element: DependencyObject,value: int) Sets the value of the System.Windows.Documents.Typography.StandardSwashes� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StandardSwashes property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticAlternates(element,value): """ SetStylisticAlternates(element: DependencyObject,value: int) Sets the value of the System.Windows.Documents.Typography.StylisticAlternates� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticAlternates property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet1(element,value): """ SetStylisticSet1(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet1� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet1 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet10(element,value): """ SetStylisticSet10(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet10� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet10 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet11(element,value): """ SetStylisticSet11(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet11� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet11 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet12(element,value): """ SetStylisticSet12(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet12� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet12 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet13(element,value): """ SetStylisticSet13(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet13� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet13 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet14(element,value): """ SetStylisticSet14(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet14� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet14 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet15(element,value): """ SetStylisticSet15(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet15� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet15 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet16(element,value): """ SetStylisticSet16(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet16� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet16 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet17(element,value): """ SetStylisticSet17(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet17� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet17 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet18(element,value): """ SetStylisticSet18(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet18� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet18 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet19(element,value): """ SetStylisticSet19(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet19� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet19 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet2(element,value): """ SetStylisticSet2(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet2� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet2 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet20(element,value): """ SetStylisticSet20(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet20� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet20 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet3(element,value): """ SetStylisticSet3(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet3� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet3 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet4(element,value): """ SetStylisticSet4(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet4� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet4 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet5(element,value): """ SetStylisticSet5(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet5� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet5 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet6(element,value): """ SetStylisticSet6(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet6� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet6 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet7(element,value): """ SetStylisticSet7(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet7� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet7 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet8(element,value): """ SetStylisticSet8(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet8� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet8 property. value: The new value to set the property to. """ pass @staticmethod def SetStylisticSet9(element,value): """ SetStylisticSet9(element: DependencyObject,value: bool) Sets the value of the System.Windows.Documents.Typography.StylisticSet9� attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.StylisticSet9 property. value: The new value to set the property to. """ pass @staticmethod def SetVariants(element,value): """ SetVariants(element: DependencyObject,value: FontVariants) Sets the value of the System.Windows.Documents.Typography.Variants�attached property for a specified dependency object. element: The dependency object for which to set the value of the System.Windows.Documents.Typography.Variants property. value: The new value to set the property to. """ pass AnnotationAlternates=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that specifies the index of an alternate annotation form. Get: AnnotationAlternates(self: Typography) -> int Set: AnnotationAlternates(self: Typography)=value """ Capitals=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a System.Windows.FontCapitals enumerated value that indicates the capital form of the selected font. Get: Capitals(self: Typography) -> FontCapitals Set: Capitals(self: Typography)=value """ CapitalSpacing=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that determines whether inter-glyph spacing for all-capital text is globally adjusted to improve readability. Get: CapitalSpacing(self: Typography) -> bool Set: CapitalSpacing(self: Typography)=value """ CaseSensitiveForms=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that determines whether glyphs adjust their vertical position to better align with uppercase glyphs. Get: CaseSensitiveForms(self: Typography) -> bool Set: CaseSensitiveForms(self: Typography)=value """ ContextualAlternates=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that determines whether custom glyph forms can be used based upon the context of the text being rendered. Get: ContextualAlternates(self: Typography) -> bool Set: ContextualAlternates(self: Typography)=value """ ContextualLigatures=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that determines whether contextual ligatures are enabled. Get: ContextualLigatures(self: Typography) -> bool Set: ContextualLigatures(self: Typography)=value """ ContextualSwashes=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that specifies the index of a contextual swashes form. Get: ContextualSwashes(self: Typography) -> int Set: ContextualSwashes(self: Typography)=value """ DiscretionaryLigatures=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that determines whether discretionary ligatures are enabled. Get: DiscretionaryLigatures(self: Typography) -> bool Set: DiscretionaryLigatures(self: Typography)=value """ EastAsianExpertForms=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that determines whether the standard Japanese font forms have been replaced with the corresponding preferred typographic forms. Get: EastAsianExpertForms(self: Typography) -> bool Set: EastAsianExpertForms(self: Typography)=value """ EastAsianLanguage=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a System.Windows.FontEastAsianLanguage enumerated value that indicates the version of glyphs to be used for a specific writing system or language. Get: EastAsianLanguage(self: Typography) -> FontEastAsianLanguage Set: EastAsianLanguage(self: Typography)=value """ EastAsianWidths=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a System.Windows.FontEastAsianWidths enumerated value that indicates the proportional width to be used for Latin characters in an East Asian font. Get: EastAsianWidths(self: Typography) -> FontEastAsianWidths Set: EastAsianWidths(self: Typography)=value """ Fraction=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a System.Windows.FontFraction enumerated value that indicates the fraction style. Get: Fraction(self: Typography) -> FontFraction Set: Fraction(self: Typography)=value """ HistoricalForms=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that determines whether historical forms are enabled. Get: HistoricalForms(self: Typography) -> bool Set: HistoricalForms(self: Typography)=value """ HistoricalLigatures=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether historical ligatures are enabled. Get: HistoricalLigatures(self: Typography) -> bool Set: HistoricalLigatures(self: Typography)=value """ Kerning=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether kerning is enabled. Get: Kerning(self: Typography) -> bool Set: Kerning(self: Typography)=value """ MathematicalGreek=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether standard typographic font forms of Greek glyphs have been replaced with corresponding font forms commonly used in mathematical notation. Get: MathematicalGreek(self: Typography) -> bool Set: MathematicalGreek(self: Typography)=value """ NumeralAlignment=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a System.Windows.FontNumeralAlignment enumerated value that indicates the alighnment of widths when using numerals. Get: NumeralAlignment(self: Typography) -> FontNumeralAlignment Set: NumeralAlignment(self: Typography)=value """ NumeralStyle=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a System.Windows.FontNumeralStyle enumerated value that determines the set of glyphs that are used to render numeric alternate font forms. Get: NumeralStyle(self: Typography) -> FontNumeralStyle Set: NumeralStyle(self: Typography)=value """ SlashedZero=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a nominal zero font form should be replaced with a slashed zero. Get: SlashedZero(self: Typography) -> bool Set: SlashedZero(self: Typography)=value """ StandardLigatures=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether standard ligatures are enabled. Get: StandardLigatures(self: Typography) -> bool Set: StandardLigatures(self: Typography)=value """ StandardSwashes=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that specifies the index of a standard swashes form. Get: StandardSwashes(self: Typography) -> int Set: StandardSwashes(self: Typography)=value """ StylisticAlternates=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that specifies the index of a stylistic alternates form. Get: StylisticAlternates(self: Typography) -> int Set: StylisticAlternates(self: Typography)=value """ StylisticSet1=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet1(self: Typography) -> bool Set: StylisticSet1(self: Typography)=value """ StylisticSet10=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet10(self: Typography) -> bool Set: StylisticSet10(self: Typography)=value """ StylisticSet11=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet11(self: Typography) -> bool Set: StylisticSet11(self: Typography)=value """ StylisticSet12=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet12(self: Typography) -> bool Set: StylisticSet12(self: Typography)=value """ StylisticSet13=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet13(self: Typography) -> bool Set: StylisticSet13(self: Typography)=value """ StylisticSet14=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet14(self: Typography) -> bool Set: StylisticSet14(self: Typography)=value """ StylisticSet15=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet15(self: Typography) -> bool Set: StylisticSet15(self: Typography)=value """ StylisticSet16=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet16(self: Typography) -> bool Set: StylisticSet16(self: Typography)=value """ StylisticSet17=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet17(self: Typography) -> bool Set: StylisticSet17(self: Typography)=value """ StylisticSet18=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet18(self: Typography) -> bool Set: StylisticSet18(self: Typography)=value """ StylisticSet19=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet19(self: Typography) -> bool Set: StylisticSet19(self: Typography)=value """ StylisticSet2=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet2(self: Typography) -> bool Set: StylisticSet2(self: Typography)=value """ StylisticSet20=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet20(self: Typography) -> bool Set: StylisticSet20(self: Typography)=value """ StylisticSet3=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet3(self: Typography) -> bool Set: StylisticSet3(self: Typography)=value """ StylisticSet4=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet4(self: Typography) -> bool Set: StylisticSet4(self: Typography)=value """ StylisticSet5=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet5(self: Typography) -> bool Set: StylisticSet5(self: Typography)=value """ StylisticSet6=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet6(self: Typography) -> bool Set: StylisticSet6(self: Typography)=value """ StylisticSet7=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet7(self: Typography) -> bool Set: StylisticSet7(self: Typography)=value """ StylisticSet8=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet8(self: Typography) -> bool Set: StylisticSet8(self: Typography)=value """ StylisticSet9=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a value that indicates whether a stylistic set of a font form is enabled. Get: StylisticSet9(self: Typography) -> bool Set: StylisticSet9(self: Typography)=value """ Variants=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a System.Windows.FontVariants enumerated value that indicates a variation of the standard typographic form to be used. Get: Variants(self: Typography) -> FontVariants Set: Variants(self: Typography)=value """ AnnotationAlternatesProperty=None CapitalSpacingProperty=None CapitalsProperty=None CaseSensitiveFormsProperty=None ContextualAlternatesProperty=None ContextualLigaturesProperty=None ContextualSwashesProperty=None DiscretionaryLigaturesProperty=None EastAsianExpertFormsProperty=None EastAsianLanguageProperty=None EastAsianWidthsProperty=None FractionProperty=None HistoricalFormsProperty=None HistoricalLigaturesProperty=None KerningProperty=None MathematicalGreekProperty=None NumeralAlignmentProperty=None NumeralStyleProperty=None SlashedZeroProperty=None StandardLigaturesProperty=None StandardSwashesProperty=None StylisticAlternatesProperty=None StylisticSet10Property=None StylisticSet11Property=None StylisticSet12Property=None StylisticSet13Property=None StylisticSet14Property=None StylisticSet15Property=None StylisticSet16Property=None StylisticSet17Property=None StylisticSet18Property=None StylisticSet19Property=None StylisticSet1Property=None StylisticSet20Property=None StylisticSet2Property=None StylisticSet3Property=None StylisticSet4Property=None StylisticSet5Property=None StylisticSet6Property=None StylisticSet7Property=None StylisticSet8Property=None StylisticSet9Property=None VariantsProperty=None
"""Trait Browser App. This app handles displaying, searching, and browsing through information on source traits and harmonized traits. """ default_app_config = 'trait_browser.apps.TraitBrowserConfig'
# ------------------------------------ # CODE BOOLA 2015 PYTHON WORKSHOP # Mike Wu, Jonathan Chang, Kevin Tan # Puzzle Challenges Number 7 # ------------------------------------ # INSTRUCTIONS: # Using only 1 line, write a function # to reverse a list. The function is # passed a list as an argument. # EXAMPLE: # reverse_lst([1, 2, 3]) => [3, 2, 1] # reverse_lst([]) => [] # reverse_lst([1]) => [1] # reverse_lst([1, 1, 1, 2, 1, 1]) => [1, 1, 2, 1, 1, 1] # HINT: # lists have a reverse function! # If lst is a list, then lst.reverse() should # do the trick! After calling lst.reverse() # [you don't need to set it to a variable], # you can just return lst! def reverse_lst(lst): pass # 1 line return lst # Don't remove this! You want to return the lst.
# Copyright 2013 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """Top-level presubmit script for appengine/components/. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for details on the presubmit API built into gclient. """ def CommonChecks(input_api, output_api): files_to_skip = list(input_api.DEFAULT_FILES_TO_SKIP) + [ r'.*_pb2\.py$', ] disabled_warnings = [ # Pylint fails to recognize lazy module loading in components.auth.config, # no local disables work, so had to kill it globally. 'cyclic-import', 'relative-import', ] return input_api.canned_checks.RunPylint( input_api, output_api, files_to_skip=files_to_skip, disabled_warnings=disabled_warnings, pylintrc=input_api.os_path.join(input_api.PresubmitLocalPath(), '../../', 'pylintrc')) # pylint: disable=unused-argument def CheckChangeOnUpload(input_api, output_api): return [] def CheckChangeOnCommit(input_api, output_api): return CommonChecks(input_api, output_api)
__all__ = ['UserScript'] class UserScript: def __init__(self, id=None, activations=None): self.functions = [] self._function_by_name = {} self.id = id self.activations = [] if activations is None else activations def __len__(self): return len(self.functions) def __getitem__(self, index): return self.functions[index] def register(self, func): self.functions.append(func) self._function_by_name[func.__name__] = func def exec(self, index=None, name=None, *args, **kwargs): if index is not None: return self.functions[index](*args, **kwargs) elif name is not None: return self._function_by_name[name](*args, **kwargs) raise ValueError("index and name are both None")
class Solution: def findDuplicates(self, nums: List[int]) -> List[int]: n=len(nums); c=[0]*n ans=list() for i in range(n): c[nums[i]-1]+=1 for i in range(n): if(c[i]==2): ans.append(i+1) return ans;
def is_isogram(s): if isinstance(s, str): s = [i for i in s.lower() if i.isalpha()] return len(s) == len(set(s)) else: raise TypeError("This doesn't look like a string.")
# Copyright (c) 2020-2021 Matematyka dla Ciekawych Świata (http://ciekawi.icm.edu.pl/) # Copyright (c) 2020-2021 Robert Ryszard Paciorek <rrp@opcode.eu.org> # # MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. try: clipData except NameError: clipData = [] clipData += [ { 'title': [ "#10.1", "Podstawy", "sieci", "komputerowych" ] }, { 'comment': 'sieci - podstawy' }, { 'image': [ [0.0, eduMovie.convertFile('network.svg', margins=0)], ["chmurkiA", eduMovie.convertFile('sieci_chmurki_1.svg')], ["chmurkiB", eduMovie.convertFile('sieci_chmurki_2.svg')], ], 'text' : [ 'Sieć komputerowa jest to zbiór hostów, komputerów, innych urządzeń <m> sieciowych, okablowania oraz protokołów określających zasady komunikacji. <m>' 'Służy do zapewnienia komunikacji pomiędzy komputerami, przesyłu danych. <m>' 'Sieci komputerowe działają na zasadzie przesyłania informacji <m> w ramach pewnych fragmentów z których każdy posiada przynajmniej informacje <m> o adresie odbiorcy do którego ma trafić. <m>' 'Fragmenty takie nazywane są ramkami bądź pakietami <m> i zwykle oprócz adresu odbiorcy jest tam też adres nadawcy <m> i kilka innych informacji pomagających obsłużyć taki pakiet. <mark name="chmurkiA" /> <m>' 'Umieszczanie w nagłówku każdego z pakietów adresów umożliwia kierowanie <m> ruchem takich pakietów bez wcześniejszego fizycznego zestawiania łącz. <m>' 'W oparciu o ten adres host jest w stanie rozpoznać czy pakiet <m> jest przeznaczony dla niego czy nie, a przełączniki i routery mogą <m> kierować pakiety do odpowiednich fragmentów sieci. <m>' 'Jeżeli w sieci komputerowej host A chce się komunikować z hostem B, <m> a host C z hostem D nie musimy zapewnić im osobnych łączy <m> do przeprowadzania takiej komunikacji, <m>' 'tak jak to było na przykład w klasycznej telefonii analogowej, <m> gdzie dwie takie "rozmowy" wymagałyby zestawienia osobnych <m> fizycznych kabli od jednego abonenta do drugiego <m>' '(odbywało się to za pomocą przekaźników w centralach). <m>' 'W sieci komputerowej hosty te będą wytwarzały odpowiednio zaadresowane <m> pakiety i reagowały tylko na pakiety zaadresowane do nich. <m>' 'Dzięki temu pakiety, stanowiące osobne strumienie komunikacji, <m> mogą być z łatwością przesyłane tym samym fizycznym łączem. <m>' 'Host C może słyszeć lub nie komunikację pomiędzy hostami A i B <m> (zależy to od różnych czynników, na przykład od wykorzystywanej sieci <m> i względnego położenia tych hostów), natomiast wie że to "nie do niego". <mark name="chmurkiB" /> ' 'Jeżeli w ramach sieci mamy jakieś urządzenie dzielące ją na <m> mniejsze kawałki, podział ten będzie się odbywał w oparciu o adresy pakietów <m>' '– urządzenie takie do danej sieci będzie przekazywało <m> tylko pakiety adresowane do hostów w tej sieci. <m>' 'Mamy do czynienia z przełączaniem, czyli komutacją pakietów <m> – w odróżnieniu od (omówionej pokrótce na przykładzie telefonii) komutacji łączy, <m>' 'która polegała na zestawianiu fizycznego łącza <m> pomiędzy komunikującymi się hostami. <m>' ] }, { 'image': [ [0.0, eduMovie.convertFile('../../LPES-booklets/extra-tex-files/booklets-sections/network/ilustracje/10-warstwy.tex', margins=12)], ], 'text' : [ 'Protokoły sieciowe na ogół tworzą tak zwane stosy protokołów, <m> gdzie dane opakowywane są kolejno w nagłówki kolejnych protokołów. <m>' 'Każdy z protokołów w takim stosie pełni dedykowane mu funkcje <m> i na ogół nie ingeruje ani w protokoły warstwy niższej, <m> ani w przenoszoną przez niego zawartość, czyli protokoły warstwy wyższej z danymi. <m>' 'Struktura warstwowa jest standardowo opisywana w ramach <m> tak zwanego modelu <OSI>[O S I] który wyróżnia 7 warstw. <m>' 'Najniższą warstwą jest warstwa fizyczna <m> – zajmuje się ona definiowaniem takich aspektów jak na przykład: <m>' 'poziom sygnału elektrycznego w kablu tworzącym sieć, <m> częstotliwości radiowe w sieciach bezprzewodowych, <m> długości fali światła w sieciach optycznych i tak dalej. <m>' 'Tutaj określane jest też to w jaki sposób przesyłane są kolejne bity <m> – w jaki sposób kodowana jest jedynka logiczna, a w jaki zero. <m>' 'Ponieważ w przypadku takiej transmisji niekoniecznie jest tak że <m> napięcie wyższe odpowiada nam na przykład logicznej jedynce, a niższe zeru. <m>' 'Niekiedy jest to kodowanie bardziej skomplikowane. <m>' 'Warstwa ta określa też sposób kodowania kolejnych bajtów, <m> tak aby dało się identyfikować koniec i początek bajtu. <m>' 'Przykładem protokołu tej warstwy o którym już mówiliśmy jest <UART>[uart] <m> i możliwe jest jego użycie w sieciach komputerowych. <m>', ] }, { 'image': [ [0.0, eduMovie.convertFile('warstwy-slajd.tex', margins=12)], ], 'text' : [ 'Kolejną warstwą o numerze dwa w modelu <OSI>[O S I], <m> stąd często określaną jako L2, jest warstwa łącza danych. <m>' 'Definiuje ona aspekty takie jak adresacja urządzeń fizycznych, <m> format ramki (w tym identyfikację jej początku i końca) <m> oraz protokoły dostępu do medium transmisyjnego określonego w L1, <m>' 'czyli co zrobić jeżeli po tym samym kablu równocześnie <m> zaczną nadawać dwa urządzenia, jak takich sytuacji unikać, itd. <m>' 'Często warstwy pierwsza i druga określone są <m> jednym standardem bądź rodziną standardów. <m>' 'Bardzo często jest to Ethernet, <m> który używa takiego samego formatu ramki, tych samych rozwiązań L2 <m> dla różnych mediów transmisyjnych, różnych warstw L1 <m>' '– zarówno przewodowych miedzianych, optycznych jak i bezprzewodowych. <m>' 'Mogą to być też protokoły związane z sieciami komórkowymi, <m> transmisją danych poprzez telewizję kablową i tak dalej. <m>' 'Rolą trzeciej warstwy jest zapewnienie możliwości komunikacji <m> pomiędzy różnymi sieciami, różnymi standardami sieci L2. <m>' 'Określa ona własną adresację, która powinna być unikalna <m> nie tylko w ramach jednej sieci L2, ale w ramach wszystkich łączonych nią sieci, <m> można powiedzieć że unikalna globalnie. <m>' 'Najpopularniejszym protokołem tej warstwy jest IP. <m>', 'Kolejna, czwarta warstwa nazywana jest transportową <m> i ma dwa główne zadania – zapewnienie adresacji wewnątrz hosta <m> oraz zapewnienie kontroli przepływu danych. <m>' 'Warstwy druga i trzecia zajmują się jedynie <m> adresacją całych hostów, komputerów. <m>' 'Jednak jak wiemy na pojedynczym komputerze może równocześnie funkcjonować <m> wiele różnych usług sieciowych, wiele różnych procesów, klientów, itd. <m>' 'Konieczne jest zapewnienie możliwości wskazania do jakiej usługi <m> lub nawet do jakiego procesu ma być skierowana informacja zawarta w pakiecie. <m>' 'Warstwa ta zajmuje się także kontrolą jakości przesyłanych danych, <m> ponieważ warstwa sieciowa (w szczególności na przykład protokół IP) <m> nie zapewnia pewności przesyłania danych< >[.] <m>' '– pakiet IP zawsze może zaginąć bez żadnych informacji o tym że zaginął <m> i protokoły warstwy wyższej powinny być tego co najmniej świadome <m> lub nawet radzić sobie jakoś z takimi problemami żądając jego retransmisji. <m>' 'Najpopularniejszymi protokołami warstwy czwartej są UDP i <TCP>[ticipi]. <m> Oba zapewniają adresację usług i klientów. <m>' '<TCP>[ticipi] zapewnia także kontrolę otrzymywania kompletu pakietów <m> i mechanizmy retransmisji zagubionych pakietów. <m>', 'Kolejne warstwy modelu <OSI>[O S I] - piąta, szósta i siódma określają <m> sposób rozmowy i interpretacji danych przez konkretne aplikacje. <m>' 'Granice pomiędzy nimi są dość płynne <m> i nie będziemy ich na tych zajęciach traktować osobno. <m>' 'Co zresztą jest dość często spotykane, <m> gdyż podział ten bywa problematyczny – na przykład część zadań warstwy piątej <m> realizuje <TCP>[ticipi], będący ewidentnie warstwą czwartą. <m>' 'Spotkać się można także z innym modelem <m> związanym ze stosem protokołów z <TCP>[ticipi]/IP. <m>' 'Model ten wyróżnia jedynie 4 warstwy – dostępu do sieci obejmującą L1 i L2, <m> internetową (obejmującą L3), transportową (obejmującą L4) <m> i aplikacji obejmującą właśnie te trzy wyższe warstwy modelu <OSI>[O S I]. <m>', 'Nie każdy powszechnie stosowany protokół <m> daje się łatwo dopasować do konkretnej warstwy. <m>' 'Przykładem może być SSL/TLS odpowiedzialny za szyfrowanie <m> przesyłanych danych (na przykład robienie HTTPS z HTTP). <m>' 'Ewidentnie powinien on być powyżej warstwy transportowej bo zawarty jest <m> w jej pakietach, jednak nie jest on warstwą aplikacji z modelu <TCP>[ticipi]/IP, <m>' 'gdyż jest wspólny dla wielu aplikacji, jest niezależny od przesyłanych nim danych <m> i ewidentnie jest poniżej protokołów warstwy aplikacji takich jak wspomniany HTTP. <m>' 'Podobnie ciężko go wpasować w którąś z wyższych warstw <OSI>[O S I]. <m> Można by powiedzieć że stanowi warstwę <4>[cztery] i pół modelu <OSI>[O S I]. <m>' ] }, ]
def zero_initializer(n): assert isinstance(n, int) and n > 0 return [0] * n def zeros_initializer(n, n_args): if n_args == 1: return zero_initializer(n) return map(zero_initializer, [n] * n_args)
## Gerador de tabuada. canGenerateTabuada = False #print("Tabuada de: ") vInput = int(input("Tabuada de: ")) canGenerateTabuada = vInput >= 1 and vInput <= 10 while not canGenerateTabuada: print("Digite um valor de 1 a 10.") vInput = int(input("Tabuada de: ")) canGenerateTabuada = vInput >= 1 and vInput <= 10 pass ## Gerando tabuada for i in range(10): print(str(vInput) + " x " + str((i+1)) + " = " + str(vInput*(i+1))) pass
# Space: O(n) # Time: O(n!) class Solution: def combine(self, n: int, k: int): if k > n: return [] data = [i for i in range(1, n + 1)] # list all numbers status = [False for _ in range(len(data))] # identify if current item has been used or not def dfs(data, index, temp_res, res, k): if len(temp_res) == k: res.append(temp_res[:]) return for i in range(index, len(data)): if status[i]: continue # if current number has been used, then pass to next one status[i] = True temp_res.append(data[i]) dfs(data, i, temp_res, res, k) temp_res.pop() status[i] = False return res return dfs(data, 0, [], [], k)
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None # Approach 1 # O(N) - Space class Solution: def detectCycle(self, head: ListNode) -> ListNode: hashmap = set() node = head while node: if node is None: return None elif node in hashmap: return node else: hashmap.add(node) node = node.next def detect(head): if head is None: return hashmap = set() curr = head while curr: if curr in hashmap: return curr hashmap.add(curr) return None def detect(head): if head is None: return slow = head fast = head flag = None while fast and fast.next : slow = slow.next fast = fast.next.next if slow == fast: flag = fast break if flag: return iter1 = head iter2 = flag while iter1 and iter2: if iter1 is iter2: return iter1 iter1 = iter1.next iter2 = iter2.next # Approach 2 class Solution: def detectCycle(self, head: ListNode) -> ListNode: def helper(head): if head is None or head.next is None: return None slow = head fast = head while fast and fast.next: slow = slow.next fast = fast.next.next if slow is fast: return slow fast = helper(head) if fast is None: return None slow = head while fast is not slow: fast = fast.next slow = slow.next return slow
""" # Zdoom Textures Writer (zdtw) """ __version__ = "1.0" __author__ = "GianptDev" __date__ = '14-2-2022' # Revisioned. # will not include default properties in PatchData and TextureData, output will become smaller. compact_mode = True # ---------------------------------------- class PatchData(): """ Patch information for a patch element. Is used inside TextureData, but it can work indipendently. """ # ---------------------------------------- # List of style types. STYLE_TYPE = [ "add", "copy", "copyalpha", "copynewalpha", "modulate", "overlay", "reversesubtract", "subtract", "translucent", ] # all possible rotates, i really whish the engine could use an actual rotation. ROTATE_TYPE = [ 0, 90, 180, 270, ] # blend mode definition in Textures is bullshit, just use one of these in blend_mode BLEND_NONE = 0 BLEND_COLOR = 1 BLEND_TINT = 2 BLEND_TRANSLATION = 3 # ---------------------------------------- # all the properties of a single patch. # to change the blend to use, set blend_mode to one of the BLEND_ values. def __init__(self, path = "", positionX = 0, positionY = 0, flipX = False, flipY = False, use_offsets = False, style = "copy", rotate = 0, alpha = 1.0, blend_mode = BLEND_NONE, blend = (255,255,255), tint = 255, translation = "" ) -> None: self.path = str(path) self.positionX = int(positionX) self.positionY = int(positionY) self.flipX = bool(flipX) self.flipY = bool(flipY) self.use_offsets = bool(use_offsets) self.style = str(style) self.rotate = int(rotate) self.alpha = float(alpha) self.blend_mode = int(blend_mode) self.blend = blend # r,g,b self.tint = int(tint) self.translation = str(translation) def __repr__(self) -> str: return "PatchData[ \"" + str(self.path) + "\" ]" # ---------------------------------------- # write the patch block and return it as a string, on problems it will print some messages but will continue whit execution. # newline -> specifcy a string to use for new lines. # tab -> specify a string to use as tabulation. def write(self, newline = "\n", tab = "\t") -> str: result = "" props = "" # ---------------------------------------- if (not self.style.lower() in self.STYLE_TYPE): print( "Inside the patch \" " + str(self.path) + " \":\n" + " - The style \" " + str(self.style) + " \" is unknow.\n" + " Possible values are: " + str(self.STYLE_TYPE) ) return "" if (not int(self.rotate) in self.ROTATE_TYPE): print( "Inside the patch \" " + str(self.path) + " \":\n" + " - The rotate \" " + str(self.rotate) + " \" is unknow.\n" + " Possible values are: " + str(self.ROTATE_TYPE) ) return "" if ((self.blend_mode < self.BLEND_NONE) or (self.blend_mode > self.BLEND_TRANSLATION)): print( "Inside the patch \" " + str(self.path) + " \":\n" + " - The blend mode \" " + str(self.blend_mode) + " \" is unknow, please see BLEND_ values." ) # ---------------------------------------- # start of patch definition result += "patch \"" + str(self.path) + "\", " + str(int(self.positionX)) + ", " + str(int(self.positionY)) # flags if (self.use_offsets == True): props += tab + "UseOffsets" + newline if (self.flipX == True): props += tab + "flipX" + newline if (self.flipY == True): props += tab + "flipY" + newline # properties if ((compact_mode == False) or (compact_mode == True) and (self.style != "copy")): props += tab + "style " + str(self.style) + newline if ((compact_mode == False) or (compact_mode == True) and (self.rotate != 0)): props += tab + "rotate " + str(self.rotate) + newline if ((compact_mode == False) or (compact_mode == True) and (self.alpha != 1.0)): props += tab + "alpha " + str(self.alpha) + newline # color blend and tint work the same way. if ((self.blend_mode == self.BLEND_COLOR) or (self.blend_mode == self.BLEND_TINT)): props += tab + "blend " # check if is a iterable type if ((type(self.blend) is tuple) or (type(self.blend) is list)): if (len(self.blend) < 3): print( "Inside the patch \" " + str(self.path) + " \":\n" + " - The blend property require at least 3 (r,g,b) values." ) # if is a iterable type add all his value (even if only 3 are required...) for b in self.blend: props += str(b) + ", " props = props[:-2] # remove last ", " # if is a string it can be used as a hex color, nothing will check if is valid. elif (type(self.blend) is str): # add the quotes and the # if missing (slade automatically add it but gzdoom does not required it, so i'm not sure....) props += "\"" + ("#" if (self.blend[0] != "#") else "") + str(self.blend).upper() + "\"" # add the tint argoument if (self.blend_mode == self.BLEND_TINT): props += ", " + str(self.tint) props += newline # color translation is just a string tk add elif (self.blend_mode == self.BLEND_TRANSLATION): props += tab + "blend \"" + str(self.translation) + "\"" + newline # add property shit only if property do actually exist. if (props != ""): result += newline + "{" + newline + props + "}" + newline # ---------------------------------------- return result # ---------------------------------------- # to do #def read(self,data) -> bool: #return False # ---------------------------------------- # ---------------------------------------- class TextureData(): """ This class contain all the information about a texture definition. The result of write can be directly used as valid textures data. """ # ---------------------------------------- # list of know textures types. TEXTURE_TYPE = [ "sprite", "texture", "flat", "graphic", "walltexture", ] # ---------------------------------------- def __init__(self, name = "", type = "texture", sizeX = 64, sizeY = 128, optional = False, world_panning = False, no_decals = False, null_texture = False, offsetX = 0, offsetY = 0, scaleX = 1.0, scaleY = 1.0 ) -> None: self.name = str(name) self.type = str(type) self.sizeX = int(sizeX) self.sizeY = int(sizeY) self.offsetX = int(offsetX) self.offsetY = int(offsetY) self.scaleX = float(scaleX) self.scaleY = float(scaleY) self.optional = bool(optional) self.world_panning = bool(world_panning) self.no_decals = bool(no_decals) self.null_texture = bool(null_texture) self.patches = [] # This is the list of all patches inside this texture block def __repr__(self) -> str: return "<TextureData[ \"" + str(self.name) + "\" ]>" # ---------------------------------------- # add a patch in the list of patches, but only if is a valid PatchData def add_patch(self, patch) -> None: if (not type(patch) is PatchData): print( "Inside the texture \" " + str(self.name) + " \":\n" + " - Non-PatchData cannot be added, it may result in errors" ) return self.patches.append(patch) # return all patches that uses the specific path name. def get_patches(self, path) -> list: patches = self.patches result = [] for p in patches: if (p.path == path): result.append(p) return result # ---------------------------------------- # write the texture block and return it as a string, the result can be directly used for a textures file. # newline -> specify a string to use for new lines. # tab -> specify a string to use as tabulation. def write(self, newline = "\n", tab = "\t") -> str: result = "" # ---------------------------------------- if (not self.type.lower() in self.TEXTURE_TYPE): print( "Inside the texture \" " + str(self.name) + " \":\n" + " - The type \" " + str(type) + " \" is unknow.\n" + " Possible values are: " + str(self.TEXTURE_TYPE) ) return "" if (len(self.patches) <= 0): print( "Inside the texture \" " + str(self.name) + " \":\n" + " - No patch are used, the texture will be empty." ) # ---------------------------------------- # set the texture type result += self.type # add the optional flag first if (self.optional == True): result += " optional" # start of texture definition result += " \"" + str(self.name) + "\", " + str(int(self.sizeX)) + ", " + str(int(self.sizeY)) + newline + "{" + newline # flags if (self.world_panning == True): result += tab + "WorldPanning" + newline if (self.no_decals == True): result += tab + "NoDecals" + newline if (self.null_texture == True): result += tab + "NullTexture" + newline # properties if ((compact_mode == False) or (compact_mode == True) and ((self.offsetX != 0) or (self.offsetY != 0))): result += tab + "offset " + str(int(self.offsetX)) + ", " + str(int(self.offsetY)) + newline if ((compact_mode == False) or (compact_mode == True) and (self.scaleX != 1.0)): result += tab + "Xscale " + str(float(self.scaleX)) + newline if ((compact_mode == False) or (compact_mode == True) and (self.scaleY != 1.0)): result += tab + "Yscale " + str(float(self.scaleY)) + newline # add each patch to the result and make sure to tabulate. for p in self.patches: b = p.write(newline,tab) # fix extra newline if (b[-1] == newline): b = b[:-1] # do not execute work if the string is empty. if (b == ""): continue else: result += tab + b.replace(newline, newline + tab) + newline # end of patch definition result += "}" + newline return result # ---------------------------------------- # ---------------------------------------- # write a list of TextureData into a single string as a valid textures lump, does not write any file. # invalid data is ignored and will show a message. def write_textures(blocks, newline = "\n", tab = "\t") -> str: result = "" invalid_count = 0 # count invalid data clone_found = False # true if a texture is defined twince or more clone_count = {} # count every cloned definition # ---------------------------------------- # loop to every data in the input for b in blocks: # check if data is valid if (not type(b) is TextureData): invalid_count += 1 continue # check if a clone exist if (b.name in clone_count): clone_found = True clone_count[b.name] += 1 else: clone_count[b.name] = 1 # just write the block and merge whit the result result += b.write(newline,tab) + newline # ---------------------------------------- # display the amount of invalid data if (invalid_count > 0): print( "While writing the lump of size " + str(len(blocks)) + ":\n" + " - The input contain " + str(invalid_count) + " invalid data,\n" + " maybe non-TextureData or None are inside." ) # display the amount of clones if (clone_found == True): print( "While writing the lump of size " + str(len(blocks)) + ":\n" + " - Some textures are defined more than once:" ) # display each clone by the name and amount of clones for c in clone_count: if (clone_count[c] <= 1): continue print( " - - \"" + str(c) + "\" is defined " + str(clone_count[c]) + " times." ) # ---------------------------------------- return result # parse an actual textures definition into TextureData and PatchData instances, will not load a file. # the function work, but does not handle all errors yet, will receive changes in future versions. # load_textures, does nothing. # load_patches, if enabled will load patches data, if disabled patches are not loaded (resulting in empty textures). def read_textures(parse, endline = "\n", tab = "\t", load_textures = True, load_patches = True) -> list: result = [] # ---------------------------------------- # parse from string become an array. parse = parse.split(endline) # remove garbage for d in range(len(parse)): parse[d] = parse[d].replace(tab,"") parse[d] = parse[d].replace(",","") # clear useless stuff for d in range(len(parse)): if (d >= len(parse)): break if (parse[d] == ""): del parse[d] elif (parse[d] == "}"): parse[d] = None elif (parse[d] == "{"): del parse[d] # start to instance stuff current_patch = None current_texture = None for d in range(len(parse)): info = parse[d] if (info == None): if (current_patch != None): current_patch = None continue if (current_texture != None): current_texture = None continue # error to add print("what the? } used twince?") return [] # this is all the info when need to read the textures lump! info = info.split(" ") # stuff to load a texture if (info[0] in TextureData.TEXTURE_TYPE): if (current_texture != None): print("what the? texture defined twince?") return [] if (len(info) < 4): print("what the? not enough texture informations?") return [] is_optional = False if (info[1].lower() == "optional"): is_optional = True del info[1] # remove quotes if they exist. if (info[1][0] == "\""): info[1] = info[1][1:] if (info[1][-1] == "\""): info[1] = info[1][:-1] current_texture = TextureData() current_texture.type = info[0] current_texture.name = info[1] current_texture.sizeX = float(info[2]) current_texture.sizeY = float(info[3]) current_texture.optional = is_optional result.append(current_texture) # stuff to load a patch if ((load_patches == True) and (info[0].lower() == "patch")): if (current_texture == None): print("what the? patch connected to nothing?") return [] if (current_patch != None): print("what the? patch defined twince?") return [] if (len(info) < 4): print("what the? not enough patch informations?") return [] # remove quotes if they exist. if (info[1][0] == "\""): info[1] = info[1][1:] if (info[1][-1] == "\""): info[1] = info[1][:-1] current_patch = PatchData() current_patch.type = info[0] current_patch.path = info[1] current_patch.positionX = float(info[2]) current_patch.positionY = float(info[3]) current_texture.add_patch(current_patch) if (current_patch != None): p = info[0].lower() # properties if (len(info) >= 2): if (p == "style"): current_patch.style = info[1] elif (p == "rotate"): current_patch.rotate = int(info[1]) elif (p == "alpha"): current_patch.alpha = float(info[1]) elif (p == "blend"): # todo: blend mode is detected like shit if (len(info) >= 4): current_patch.blend = (int(info[1]),int(info[2]),int(info[3])) if (len(info) >= 5): current_patch.tint = int(info[4]) current_patch.blend_mode = current_patch.BLEND_TINT else: current_patch.blend_mode = current_patch.BLEND_COLOR elif (len(info) >= 2): current_patch.blend = info[1] current_patch.translation = info[1] # yeah... if (len(info) >= 3): current_patch.tint = int(info[2]) current_patch.blend_mode = current_patch.BLEND_TINT else: current_patch.blend_mode = current_patch.BLEND_COLOR else: print("what the? wrong blend data?") # flags else: if (p == "flipx"): current_patch.flipX = True elif (p == "flipy"): current_patch.flipY = True elif (p == "useoffsets"): current_patch.use_offsets = True if (current_texture != None): p = info[0].lower() # properties if (len(info) >= 2): if (p == "offset"): current_texture.offsetX = int(info[1]) current_texture.offsetY = int(info[2]) elif (p == "xscale"): current_texture.scaleX = float(info[1]) elif (p == "yscale"): current_texture.scaleY = float(info[1]) # flags else: if (p == "worldpanning"): current_texture.world_panning = True elif (p == "nodecals"): current_texture.no_decals = True elif (p == "nulltexture"): current_texture.null_texture = True # ---------------------------------------- # return a beautiful amount of classes! return result # ---------------------------------------- # Will convert a string into a valid sprite name, will add the frame character and angle by using a simple number. # index is the range between A and Z, a greater number will wrap around and override the name. # angle is the rotate of the sprite, 0 is no rotate and 1 to 8 are all rotate keys. def to_sprite_name(name, index = 0, angle = 0) -> None: result = "" # get only 4 characters for the name, it will be used to wrap around. wrap = [ord(name[0]) - 65,ord(name[1]) - 65,ord(name[2]) - 65,ord(name[3]) - 65] base = 25 # from A to Z # convert to base 26 while(True): # if the index is already under the limit, then no more shit is required. if (index >= base): index -= base # increase the next character every time the number is greater than the limit. for i in range(len(wrap)): i = len(wrap) - (i + 1) if (wrap[i] >= base): wrap[i] = 0 else: wrap[i] += 1 break else: break # build the new name. name = "" for i in wrap: name += chr(65 + i) frame = chr(65 + index) # add the frame string to the name. result += name + frame # add the rotate index. if (angle == 0): result += "0" elif (angle == 1): result += "1" elif (angle == 2): result += frame + "8" elif (angle == 3): result += frame + "7" elif (angle == 4): result += frame + "6" elif (angle == 5): result += "5" elif (angle == 6): result += frame + "4" elif (angle == 7): result += frame + "3" elif (angle == 8): result += frame + "2" return result # ---------------------------------------- # Exampes if __name__ == '__main__': # load test #ims = read_textures(open("test.txt","r").read()) #print(write_textures(ims)) #input() print("Zdoom Textures Parser examples:\n") empty = TextureData(type = "sprite",sizeX = 32, sizeY = 16) empty.name = to_sprite_name("PIST",0) wall = TextureData("WALLBRICK",type = "walltexture", optional = True, scaleY = 1.2) p = PatchData("textures/brick.png") wall.add_patch(p) more_patches = TextureData("WALLSTONE","walltexture",sizeX = 64, sizeY = 64) for i in [ PatchData("textures/stone1.png", flipX = True, rotate = 90), PatchData("textures/stone2.png",positionX = 32, blend_mode = PatchData.BLEND_TINT, blend = "ff0000"), ]: more_patches.add_patch(i) print("Empty texture example:") print(empty.write()) print("Texture whit a single patch:") print(wall.write()) print("Texture whit more patches:") print(more_patches.write()) # spam test #for i in range(26 ** 4): # c = to_sprite_name("AAAA",i) # print(c) # write test #print(write_textures([empty])) #open("test.txt","w").write(write_textures([more_patches,wall]))
# c_diccionarios.py # muestra ejemplos de operaciones con diccionarios # los diccionarios son pares de claves y valores encerrados entre {}, # y, al igual que los conjuntos, no admiten duplicados, PERO ENTRE SUS CLAVES agenda = {'Ana': 43782348, 'Beto': 45872394, 'Charly': 47893489} print(f'\nTenemos una agenda: {agenda}') # tienen la particularidad de poder devolver el valor asociado a una clave # referenciando a ese valor por su clave como si fuera un índice print(f'\nagenda["Ana"] devuelve el teléfono de Ana: {agenda["Ana"]}') # podemos agregar claves que todavía no existen del mismo modo agenda["Dani"] = 42875937 print(f'\nActualizamos el diccionario: {agenda}') # se comportan como conjuntos en la medida en la que no se haga alusión a sus valores, # es decir, por defecto devuelve sólo sus claves claves = list(agenda) print(f'\nNombres de la agenda: {claves}') al_reves = sorted(agenda, reverse=True) print(f'\nDados vuelta: {al_reves}') print(f'\nPregunto si Ana está en la agenda: {"Ana" in agenda}') print(f'\nPregunto si Juan está en la agenda: {"Juan" in agenda}') # el método dict() acepta dos maneras de pasarle valores para crear diccionarios numeros_por_clave = dict(uno=1, dos=2, tres=3, cuatro=4) numeros_por_coleccion = dict([('uno', 1), ('dos', 2), ('tres', 3), ('cuatro', 4)]) print(f'\ndict() con claves: {numeros_por_clave}') print(f'\ndict() con colecciones: {numeros_por_coleccion}') # admiten ser creados por comprensión cuadrados = {x: x**2 for x in range(1, 6)} print(f'\nDiccionario de cuadrados: {cuadrados}') # entre los métodos más comunmente utilizados encontramos: ana = agenda.get('Ana') dani = agenda.get('Dani') print(f'\ndict.get() devuelve el valor asociado al argumento: Ana = {ana}, Dani = {dani}') copia = agenda.copy() print(f'\ndict.copy() devuelve una copia: {copia}') dani_copia = copia.pop('Dani') print(f'\ndict.pop() borra una clave devolviendo su valor: Dani = {dani_copia}') print(f'\nCopia actualizada: {copia}') claves = agenda.keys() print(f'\ndict.keys() devuelve las claves: {claves}') valores = agenda.values() print(f'\ndict.values() devuelve los valores: {valores}') items = agenda.items() print(f'\ndict.items() devuelve pares de clave/valor: {items}') # al igual que dict(), dict.update() admite dos maneras de pasar diccionarios agenda.update(Ana=48973478) print(f'\ndict.update() admite actualizar por clave: {agenda}') agenda.update({'Eze': 46982190}) print(f'\nY también pasarle un diccionario: {agenda}') print()
############################################################################################################### # DESAFIO: 002 # TÍTULO: Respondendo ao Usuário # AULA: 04 # EXERCÍCIO: Faça um programa que leia o nome de uma pessoa e mostre uma mensagem de boas-vindas. ############################################################################################################### nome = input("Digite seu nome: ") print("É uma prazer te conhecer {}. ".format(nome))
#!/Users/philip/opt/anaconda3/bin/python a = [ "aa", "bb", "cc" ] print ( "".join(a) )
class Solution: def fairCandySwap(self, A: List[int], B: List[int]) -> List[int]: total_a = sum(A) total_b = sum(B) set_b = set(B) for candy in A: swap_item = candy + (total_b - total_a) / 2 if swap_item in set_b: return [candy, candy + (total_b - total_a) / 2]
# Shortest Unsorted Continuous Subarray """ Find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order. Return length of the shortest subarray. Example 1: nums = [2,6,4,8,10,9,15] o/p:- 5 Explanation: You need to sort [6, 4, 8, 10, 9] in ascending order to make the whole array sorted in ascending order. Example 2: nums = [1,2,3,4] o/p:- 0 """ def findUnsortedSubarray(nums): res=[] ans=[] final=[] for i in nums: res.append(i) res.sort() for i in range(0,len(nums)): if nums[i]!=res[i]: ans.append(i) if len(ans)==0: return 0 else: for i in range(ans[0],ans[len(ans)-1]+1): final.append(nums[i]) return len(final) nums=[] n=int(input("Enter the no. of elements: ")) print("Enter the elements of the array one by one: ") for i in range(0,n): ele=int(input()) nums.append(ele) answer=findUnsortedSubarray(nums) print("The length of the shortest subarray:",answer)
def sanduiche (*toppings): """Monta o sanduiche""" print("\n Sanduíche composto de :") for toppping in toppings: print("\t"+toppping) sanduiche('queijo','maionese','presunto') sanduiche('pasta de amendoin','geleia') sanduiche('manteiga', 'queijo', 'oregano','tomate')
class ARMAModel(): def __init__(self, gamma=0.15, beta=0.8): self.gamma_param = gamma self.beta_param = beta def predict(self, x): x_simplified = x[0, 0, :] # convert to a simple array, ignoring batch size return (self.beta_param * x_simplified[-1]) + \ (self.gamma_param * x_simplified[-2]) + \ ((1 - (self.gamma_param + self.beta_param)) * x_simplified[-3])
"""Debug flag.""" ON: bool = False
# Write a program to check whether a given number is an ugly number. # Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. # Example 1: # Input: 6 # Output: true # Explanation: 6 = 2 × 3 # Example 2: # Input: 8 # Output: true # Explanation: 8 = 2 × 2 × 2 # Example 3: # Input: 14 # Output: false # Explanation: 14 is not ugly since it includes another prime factor 7. # Note: # 1 is typically treated as an ugly number. # Input is within the 32-bit signed integer range: [−231, 231 − 1]. class Solution: def isUgly(self, num: int) -> bool: if num<=0: return False for p in [2,3,5]: if num%p==0: num=num//p if num==1: return True return False if __name__ == "__main__": n=14 print(Solution().isUgly(n))
somaidade = 0 médiaidade = 0 maioridadehomem = 0 nomevelho = '' totmulher20 = 0 for p in range(1, 5): print('---- {}ª PESSOA ---- '.format(p)) Nome = str(input('Nome: ')).strip() Idade = int(input('Idade: ')) Sexo = str(input('Sexo [M/F] ')).strip() somaidade += Idade if p == 1 and Sexo in 'Mm': maioridadehomem = Idade nomevelho = Nome if Sexo in 'Mm' and Idade > maioridadehomem: maioridadehomem = Idade nomevelho = Nome if Sexo in 'Ff' and Idade < 20: totmulher20 += 1 médiaidade = somaidade / 4 print('A média de idade de grupo ŕ do {} anos '.format(médiaidade)) print('O homem mais velho tem {} anos e se chama {} '.format(maioridadehomem, nomevelho)) print('Ao todo são {} mulheres com menos de 20 anos '.format(totmulher20))
class InterpretationParser: def __init__(self, socketio): self.interpreter = None self.entity_intent_map = {'item_attribute_query': {'attribute': None, 'entity': None}, 'batch_restriction_query': {'attribute': None, 'class': None}, 'batch_restriction_query_numerical': {'class': None, 'attribute': None, 'comparison': None, 'numerical_value': None}, 'batch_restriction_query_numerical_and_attribute': {'attribute': [], 'class': None, 'comparison': None, 'numerical_value': None} } self.socketio = socketio def parse_question_interpretation(self, question): result = self.interpreter.parse(question) # get the key components and their types out # get the intent of the question intent = result['intent']['name'] entities = result['entities'] result = self.fill_in_components(intent, entities) return result def fill_in_components(self, intent, entities): obj = self.entity_intent_map[intent] for entity in entities: entity_type = entity['entity'] term = entity['value'].lower() slot = obj[entity_type] if type(slot) is list: obj[entity_type].append(term) # more than one term should present ... else: obj[entity_type] = term return {'type': intent, 'entities': obj}
list_of_users=[] # it stores the list of usernames in form of strings def fun(l1): global list_of_users list_of_users=l1 def fun2(): return list_of_users
# Scrapy settings for gettaiex project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/topics/settings.html # BOT_NAME = 'gettaiex' BOT_VERSION = '1.0' SPIDER_MODULES = ['gettaiex.spiders'] NEWSPIDER_MODULE = 'gettaiex.spiders' USER_AGENT = '%s/%s' % (BOT_NAME, BOT_VERSION)
penctutions = ".,;?()[]{}&_-@%<>:!~1234567890/*+$#^/" newt = "" #text without penctutions List2 = [] text = str("Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of de Finibus Bonorum et Malorum (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, Lorem ipsum dolor sit amet.., comes from a line in section 1.10.32.The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from de Finibus Bonorum et Malorum by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.") for char in text: if char not in penctutions: newt += char for char in newt: y = ord(char) x = 128 - y List2.append(x) print(List2[::-1])
""" Demonstration of defining functions. """ def sayhello(): """ Prints "hello". """ print("hello") # Call the function sayhello() def double(value): """ Return twice the input value """ return value * 2 # Call the function and assign the result to a variable result = double(6) print(result) def product(value1, value2, value3): """ Returns the product of the three input values. """ prod = value1 * value2 prod = prod * value3 return prod # Call the function and assign the result to a variable result = product(7, 13.3, -1.2) print(result) """ Demonstration of parameters and variables within functions. """ def fahrenheit_to_celsius(fahrenheit): """ Return celsius temperature that corresponds to fahrenheit temperature input. """ offset = 32 multiplier = 5 / 9 celsius = (fahrenheit - offset) * multiplier print("inside function:", fahrenheit, offset, multiplier, celsius) return celsius temperature = 95 converted = fahrenheit_to_celsius(temperature) print("Fahrenheit temp:", temperature) print("Celsius temp:", converted) # Variables defined inside a function are local to that function fahrenheit = 27 offset = 2 multiplier = 19 celsius = 77 print("before:", fahrenheit, offset, multiplier, celsius) newtemp = fahrenheit_to_celsius(32) print("after:", fahrenheit, offset, multiplier, celsius) print("result:", newtemp)
_base_ = './rr_yolov3_d53_416_coco.py' # model settings model = dict( type='SingleStageDetector', pretrained=None, backbone=dict(type='RRTinyYolov4Backbone'), neck=None, bbox_head=dict( type='RRTinyYolov4Head', num_classes=80, in_channels=[512, 256], out_channels=[256, 128], anchor_generator=dict( type='YOLOAnchorGenerator', base_sizes=[[(81, 82), (135, 169), (344, 319)], [(23, 27), (37, 58), (81, 82)]], strides=[32, 16]), bbox_coder=dict(type='YOLOBBoxCoder'), featmap_strides=[32, 16], loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0, reduction='sum'), loss_conf=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0, reduction='sum'), loss_xy=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=2.0, reduction='sum'), loss_wh=dict(type='MSELoss', loss_weight=2.0, reduction='sum')))
# Time: O(logn) = O(1) # Space: O(1) # 29 # Divide two integers without using multiplication, division and mod operator. # Return the quotient after dividing dividend by divisor. # # The integer division should truncate toward zero. # - Both dividend and divisor will be 32-bit signed integers. # - The divisor will never be 0. # - Assume we are dealing with an environment which could only store integers within the 32-bit signed integer # range: [−2^31, 2^31 − 1]. For the purpose of this problem, assume that your function returns 2^31 − 1 # when the division result overflows. ## 要求不用乘,除和模操作完成除法操作,所以我们考虑使用减法。 ## 不断地减掉除数,直到为0为止。使用倍增的思想优化, 可以将减法的次数优化到对数时间复杂度. ## SOL: for a // b: rewrite a//b = c0*2^0 + c1 * 2^1 + c2 * 2^2... + cn * 2^n, cofficient cn 为对应2^n需要减的次数。 ## 因为 2^1, 2^2, 2^3是离散的,所以cn可能大于1. ## use shift instead of multiplication when double the factor. class Solution: def divide(self, dividend, divisor): # USE THIS: in first pass, deduct factors (from small to large) as many as possible """ :type dividend: int :type divisor: int :rtype: int """ positive = (dividend < 0) is (divisor < 0) # OR positive = dividend > 0 and divisor > 0 or dividend < 0 and divisor < 0 dividend, divisor = abs(dividend), abs(divisor) res = 0 while dividend >= divisor: temp, q = divisor, 1 # 7//3 will run outer loop twice while dividend >= temp: dividend -= temp res += q q <<= 1 # double temp <<= 1 # double if not positive: res = -res return min(max(-2**31, res), 2**31-1) def divide2(self, dividend, divisor): # same as solution 1, except deduct the biggest factor first positive = (dividend < 0) is (divisor < 0) dividend, divisor = abs(dividend), abs(divisor) res = 0 while dividend >= divisor: temp, q = divisor, 1 # 7//3 will run outer loop once while dividend >= (temp << 1): q <<= 1 # double temp <<= 1 # double dividend -= temp res += q if not positive: res = -res return min(max(-2**31, res), 2**31-1) def divide_recursive(self, dividend: int, divisor: int) -> int: def div(a, b): ans, olda = 0, a while a >= b: a -= b ans += 1 q, less = div(a, b<<1) a -= less ans += q << 1 return ans, olda - a pos = (dividend > 0) is (divisor > 0) dvd, dvs = abs(dividend), abs(divisor) ans, _ = div(dvd, dvs) if not pos: ans = -ans return min(max(-2**31, ans), 2**31-1) def divide3(self, dividend, divisor): # same as solution 1, except maintain the power of 2 result, dvd, dvs = 0, abs(dividend), abs(divisor) while dvd >= dvs: inc = dvs i = 0 while dvd >= inc: dvd -= inc result += 1 << i inc <<= 1 i += 1 if dividend > 0 and divisor < 0 or dividend < 0 and divisor > 0: result = -result return min(max(result, -2**31), 2**31-1) if __name__ == "__main__": #print(Solution().divide(-2147483648, -1)) # 2147483647. Overflow, valid return range [-2^31, 2^31-1] print(Solution().divide(94, 3)) # 31 print(Solution().divide(10, 3)) # 3 print(Solution().divide(7, -3)) # -2 print(Solution().divide(123, 12)) # 10 print(Solution().divide(123, -12)) # -10 print(Solution().divide(-123, 12)) # -10 print(Solution().divide(-123, -12)) # 10
def isWordGuessed(secretWord, lettersGuessed): ''' secretWord: string, the word the user is guessing lettersGuessed: list, what letters have been guessed so far returns: boolean, True if all the letters of secretWord are in lettersGuessed; False otherwise ''' # FILL IN YOUR CODE HERE... for each_letter in secretWord: if each_letter not in lettersGuessed: return False return True print(isWordGuessed('apple', ['e', 'a', 'l', 'i', 'k', 'p', 'r', 's']))
class Solution: def permute(self, nums: list) -> list: # ans = [] # n = len(nums) # tmp = [] # def backtrack(nums): # for k in range(len(nums)): # tmp.append(nums[k]) # if len(tmp) == n: # ans.append(tmp) # tmp = [] # return # else: # backtrack(nums[k+1:]) # return # backtrack(nums) # return ans ''' 什么是全排列 所谓全排列,无非就是各个元素一次交换位置 ''' ans = [] n = len(nums) def backtrack(first): #数组或者子数组的头元素,时刻在改变 if first == n: ans.append(nums.copy()) return for k in range(first, n): #大数组的交换中 嵌套着 小数组的交换 nums[first], nums[k] = nums[k], nums[first] backtrack(first+1) nums[first], nums[k] = nums[k], nums[first] #从函数中出来,还要再交换回来,供后来者使用 return backtrack(0) return ans
def extractNadenadeshitai(item): """ Nadenadeshitai """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if item['title'].startswith('Command Chapter '): return buildReleaseMessageWithType(item, 'Command Sousa Skill de, Isekai no Subete wo Kage kara Shihaishitemita', vol, chp, frag=frag, postfix=postfix) return False
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def preorderTraversal(self, root): """ :type root: TreeNode :rtype: List[int] """ if root is None: return [] stack, output = [root, ], [] while stack: root = stack.pop() if root is not None: output.append(root.val) if root.right is not None: stack.append(root.right) if root.left is not None: stack.append(root.left) return output if __name__ == "__main__": solution = Solution() node = TreeNode(2) node.left = TreeNode(1) node.right = TreeNode(3) node.right.left = TreeNode(4) print(solution.levelOrder(node))
v = float(input('Qual é a velocidade atual do seu carro: ')) #Recebe a velocidade atual if v > 80.0: print('MULTADO. Você excedeu o limite permitido que é de 80 Km/h.') multa = (v - 80) * 7.0 print('Você deve pagar uma multa de R$ {:.2f}'.format(multa)) print('Tenha um bom dia. Dirija com segurança!')
""" Find whether string s is divisible by string t. A string s divisible by string t if string t can be concatenated some number of times to obtain the string s. If s is divisible, find the smallest string u such that it can be concatenated some number of times to obtain both s and t. If it is not divisible, set the return value to -1. Finally, return the length of the string u or -1. Example 1: s = "bcdbcdbcdbcd" t = "bcdbcd" If string t is concatenated twice, the result is "bcdbcdbcdbcd" which is equal to the string s. The string s is divisible by string t. Since it passes the first test, look for the smallest string u that can be concatenated to create both strings s and t. The string "bcd" is the smallest string that can be concatenated to create both strings s and t. The length of the string u is 3, the integer value to return. Example 2: s = "bcdbcdbcd" t = "bcdbcd" If string t is concatenated twice, the result is "bcdbcdbcdbcd" which is greater than string s. There is an extra "bcd" in the concatenated string. The string s is not divisible by string t, so return -1. Function Description Complete the function findSmallestDivisor in the editor below. The function should return a single integer denoting the length of the smallest string u if string s is divisible by string t, or return -1 if not. findSmallestDivisor has the following parameter(s): s : string s t : string t Constraints 1 ≤ size of s ≤ 2 x 10^5 1 ≤ size of t ≤ 2 x 10^5 size of t ≤ size of s SOLUTION Time O(S^2) Space O(S): string U can grow to be as long as S See https://leetcode.com/discuss/interview-question/427484/mathworks """ def solve(s: str, t: str) -> int: if len(s) % len(t) != 0: return -1 for i in range(len(s)): if s[i] != t[i % len(t)]: return -1 for i in range(1, len(t) + 1): if len(t) % i != 0: continue u = t[:i] * int(len(t) / i) # Time O(S) if u == t: return i return -1
#!/usr/bin/env python3 ''' This is a multiline comment ''' print("This is some dummy code") # Hi # This shouldn't count as another comment '''neither should this'''
class Pessoa: olhos = 2 def __init__(self, *filhos, nome=None, idade=35): self.nome = nome self.idade = idade self.filhos = list(filhos) def cumprimentar(self): return f'Olá meu nome é {self.nome}' @staticmethod def metodo_estatico(): return 42 @classmethod def nome_e_atributos_de_classe(cls): return f'{cls} - olhos {cls.olhos}' class Homem(Pessoa): def cumprimentar(self): cumprimentar_da_classe=super().cumprimentar() return f'{cumprimentar_da_classe}. Aperto de mão' class Mutante(Pessoa): olhos = 3 if __name__ == '__main__': ricardo = Mutante(nome='Ricardo') serafim = Homem(ricardo, nome='Serafim') print(Pessoa.cumprimentar(serafim)) print(id(serafim)) print(serafim.cumprimentar()) print(serafim.nome) print(serafim.idade) for filho in serafim.filhos: print(filho.nome) serafim.sobrenome = 'Branco' del serafim.filhos serafim.olhos = 1 del serafim.olhos print(serafim.__dict__) print(ricardo.__dict__) print(Pessoa.olhos) print(serafim.olhos) print(ricardo.olhos) print(id(Pessoa.olhos), id(serafim.olhos), id(ricardo.olhos)) print(Pessoa.metodo_estatico(), serafim.metodo_estatico()) print(Pessoa.nome_e_atributos_de_classe(), serafim.nome_e_atributos_de_classe()) pessoa = Pessoa('Anonimo') print(isinstance(pessoa, Pessoa)) print(isinstance(pessoa, Homem)) print(isinstance(ricardo, Pessoa)) print(isinstance(ricardo, Homem)) print(ricardo.olhos) print(serafim.cumprimentar()) print(ricardo.cumprimentar())
""" FastAPI uses data models (pydantic) to validate data types For each resource (data), describe how it should look and behave at various stage """
def sock_merchant(n, ar): stock = set() pairs = 0 for socks in ar: if socks in stock: stock.remove(socks) pairs += 1 else: stock.add(socks) return pairs n = int(input("Number of socks: ")) ar = list( map(int, input("Different socks (spaces in between): ").rstrip().split())) print("sock_merchant():", sock_merchant(n, ar)) """ Number of socks: 10 Different socks (spaces in between): 1 2 2 2 1 2 2 2 1 2 sock_merchant(): 4 """
class Solution: def halveArray(self, nums: List[int]) -> int: halfSum = sum(nums) / 2 ans = 0 runningSum = 0.0 maxHeap = [-num for num in nums] heapq.heapify(maxHeap) while runningSum < halfSum: maxValue = -heapq.heappop(maxHeap) / 2 runningSum += maxValue heapq.heappush(maxHeap, -maxValue) ans += 1 return ans
# TODO BenM/assessor_of_assessor/pick this up later; it isn't required for the # initial working solution class TestPyxnatSession: def __init__(self, project, subject, session, scans, assessors): self.scans_ = scans self.assessors_ = assessors self.project = project self.subject = subject self.session = session def scans(self): return self.scans_ def assessors(self): return self.assessors_ class TestAttrs: def __init__(self, properties): pass class TestPyxnatScan: def __init__(self, project, subject, session, scanjson): self.scanjson = scanjson self.project = project self.subject = subject self.session = session uristr = '/data/project/{}/subjects/{}/experiments/{}/scans/{}' self._uri = uristr.format(project, subject, session, self.scanjson['label']) def id(self): return self.scanjson['id'] def label(self): return self.scanjson['label'] class TestPyxnatAssessor: def __init__(self, project, subject, session, asrjson): self.asrjson = asrjson self.project = project self.subject = subject self.session = session uristr = '/data/project/{}/subjects/{}/experiments/{}/assessors/{}' self._uri = uristr.format(project, subject, session, self.asrjson['label']) def id(self): return self.asrjson['id'] def label(self): return self.asrjson['label'] def inputs(self): return self.asrjson['xsitype'] + '/' + self.asrjson['inputs']
def Main(): """ :return: """ a = 1 c = 3 a += c b = 10 b -= a d = 2 b *= d b /= c b %= 3 f = b + 20 # f |= 34 # this doesn't curretly work return f # expect 21
def operation(first,second,operator): if(operator == 1): return first + second if(operator == 2): return first - second if(operator == 3): return first / second if(operator == 4): return first * second return "invalid selection or input" print("Welcome to calculator.py, please enter 2 values to perform an operation") firstValue = float(input("What is the first value? \n")) secondValue = float(input("What is the second value? \n")) print("Available operations") print("1. add - add two numbers") print("2. sub - subtract two numbers") print("3. div - divide two numbers") print("4. mul - multiply two numbers") operator = int(input("What operation would you like to perform? \n")) print(operation(firstValue,secondValue,operator))
class NoDataForTrigger(ValueError): """An error that's raised when a trigger is passed a data point that cannot be handled due to an incompatible value being stored""" pass class IncompatibleTriggerError(NoDataForTrigger): """An error that's raised when a trigger is passed a data point that cannot be handled due to an incompatible value being stored""" pass
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyYarl(PythonPackage): """The module provides handy URL class for URL parsing and changing.""" homepage = "https://github.com/aio-libs/yarl" url = "https://github.com/aio-libs/yarl/archive/v1.4.2.tar.gz" version('1.7.2', sha256='19b94c68e8eda5731f87d79e3c34967a11e69695965113c4724d2491f76ad461') version('1.4.2', sha256='a400eb3f54f7596eeaba8100a8fa3d72135195423c52808dc54a43c6b100b192') depends_on('python@3.5:', type=('build', 'run')) depends_on('py-setuptools', type='build') depends_on('py-setuptools@40:', type='build', when='@1.7.2:') depends_on('py-cython', type='build') depends_on('py-multidict@4.0:', type=('build', 'run')) depends_on('py-idna@2.0:', type=('build', 'run')) depends_on('py-typing-extensions@3.7.4:', type=('build', 'run'), when='@1.7.2: ^python@:3.7') @run_before('build') def fix_cython(self): if self.spec.satisfies('@1.7.2:'): pyxfile = 'yarl/_quoting_c' else: pyxfile = 'yarl/_quoting' cython = self.spec['py-cython'].command cython('-3', '-o', pyxfile + '.c', pyxfile + '.pyx', '-Iyarl')
mod, maxn, cur, ans, r = 998244353, 1000005, 10, 0, 0 dp, x, a = [0] * maxn, [0] * maxn, [0] * 12, x[1] = 1 dp[0] = 1 for i in range(2 , maxn): x[i] = mod - (mod // i) * x[mod % i] % mod n, k = map(int, input().split()) n = n // 2 p = [0] * k for u in map(int, input().split()): cur = min(cur, u) p[r] = u r += 1 for i in range(k): a[p[i] - cur] = 1 for i in range(n * 10 + 1): sm, j = 0, 0 while j < min(10, i + 1): sm += dp[i-j] * (j+1) * a[j+1] * n % mod j += 1 j = 1 while j < min(10, i + 1): sm -= dp[i-j+1] * (i-j+1) * a[j] j += 1 ans = (ans + dp[i] * dp[i]) % mod dp[i+1] = sm * x[i+1] % mod print(ans % mod)
def nomina(salario, horasNormales, horasExtra): if horasNormales+horasExtra>=36 and horasNormales+horasExtra<=43: salario=salario+horasExtra*1.25 elif horasNormales+horasExtra>=44: salario=salario+horasExtra*1.5 else: salario=salario return print(salario) nomina(1500,35,0)
# Exercise 051 - Arithmetic Progression """Develop a program that reads the first term and reason of an AP. At the end, show the first 10 terms of this progression.""" # To facilitate your viewing: first_term = int(input("What is the first term of this Arithmetic Progression?: ")) r = int(input("What is the common difference for progression? ")) num_terms = int(input("How many terms you want in this Arithmetic Progression?: ")) nth_term = first_term + (num_terms - 1) * r for i in range(first_term, nth_term, r): print(i, end=" > ") print("End") # ------- # Code explained """An arithmetic progression is a numerical sequence in which each term, starting from the second, is equal to the sum of the previous term with a constant r. The number r is called the ratio or common difference of the arithmetic progression.""" # 1. We'll ask the user to input the first term of our AP first_term = int(input("What is the first term of this Arithmetic Progression?: ")) # 2. We ask the common difference (r) of our AP r = int(input("What is the common difference for progression? ")) """ Here's the trick, only with these two variables we have a problem Our AP, will not work, because we want the first ten terms of this progression to solve our problem we use what is calles the general term of an arithmetic progression (nth term) The formula is: nth term = first term + (the_nº_of_terms_we_want - 1) * r We could do this calculation and put 10 as our "the_nº_of_terms_we_want" But that would only solve this question for the first 10 terms Let's create a question that solves for any number of terms """ # 3. We create a variable with the_nº_of_terms_we_want num_terms = int(input("How many terms you want in this Arithmetic Progression?: ")) # 4. Now let's do our nth_term equation nth_term = first_term + (num_terms - 1) * r # When creating our for loop, we will use the range function, remember range(star, stop, step) # 5. So it'll be for i in range(start with the first_term, stop at the nth_term, step from r to r) this is: for i in range(first_term, nth_term, r): # 6. Then we print our control variable inside the loop, because we want to see each iteration print(i, end=" > ") print("End")
#Fix the code below 👇 ''' print(Day 1 - String Manipulation") print("String Concatenation is done with the "+" sign.") print('e.g. print("Hello " + "world")') print(("New lines can be created with a backslash and n.") ''' print("Day 1 - String Manipulation") print("String Concatenation is done with the \"+\" sign.") print('e.g. print("Hello " + "world")') print("New lines can be created with a backslash and n.") ''' SOLUTION #1. Missing double quotes before the word Day. print("Day 1 - String Manipulation") #2. Outer double quotes changed to single quotes. print('String Concatenation is done with the "+" sign.') #3. Extra indentation removed print('e.g. print("Hello " + "world")') #4. Extra ( in print function removed. print("New lines can be created with a backslash and n.") '''
""" map """ def multiply(value, times=1): return value * times a = list(map(multiply, [1, 2, 3])) print(a) print() a = list(map(multiply, [1, 2, 3], [1, 2, 3])) print(a)
print('The choice coin voting session has started!!!!!') print('------------------------------------------------') print ('should we continue with the proposal method') nominee_1 = 'yes' nominee_2 = 'no' nom_1_votes = 0 nom_2_votes = 0 votes_id = [1,2,3,4,5,6,7,8,9,10] num_of_voter = len(votes_id) while True: voter = int(input('enter your voter id no:')) if votes_id ==[]: print('voting session over') if nom_1_votes >nom_2_votes: percent = (nom_1_votes/num_of_voter)*100 print(nominee_1, 'has won', 'with', percent, '% votes') break if nom_2_votes > nom_1_votes: percent = (nom_2_votes/num_of_voter)*100 print(nominee_2, 'has won', 'with', percent, '% votes') break else: if voter in votes_id: print('you are a voter') votes_id.remove(voter) vote = int(input('enter your vote 1 for yes, 2 for no: ')) if vote==1: nom_1_votes+=1 print('thank you for voting') elif vote == 2: nom_2_votes+=1 print('thanks for voting') else: print('you are not a voter here or you have already voted')
sal = float(input('Digite seu salário atual:\n')) if sal >= 1200: aum = sal + (sal*0.15) print('Seu salário vai de R${} para R${}.'.format(sal, aum)) else: aum = sal + (sal*0.2) print('Seu salário vai de R${} para R${}.'.format(sal, aum)) print('Agora vai lá comemorar comendo umas puta')
''' The complete Intcode computer N. B. Someone wrote an intcode computer in intcode https://www.reddit.com/r/adventofcode/comments/e7wml1/2019_intcode_computer_in_intcode/ ''' fin = open('input_13.txt') temp = fin.readline().split(',') fin.close() program_template = [int(x) for x in temp] # program_template = [109, 1, 204, -1, 1001, 100, # 1, 100, 1008, 100, 16, 101, 1006, 101, 0, 99] # program_template = [1102, 34915192, 34915192, 7, 4, 7, 99, 0] # program_template = [104, 1125899906842624, 99] # memory extension program_template += [0] * 2000 def pexec(p, pc, in_queue, out_queue, rbase): def g_o(pc, opnum): # get operand modes = p[pc] // 100 m = [0, 0, 0, 0] m[1] = modes % 10 modes = modes // 10 m[2] = modes % 10 modes = modes // 10 m[3] = modes % 10 if (opnum == 3): # target address for write operations if m[3] == 0: return p[pc + opnum] else: return p[pc + opnum] + rbase if (p[pc] % 100 == 3): # target address for input write if m[1] == 0: return p[pc + opnum] else: return p[pc + opnum] + rbase if m[opnum] == 0: # positional, immediate, relative target value return p[p[pc + opnum]] elif m[opnum] == 1: return p[pc + opnum] elif m[opnum] == 2: return p[p[pc + opnum] + rbase] else: return None while True: # decode instruction opcode = p[pc] % 100 if opcode == 99: # terminate return 'END', pc, rbase elif opcode == 1: # add p[g_o(pc, 3)] = g_o(pc, 1) + g_o(pc, 2) pc += 4 elif opcode == 2: # multiply p[g_o(pc, 3)] = g_o(pc, 1) * g_o(pc, 2) pc += 4 elif opcode == 3: # input # inp = int(input('Input at location ' + str(pc) + ' : ')) if in_queue == []: return 'WAIT', pc, rbase inp = in_queue.pop(0) p[g_o(pc, 1)] = inp pc += 2 elif opcode == 4: # print # print(g_o(pc, 1)) out_queue.append(g_o(pc, 1)) pc += 2 elif opcode == 5: # jump-if-true if g_o(pc, 1) != 0: pc = g_o(pc, 2) else: pc += 3 elif opcode == 6: # jump-if-false if g_o(pc, 1) == 0: pc = g_o(pc, 2) else: pc += 3 elif opcode == 7: # less than if g_o(pc, 1) < g_o(pc, 2): p[g_o(pc, 3)] = 1 else: p[g_o(pc, 3)] = 0 pc += 4 elif opcode == 8: # equal if g_o(pc, 1) == g_o(pc, 2): p[g_o(pc, 3)] = 1 else: p[g_o(pc, 3)] = 0 pc += 4 elif opcode == 9: # change relative base rbase += g_o(pc, 1) pc += 2 else: # unknown opcode return 'ERROR', pc, rbase pA = program_template[:] qAin = [] qAout = [] pcA = 0 stateA = 'WAIT' rbaseA = 0 while True: if stateA == 'WAIT': stateA, pcA, rbaseA = pexec(pA, pcA, qAin, qAout, rbaseA) if stateA == 'END': break print(qAout[::3], qAout[1::3], qAout[2::3], qAout[2::3].count(2))
# Original Solution def additionWithoutCarrying(param1, param2): smaller = min(param1,param2) larger = max(param1,param2) small_list = list(str(smaller)) large_list = list(str(larger)) output = [] print(param1,param2) print(small_list,large_list) index_2= 0 for index,i in enumerate(large_list): if index >= (len(large_list) - len(small_list)): print('index1:',index) print('index_two',index_2) print('larger_num',i) print('smaller_num',small_list[index_2]) number = int(i)+int(small_list[index_2]) if number > 9: digit = list(str(number))[-1] output.append(digit) else: output.append(str(number)) index_2+=1 else: print('index1:',index) print(i) output.append(i) return int("".join(output)) # Much cleaner solution (from reading the solutions) # the reason that this works is because you stay in numeric space # you are composing the number numerically not logically. # I was composing the number logically, and so I was working in # "string" space, and going back and forth. Here # you don't have to translate back and forth. def additionWithoutCarrying(param1, param2): output = 0 tenPower = 1 while param1 or param2: output += tenPower * ((param1+param2)%10) param1 //= 10 param2 //= 10 tenPower *= 10 return output
def soma (x,y): return x+y def subtrai (x,y): return x-y def mult(): pass
# Copyright 2021 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable 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. """ Common code for reuse across java_* rules """ load(":common/rule_util.bzl", "create_composite_dep") load(":common/java/android_lint.bzl", "ANDROID_LINT_ACTION") load(":common/java/compile_action.bzl", "COMPILE_ACTION") coverage_common = _builtins.toplevel.coverage_common def _filter_srcs(srcs, ext): return [f for f in srcs if f.extension == ext] def _base_common_impl( ctx, extra_resources, output_prefix, enable_compile_jar_action = True, extra_runtime_jars = [], coverage_config = None): srcs = ctx.files.srcs source_files = _filter_srcs(srcs, "java") source_jars = _filter_srcs(srcs, "srcjar") java_info, default_info, compilation_info = COMPILE_ACTION.call( ctx, extra_resources, source_files, source_jars, output_prefix, enable_compile_jar_action, extra_runtime_jars, extra_deps = [coverage_config.runner] if coverage_config else [], ) output_groups = dict( compilation_outputs = compilation_info.outputs, _source_jars = java_info.transitive_source_jars, _direct_source_jars = java_info.source_jars, ) lint_output = ANDROID_LINT_ACTION.call(ctx, java_info, source_files, source_jars, compilation_info) if lint_output: output_groups["_validation"] = [lint_output] instrumented_files_info = coverage_common.instrumented_files_info( ctx, source_attributes = ["srcs"], dependency_attributes = ["deps", "data", "resources", "resource_jars", "exports", "runtime_deps", "jars"], coverage_support_files = coverage_config.support_files if coverage_config else depset(), coverage_environment = coverage_config.env if coverage_config else {}, ) return struct( java_info = java_info, default_info = default_info, instrumented_files_info = instrumented_files_info, output_groups = output_groups, extra_providers = [], ) JAVA_COMMON_DEP = create_composite_dep( _base_common_impl, COMPILE_ACTION, ANDROID_LINT_ACTION, )
if __name__ == '__main__': N = int(input()) Output = []; for i in range(0,N): ip = input().split(); if ip[0] == "print": print(Output) elif ip[0] == "insert": Output.insert(int(ip[1]),int(ip[2])) elif ip[0] == "remove": Output.remove(int(ip[1])) elif ip[0] == "pop": Output.pop(); elif ip[0] == "append": Output.append(int(ip[1])) elif ip[0] == "sort": Output.sort(); else: Output.reverse();
def capacity(K, weights): if sum(weights) < K: return None weights = sorted(weights, reverse=True) def solve(K, i): print("Solve({0}, {1})".format(K, i)) if K == 0: return [] while i < len(weights) and weights[i]> K: i += 1 if i == len(weights): return None subK = K - weights[i] subI = i + 1 subsolution = solve(subK, subI) if subsolution is not None: subsolution.append(weights[i]) return subsolution subsolution = solve(K, subI) if subsolution is not None: return subsolution return None return solve(K, 0) print(capacity(20000, [x**2 for x in range(100)]))
def main(): n = int(input()) for case in range(1, n + 1): d = int(input()) guys = [int(s) for s in input().split(" ")] # print(d, guys) guys = sorted(guys, reverse=True) # print(d, guys) print("Case #{}: {}".format(case, cal_move(d, guys))) def cal_move(d, guys, moved=0): """special move for single 9.""" # print(d, guys, moved) unmove = guys[0] if unmove == 9 and d == 1: return 5 if unmove == 9 and d > 1 and guys[1] <= 3: return 5 if unmove == 9 and d > 1 and guys[1] <= 6 and (d == 2 or (d > 2 and guys[2] <= 3)): # special case of 9, 6, 2, min_move = 6 (333 6 2, 333 33 2) # and special case of 9 6. move_guys = guys del move_guys[0] move_guys.append(3) move_guys.append(3) move_guys.append(3) move_guys = sorted(move_guys, reverse=True) move_n = cal_move(d+1, move_guys.copy(), moved+1) if move_n < unmove: return move_n + 2 else: return unmove + 1 elif unmove <= 2: return unmove else: move_guys = guys del move_guys[0] if unmove % 2 == 0: move_guys.append(int(unmove / 2)) move_guys.append(int(unmove / 2)) else: move_guys.append(int((unmove+1) / 2)) move_guys.append(int((unmove-1) / 2)) # special 9 here move_guys = sorted(move_guys, reverse=True) """ print(move_guys) print(cal_move(d+1, move_guys, moved+1)) print(move_guys) print("before add.") print(move_guys) print(cal_move(d+1, move_guys, moved+1)) """ move_n = cal_move(d+1, move_guys.copy(), moved+1) if move_n < unmove: return move_n + 1 else: return unmove def test_iter(i): if i == 1: return i else: return test_iter(i-1) * i main()
""" 9. Дана последовательность натуральных чисел (одно число в строке), завершающаяся двумя числами 0 подряд. Определите, сколько раз в этой последовательности встречается число 1. Числа, идущие после двух нулей, необходимо игнорировать. В этой задаче нельзя использовать глобальные переменные и параметры, передаваемые в функцию. Функция получает данные, считывая их с клавиатуры, а не получая их в виде параметров. """ def def_recursion(): n = int(input()) if n == 1: m = int(input()) if m == 1: # Шаг рекурсии / рекурсивное условие return def_recursion() + n + m else: k = int(input()) if k == 1: # Шаг рекурсии / рекурсивное условие return def_recursion() + n + m + k else: return n + m + k else: m = int(input()) if m == 1: return def_recursion() + n + m else: return n + m if __name__ == "__main__": print(def_recursion())
flatmates = [ { 'name': "Fred", 'telegram_id': "930376906" }, { 'name': "Kata", 'telegram_id': "1524429277" }, { 'name': "Daniel", 'telegram_id': "1145198247" }, { 'name': "Ricky", 'telegram_id': "930376906" }, { 'name': "Ankit", 'telegram_id': "1519503399" }, { 'name': "Csaba", 'telegram_id': "5044038381" }, { 'name': "Lisa", 'telegram_id': "2087012195" }, { 'name': "Raminta", 'telegram_id': "930376906" } ]
#!/usr/bin/python """Programa que implementa el algoritmo de ordenamiento por insercion.""" def InsertionSort(lista): """Algoritmo de ordenamiento por insercion.""" for j in range(1, len(lista)): key = lista[j] # Inserta lista[j] en la secuecia ordenada lista[0.. j] i = j - 1 while i >= 0 and lista[i] > key: lista[i + 1] = lista[i] i -= 1 lista[i + 1] = key lista = [5, 3, 2, 1, 6, 7, 10, 0, 4, 8, 9] print(lista) InsertionSort(lista) print(lista)
# callback handlers: reloaded each time triggered def message1(): # change me print('BIMRI') # or could build a dialog... def message2(self): print('Nil!') # change me self.method1() # access the 'Hello' instance...
class Solution: def largestNumber(self, num): num_str = map(str, num) num_str.sort(cmp=lambda str1, str2: -1 if str1 + str2 > str2 + str1 else 1) if len(num_str) >= 2 and num_str[0] == num_str[1] == "0": return "0" return "".join(num_str)
name = input("Enter file:") if len(name) < 1: name = "mbox-short.txt" handle = open(name) emails = dict() for line in handle: words = line.split() if not line.startswith('From') or len(words) < 3: continue email = words[1] emails[email] = emails.get(email, 0) + 1 max = 0 max_email = None for email, count in emails.items(): if count > max: max = count max_email = email print(max_email, max)
# -*- coding: utf-8 -*- # @Time : 2021/8/25 4:25 # @Author : pixb # @Email : tpxsky@163.com # @File : main_model.py.py # @Software: PyCharm # @Description: class main_model(object): pass
# -*- coding: utf-8 -*- """ Created on Mon Jun 22 17:32:32 2020 @author: abhi0 """ class Solution: def findContentChildren(self, g: List[int], s: List[int]) -> int: count=0 i=0 s=sorted(s) while i<len(g): #greed factor for childrens for j in range(len(s)): #size of cookies if s[j]>=g[i]: #if the size is larger than greed factor,children is satisfied count+=1 #increment the counter s.pop(j) #Remove the cookie break #go to the next children i+=1 return count
response.title = settings.title response.subtitle = settings.subtitle response.meta.author = '%(author)s <%(author_email)s>' % settings response.meta.keywords = settings.keywords response.meta.description = settings.description response.menu = [ (T('Index'),URL('default','index')==URL(),URL('default','index'),[]), (T('Book'),URL('default','book_manage')==URL(),URL('default','book_manage'),[]), (T('Chapter'),URL('default','chapter_manage')==URL(),URL('default','chapter_manage'),[]), (T('Character'),URL('default','character_manage')==URL(),URL('default','character_manage'),[]), (T('Character Reference'),URL('default','character_reference_manage')==URL(),URL('default','character_reference_manage'),[]), (T('Question'),URL('default','question_manage')==URL(),URL('default','question_manage'),[]), ]
print('===== DESAFIO 90 =====') aprov = {} aprov['nome'] = str(input('Nome: ')) aprov['media'] = float(input(f'Média de {aprov["nome"]}: ')) print(f'Nome é igual a {aprov["nome"]}') print(f'Média é igual a {aprov["media"]}') if aprov['media'] >= 7: print('Situação é igual a APROVADO') else: print('Situação é igual a REPROVADO')
DEFAULT_GEASE_FILE_NAME = ".gease" DEFAULT_RELEASE_MESSAGE = "A new release via gease." NOT_ENOUGH_ARGS = "Not enough arguments" KEY_GEASE_USER = "user" KEY_GEASE_TOKEN = "personal_access_token" MESSAGE_FMT_RELEASED = "Release is created at: %s"
def paint_calc(height,width,cover): number_of_cans = round((height * width) / coverage) print(f"You'll need {number_of_cans} cans of paint.") height = int(input("Height of Wall :\n")) width = int(input("Width of wall : \n")) coverage = 5 paint_calc(height=height,width=width,cover=coverage)
class Tokenizer: def __init__(self): self.on_token_funcs = [] def read(self, chunk): raise NotImplementedError def token_fetched(self, token): for func in self.on_token_funcs: func(token) def on_token_fetched(self, func): self.on_token_funcs.append(func) return func class CharacterTokenizer(Tokenizer): sep = '' name = 'char' def __init__(self): super().__init__() self.last_symbol_was_space = False def read(self, chunk): if len(chunk) != 1: for char in chunk: self.read(char) else: if chunk.isspace(): if not self.last_symbol_was_space: self.token_fetched(' ') self.last_symbol_was_space = True else: self.last_symbol_was_space = False self.token_fetched(chunk) class WordTokenizer(Tokenizer): sep = ' ' name = 'word' def __init__(self): super().__init__() self.word_buffer = [] def read(self, chunk): if len(chunk) != 1: for char in chunk: self.read(char) else: if chunk.isspace(): if self.word_buffer: self.token_fetched(''.join(self.word_buffer)) self.word_buffer.clear() else: self.word_buffer.append(chunk)
# GETTER (Obtem o valor) e SETTER(Configura o valor) #Getters : - Estes são os métodos usados em Programação Orientada a Objetos (OOPS) que ajudam a # acessar os atributos privados de uma classe . #Setters : - Estes são os métodos usados no recurso OOPS que ajuda a definir o valor para atributos # privados em uma classe . class Produto: def __init__(self,nome,preco): self.nome=nome self.preco=preco def desconto(self,percentual): self.preco=self.preco-(self.preco*(percentual/100)) return #Fazendo Getter de nome @property def nome(self): return self._nome #Fazendo Setter de nome @nome.setter def nome(self,valor): self._nome=valor.replace('a', 'A') # Fazendo Getter @property #Decorador Property antes de getter def preco(self): return self._preco #Fazendo Setter @preco.setter #PERCEBA: Antes de Setter, tem a property preco def preco(self,valor): #Criei o parametro valor, que será atribuido à variavel preco. (Lá nos atributos do init,preco) if isinstance(valor,str): #Se instancia Valor for string valor=float(valor.replace('R$','')) #Ele vai substituir (replace) onde tem R$, e vai colocar NADA. self._preco=valor p1=Produto('Camiseta',50) p1.desconto(10) print(p1.nome, p1.preco) p2=Produto('Caneca','R$ 15') #Mudei o 15 de variavel INT para variavel String, logo deu erro, usarei Getter p2.desconto(10) print(p2.nome, p2.preco)
DEFAULT_FIT_VAR_NAMES = tuple(['beta0', 'c_reduction']) DEFAULT_FIT_GUESS = { 'beta0': 0.025, 'c_reduction': 0.5 } DEFAULT_FIT_BOUNDS = { 'beta0': [0., 1.], 'c_reduction': [0., 1.] }
for n in range(2, 100): for x in range(2, n): if n % x == 0: print(n, '==', x, '*', n//x) break else: print(n, 'is prime!')
''' @author: Kittl ''' def exportExternalNets(dpf, exportProfile, tables, colHeads): # Get the index in the list of worksheets if exportProfile is 2: cmpStr = "ExternalNet" elif exportProfile is 3: cmpStr = "" idxWs = [idx for idx,val in enumerate(tables[exportProfile-1]) if val == cmpStr] if not idxWs: dpf.PrintPlain('') dpf.PrintInfo('There is no worksheet '+( cmpStr if not cmpStr == "" else "for external nets" )+' defined. Skip this one!') return (None, None) elif len(idxWs) > 1: dpf.PrintError('There is more than one table with the name '+cmpStr+' defined. Cancel this script.') exit(1) else: idxWs = idxWs[0] colHead = list(); # Index 8 indicates the externalNet-Worksheet for cHead in colHeads[exportProfile-1][idxWs]: colHead.append(str(cHead.name)) dpf.PrintPlain('') dpf.PrintPlain('#####################################') dpf.PrintPlain('# Starting to export external nets. #') dpf.PrintPlain('#####################################') expMat = list() expMat.append(colHead) externalNets = dpf.GetCalcRelevantObjects('*.ElmXNet') for externalNet in externalNets: if exportProfile is 2: # Get voltage setpoint from connected node, when this is chosen in PowerFactory if externalNet.uset_mode is 1: vtarget = externalNet.cpCtrlNode.vtarget if not externalNet.cpCtrlNode.loc_name == externalNet.bus1.cterm.loc_name: dpf.PrintWarn('The external net '+externalNet.loc_name+' regulates the voltage at node '+externalNet.cpCtrlNode.loc_name+', which is not the current node.') else: vtarget = externalNet.usetp expMat.append([ externalNet.loc_name, # id externalNet.bus1.cterm.loc_name, # node vtarget, # vSetp externalNet.phiini, # phiSetp externalNet.cpArea.loc_name if externalNet.cpArea is not None else "", # subnet externalNet.cpZone.loc_name if externalNet.cpZone is not None else "" # voltLvl ]) else: dpf.PrintError("This export profile isn't implemented yet.") exit(1) return (idxWs, expMat)
class DefaultQuotaPlugin(object): def get_default_quota(self, user, provider): raise NotImplementedError("Validation plugins must implement a get_default_quota function that " "takes two arguments: 'user' and 'provider")