content
stringlengths 7
1.05M
|
---|
class Navio:
def __init__(self, nome, tamanho, direcao):
self.nome = nome
self.tamanho = tamanho
self.direcao = direcao |
description = 'GE detector setup PV values'
group = 'configdata'
EIGHT_PACKS = [
# ('ep01', 'GE-DD590C-EP'), # replaced 2015/10/29
('ep01', 'GE-DD6D8C-EP'),
('ep02', 'GE-DD5FB3-EP'),
('ep03', 'GE-DDA871-EP'),
('ep04', 'GE-DD7D29-EP'),
('ep05', 'GE-DDBA8F-EP'),
('ep06', 'GE-DD5913-EP'),
('ep07', 'GE-DDC7CA-EP'),
('ep08', 'GE-DD6DEF-EP'),
('ep09', 'GE-DD5FB6-EP'),
('ep10', 'GE-DDBA88-EP'),
# ('ep11', 'GE-DD6AE9-EP'),
# ('ep11', 'GE-DD6D79-EP'), # was spare
('ep11', 'GE-DD9522-EP'), # changed 2015/09/23
('ep12', 'GE-DD6D89-EP'),
('ep13', 'GE-DD6D96-EP'),
('ep14', 'GE-DD6974-EP'),
('ep15', 'GE-DD5FA9-EP'),
('ep16', 'GE-DDA874-EP'),
('ep17', 'GE-DD6975-EP'),
('ep18', 'GE-DD5916-EP'),
]
HV_VALUES = {n[0]: 1530 for n in EIGHT_PACKS}
# -- To set different HVs for some 8-packs:
# HV_VALUES['ep01'] = 0
# HV_VALUES['ep18'] = 0
PV_SCALES = {
'ep01': [('AScales', [2077, 2033, 2127, 2137, 2095, 2130, 2149, 2123]), ('Scales', [2102, 2114, 2118, 2088, 2088, 2076, 2107, 2124])],
'ep02': [('AScales', [2089, 2148, 2095, 2090, 2088, 2147, 2107, 2098]), ('Scales', [2069, 2099, 2061, 2100, 2104, 2090, 2101, 2087])],
'ep03': [('AScales', [2105, 2084, 2112, 2107, 2183, 2050, 2084, 2102]), ('Scales', [2093, 2125, 2086, 2112, 2101, 2097, 2102, 2111])],
'ep04': [('AScales', [2060, 2036, 2055, 2063, 2060, 2071, 2067, 2083]), ('Scales', [2006, 1991, 1996, 2003, 2011, 2002, 1996, 1999])],
'ep05': [('AScales', [2016, 2064, 2037, 2083, 2062, 2023, 2078, 2083]), ('Scales', [2009, 1997, 1973, 2020, 1989, 2038, 2010, 2010])],
'ep06': [('AScales', [2026, 2048, 2087, 2059, 2040, 2050, 2073, 2037]), ('Scales', [2007, 2005, 2011, 2009, 2010, 1990, 2002, 2010])],
'ep07': [('AScales', [2041, 2037, 1999, 1996, 2031, 2013, 1982, 2063]), ('Scales', [1982, 2021, 1993, 1984, 1987, 1961, 1986, 1964])],
'ep08': [('AScales', [2055, 2074, 2039, 2032, 2068, 2070, 2054, 2100]), ('Scales', [2010, 1999, 1987, 2009, 1986, 2005, 1984, 2005])],
'ep09': [('AScales', [2031, 2065, 2005, 2088, 2048, 2048, 2035, 2009]), ('Scales', [2001, 1999, 1984, 2018, 1979, 1992, 1986, 1977])],
'ep10': [('AScales', [2050, 2022, 2040, 2082, 2059, 2030, 2033, 2055]), ('Scales', [1978, 2030, 1978, 1980, 1997, 2016, 1982, 1991])],
'ep11': [('AScales', [2035, 2024, 2042, 2014, 2024, 2005, 2063, 2037]), ('Scales', [1996, 2018, 1996, 1975, 1966, 1963, 2035, 2016])],
'ep12': [('AScales', [2063, 2079, 2042, 2049, 2053, 2055, 2050, 2063]), ('Scales', [1990, 2020, 2003, 2002, 1978, 1988, 2015, 1975])],
'ep13': [('AScales', [2072, 2095, 2092, 2104, 2083, 2077, 2036, 2092]), ('Scales', [2018, 2013, 2004, 2013, 2007, 2002, 2027, 2004])],
'ep15': [('AScales', [2078, 2060, 2063, 2091, 2050, 2053, 2071, 2061]), ('Scales', [2014, 2000, 2017, 1998, 1989, 1996, 2002, 2030])],
'ep14': [('AScales', [2070, 2078, 2055, 2026, 2075, 2053, 2072, 2073]), ('Scales', [2011, 2002, 2009, 1990, 1998, 1963, 2015, 1986])],
'ep16': [('AScales', [2196, 2085, 2053, 2161, 2168, 2127, 2155, 2185]), ('Scales', [2087, 2079, 2090, 2113, 2100, 2085, 2082, 2086])],
'ep17': [('AScales', [2144, 2188, 2168, 2153, 2192, 2148, 2178, 2205]), ('Scales', [2105, 2070, 2098, 2109, 2111, 2099, 2103, 2090])],
'ep18': [('AScales', [2178, 2134, 2149, 2053, 2142, 2191, 2154, 2115]), ('Scales', [2125, 2118, 2110, 2154, 2113, 2132, 2102, 2099])],
}
# -- For recalibration, set everything to defaults:
# PV_SCALES = {
# 'ep%02d' % i: [('AScales', [2048]*8), ('Scales', [2048]*8)] for i in range(1, 19)
# }
# event modes
MODE = 0x03
MODE_DIAG = 0x06
MODE_FAKE = 0x23
MODE_FAKEDIAG = 0x26
PV_VALUES_COMMON = [
('Mode', MODE),
('DecimationFactor', 1),
('DiscriminatorLevel', 1024),
('NegativeVeto', -16384),
('PositiveVeto', 16383),
('Sample1', 10),
('BScales', [2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048]),
('TubeEnables', [1, 1, 1, 1, 1, 1, 1, 1]),
('AccumulationLength', 60),
('WaveformCaptureLength', 1015),
]
# pixel per tube
PPT_S = 94
PPT_M = 206
PPT_L = 256
# -- For recalibration, set to max. pixel resolution:
# PPT_S = 1024
# PPT_M = 1024
# PPT_L = 1024
PV_VALUES_SINGLE = {
'ep01': [('ModulePixelIdStart', 0*8192), ('PixelCount', PPT_S)],
'ep02': [('ModulePixelIdStart', 1*8192), ('PixelCount', PPT_S)],
'ep03': [('ModulePixelIdStart', 2*8192), ('PixelCount', PPT_S)],
'ep04': [('ModulePixelIdStart', 3*8192), ('PixelCount', PPT_M)],
'ep05': [('ModulePixelIdStart', 4*8192), ('PixelCount', PPT_M)],
'ep06': [('ModulePixelIdStart', 5*8192), ('PixelCount', PPT_M)],
'ep07': [('ModulePixelIdStart', 6*8192), ('PixelCount', PPT_L)],
'ep08': [('ModulePixelIdStart', 7*8192), ('PixelCount', PPT_L)],
'ep09': [('ModulePixelIdStart', 8*8192), ('PixelCount', PPT_L)],
'ep10': [('ModulePixelIdStart', 9*8192), ('PixelCount', PPT_L)],
'ep11': [('ModulePixelIdStart', 10*8192), ('PixelCount', PPT_L)],
'ep12': [('ModulePixelIdStart', 11*8192), ('PixelCount', PPT_L)],
'ep13': [('ModulePixelIdStart', 12*8192), ('PixelCount', PPT_M)],
'ep14': [('ModulePixelIdStart', 14*8192), ('PixelCount', PPT_M)],
'ep15': [('ModulePixelIdStart', 13*8192), ('PixelCount', PPT_M)],
'ep16': [('ModulePixelIdStart', 15*8192), ('PixelCount', PPT_S)],
'ep17': [('ModulePixelIdStart', 16*8192), ('PixelCount', PPT_S)],
'ep18': [('ModulePixelIdStart', 17*8192), ('PixelCount', PPT_S)],
}
|
# Write a program to print the pattern
'''
* *
* *
*
* *
* *
'''
n = int(input("Size: "))
s1 = 0
s2 = 2 * n - 3
i = 0
while (i < n):
if (i < n-1):
extra = "*"
else :
extra = ""
print(" " * s1 + "*" + " " * s2 + extra)
s1 += 1
s2 -= 2
i += 1
s1 -= 2
s2 += 4
i = 0
while (i < n-1):
print(" " * s1 + "*" + " " * s2 + "*")
s1 -= 1
s2 += 2
i += 1 |
def empty_float():
"""
>>> float()
0.0
>>> empty_float()
0.0
"""
x = float()
return x
def float_conjugate():
"""
>>> float_call_conjugate()
1.5
"""
x = 1.5 .conjugate()
return x
def float_call_conjugate():
"""
>>> float_call_conjugate()
1.5
"""
x = float(1.5).conjugate()
return x
|
"""
Exception module.
"""
__docformat__ = "restructuredtext en"
## Copyright (c) 2009 Emmanuel Goossaert
##
## This file is part of npy.
##
## npy is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## npy is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with npy. If not, see <http://www.gnu.org/licenses/>.
class NpyException(Exception):
"""
Exception base class.
The base Exception class is overridden, so that the __init__() function
can be redefined.
"""
def __init__(self, msg):
self.msg = msg
def __str__(self):
return repr(self.msg)
class NpyStreamError(NpyException):
"""
Raised when an error is met while working with streams.
"""
pass
class NpyTransferFunctionError(NpyException):
"""
Raised when a critical error regarding transfer function is encountered.
"""
pass
class NpyDataTypeError(NpyException):
"""
Raised when the type of a parameter is not the one that is expected.
"""
pass
class NpyIndexError(NpyException):
"""
Raised when an error regarding internal data structure indices occurs.
"""
pass
class NpyValueError(NpyException):
"""
Raised when the value of a parameter is critical.
"""
pass
class NpyUnitError(NpyException):
"""
Raised when a problem occurs during the creation of a `Unit`.
"""
pass
|
# Write your solution here
def double_items(numbers):
double_numbers = []
for item in numbers:
double_numbers.append(item*2)
return double_numbers
if __name__ == "__main__":
numbers = [2, 4, 5, 3, 11, -4]
numbers_doubled = double_items(numbers)
print("original:", numbers)
print("doubled:", numbers_doubled) |
class SIG_REVERIESH(object):
KILL = 'SIG_REVERIESH_KILL'.encode()
PROMPT = 'SIG_REVERIESH_PROMPT'.encode()
class ascii_format:
magenta = '\033[95m'
blue = '\033[94m'
green = '\033[92m'
yellow = '\033[93m'
red = '\033[91m'
clear = '\033[0m'
bold = '\033[1m'
underline = '\033[4m'
def __new__(cls, s, f=None):
return ascii_format.format(s, f)
@staticmethod
def from_int(i):
return '\033[{}m'.format(i)
@staticmethod
def format(s, f=None):
if f is None:
f = ascii_format.clear
elif isinstance(f, int):
f = ascii_format.from_int(f)
elif isinstance(f, str):
f = getattr(ascii_format, f)
else:
raise ValueError('Invalid format type: {}'.format(type(f)))
return '{}{}{}'.format(f, s, ascii_format.clear)
"""WORK IN PROGRESS """
def marshall_item(x):
# type: (Any) -> bytes
"""Marshall data into binary format
Right now, only working with strings, so we can take some shortcuts
with deliminators
"""
if isinstance(x, bytes):
return x
if isinstance(x, str):
return x.encode()
raise TypeError('Cannot marshall type: {}'.format(type(x)))
def unmarshall_item(x):
# type: (bytes) -> str
try:
return x.decode()
except Exception as exc:
raise TypeError('Cannot marshall data: {}'.format(type(x)))
def dictpack(dd):
# type: (dict) -> bytes
out = b''
for k, v in dd.items():
ke = marshall_item(k)
kv = marshall_item(v)
def dictunpack():
# type: (bytes) -> dict
pass
|
#!/usr/bin/env python3
# Write a program that computes the running sum from 1..n
# Also, have it compute the factorial of n while you're at it
# No, you may not use math.factorial()
# Use the same loop for both calculations
n = 5
runsum = 0
factorial = 1
for i in range(1, n+1):
runsum += i # computes the running sum from 1 to 5 (we set the range 1, n+1)
factorial *= i # computes factorial of n = 5
print(n, runsum, factorial)
"""
5 15 120
"""
|
# -*- coding: utf-8 -*-
TOILET_CHOICES = (
('F', 'Flush'),
('PT', 'Pit toilet'),
('TPT', 'Traditional Pit toilet'),
('L', 'Latrine'),
('BF', 'Bush /Field'),
('R', 'River'),
('O', 'Others'),
)
COOKING_FACILITIES = (
('Electricity', 'Electricity'),
('Gas', 'Gas'),
('Biomass', 'Biomass'),
('Kerosene', 'Kerosene'),
('Coal', 'Coal'),
('Charcoal', 'Charcoal'),
('Firewood', 'Firewood'),
('Others', 'Others'),
)
SEX_CHOICES = (
("M","Male"),
("F","Female"),
("O","Others"),
)
MARITAL_CHOICES = (
('SG', 'Single'),
('MR', 'Married'),
('DV', 'Divorced'),
('WD', 'Widowed'),
)
FREQUENCY_CHOICES = (
('AL', 'Always'),
('US', 'Usually'),
('OF', 'Often'),
('SO', 'Sometimes'),
('SE', 'Seldom'),
('RA', 'Rarely'),
('NV', 'Never'),
)
LITERATE_CHOICES = (
('LT', 'Literate'),
('SL', 'Semiliterate'),
('IL', 'Iliterate'),
)
LEVEL_CHOICES = (
('No', 'No'),
('Mi', 'Mild'),
('Mo', 'Moderate'),
('S', 'Severe'),
)
EDUCATIONAL_LEVEL_CHOICES = (
('KD', 'Kindergarden'),
('PR', 'Primary'),
('SC', 'Secondary'),
('UN', 'University'),
('NV', 'Never'),
)
RELATIONSHIP_CHOICES = (
('HS', 'Husband'),
('FA', 'Father'),
('MO', 'Mother'),
('GF', 'Grandfather'),
('GM', 'Grandmother'),
('UN', 'Uncle'),
('AU', 'Aunt'),
('FR', 'Friend'),
)
MENSTRUAL_CYCLE_CHOICES = (
('28', '28days'),
('30', '30days'),
('OT', 'Others'),
)
HAVE_BEEN_PREGNANT_CHOICES = (
(0, '0'),
(1, '1'),
(2, '2'),
(3, '3'),
(4, '4'),
(5, '5'),
(6, '6'),
(7, '7'),
(8, '8'),
(9, '9'),
(10, '10'),
(11, '11'),
(12, '12'),
(13, '13'),
(14, '14'),
(15, '15'),
(16, '16'),
(17, '17'),
(18, '18'),
(19, '19'),
(20, '20'),
)
TYPES_OF_DELIVERY_CHOICES = (
('LB', 'Live Birth'),
('SB', 'Still Birth'),
('AB', 'Abortion'),
('EC', 'Ectopic'),
('HM', 'Hydatidiform Model'),
('OT', 'Others'),
)
PROBLEMS_CHOICES = (
('NO', 'None'),
('PL','PretermLabor'),
('DB','Diabetes'),
('HB','High Blood Pressure'),
('TH','Thrombosis'),
('EM','Embolus'),
('HT','Hypertension'),
('PE','Pre-Eclampsia'),
('EC','Eclampsia'),
('OT','Others'),
)
OBSTETRICALOPERATION_CHOICES = (
('NO', 'None'),
('CS', 'Caesarian Section'),
('FO','Forceps'),
('VE','Vacuum Extraction'),
('MI','Manual instrumental help in vaginal breech delivery'),
('MR','Manual Removal Of The Placenta'),
('OT','Others'),
)
METHOD_OF_BIRTH_CONTROL_CHOICES = (
('CO', 'Condoms'),
('PI', 'Pills'),
('PA', 'Patch'),
('VR', 'Vaginal Ring'),
('TU', 'Tubal/Essure'),
('IU', 'IUD'),
('PV', 'Partner with vasectomy'),
('NA', 'Natural Family Planning'),
('IM', 'Implanon'),
('NO', 'None'),
('OT', 'Other'),
)
NORMAL_CHOICES = (
('NR', 'Normal'),
('AB', 'Abnormal'),
)
VACCINATION_CHOICES= (
('RU', 'Rubella'),
('TT', 'Tetanus Toxoid'),
('OT', 'Other'),
)
VISIT_CHOICES = (
('FT', 'First trimester'),
('ST', 'Second Trimester'),
('TT', 'Third Trimester'),
('OT', 'Other visit'),
)
BLOOD_PRESSURE_CHOICES = (
('BE','140/90'),
('AB','>= 140/90'),
)
URINALYSIS_CHOICES = (
('BE', '<0.3g/24h'),
('AB', '>0.3g/24h'),
)
HEMOGLOBIN_CHOICES = (
('A', '9-10'),
('B', '7-8'),
('C', '<7'),
('D', '>=11'),
)
MATERNAL_COMPLICATIONS_CHOICES = (
('NO','No complication'),
('RA', 'Recurrent early abortion'),
('IA','Induced abortion and any associated complications'),
('TH','Thrombosis'),
('EM','Embolus'),
('HY','Hypertension'),
('PE','Pre-Eclampsia'),
('EC','Eclampsia'),
('PA','Placental abruption'),
('OT','Others'),
)
PERINATAL_COMPLICATIONS_CHOICES = (
('NO','No complication'),
('TW', 'Twins or higher order multiples'),
('LO', 'Low birth weight (<2500g)'),
('IG','Intrauterine growth retardation'),
('RA','Rhesus antibody(erytroblastosis,hydrops)'),
('MC','Malformed or chromosomally abnormal child'),
('MA','macrosomic(>4500g) newborn'),
('RE','Resuscitation or other treatment of newborn'),
('PE','Perinatal,neonatal or infant death'),
('OT','Others'),
)
|
#
# PySNMP MIB module ZHONE-COM-IP-ZEDGE-NAT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-COM-IP-ZEDGE-NAT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:41:01 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)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint")
InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
NotificationType, Gauge32, iso, Counter32, IpAddress, Bits, Unsigned32, ObjectIdentity, ModuleIdentity, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, Counter64, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "NotificationType", "Gauge32", "iso", "Counter32", "IpAddress", "Bits", "Unsigned32", "ObjectIdentity", "ModuleIdentity", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "Counter64", "TimeTicks")
TruthValue, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "DisplayString", "TextualConvention")
zhoneModules, zhoneIp = mibBuilder.importSymbols("Zhone", "zhoneModules", "zhoneIp")
ZhoneRowStatus, = mibBuilder.importSymbols("Zhone-TC", "ZhoneRowStatus")
comIpZEdgeNat = ModuleIdentity((1, 3, 6, 1, 4, 1, 5504, 6, 66))
comIpZEdgeNat.setRevisions(('2010-10-20 05:52', '2008-07-22 07:28', '2003-12-11 02:58', '2003-03-19 09:02', '2000-10-04 15:30',))
if mibBuilder.loadTexts: comIpZEdgeNat.setLastUpdated('201010200727Z')
if mibBuilder.loadTexts: comIpZEdgeNat.setOrganization('Zhone Technologies, Inc.')
zedgeNat = ObjectIdentity((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16))
if mibBuilder.loadTexts: zedgeNat.setStatus('current')
natConfigGroup = ObjectIdentity((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 1))
if mibBuilder.loadTexts: natConfigGroup.setStatus('current')
natTcpTimeout = MibScalar((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 604800))).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: natTcpTimeout.setStatus('current')
natUdpTimeout = MibScalar((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 604800))).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: natUdpTimeout.setStatus('current')
natClearBindings = MibScalar((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 1, 3), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: natClearBindings.setStatus('current')
natStatsGroup = ObjectIdentity((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 2))
if mibBuilder.loadTexts: natStatsGroup.setStatus('current')
natNumCurrentBindings = MibScalar((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 2, 1), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: natNumCurrentBindings.setStatus('current')
natNumExpiredBindings = MibScalar((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 2, 2), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: natNumExpiredBindings.setStatus('current')
natTotalPkts = MibScalar((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 2, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: natTotalPkts.setStatus('current')
natDroppedPkts = MibScalar((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 2, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: natDroppedPkts.setStatus('current')
natBindingsTable = MibTable((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 3), )
if mibBuilder.loadTexts: natBindingsTable.setStatus('current')
natBindingsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 3, 1), ).setIndexNames((0, "ZHONE-COM-IP-ZEDGE-NAT-MIB", "natBindingsIfIndex"), (0, "ZHONE-COM-IP-ZEDGE-NAT-MIB", "natBindingLocalAddr"), (0, "ZHONE-COM-IP-ZEDGE-NAT-MIB", "natBindingLocalPort"), (0, "ZHONE-COM-IP-ZEDGE-NAT-MIB", "natBindingPublicAddr"), (0, "ZHONE-COM-IP-ZEDGE-NAT-MIB", "natBindingPublicPort"))
if mibBuilder.loadTexts: natBindingsEntry.setStatus('current')
natBindingsIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 3, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: natBindingsIfIndex.setStatus('current')
natBindingLocalAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 3, 1, 2), IpAddress())
if mibBuilder.loadTexts: natBindingLocalAddr.setStatus('current')
natBindingLocalPort = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 3, 1, 3), Unsigned32())
if mibBuilder.loadTexts: natBindingLocalPort.setStatus('current')
natBindingPublicAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 3, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: natBindingPublicAddr.setStatus('current')
natBindingPublicPort = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 3, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: natBindingPublicPort.setStatus('current')
zhonePATBindings = MibIdentifier((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 4))
patBindNextIndex = MibScalar((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 4, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: patBindNextIndex.setStatus('current')
patTable = MibTable((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 4, 2), )
if mibBuilder.loadTexts: patTable.setStatus('current')
patEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 4, 2, 1), ).setIndexNames((0, "ZHONE-COM-IP-ZEDGE-NAT-MIB", "zhonePATBindIndex"))
if mibBuilder.loadTexts: patEntry.setStatus('current')
zhonePATBindIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 4, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4320)))
if mibBuilder.loadTexts: zhonePATBindIndex.setStatus('current')
zhonePATBindRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 4, 2, 1, 2), ZhoneRowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: zhonePATBindRowStatus.setStatus('current')
publicAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 4, 2, 1, 3), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: publicAddr.setStatus('current')
publicPort = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 4, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(51921, 56250))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: publicPort.setStatus('current')
localAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 4, 2, 1, 5), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: localAddr.setStatus('current')
localPort = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 4, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 49151))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: localPort.setStatus('current')
portType = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 4, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("tcp", 1), ("udp", 2), ("cpemgr", 3), ("cpemgrsecure", 4))).clone('tcp')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: portType.setStatus('current')
zhoneNATExclusion = MibIdentifier((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 5))
natExcludeNextIndex = MibScalar((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 5, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: natExcludeNextIndex.setStatus('current')
natExcludeTable = MibTable((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 5, 2), )
if mibBuilder.loadTexts: natExcludeTable.setStatus('current')
natExcludeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 5, 2, 1), ).setIndexNames((0, "ZHONE-COM-IP-ZEDGE-NAT-MIB", "zhoneNATExcludeIndex"))
if mibBuilder.loadTexts: natExcludeEntry.setStatus('current')
zhoneNATExcludeIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 5, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 20)))
if mibBuilder.loadTexts: zhoneNATExcludeIndex.setStatus('current')
zhoneNATExcludeRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 5, 2, 1, 2), ZhoneRowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: zhoneNATExcludeRowStatus.setStatus('current')
ipStartAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 5, 2, 1, 3), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: ipStartAddr.setStatus('current')
ipEndAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 4, 1, 16, 5, 2, 1, 4), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: ipEndAddr.setStatus('current')
mibBuilder.exportSymbols("ZHONE-COM-IP-ZEDGE-NAT-MIB", portType=portType, natBindingLocalAddr=natBindingLocalAddr, zedgeNat=zedgeNat, natBindingsIfIndex=natBindingsIfIndex, patEntry=patEntry, publicPort=publicPort, natClearBindings=natClearBindings, natNumExpiredBindings=natNumExpiredBindings, natBindingPublicPort=natBindingPublicPort, natTcpTimeout=natTcpTimeout, natBindingLocalPort=natBindingLocalPort, natStatsGroup=natStatsGroup, natExcludeTable=natExcludeTable, natBindingsTable=natBindingsTable, natExcludeNextIndex=natExcludeNextIndex, natBindingPublicAddr=natBindingPublicAddr, zhonePATBindings=zhonePATBindings, natDroppedPkts=natDroppedPkts, localPort=localPort, comIpZEdgeNat=comIpZEdgeNat, natExcludeEntry=natExcludeEntry, patTable=patTable, zhoneNATExclusion=zhoneNATExclusion, natConfigGroup=natConfigGroup, natUdpTimeout=natUdpTimeout, natBindingsEntry=natBindingsEntry, PYSNMP_MODULE_ID=comIpZEdgeNat, zhonePATBindRowStatus=zhonePATBindRowStatus, patBindNextIndex=patBindNextIndex, zhonePATBindIndex=zhonePATBindIndex, zhoneNATExcludeRowStatus=zhoneNATExcludeRowStatus, zhoneNATExcludeIndex=zhoneNATExcludeIndex, natNumCurrentBindings=natNumCurrentBindings, ipStartAddr=ipStartAddr, natTotalPkts=natTotalPkts, ipEndAddr=ipEndAddr, localAddr=localAddr, publicAddr=publicAddr)
|
# Data paths
DATA_BACKGROUND_FOLDER = "../data/background/"
DATA_GENERATED_FOLDER = "../data/generated_data/"
# General settings
IMAGES_TO_GENERATE = 500
COIN_RESIZE_RATIO_MIN = 0.4
COIN_RESIZE_RATIO_MAX = 0.6
# Background settings
BACKGROUND_RESIZE_RATIO = 400
BACKGROUND_MAX_N_COINS = 25
# Coin crop settings
MAX_COIN_OVERLAP_PERCENTAGE = 0.33
INDIVIDUAL_COIN_CROP_NOISE = 0.05
|
"""
This is the Blockchain
Model class implementation
"""
class Blockchain:
def __init__(self):
self.current_transactions = []
self.chain = []
self.nodes = set()
def __repr__(self):
return '<Blockchain(chain={self.chain!r}, current_transactions={self.current_transactions!r})>'.format(self=self) |
#!/usr/bin/env python3
"""Helper for finding threshold values for CO alarm."""
# The calculation is based of https://github.com/ElectronicCats/MICS4514-Croquette
# and is not verified.
LOAD_RESISTOR_OHM = 47000
VSUP = 3.3
VREF = 3.3
ADC_RESOLUTION_BITS = 10
def _main():
"""Present the ppm value for each ADC raw value for the MiCS-4515."""
for adc in range(2 ** ADC_RESOLUTION_BITS):
try:
vco = (VREF * adc) / ((2 ** ADC_RESOLUTION_BITS) - 1)
rco = LOAD_RESISTOR_OHM / ((VSUP - vco) / vco)
conco = LOAD_RESISTOR_OHM / rco
ppmco = 4.4138 * pow(conco, -1.178)
except ZeroDivisionError:
continue
print('0x{0:04x} // {1} ppm CO'.format(adc, round(ppmco, 1)))
if __name__ == "__main__":
_main()
|
"""
Given an array, find the nearest smaller element G[i] for every element A[i] in the array such that the element has an index smaller than i.
More formally,
G[i] for an element A[i] = an element A[j] such that
j is maximum possible AND
j < i AND
A[j] < A[i]
Elements for which no smaller element exist, consider next smaller element as -1.
Example:
Input : A : [4, 5, 2, 10, 8]
Return : [-1, 4, -1, 2, 2]
Example 2:
Input : A : [3, 2, 1]
Return : [-1, -1, -1]
"""
class Solution:
# @param arr : list of integers
# @return a list of integers
def prevSmaller(self, arr):
stack = [arr[0]]
result = [-1]
l = len(arr)
for i in xrange(1, l):
while stack and stack[len(stack) - 1] >= arr[i]:
stack.pop()
if stack:
popped = stack.pop()
stack.append(popped)
stack.append(arr[i])
result.append(popped)
else:
stack.append(arr[i])
result.append(-1)
return result
|
"""
Faça um mini Sistema que utilize o interactive help do Python.
O usuário vai digitar o comando e o manual vai aparecer.
Quando o usuário digitar FIM, o programa se encerrará.
"""
# Funções
def ajuda(com):
help(com)
def titulo(mensagem):
tamanho = len(mensagem) + 4
print('~' * tamanho)
print(f' {mensagem} ')
print('~' * tamanho)
# Programa Principal
titulo('SISTEMA DE AJUDA PYHELP')
comando = ''
while True:
comando = str(input('\n Função ou Biblioteca > '))
if comando.upper() == 'FIM':
print()
titulo('ATÉ LOGO')
break
else:
ajuda(comando)
|
''' Crie um programa que simule o funcionamento de um caixa eletrônico. No início, pergunte ao usuário qual será o valor a ser sacado (número inteiro) e o programa vai informar quantas cédulas de cada valor serão entregues. OBS: considere que o caixa possui cédulas de R$100, R$50, R$20, R$10, R$5 e R$1. '''
valor = int(input('Qual o valor ser sacado? R$ '))
if valor >= 100:
cedula = valor // 100
valor = valor % 100
print(f'Total de {cedula} cédula(s) de R$ 100.')
if valor >= 50:
cedula = valor // 50
valor = valor % 50
print(f'Total de {cedula} cédula(s) de R$ 50.')
if valor >= 20:
cedula = valor // 20
valor = valor % 20
print(f'Total de {cedula} cédula(s) de R$ 20.')
if valor >= 10:
cedula = valor // 10
valor = valor % 10
print(f'Total de {cedula} cédula(s) de R$ 10.')
if valor >= 5:
cedula = valor // 5
valor = valor % 5
print(f'Total de {cedula} cédula(s) de R$ 5.')
if valor >= 1:
cedula = valor // 1
valor = valor % 1
print(f'Total de {cedula} cédula(s) de R$ 1.')
|
# Test values must be in the form [(text_input, expected_output), (text_input, expected_output), ...]
test_values = [
(
"president",
{
"n": {
"president",
"presidentship",
"presidencies",
"presidency",
"presidentships",
"presidents",
},
"r": {"presidentially"},
"a": {"presidential"},
"v": {"presiding", "presides", "preside", "presided"},
},
),
(
"elect",
{
"n": {
"elector",
"elects",
"electors",
"elective",
"electorates",
"elect",
"electives",
"elections",
"electorate",
"eligibility",
"election",
"eligibilities",
},
"r": set(),
"a": {"elect", "electoral", "elective", "eligible"},
"v": {"elect", "elects", "electing", "elected"},
},
),
(
"running",
{
"n": {
"runninesses",
"runnings",
"runs",
"running",
"runniness",
"runners",
"runner",
"run",
},
"a": {"running", "runny"},
"v": {"running", "ran", "runs", "run"},
"r": set(),
},
),
(
"run",
{
"n": {
"runninesses",
"runnings",
"runs",
"running",
"runniness",
"runners",
"runner",
"run",
},
"a": {"running", "runny"},
"v": {"running", "ran", "runs", "run"},
"r": set(),
},
),
(
"operations",
{
"n": {
"operators",
"operations",
"operation",
"operative",
"operator",
"operatives",
},
"a": {"operant", "operative"},
"v": {"operated", "operating", "operate", "operates"},
"r": {"operatively"},
},
),
(
"operate",
{
"n": {
"operators",
"operations",
"operation",
"operative",
"operator",
"operatives",
},
"a": {"operant", "operative"},
"v": {"operated", "operating", "operate", "operates"},
"r": {"operatively"},
},
),
(
"invest",
{
"n": {
"investitures",
"investors",
"investiture",
"investor",
"investments",
"investings",
"investment",
"investing",
},
"a": set(),
"v": {"invested", "invests", "invest", "investing"},
"r": set(),
},
),
(
"investments",
{
"n": {
"investitures",
"investors",
"investiture",
"investor",
"investments",
"investings",
"investment",
"investing",
},
"a": set(),
"v": {"invested", "invests", "invest", "investing"},
"r": set(),
},
),
(
"conjugation",
{
"n": {"conjugate", "conjugation", "conjugates", "conjugations"},
"a": {"conjugate"},
"v": {"conjugating", "conjugated", "conjugate", "conjugates"},
"r": set(),
},
),
(
"do",
{
"n": {"does", "doer", "doers", "do"},
"a": set(),
"v": {
"doing",
"don't",
"does",
"didn't",
"do",
"doesn't",
"done",
"did",
},
"r": set(),
},
),
(
"word",
{
"n": {"words", "word", "wordings", "wording"},
"a": set(),
"v": {"words", "word", "worded", "wording"},
"r": set(),
},
),
(
"love",
{
"a": {"lovable", "loveable"},
"n": {"love", "lover", "lovers", "loves"},
"r": set(),
"v": {"love", "loved", "loves", "loving"},
},
),
(
"word",
{
"n": {"words", "word", "wordings", "wording"},
"a": set(),
"v": {"words", "word", "worded", "wording"},
"r": set(),
},
),
(
"verb",
{
"n": {"verbs", "verb"},
"a": {"verbal"},
"v": {"verbifying", "verbified", "verbify", "verbifies"},
"r": {"verbally"},
},
),
(
"genetic",
{
"n": {"geneticist", "genetics", "geneticists", "genes", "gene"},
"a": {"genic", "genetic", "genetical"},
"v": set(),
"r": {"genetically"},
},
),
(
"politician",
{
"r": {"politically"},
"a": {"political"},
"n": {"politician", "politicians", "politics"},
"v": set(),
},
),
(
"death",
{
"n": {"death", "dying", "deaths", "die", "dyings", "dice"},
"a": {"dying", "deathly"},
"v": {"died", "die", "dying", "dies"},
"r": {"deathly"},
},
),
(
"attitude",
{
"n": {"attitudes", "attitude"},
"a": set(),
"v": {
"attitudinise",
"attitudinized",
"attitudinize",
"attitudinizes",
"attitudinizing",
},
"r": set(),
},
),
(
"cheek",
{
"n": {"cheek", "cheekinesses", "cheeks", "cheekiness"},
"a": {"cheeky"},
"v": {"cheek", "cheeks", "cheeked", "cheeking"},
"r": {"cheekily"},
},
),
(
"world",
{
"n": {"worldliness", "world", "worldlinesses", "worlds"},
"a": {"worldly", "world"},
"v": set(),
"r": set(),
},
),
("lake", {"n": {"lake", "lakes"}, "a": set(), "v": set(), "r": set()}),
(
"guitar",
{
"n": {"guitarist", "guitarists", "guitar", "guitars"},
"a": set(),
"v": set(),
"r": set(),
},
),
(
"presence",
{
"n": {
"presenter",
"present",
"presents",
"presentness",
"presenters",
"presentnesses",
"presentments",
"presentations",
"presences",
"presence",
"presentment",
"presentation",
},
"a": {"present"},
"v": {"present", "presents", "presenting", "presented"},
"r": {"presently"},
},
),
(
"enthusiasm",
{
"n": {"enthusiasm", "enthusiasms"},
"a": {"enthusiastic"},
"v": set(),
"r": {"enthusiastically"},
},
),
(
"organization",
{
"n": {"organizers", "organization", "organizations", "organizer"},
"a": set(),
"v": {"organize", "organized", "organizing", "organizes"},
"r": set(),
},
),
(
"player",
{
"n": {
"plays",
"playlet",
"playings",
"players",
"playing",
"playlets",
"play",
"player",
},
"a": set(),
"v": {"plays", "play", "playing", "played"},
"r": set(),
},
),
(
"transportation",
{
"n": {
"transporters",
"transportation",
"transportations",
"transporter",
"transport",
"transports",
},
"a": set(),
"v": {"transport", "transporting", "transports", "transported"},
"r": set(),
},
),
(
"television",
{
"n": {"televisions", "television"},
"a": set(),
"v": {"televising", "televise", "televises", "televised"},
"r": set(),
},
),
(
"cousin",
{"n": {"cousins", "cousin"}, "a": {"cousinly"}, "v": set(), "r": set()},
),
(
"ability",
{"n": {"abilities", "ability"}, "a": {"able"}, "v": set(), "r": {"ably"}},
),
("chapter", {"n": {"chapters", "chapter"}, "a": set(), "v": set(), "r": set()}),
(
"appearance",
{
"n": {
"appearances",
"apparitions",
"appearance",
"apparencies",
"apparentness",
"apparentnesses",
"apparition",
"apparency",
},
"a": {"apparent"},
"v": {"appears", "appeared", "appear", "appearing"},
"r": {"apparently"},
},
),
(
"drawing",
{
"n": {
"drawings",
"drawers",
"draws",
"drawer",
"drawees",
"drawee",
"draw",
"drawing",
},
"a": set(),
"v": {"draws", "drew", "drawn", "draw", "drawing"},
"r": set(),
},
),
(
"university",
{"n": {"university", "universities"}, "a": set(), "v": set(), "r": set()},
),
(
"performance",
{
"n": {
"performings",
"performing",
"performances",
"performance",
"performer",
"performers",
},
"a": set(),
"v": {"performs", "performing", "performed", "perform"},
"r": set(),
},
),
("revenue", {"n": {"revenue", "revenues"}, "a": set(), "v": set(), "r": set()}),
# Some Verbs
(
"cling",
{
"n": {"cling", "clings"},
"a": set(),
"v": {"clung", "cling", "clinging", "clings"},
"r": set(),
},
),
(
"decrease",
{
"n": {"decrease", "decreases"},
"a": set(),
"v": {"decrease", "decreases", "decreased", "decreasing"},
"r": set(),
},
),
(
"wonder",
{
"n": {
"wonder",
"wonderment",
"wonderments",
"wonders",
"wonderers",
"wonderer",
},
"a": {"wondrous"},
"v": {"wondering", "wonder", "wonders", "wondered"},
"r": {"wondrous", "wondrously"},
},
),
(
"rest",
{
"n": {"rest", "rests", "resters", "rester"},
"a": set(),
"v": {"rest", "rests", "resting", "rested"},
"r": set(),
},
),
(
"mutter",
{
"n": {
"mutterer",
"mutterers",
"muttering",
"mutter",
"mutterings",
"mutters",
},
"a": set(),
"v": {"muttering", "muttered", "mutters", "mutter"},
"r": set(),
},
),
(
"implement",
{
"n": {"implementations", "implement", "implements", "implementation"},
"a": {"implemental"},
"v": {"implemented", "implement", "implements", "implementing"},
"r": set(),
},
),
(
"evolve",
{
"n": {"evolution", "evolutions"},
"a": {"evolutionary"},
"v": {"evolved", "evolve", "evolves", "evolving"},
"r": {"evolutionarily"},
},
),
(
"allocate",
{
"n": {"allocations", "allocators", "allocation", "allocator"},
"a": {"allocable", "allocatable"},
"v": {"allocating", "allocates", "allocated", "allocate"},
"r": set(),
},
),
(
"flood",
{
"n": {"flood", "flooding", "floodings", "floods"},
"a": set(),
"v": {"flooding", "flooded", "flood", "floods"},
"r": set(),
},
), # Should there be `flooded` in 'a' here?
(
"bow",
{
"n": {"bows", "bow"},
"a": set(),
"v": {"bows", "bowing", "bowed", "bow"},
"r": set(),
},
),
(
"advocate",
{
"n": {
"advocates",
"advocator",
"advocacy",
"advocacies",
"advocators",
"advocate",
},
"a": set(),
"v": {"advocates", "advocating", "advocated", "advocate"},
"r": set(),
},
),
(
"divert",
{
"n": {"diversions", "diversionists", "diversionist", "diversion"},
"a": {"diversionary"},
"v": {"diverted", "diverts", "divert", "diverting"},
"r": set(),
},
),
# Some adjectives
(
"sweet",
{
"n": {"sweetnesses", "sweets", "sweetness", "sweet"},
"a": {"sweet"},
"v": set(),
"r": {"sweet", "sweetly"},
},
),
(
"glossy",
{
"n": {"glossiness", "glossy", "glossies", "glossinesses"},
"a": {"glossy"},
"v": set(),
"r": {"glossily"},
},
),
(
"relevant",
{
"n": {"relevancies", "relevance", "relevancy", "relevances"},
"a": {"relevant"},
"v": set(),
"r": {"relevantly"},
},
),
(
"aloof",
{"n": {"aloofnesses", "aloofness"}, "a": {"aloof"}, "v": set(), "r": {"aloof"}},
),
(
"therapeutic",
{
"n": {
"therapists",
"therapies",
"therapy",
"therapist",
"therapeutic",
"therapeutics",
},
"a": {"therapeutical", "therapeutic"},
"v": set(),
"r": {"therapeutically"},
},
),
(
"obviously",
{
"n": {"obviousnesses", "obviousness"},
"a": {"obvious"},
"v": set(),
"r": {"obviously"},
},
),
(
"jumpy",
{
"n": {"jumpings", "jumpiness", "jumpinesses", "jump", "jumping", "jumps"},
"a": {"jumpy"},
"v": {"jump", "jumping", "jumped", "jumps"},
"r": set(),
},
),
(
"venomous",
{"n": {"venom", "venoms"}, "a": {"venomous"}, "v": set(), "r": {"venomously"}},
),
(
"laughable",
{
"n": {"laugher", "laughs", "laughers", "laugh"},
"a": {"laughable"},
"v": {"laughing", "laughs", "laughed", "laugh"},
"r": {"laughably"},
},
),
(
"demonic",
{
"n": {"demons", "demon", "demonizations", "demonization"},
"a": {"demonic"},
"v": {"demonized", "demonizing", "demonizes", "demonize"},
"r": set(),
},
),
(
"knotty",
{
"n": {"knot", "knottiness", "knots", "knottinesses"},
"a": {"knotty"},
"v": {"knotted", "knotting", "knots", "knot"},
"r": set(),
},
), # Is `knottinesses` a valid plural?
(
"little",
{
"n": {"little", "littlenesses", "littles", "littleness"},
"a": {"little"},
"v": set(),
"r": {"little"},
},
), # Is `littlenesses` a valid plural?
(
"puzzling",
{
"n": {
"puzzle",
"puzzlers",
"puzzler",
"puzzlement",
"puzzlements",
"puzzles",
},
"a": {"puzzling"},
"v": {"puzzle", "puzzled", "puzzles", "puzzling"},
"r": set(),
},
),
(
"overrated",
{
"n": {"overratings", "overrating"},
"a": set(),
"v": {"overrated", "overrating", "overrate", "overrates"},
"r": set(),
},
),
(
"walk",
{
"n": {"walking", "walks", "walkings", "walker", "walk", "walkers"},
"a": {"walking"},
"v": {"walked", "walking", "walk", "walks"},
"r": set(),
},
),
(
"walking",
{
"n": {"walking", "walks", "walkings", "walker", "walk", "walkers"},
"a": {"walking"},
"v": {"walked", "walking", "walk", "walks"},
"r": set(),
},
),
(
"be",
{
"n": {"beings", "being"},
"a": set(),
"v": {
"wasn't",
"being",
"be",
"are",
"was",
"am",
"isn't",
"is",
"aren't",
"been",
"weren't",
"were",
"am not",
},
"r": set(),
},
),
(
"am",
{
"n": {"beings", "being"},
"a": set(),
"v": {
"wasn't",
"being",
"be",
"are",
"was",
"am",
"isn't",
"is",
"aren't",
"been",
"weren't",
"were",
"am not",
},
"r": set(),
},
),
(
"run",
{
"n": {
"runnings",
"run",
"runninesses",
"runner",
"runniness",
"running",
"runs",
"runners",
},
"a": {"running", "runny"},
"v": {"running", "ran", "run", "runs"},
"r": set(),
},
),
(
"ran",
{
"n": {
"runnings",
"run",
"runninesses",
"runner",
"runniness",
"running",
"runs",
"runners",
},
"a": {"running", "runny"},
"v": {"running", "ran", "run", "runs"},
"r": set(),
},
),
(
"blanket",
{
"n": {"blanket", "blankets"},
"a": {"blanket"},
"v": {"blankets", "blanketed", "blanketing", "blanket"},
"r": set(),
},
),
] |
def simulate_accuracy_vs_stoptime(sigma, stop_time_list, num_sample):
"""Calculate the average decision accuracy vs. stopping time by running
repeated SPRT simulations for each stop time.
Args:
sigma (float): standard deviation for observation model
stop_list_list (list-like object): a list of stopping times to run over
num_sample (int): number of simulations to run per stopping time
Returns:
accuracy_list: a list of average accuracies corresponding to input
`stop_time_list`
decisions_list: a list of decisions made in all trials
"""
# Determine true state (1 or -1)
true_dist = 1
# Set up tracker of accuracy and decisions
accuracies = np.zeros(len(stop_time_list),)
decisions_list = []
# Loop over stop times
for i_stop_time, stop_time in enumerate(stop_time_list):
# Set up tracker of decisions for this stop time
decisions = np.zeros((num_sample,))
# Loop over samples
for i in range(num_sample):
# Simulate run for this stop time (hint: last exercise)
_, decision, _= simulate_SPRT_fixedtime(sigma, stop_time, true_dist)
# Log decision
decisions[i] = decision
# Calculate accuracy
accuracies[i_stop_time] = np.sum(decisions == true_dist) / decisions.shape[0]
# Log decisions
decisions_list.append(decisions)
return accuracies, decisions_list
# Set random seed
np.random.seed(100)
# Set parameters of model
sigma = 4.65 # standard deviation for observation noise
num_sample = 200 # number of simulations to run for each stopping time
stop_time_list = np.arange(1, 150, 10) # Array of stopping times to use
# Calculate accuracies for each stop time
accuracies, _ = simulate_accuracy_vs_stoptime(sigma, stop_time_list,
num_sample)
# Visualize
with plt.xkcd():
plot_accuracy_vs_stoptime(stop_time_list, accuracies) |
def myfunc(str):
print(str)
nstr = str.lower()
for i in range(len(str)):
nstr[i+1].upper()
return nstr
print(myfunc("SlseJbKWdOEuhB")) |
'''
@Coded by TSG, 2021
Problem:
FizzBuzz is a well known programming assignment, asked during interviews.
The given code solves the FizzBuzz problem and uses the words "Solo" and "Learn" instead of "Fizz" and "Buzz".
It takes an input n and outputs the numbers from 1 to n.
For each multiple of 3, print "Solo" instead of the number.
For each multiple of 5, prints "Learn" instead of the number.
For numbers which are multiples of both 3 and 5, output "SoloLearn".
You need to change the code to skip the even numbers, so that the logic only applies to odd numbers in the range.
'''
# your code goes here
for x in range(1, int(input())):
if x % 2 == 0: continue
if x % 3 == 0 and x % 5 == 0: print("SoloLearn")
elif x % 3 == 0: print("Solo")
elif x % 5 == 0: print("Learn")
else: print(x)
|
#
# PySNMP MIB module HP-ICF-MLD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-MLD-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:22:09 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)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint")
hpSwitch, = mibBuilder.importSymbols("HP-ICF-OID", "hpSwitch")
InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex")
InetAddressIPv6, = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressIPv6")
mldInterfaceEntry, = mibBuilder.importSymbols("IPV6-MLD-MIB", "mldInterfaceEntry")
PortList, = mibBuilder.importSymbols("Q-BRIDGE-MIB", "PortList")
ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")
Counter64, Integer32, Gauge32, Counter32, ModuleIdentity, Unsigned32, ObjectIdentity, NotificationType, IpAddress, TimeTicks, MibIdentifier, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Integer32", "Gauge32", "Counter32", "ModuleIdentity", "Unsigned32", "ObjectIdentity", "NotificationType", "IpAddress", "TimeTicks", "MibIdentifier", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits")
RowStatus, TextualConvention, DisplayString, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TextualConvention", "DisplayString", "TruthValue")
hpicfMldMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48))
hpicfMldMIB.setRevisions(('2015-09-11 00:00', '2013-02-10 00:00', '2011-03-10 00:00', '2011-01-11 00:00', '2010-09-09 00:00', '2007-07-02 00:00',))
if mibBuilder.loadTexts: hpicfMldMIB.setLastUpdated('201509110000Z')
if mibBuilder.loadTexts: hpicfMldMIB.setOrganization('HP Networking')
class HpicfMcastGroupTypeDefinition(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("standard", 1), ("filtered", 2), ("mini", 3))
class HpicfMldIfEntryState(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("initialWait", 1), ("querierElection", 2), ("querier", 3), ("nonQuerier", 4))
hpicfMldObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1))
hpicfMld = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1))
hpicfMldConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2))
hpicfMldGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1))
hpicfMldCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 2))
hpicfMldControlUnknownMulticast = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 1), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfMldControlUnknownMulticast.setStatus('current')
hpicfMldConfigForcedLeaveInterval = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfMldConfigForcedLeaveInterval.setStatus('current')
hpicfMldEnabledCount = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldEnabledCount.setStatus('current')
hpicfMldMcastGroupJoinsCount = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldMcastGroupJoinsCount.setStatus('current')
hpicfMldIfTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5), )
if mibBuilder.loadTexts: hpicfMldIfTable.setStatus('current')
hpicfMldIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1), )
mldInterfaceEntry.registerAugmentions(("HP-ICF-MLD-MIB", "hpicfMldIfEntry"))
hpicfMldIfEntry.setIndexNames(*mldInterfaceEntry.getIndexNames())
if mibBuilder.loadTexts: hpicfMldIfEntry.setStatus('current')
hpicfMldIfEntryQuerierFeature = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 1), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfMldIfEntryQuerierFeature.setStatus('current')
hpicfMldIfEntrySnoopingFeature = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 2), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfMldIfEntrySnoopingFeature.setStatus('current')
hpicfMldIfEntryQuerierPort = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryQuerierPort.setStatus('current')
hpicfMldIfEntryFilteredJoins = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryFilteredJoins.setStatus('current')
hpicfMldIfEntryStandardJoins = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStandardJoins.setStatus('current')
hpicfMldIfEntryPortsWithMcastRouter = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 6), PortList()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryPortsWithMcastRouter.setStatus('current')
hpicfMldIfEntryStatGeneralQueryRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatGeneralQueryRx.setStatus('current')
hpicfMldIfEntryStatQueryTx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatQueryTx.setStatus('current')
hpicfMldIfEntryStatGSQRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatGSQRx.setStatus('current')
hpicfMldIfEntryStatGSQTx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatGSQTx.setStatus('current')
hpicfMldIfEntryStatMldV1ReportRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatMldV1ReportRx.setStatus('current')
hpicfMldIfEntryStatMldV2ReportRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatMldV2ReportRx.setStatus('current')
hpicfMldIfEntryStatMldV1LeaveRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatMldV1LeaveRx.setStatus('current')
hpicfMldIfEntryStatUnknownMldTypeRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatUnknownMldTypeRx.setStatus('current')
hpicfMldIfEntryStatUnknownPktRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatUnknownPktRx.setStatus('current')
hpicfMldIfEntryStatForwardToRoutersTx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatForwardToRoutersTx.setStatus('current')
hpicfMldIfEntryStatForwardToAllPortsTx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatForwardToAllPortsTx.setStatus('current')
hpicfMldIfEntryStatFastLeaves = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatFastLeaves.setStatus('current')
hpicfMldIfEntryStatForcedFastLeaves = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatForcedFastLeaves.setStatus('current')
hpicfMldIfEntryStatJoinTimeouts = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatJoinTimeouts.setStatus('current')
hpicfMldIfEntryStatWrongVersionQueries = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatWrongVersionQueries.setStatus('current')
hpicfMldIfEntryLastMemberQueryCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryLastMemberQueryCount.setStatus('current')
hpicfMldIfEntryStartupQueryCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStartupQueryCount.setStatus('current')
hpicfMldIfEntryStartupQueryInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 24), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStartupQueryInterval.setStatus('current')
hpicfMldIfEntryStatExcludeGroupJoinsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 25), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatExcludeGroupJoinsCount.setStatus('current')
hpicfMldIfEntryStatIncludeGroupJoinsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 26), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatIncludeGroupJoinsCount.setStatus('current')
hpicfMldIfEntryStatFilteredExcludeGroupJoinsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 27), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatFilteredExcludeGroupJoinsCount.setStatus('current')
hpicfMldIfEntryStatFilteredIncludeGroupJoinsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 28), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatFilteredIncludeGroupJoinsCount.setStatus('current')
hpicfMldIfEntryStatStandardExcludeGroupJoinsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 29), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatStandardExcludeGroupJoinsCount.setStatus('current')
hpicfMldIfEntryStatStandardIncludeGroupJoinsCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 30), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatStandardIncludeGroupJoinsCount.setStatus('current')
hpicfMldIfEntryStatV1QueryTx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 31), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatV1QueryTx.setStatus('current')
hpicfMldIfEntryStatV1QueryRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 32), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatV1QueryRx.setStatus('current')
hpicfMldIfEntryStatV2QueryTx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 33), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatV2QueryTx.setStatus('current')
hpicfMldIfEntryStatV2QueryRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 34), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatV2QueryRx.setStatus('current')
hpicfMldIfEntryStatGSSQTx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 35), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatGSSQTx.setStatus('current')
hpicfMldIfEntryStatGSSQRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 36), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatGSSQRx.setStatus('current')
hpicfMldIfEntryStatMalformedPktRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 37), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatMalformedPktRx.setStatus('current')
hpicfMldIfEntryStatBadCheckSumRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 38), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatBadCheckSumRx.setStatus('current')
hpicfMldIfEntryStatMartianSourceRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 39), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatMartianSourceRx.setStatus('current')
hpicfMldIfEntryStatPacketsRxOnDisabled = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 40), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatPacketsRxOnDisabled.setStatus('current')
hpicfMldIfEntryStrictVersionMode = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 41), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfMldIfEntryStrictVersionMode.setStatus('current')
hpicfMldIfEntryStatMldV1ReportTx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 42), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatMldV1ReportTx.setStatus('current')
hpicfMldIfEntryStatMldV2ReportTx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 43), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatMldV2ReportTx.setStatus('current')
hpicfMldIfEntryState = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 44), HpicfMldIfEntryState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryState.setStatus('current')
hpicfMldIfEntryStatV1GSQRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 45), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatV1GSQRx.setStatus('current')
hpicfMldIfEntryStatV1GSQTx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 46), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatV1GSQTx.setStatus('current')
hpicfMldIfEntryStatV2GSQRx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 47), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatV2GSQRx.setStatus('current')
hpicfMldIfEntryStatV2GSQTx = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 48), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStatV2GSQTx.setStatus('current')
hpicfMldIfEntryStartupQueryExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 49), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryStartupQueryExpiryTime.setStatus('current')
hpicfMldIfEntryOtherQuerierInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 50), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryOtherQuerierInterval.setStatus('current')
hpicfMldIfEntryOtherQuerierExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 5, 1, 51), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldIfEntryOtherQuerierExpiryTime.setStatus('current')
hpicfMldCacheTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6), )
if mibBuilder.loadTexts: hpicfMldCacheTable.setStatus('current')
hpicfMldCacheEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1), ).setIndexNames((0, "HP-ICF-MLD-MIB", "hpicfMldCacheIfIndex"), (0, "HP-ICF-MLD-MIB", "hpicfMldCacheAddress"))
if mibBuilder.loadTexts: hpicfMldCacheEntry.setStatus('current')
hpicfMldCacheIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: hpicfMldCacheIfIndex.setStatus('current')
hpicfMldCacheAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 2), InetAddressIPv6().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16))
if mibBuilder.loadTexts: hpicfMldCacheAddress.setStatus('current')
hpicfMldCacheSelf = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 3), TruthValue().clone('true')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpicfMldCacheSelf.setStatus('current')
hpicfMldCacheLastReporter = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 4), InetAddressIPv6().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldCacheLastReporter.setStatus('current')
hpicfMldCacheUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 5), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldCacheUpTime.setStatus('current')
hpicfMldCacheExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 6), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldCacheExpiryTime.setStatus('current')
hpicfMldGroupType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 7), HpicfMcastGroupTypeDefinition()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldGroupType.setStatus('current')
hpicfJoinedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 8), PortList()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfJoinedPorts.setStatus('current')
hpicfMldCacheStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 9), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpicfMldCacheStatus.setStatus('current')
hpicfMldCacheFilterMode = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("include", 1), ("exclude", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldCacheFilterMode.setStatus('current')
hpicfMldCacheExcludeModeExpiryTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 11), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldCacheExcludeModeExpiryTimer.setStatus('current')
hpicfMldCacheVersion1HostTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 12), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldCacheVersion1HostTimer.setStatus('current')
hpicfMldCacheSrcCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 6, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldCacheSrcCount.setStatus('current')
class HpicfMldConfigPortModeType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("auto", 1), ("blocked", 2), ("forward", 3))
hpicfMldPortConfigTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 7), )
if mibBuilder.loadTexts: hpicfMldPortConfigTable.setStatus('current')
hpicfMldPortConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 7, 1), ).setIndexNames((0, "HP-ICF-MLD-MIB", "hpicfMldPortConfigEntryInterfaceIfIndex"), (0, "HP-ICF-MLD-MIB", "hpicfMldPortConfigEntryIndex"))
if mibBuilder.loadTexts: hpicfMldPortConfigEntry.setStatus('current')
hpicfMldPortConfigEntryInterfaceIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 7, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: hpicfMldPortConfigEntryInterfaceIfIndex.setStatus('current')
hpicfMldPortConfigEntryIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 7, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: hpicfMldPortConfigEntryIndex.setStatus('current')
hpicfMldPortConfigEntryPortModeFeature = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 7, 1, 3), HpicfMldConfigPortModeType()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfMldPortConfigEntryPortModeFeature.setStatus('current')
hpicfMldPortConfigEntryForcedLeaveFeature = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 7, 1, 4), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfMldPortConfigEntryForcedLeaveFeature.setStatus('current')
hpicfMldPortConfigEntryFastLeaveFeature = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 7, 1, 5), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfMldPortConfigEntryFastLeaveFeature.setStatus('current')
hpicfMldFilteredGroupPortCacheTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 8), )
if mibBuilder.loadTexts: hpicfMldFilteredGroupPortCacheTable.setStatus('current')
hpicfMldFilteredGroupPortCacheEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 8, 1), ).setIndexNames((0, "HP-ICF-MLD-MIB", "hpicfMldFilteredGroupPortCacheIfIndex"), (0, "HP-ICF-MLD-MIB", "hpicfMldFilteredGroupPortCacheGroupAddress"), (0, "HP-ICF-MLD-MIB", "hpicfMldFilteredGroupPortCachePortIndex"))
if mibBuilder.loadTexts: hpicfMldFilteredGroupPortCacheEntry.setStatus('current')
hpicfMldFilteredGroupPortCacheIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 8, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: hpicfMldFilteredGroupPortCacheIfIndex.setStatus('current')
hpicfMldFilteredGroupPortCacheGroupAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 8, 1, 2), InetAddressIPv6())
if mibBuilder.loadTexts: hpicfMldFilteredGroupPortCacheGroupAddress.setStatus('current')
hpicfMldFilteredGroupPortCachePortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 8, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: hpicfMldFilteredGroupPortCachePortIndex.setStatus('current')
hpicfMldFilteredGroupPortCacheExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 8, 1, 4), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldFilteredGroupPortCacheExpiryTime.setStatus('current')
hpicfMldSrcListTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 9), )
if mibBuilder.loadTexts: hpicfMldSrcListTable.setStatus('current')
hpicfMldSrcListEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 9, 1), ).setIndexNames((0, "HP-ICF-MLD-MIB", "hpicfMldSrcListIfIndex"), (0, "HP-ICF-MLD-MIB", "hpicfMldSrcListAddress"), (0, "HP-ICF-MLD-MIB", "hpicfMldSrcListHostAddress"))
if mibBuilder.loadTexts: hpicfMldSrcListEntry.setStatus('current')
hpicfMldSrcListIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 9, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: hpicfMldSrcListIfIndex.setStatus('current')
hpicfMldSrcListAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 9, 1, 2), InetAddressIPv6().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16))
if mibBuilder.loadTexts: hpicfMldSrcListAddress.setStatus('current')
hpicfMldSrcListHostAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 9, 1, 3), InetAddressIPv6().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16))
if mibBuilder.loadTexts: hpicfMldSrcListHostAddress.setStatus('current')
hpicfMldSrcListPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 9, 1, 4), PortList()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldSrcListPorts.setStatus('current')
hpicfMldSrcListExpiry = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 9, 1, 5), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldSrcListExpiry.setStatus('current')
hpicfMldSrcListUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 9, 1, 6), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldSrcListUpTime.setStatus('current')
hpicfMldSrcListType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 9, 1, 7), HpicfMcastGroupTypeDefinition()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldSrcListType.setStatus('current')
hpicfMldPortSrcTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 10), )
if mibBuilder.loadTexts: hpicfMldPortSrcTable.setStatus('current')
hpicfMldPortSrcEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 10, 1), ).setIndexNames((0, "HP-ICF-MLD-MIB", "hpicfMldPortSrcIfIndex"), (0, "HP-ICF-MLD-MIB", "hpicfMldPortSrcAddress"), (0, "HP-ICF-MLD-MIB", "hpicfMldPortSrcHostAddress"), (0, "HP-ICF-MLD-MIB", "hpicfMldPortSrcPortIndex"))
if mibBuilder.loadTexts: hpicfMldPortSrcEntry.setStatus('current')
hpicfMldPortSrcIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 10, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: hpicfMldPortSrcIfIndex.setStatus('current')
hpicfMldPortSrcAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 10, 1, 2), InetAddressIPv6().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16))
if mibBuilder.loadTexts: hpicfMldPortSrcAddress.setStatus('current')
hpicfMldPortSrcHostAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 10, 1, 3), InetAddressIPv6().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16))
if mibBuilder.loadTexts: hpicfMldPortSrcHostAddress.setStatus('current')
hpicfMldPortSrcPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 10, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: hpicfMldPortSrcPortIndex.setStatus('current')
hpicfMldPortSrcExpiry = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 10, 1, 5), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldPortSrcExpiry.setStatus('current')
hpicfMldPortSrcUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 10, 1, 6), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldPortSrcUpTime.setStatus('current')
hpicfMldPortSrcFilterMode = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 10, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("include", 1), ("exclude", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldPortSrcFilterMode.setStatus('current')
hpicfMldMcastExcludeGroupJoinsCount = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldMcastExcludeGroupJoinsCount.setStatus('current')
hpicfMldMcastIncludeGroupJoinsCount = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldMcastIncludeGroupJoinsCount.setStatus('current')
hpicfMldMcastPortFastLearn = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 13), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfMldMcastPortFastLearn.setStatus('current')
hpicfMldGroupPortCacheTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14), )
if mibBuilder.loadTexts: hpicfMldGroupPortCacheTable.setStatus('current')
hpicfMldGroupPortCacheEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14, 1), ).setIndexNames((0, "HP-ICF-MLD-MIB", "hpicfMldGroupPortCacheIfIndex"), (0, "HP-ICF-MLD-MIB", "hpicfMldGroupPortCacheGroupAddress"), (0, "HP-ICF-MLD-MIB", "hpicfMldGroupPortCachePortIndex"))
if mibBuilder.loadTexts: hpicfMldGroupPortCacheEntry.setStatus('current')
hpicfMldGroupPortCacheIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: hpicfMldGroupPortCacheIfIndex.setStatus('current')
hpicfMldGroupPortCacheGroupAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14, 1, 2), InetAddressIPv6())
if mibBuilder.loadTexts: hpicfMldGroupPortCacheGroupAddress.setStatus('current')
hpicfMldGroupPortCachePortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: hpicfMldGroupPortCachePortIndex.setStatus('current')
hpicfMldGroupPortCacheExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14, 1, 4), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldGroupPortCacheExpiryTime.setStatus('current')
hpicfMldGroupPortCacheUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14, 1, 5), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldGroupPortCacheUpTime.setStatus('current')
hpicfMldGroupPortCacheVersion1Timer = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14, 1, 6), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldGroupPortCacheVersion1Timer.setStatus('current')
hpicfMldGroupPortCacheFilterTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14, 1, 7), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldGroupPortCacheFilterTimer.setStatus('current')
hpicfMldGroupPortCacheFilterMode = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("include", 1), ("exclude", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldGroupPortCacheFilterMode.setStatus('current')
hpicfMldGroupPortCacheExcludeSrcCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldGroupPortCacheExcludeSrcCount.setStatus('current')
hpicfMldGroupPortCacheRequestedSrcCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 14, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfMldGroupPortCacheRequestedSrcCount.setStatus('current')
hpicfMldReload = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 1, 1, 15), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfMldReload.setStatus('current')
hpicfMldBaseGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 1)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldControlUnknownMulticast"), ("HP-ICF-MLD-MIB", "hpicfMldConfigForcedLeaveInterval"), ("HP-ICF-MLD-MIB", "hpicfMldEnabledCount"), ("HP-ICF-MLD-MIB", "hpicfMldMcastGroupJoinsCount"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldBaseGroup = hpicfMldBaseGroup.setStatus('current')
hpicfMldIfGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 2)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldIfEntryQuerierFeature"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntrySnoopingFeature"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryQuerierPort"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryFilteredJoins"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStandardJoins"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryPortsWithMcastRouter"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGeneralQueryRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatQueryTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGSQRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGSQTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV1ReportRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV2ReportRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV1LeaveRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatUnknownMldTypeRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatUnknownPktRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatForwardToRoutersTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatForwardToAllPortsTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatFastLeaves"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatForcedFastLeaves"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatJoinTimeouts"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldIfGroup = hpicfMldIfGroup.setStatus('current')
hpicfMldCacheGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 3)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldCacheSelf"), ("HP-ICF-MLD-MIB", "hpicfMldCacheLastReporter"), ("HP-ICF-MLD-MIB", "hpicfMldCacheUpTime"), ("HP-ICF-MLD-MIB", "hpicfMldCacheExpiryTime"), ("HP-ICF-MLD-MIB", "hpicfMldGroupType"), ("HP-ICF-MLD-MIB", "hpicfJoinedPorts"), ("HP-ICF-MLD-MIB", "hpicfMldCacheStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldCacheGroup = hpicfMldCacheGroup.setStatus('current')
hpicfMldPortGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 4)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldPortConfigEntryPortModeFeature"), ("HP-ICF-MLD-MIB", "hpicfMldPortConfigEntryForcedLeaveFeature"), ("HP-ICF-MLD-MIB", "hpicfMldPortConfigEntryFastLeaveFeature"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldPortGroup = hpicfMldPortGroup.setStatus('current')
hpicfMldFilteredGroupPortCacheGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 5)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldFilteredGroupPortCacheExpiryTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldFilteredGroupPortCacheGroup = hpicfMldFilteredGroupPortCacheGroup.setStatus('current')
hpicfMldBaseGroupV2 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 6)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldControlUnknownMulticast"), ("HP-ICF-MLD-MIB", "hpicfMldConfigForcedLeaveInterval"), ("HP-ICF-MLD-MIB", "hpicfMldEnabledCount"), ("HP-ICF-MLD-MIB", "hpicfMldMcastGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldMcastExcludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldMcastIncludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldMcastPortFastLearn"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldBaseGroupV2 = hpicfMldBaseGroupV2.setStatus('current')
hpicfMldIfGroupV2 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 7)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldIfEntryQuerierFeature"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntrySnoopingFeature"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryQuerierPort"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryFilteredJoins"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStandardJoins"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryPortsWithMcastRouter"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGeneralQueryRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatQueryTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGSQRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGSQTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV1ReportRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV2ReportRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV1LeaveRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatUnknownMldTypeRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatUnknownPktRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatForwardToRoutersTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatForwardToAllPortsTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatFastLeaves"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatForcedFastLeaves"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatJoinTimeouts"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatWrongVersionQueries"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryLastMemberQueryCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStartupQueryCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStartupQueryInterval"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatExcludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatIncludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatFilteredExcludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatFilteredIncludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatStandardExcludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatStandardIncludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV1QueryTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV1QueryRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV2QueryTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV2QueryRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGSSQTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGSSQRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMalformedPktRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatBadCheckSumRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMartianSourceRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatPacketsRxOnDisabled"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStrictVersionMode"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV1ReportTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV2ReportTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryState"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV1GSQRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV1GSQTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV2GSQRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV2GSQTx"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldIfGroupV2 = hpicfMldIfGroupV2.setStatus('current')
hpicfMldCacheGroupV2 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 8)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldCacheSelf"), ("HP-ICF-MLD-MIB", "hpicfMldCacheLastReporter"), ("HP-ICF-MLD-MIB", "hpicfMldCacheUpTime"), ("HP-ICF-MLD-MIB", "hpicfMldCacheExpiryTime"), ("HP-ICF-MLD-MIB", "hpicfMldGroupType"), ("HP-ICF-MLD-MIB", "hpicfJoinedPorts"), ("HP-ICF-MLD-MIB", "hpicfMldCacheStatus"), ("HP-ICF-MLD-MIB", "hpicfMldCacheFilterMode"), ("HP-ICF-MLD-MIB", "hpicfMldCacheExcludeModeExpiryTimer"), ("HP-ICF-MLD-MIB", "hpicfMldCacheVersion1HostTimer"), ("HP-ICF-MLD-MIB", "hpicfMldCacheSrcCount"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldCacheGroupV2 = hpicfMldCacheGroupV2.setStatus('current')
hpicfMldSrcListGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 9)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldSrcListPorts"), ("HP-ICF-MLD-MIB", "hpicfMldSrcListExpiry"), ("HP-ICF-MLD-MIB", "hpicfMldSrcListUpTime"), ("HP-ICF-MLD-MIB", "hpicfMldSrcListType"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldSrcListGroup = hpicfMldSrcListGroup.setStatus('current')
hpicfMldPortSrcGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 10)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldPortSrcExpiry"), ("HP-ICF-MLD-MIB", "hpicfMldPortSrcUpTime"), ("HP-ICF-MLD-MIB", "hpicfMldPortSrcFilterMode"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldPortSrcGroup = hpicfMldPortSrcGroup.setStatus('current')
hpicfMldGroupPortCacheGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 11)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldGroupPortCacheExpiryTime"), ("HP-ICF-MLD-MIB", "hpicfMldGroupPortCacheUpTime"), ("HP-ICF-MLD-MIB", "hpicfMldGroupPortCacheVersion1Timer"), ("HP-ICF-MLD-MIB", "hpicfMldGroupPortCacheFilterTimer"), ("HP-ICF-MLD-MIB", "hpicfMldGroupPortCacheFilterMode"), ("HP-ICF-MLD-MIB", "hpicfMldGroupPortCacheExcludeSrcCount"), ("HP-ICF-MLD-MIB", "hpicfMldGroupPortCacheRequestedSrcCount"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldGroupPortCacheGroup = hpicfMldGroupPortCacheGroup.setStatus('current')
hpicfMldIfGroupV3 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 12)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldIfEntryQuerierFeature"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntrySnoopingFeature"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryQuerierPort"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryFilteredJoins"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStandardJoins"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryPortsWithMcastRouter"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGeneralQueryRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatQueryTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGSQRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGSQTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV1ReportRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV2ReportRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV1LeaveRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatUnknownMldTypeRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatUnknownPktRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatForwardToRoutersTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatForwardToAllPortsTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatFastLeaves"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatForcedFastLeaves"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatJoinTimeouts"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatWrongVersionQueries"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryLastMemberQueryCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStartupQueryCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStartupQueryInterval"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatExcludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatIncludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatFilteredExcludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatFilteredIncludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatStandardExcludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatStandardIncludeGroupJoinsCount"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV1QueryTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV1QueryRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV2QueryTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV2QueryRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGSSQTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatGSSQRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMalformedPktRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatBadCheckSumRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMartianSourceRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatPacketsRxOnDisabled"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStrictVersionMode"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV1ReportTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatMldV2ReportTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryState"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV1GSQRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV1GSQTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV2GSQRx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStatV2GSQTx"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryStartupQueryExpiryTime"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryOtherQuerierInterval"), ("HP-ICF-MLD-MIB", "hpicfMldIfEntryOtherQuerierExpiryTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldIfGroupV3 = hpicfMldIfGroupV3.setStatus('current')
hpicfMldReloadModeGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 1, 13)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldReload"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldReloadModeGroup = hpicfMldReloadModeGroup.setStatus('current')
hpicfMldMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 2, 1)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldBaseGroup"), ("HP-ICF-MLD-MIB", "hpicfMldIfGroup"), ("HP-ICF-MLD-MIB", "hpicfMldCacheGroup"), ("HP-ICF-MLD-MIB", "hpicfMldPortGroup"), ("HP-ICF-MLD-MIB", "hpicfMldFilteredGroupPortCacheGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldMIBCompliance = hpicfMldMIBCompliance.setStatus('current')
hpicfMldMIBComplianceV2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 2, 2)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldBaseGroupV2"), ("HP-ICF-MLD-MIB", "hpicfMldIfGroupV2"), ("HP-ICF-MLD-MIB", "hpicfMldCacheGroupV2"), ("HP-ICF-MLD-MIB", "hpicfMldPortGroup"), ("HP-ICF-MLD-MIB", "hpicfMldFilteredGroupPortCacheGroup"), ("HP-ICF-MLD-MIB", "hpicfMldSrcListGroup"), ("HP-ICF-MLD-MIB", "hpicfMldPortSrcGroup"), ("HP-ICF-MLD-MIB", "hpicfMldGroupPortCacheGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldMIBComplianceV2 = hpicfMldMIBComplianceV2.setStatus('current')
hpicfMldMIBComplianceV3 = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 48, 2, 2, 3)).setObjects(("HP-ICF-MLD-MIB", "hpicfMldBaseGroupV2"), ("HP-ICF-MLD-MIB", "hpicfMldIfGroupV3"), ("HP-ICF-MLD-MIB", "hpicfMldCacheGroupV2"), ("HP-ICF-MLD-MIB", "hpicfMldPortGroup"), ("HP-ICF-MLD-MIB", "hpicfMldFilteredGroupPortCacheGroup"), ("HP-ICF-MLD-MIB", "hpicfMldSrcListGroup"), ("HP-ICF-MLD-MIB", "hpicfMldPortSrcGroup"), ("HP-ICF-MLD-MIB", "hpicfMldGroupPortCacheGroup"), ("HP-ICF-MLD-MIB", "hpicfMldReloadModeGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfMldMIBComplianceV3 = hpicfMldMIBComplianceV3.setStatus('current')
mibBuilder.exportSymbols("HP-ICF-MLD-MIB", hpicfMldPortSrcExpiry=hpicfMldPortSrcExpiry, hpicfMldPortSrcAddress=hpicfMldPortSrcAddress, hpicfMldCacheAddress=hpicfMldCacheAddress, hpicfMldSrcListEntry=hpicfMldSrcListEntry, hpicfMldPortConfigTable=hpicfMldPortConfigTable, hpicfMldIfEntryPortsWithMcastRouter=hpicfMldIfEntryPortsWithMcastRouter, hpicfMldFilteredGroupPortCacheGroup=hpicfMldFilteredGroupPortCacheGroup, hpicfMldBaseGroupV2=hpicfMldBaseGroupV2, hpicfMldIfEntryStatGSSQRx=hpicfMldIfEntryStatGSSQRx, hpicfMldCacheTable=hpicfMldCacheTable, hpicfJoinedPorts=hpicfJoinedPorts, hpicfMldCacheSelf=hpicfMldCacheSelf, hpicfMldMIBComplianceV3=hpicfMldMIBComplianceV3, hpicfMldIfEntryStandardJoins=hpicfMldIfEntryStandardJoins, hpicfMldIfEntryStatV1GSQRx=hpicfMldIfEntryStatV1GSQRx, hpicfMldIfEntryStartupQueryExpiryTime=hpicfMldIfEntryStartupQueryExpiryTime, hpicfMldIfEntryStatUnknownMldTypeRx=hpicfMldIfEntryStatUnknownMldTypeRx, hpicfMldIfEntryQuerierPort=hpicfMldIfEntryQuerierPort, hpicfMldMcastExcludeGroupJoinsCount=hpicfMldMcastExcludeGroupJoinsCount, hpicfMldIfGroupV3=hpicfMldIfGroupV3, hpicfMldPortConfigEntryInterfaceIfIndex=hpicfMldPortConfigEntryInterfaceIfIndex, hpicfMldSrcListAddress=hpicfMldSrcListAddress, hpicfMldFilteredGroupPortCachePortIndex=hpicfMldFilteredGroupPortCachePortIndex, hpicfMldGroupPortCacheFilterTimer=hpicfMldGroupPortCacheFilterTimer, hpicfMldIfEntryStatFilteredIncludeGroupJoinsCount=hpicfMldIfEntryStatFilteredIncludeGroupJoinsCount, hpicfMldConformance=hpicfMldConformance, hpicfMldIfEntryStatGSSQTx=hpicfMldIfEntryStatGSSQTx, hpicfMldIfEntryStatExcludeGroupJoinsCount=hpicfMldIfEntryStatExcludeGroupJoinsCount, hpicfMldIfEntryLastMemberQueryCount=hpicfMldIfEntryLastMemberQueryCount, hpicfMldIfEntryStatForwardToAllPortsTx=hpicfMldIfEntryStatForwardToAllPortsTx, hpicfMldCacheSrcCount=hpicfMldCacheSrcCount, hpicfMldFilteredGroupPortCacheExpiryTime=hpicfMldFilteredGroupPortCacheExpiryTime, hpicfMldCacheFilterMode=hpicfMldCacheFilterMode, hpicfMldSrcListExpiry=hpicfMldSrcListExpiry, hpicfMldCacheGroupV2=hpicfMldCacheGroupV2, hpicfMldCacheExcludeModeExpiryTimer=hpicfMldCacheExcludeModeExpiryTimer, hpicfMldPortConfigEntryIndex=hpicfMldPortConfigEntryIndex, hpicfMldGroupPortCacheUpTime=hpicfMldGroupPortCacheUpTime, hpicfMldCacheGroup=hpicfMldCacheGroup, PYSNMP_MODULE_ID=hpicfMldMIB, hpicfMldIfEntryStatV2GSQTx=hpicfMldIfEntryStatV2GSQTx, hpicfMldCacheIfIndex=hpicfMldCacheIfIndex, hpicfMldGroupPortCacheEntry=hpicfMldGroupPortCacheEntry, hpicfMldIfEntryState=hpicfMldIfEntryState, hpicfMldGroupPortCacheRequestedSrcCount=hpicfMldGroupPortCacheRequestedSrcCount, hpicfMldIfTable=hpicfMldIfTable, hpicfMldMcastPortFastLearn=hpicfMldMcastPortFastLearn, hpicfMldIfEntryStatV2GSQRx=hpicfMldIfEntryStatV2GSQRx, hpicfMldReloadModeGroup=hpicfMldReloadModeGroup, hpicfMldIfEntryStatFilteredExcludeGroupJoinsCount=hpicfMldIfEntryStatFilteredExcludeGroupJoinsCount, hpicfMldIfEntryStatFastLeaves=hpicfMldIfEntryStatFastLeaves, hpicfMldIfEntrySnoopingFeature=hpicfMldIfEntrySnoopingFeature, HpicfMcastGroupTypeDefinition=HpicfMcastGroupTypeDefinition, hpicfMldSrcListType=hpicfMldSrcListType, hpicfMldPortConfigEntryFastLeaveFeature=hpicfMldPortConfigEntryFastLeaveFeature, hpicfMldIfEntryStatMldV1ReportTx=hpicfMldIfEntryStatMldV1ReportTx, hpicfMldCacheUpTime=hpicfMldCacheUpTime, hpicfMldMIBCompliance=hpicfMldMIBCompliance, hpicfMldPortGroup=hpicfMldPortGroup, hpicfMldIfEntryStatBadCheckSumRx=hpicfMldIfEntryStatBadCheckSumRx, hpicfMldIfEntryStatForcedFastLeaves=hpicfMldIfEntryStatForcedFastLeaves, hpicfMldGroups=hpicfMldGroups, hpicfMldPortSrcFilterMode=hpicfMldPortSrcFilterMode, hpicfMldEnabledCount=hpicfMldEnabledCount, hpicfMldIfEntryStatMldV1ReportRx=hpicfMldIfEntryStatMldV1ReportRx, hpicfMldCacheExpiryTime=hpicfMldCacheExpiryTime, hpicfMldMIBComplianceV2=hpicfMldMIBComplianceV2, hpicfMldCacheVersion1HostTimer=hpicfMldCacheVersion1HostTimer, hpicfMldCompliances=hpicfMldCompliances, hpicfMldSrcListHostAddress=hpicfMldSrcListHostAddress, hpicfMldFilteredGroupPortCacheIfIndex=hpicfMldFilteredGroupPortCacheIfIndex, hpicfMldCacheLastReporter=hpicfMldCacheLastReporter, hpicfMldGroupPortCacheTable=hpicfMldGroupPortCacheTable, hpicfMldCacheStatus=hpicfMldCacheStatus, hpicfMldGroupPortCacheGroup=hpicfMldGroupPortCacheGroup, hpicfMldControlUnknownMulticast=hpicfMldControlUnknownMulticast, hpicfMldIfEntryStatPacketsRxOnDisabled=hpicfMldIfEntryStatPacketsRxOnDisabled, hpicfMldPortSrcIfIndex=hpicfMldPortSrcIfIndex, hpicfMldIfEntryStatGSQRx=hpicfMldIfEntryStatGSQRx, hpicfMldMcastGroupJoinsCount=hpicfMldMcastGroupJoinsCount, hpicfMldSrcListIfIndex=hpicfMldSrcListIfIndex, hpicfMldGroupPortCachePortIndex=hpicfMldGroupPortCachePortIndex, hpicfMldPortSrcHostAddress=hpicfMldPortSrcHostAddress, hpicfMldPortSrcGroup=hpicfMldPortSrcGroup, hpicfMldIfEntryStatForwardToRoutersTx=hpicfMldIfEntryStatForwardToRoutersTx, hpicfMldGroupPortCacheFilterMode=hpicfMldGroupPortCacheFilterMode, hpicfMldIfEntryStatStandardExcludeGroupJoinsCount=hpicfMldIfEntryStatStandardExcludeGroupJoinsCount, hpicfMldIfEntryOtherQuerierInterval=hpicfMldIfEntryOtherQuerierInterval, hpicfMldFilteredGroupPortCacheGroupAddress=hpicfMldFilteredGroupPortCacheGroupAddress, hpicfMldMIB=hpicfMldMIB, hpicfMldSrcListUpTime=hpicfMldSrcListUpTime, hpicfMldConfigForcedLeaveInterval=hpicfMldConfigForcedLeaveInterval, hpicfMldGroupPortCacheExcludeSrcCount=hpicfMldGroupPortCacheExcludeSrcCount, hpicfMldIfEntryStatMldV2ReportTx=hpicfMldIfEntryStatMldV2ReportTx, hpicfMldIfEntryStatUnknownPktRx=hpicfMldIfEntryStatUnknownPktRx, hpicfMldIfEntryStatStandardIncludeGroupJoinsCount=hpicfMldIfEntryStatStandardIncludeGroupJoinsCount, hpicfMldIfGroupV2=hpicfMldIfGroupV2, hpicfMldIfEntryStatMldV1LeaveRx=hpicfMldIfEntryStatMldV1LeaveRx, hpicfMldIfEntryStartupQueryInterval=hpicfMldIfEntryStartupQueryInterval, hpicfMldIfEntryStatMalformedPktRx=hpicfMldIfEntryStatMalformedPktRx, hpicfMldReload=hpicfMldReload, HpicfMldIfEntryState=HpicfMldIfEntryState, hpicfMldIfEntryStatWrongVersionQueries=hpicfMldIfEntryStatWrongVersionQueries, hpicfMldMcastIncludeGroupJoinsCount=hpicfMldMcastIncludeGroupJoinsCount, hpicfMldIfEntryStatV1QueryRx=hpicfMldIfEntryStatV1QueryRx, hpicfMldIfEntryQuerierFeature=hpicfMldIfEntryQuerierFeature, hpicfMldIfEntryStrictVersionMode=hpicfMldIfEntryStrictVersionMode, hpicfMldGroupPortCacheExpiryTime=hpicfMldGroupPortCacheExpiryTime, hpicfMldIfEntryStatQueryTx=hpicfMldIfEntryStatQueryTx, hpicfMldIfEntryStatIncludeGroupJoinsCount=hpicfMldIfEntryStatIncludeGroupJoinsCount, hpicfMldPortConfigEntryPortModeFeature=hpicfMldPortConfigEntryPortModeFeature, hpicfMldIfEntry=hpicfMldIfEntry, hpicfMldSrcListGroup=hpicfMldSrcListGroup, hpicfMldIfEntryStatV1GSQTx=hpicfMldIfEntryStatV1GSQTx, hpicfMldCacheEntry=hpicfMldCacheEntry, hpicfMldIfEntryStatGeneralQueryRx=hpicfMldIfEntryStatGeneralQueryRx, hpicfMldIfEntryStatV2QueryTx=hpicfMldIfEntryStatV2QueryTx, hpicfMldSrcListTable=hpicfMldSrcListTable, hpicfMldPortSrcEntry=hpicfMldPortSrcEntry, hpicfMldPortSrcUpTime=hpicfMldPortSrcUpTime, hpicfMldPortSrcPortIndex=hpicfMldPortSrcPortIndex, hpicfMldIfEntryStatV2QueryRx=hpicfMldIfEntryStatV2QueryRx, hpicfMldGroupType=hpicfMldGroupType, hpicfMldIfEntryFilteredJoins=hpicfMldIfEntryFilteredJoins, hpicfMldFilteredGroupPortCacheEntry=hpicfMldFilteredGroupPortCacheEntry, hpicfMldIfEntryStatMartianSourceRx=hpicfMldIfEntryStatMartianSourceRx, hpicfMldIfEntryStatJoinTimeouts=hpicfMldIfEntryStatJoinTimeouts, hpicfMldIfEntryStatGSQTx=hpicfMldIfEntryStatGSQTx, hpicfMldIfEntryStatV1QueryTx=hpicfMldIfEntryStatV1QueryTx, hpicfMldGroupPortCacheIfIndex=hpicfMldGroupPortCacheIfIndex, hpicfMldGroupPortCacheGroupAddress=hpicfMldGroupPortCacheGroupAddress, hpicfMldPortConfigEntry=hpicfMldPortConfigEntry, HpicfMldConfigPortModeType=HpicfMldConfigPortModeType, hpicfMldObjects=hpicfMldObjects, hpicfMld=hpicfMld, hpicfMldIfEntryStartupQueryCount=hpicfMldIfEntryStartupQueryCount, hpicfMldPortConfigEntryForcedLeaveFeature=hpicfMldPortConfigEntryForcedLeaveFeature, hpicfMldPortSrcTable=hpicfMldPortSrcTable, hpicfMldBaseGroup=hpicfMldBaseGroup, hpicfMldIfGroup=hpicfMldIfGroup, hpicfMldFilteredGroupPortCacheTable=hpicfMldFilteredGroupPortCacheTable, hpicfMldGroupPortCacheVersion1Timer=hpicfMldGroupPortCacheVersion1Timer, hpicfMldIfEntryOtherQuerierExpiryTime=hpicfMldIfEntryOtherQuerierExpiryTime, hpicfMldSrcListPorts=hpicfMldSrcListPorts, hpicfMldIfEntryStatMldV2ReportRx=hpicfMldIfEntryStatMldV2ReportRx)
|
# Author: Nic Wolfe <[email protected]>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Sick Beard is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
__all__ = ["mainDB", "cache"] |
class Solution(object):
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
start = 0
end = len(height)-1
best = 0
while start < end:
best = max(best, self.getArea(start,end,height))
if height[start] < height[end]:
start +=1
else:
end-=1
return best
def getArea (self, start, end, height):
return min(height[start], height[end]) * (end - start)
|
def read_passphrases():
with open("day_04/input.txt", "r") as f:
return [line.split() for line in f.readlines()]
def part1():
return sum(len(phrase) == len(set(phrase)) for phrase in read_passphrases())
print(part1())
def anagram(passphrase):
return len(passphrase) == len(set("".join(sorted(phrase)) for phrase in passphrase))
def part2():
return sum(anagram(phrase) for phrase in read_passphrases())
print(part2())
|
autoref_rst="""
Math
====
.. index ::
single: Math
This is the reference documentation for the math modules.
"""
__all__ = ['kernel'] |
"""
ID: IEV
Title: Calculating Expected Offspring
URL: http://rosalind.info/problems/iev/
"""
# 1. P(AA-AA) = 1 (AA, AA, AA, AA) = 4/4
# 2. P(AA-Aa) = 1 (AA, AA, Aa, Aa) = 4/4
# 3. P(AA-aa) = 1 (Aa, Aa, Aa, Aa) = 4/4
# 4. P(Aa-Aa) = 0.75 (AA, Aa, Aa, aa) = 3/4
# 5. P(Aa-aa) = 0.5 (Aa, Aa, aa, aa) = 2/4
# 6. P(aa-aa) = 0 (aa, aa, aa, aa) = 0/4
probabilities = [1, 1, 1, 0.75, 0.5, 0]
def get_expected_offspring(couples_string):
"""
Calculates the expected number of offspring displaying the dominant phenotype in the next generation,
under the assumption that every couple has exactly two offspring.
Args:
couples_string (str): number of couples in a population possessing each genotype pairing for a given factor.
Returns:
float: expected offspring.
"""
couples = map(int, couples_string.split())
return sum([2 * probability * couple for probability, couple in zip(probabilities, couples)])
|
def n_params(model):
"""Return the number of parameters in a pytorch model.
Args:
model (nn.Module): The model to analyze.
Returns:
int: The number of parameters in the model.
"""
pp = 0
for p in list(model.parameters()):
nn = 1
for s in list(p.size()):
nn = nn * s
pp += nn
return pp
|
n = int(input())
a = sorted(list(map(int, input().split())))
if n % 2 == 1 and a[0] != 0:
print(0)
exit()
for i in range(n % 2, n, 2):
if a[i] != a[i + 1] or a[i] != i + 1:
print(0)
exit()
print(2 ** (n // 2) % (10 ** 9 + 7))
|
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#--------------------------------------------------------------------------
# This is a placeholder file. It is deployed with inference only wheel.
print("An inference only version of ONNX Runtime is installed. Training functionalities are unavailable.") |
# Copyright 2010-2012 Institut Mines-Telecom
#
# 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.
"""
Created on Jun 19, 2012
@author: Bilel Msekni
@contact: [email protected]
@author: Houssem Medhioub
@contact: [email protected]
@organization: Institut Mines-Telecom - Telecom SudParis
@license: Apache License, Version 2.0
"""
#=======================================================================================================================
# JSON format
#=======================================================================================================================
kind =\
"{"\
"\"kinds\": ["\
"{"\
"\"term\": \"compute\","\
"""
"scheme": "http://schemas.ogf.org/occi/infrastructure#",
"title": "Compute Resource no2",
"attributes": {
"occi": {
"compute": {
"hostname": {
"mutable": true,
"required": false,
"type": "string",
"pattern": "(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*",
"minimum": "1",
"maximum": "255"
},
"state": {
"mutable": false,
"required": false,
"type": "string",
"pattern": "inactive|active|suspended|failed",
"default": "inactive"
}
}
}
},
"actions": [
"http://schemas.ogf.org/occi/infrastructure/compute/action#start"
],
"""\
"\"location\": \"/compute/\""\
"}"\
"]"\
"}"
#=======================================================================================================================
mixin = """
{
"mixins": [
{
"term": "medium",
"scheme": "http://example.com/template/resource#",
"title": "Medium VM",
"attributes": {
"occi": {
"compute": {
"speed": {
"type": "number",
"default": 3.0
}
}
}
},
"location": "/template/resource/medium/"
}
]
}
"""
#=======================================================================================================================
action =\
"""
{
"actions": [
{
"term": "start",
"scheme": "http://schemas.ogf.org/occi/infrastructure/compute/action#",
"title": "Start Compute instance now",
"attributes": {
"method": {
"mutable": false,
"required": false,
"type": "string",
"pattern": "graceful|acpion|poweron",
"default": "poweron"
}
}
}
]
}
"""
#=======================================================================================================================
put_provider = """
{
"providers": [
{
"Provider": {
"local": [
"dummy"
],
"remote": [
"Bilel"
]
},
"OCCI_ID": "http://schemas.ogf.org/occi/infrastructure#compute"
}
]
}
"""
action_plus_attributes =\
"""
{
"actions": [
{
"term": "start",
"scheme": "http://schemas.ogf.org/occi/infrastructure/compute/action#",
"title": "Start Compute instance now",
"attributes": {
"method": {
"mutable": true,
"required": false,
"type": "string",
"pattern": "graceful|acpion|poweron",
"default": "poweron"
}
}
}
],
"attributes": {
"occi": {
"infrastructure": {
"networkinterface": {
"interface": "eth0",
"mac": "00:80:41:ae:fd:7e",
"address": "192.168.0.100",
"gateway": "192.168.0.1",
"allocation": "dynamic"
}
}
}
}
}
"""
#=======================================================================================================================
# HTTP format
#=======================================================================================================================
kind_occci_id = """Category: compute;
scheme="http://schemas.ogf.org/occi/infrastructure#";
class=kind;
"""
#=======================================================================================================================
mixin_occci_id = """Category: medium;
scheme="http://example.com/template/resource#";
class=mixin;
"""
#=======================================================================================================================
action_occci_id = """Category: start;scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#"; class=action;
"""
#=======================================================================================================================
mixin_http = "Category : my_stuff;\""\
"scheme=\"http://example.com/occi/my_stuff#\";"\
"class=\"mixin\";"\
"title=\"Storage Resource\";"\
"location=\"/my_stuff/\";"\
"attributes=\"occi.storage.size{required},occi.storage.state{immutable}\";"\
\
#=======================================================================================================================
kind_http = "Category: compute5;"\
"scheme=\"http://schemas.ogf.org/occi/infrastructure#\";"\
"class=\"kind\";"\
"title=\"Compute Resource type\";"\
"rel=\"http://schemas.ogf.org/occi/core#resource\";"\
"attributes=\"occi.compute.cores, occi.compute.state{immutable}\";"\
"actions=\"http://schemas.ogf.org/occi/infrastructure/compute/action#stop\";"\
"location=\"http://example.com/compute/\""
#=======================================================================================================================
action_att_http = """Category: start;
scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#";
class=action;
X-OCCI-Attribute: occi.compute.cores=20:2
""" |
'''
Basic Info
'''
__version__ = '0.1'
|
def maprange( a, b, s):
(a1, a2), (b1, b2) = a, b
return b1 + ((s - a1) * (b2 - b1) / (a2 - a1))
for s in range(11):
print("%2g maps to %g" % (s, maprange( (0, 10), (-1, 0), s)))
|
strings = {
'str NaN': 'NaN',
'str none': 'None',
'str true': 'True',
'str false': 'False',
'str 0': '0',
'str -1': '-1',
'str -1.5': '-1.5',
'str 0.42': '0.42',
'str .42': '.42',
'str 1.2E+9': '1.2E+9',
'str 1.2e8': '1.2e8',
'str 0xFF': '0xFF',
'str Inf..': 'Infinity',
'str empty': '',
'str space': ' ',
'str [Ob]': '[object Object]',
'str dot': '.',
'str +': '+',
'str -': '-',
'str 99,999': '99,999',
'str date': '2077-09-08',
'str #abcdef': '#abcdef',
'str 1.2.3': '1.2.3',
'str blah': 'blah',
}
|
# coding: utf8
#!/usr/bin/python2
def directorymaker():
pass
|
# -------------------------------------------------#
# EXERCICIO 10 #
# -------------------------------------------------#
# Faça um programa que leia quanto dinheiro uma pessoa
# tem na carteira e mostre quantos dolares ela pode comprar
r = float(input('Digite quantos R$ voce tem na carteira...:'))
d = float(input('Digite a cotação do US$ hoje...: '))
c = r/d
print('com R$ {:.2f} , você consegue comprar US$ {:.2f}'.format(r,c))
|
ZALORA_URLS = ['https://www.zalora.co.id/women/pakaian/atasan/?from=header']
def get_start_urls():
return ZALORA_URLS
|
name0_0_0_1_0_1_0 = None
name0_0_0_1_0_1_1 = None
name0_0_0_1_0_1_2 = None
name0_0_0_1_0_1_3 = None
name0_0_0_1_0_1_4 = None |
## ⌠1 ⌠2
## ⌡-1 ⌡1 (x^2 y + x y^2) dx dy
f = lambda x, y: x**2 * y + x * y**2 # Equation to be integrated
ax = 1 # Lower limit of inner integral
bx = 2 # Upper limit of inner integral
ay = -1 # Lower limit of outer integral
by = 1 # Upper limit of outer integral
nx = 10 # Number of divisions of inner integral
ny = 10 # Number of divisions of outer integral
hx = (bx - ax) / nx # Width of each division of inner integral
hy = (by - ay) / ny # Width of each division of outer integral
## Using Simpson's 1/3 rule for both integrations:
## I = hx*hy/9 {f[0] + 4*4f[1] + 2*2f[2] + 4*4f[3] + 2*2f[4] + ... + 1*4ƒ(1,0)
## + 2*2f[n-4] + 4*4f[n-3] + 2*2f[n-2] + 4*4f[n-1] + f[n]}
## I = hx*hy/9 [p*q * f(ax + j*hx, ay + i*hy)]
## where i = 0 to ny+1 and j = 0 to nx+1
S = 0
for i in range(ny+1):
if i == 0 or i == ny: p = 1 # f[0], f[n]
elif i % 2 == 1: p = 4 # 4f[1], 4f[3], 4f[n-3], 4f[n-1]
else: p = 2 # 2f[2], 2f[4], 2f[n-4], 2f[n-2]
for j in range(nx+1):
if j == 0 or j == nx: q = 1 ## For Simpson's 3/8 rule:
elif j % 2 == 1: q = 4 ## j%3 == 1 or j%3 == 2: q = 3
else: q = 2
S += p*q * f(ax + j*hx, ay + i*hy)
I = hx*hy/9 * S
print("Integral of the equation, I = %f" % I)
'''
The extended form of the Simpson's 1/3 rule:
I = 1/3 h {f[0] + 4f[1] + 2f[2] + 4f[3] + 2f[4] + ... +
2f[n-4] + 4f[n-3] + 2f[n-2] + 4f[n-1] + f[n]}
The extended form of the Simpson's 1/3 rule:
I = 3/8 h {f[0] + 3f[1] + 3f[2] + 2f[3] + 3f[4] + 3f[5] + 2f[6] + ... +
2f[n-3] + 3f[n-2] + 3f[n-1] + f[n])}
where f = ƒ(x,y)
Number of divisions must be even for Simpson's 1/3 rule
Number of divisions must be multiple of 3 for Simpson's 3/8 rule
ʃʃ ƒ(x,y) dx dy
Final common factor when using Simpson's 1/3 rule for both integrations:
hx/3 * hy/3 = hx*hy/9
Final common factor when using Simpson's 3/8 rule for both integrations:
3hx/8 * 3hy/8 = 9hx*hy/64
Final common factor when using different rule for different integration:
3hx/8 * hy/3 = 3hx*hy/24
Weighing factor of each f term is also multiplied depending on used rule
p*q where p is outer and q is inner weighing factor
'''
|
# Copyright (C) 2019-2020, TomTom (http://tomtom.com).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
class Coordinate:
"""Class to hold information about a coordinate.
A coordinate has a latitude, longitude, and an altitude.
Attributes:
latitude: Latitude in degrees.
longitude: Longitude in degrees.
altitude: Altitude in meters.
"""
latitude: float
longitude: float
altitude: float
def __init__(self):
self.latitude = 0.0
self.longitude = 0.0
self.altitude = 0.0
def is_valid(self) -> bool:
"""Check if the coordinate is valid.
A coordinate is valid if its values are within WGS84 bounds.
Returns:
True if valid, False if not.
"""
...
@classmethod
def from_string(cls, value: str) -> "Coordinate":
"""Create a coordinate from its string representation."""
...
@staticmethod
def combine(left: "Coordinate", right: "Coordinate") -> "Coordinate":
"""Combine two coordinates."""
...
|
email_info = { 'recepient' : '[email protected]',
'messages' : {'TOO_LOW' : 'Hi, the temperature is too low',
'TOO_HIGH' : 'Hi, the temperature is too high'
}
}
def DefineCoolingtype_limits(coolingType):
coolingtype_limits = { 'PASSIVE_COOLING' : {"lowerLimit" : 0, "upperLimit" : 35},
'HI_ACTIVE_COOLING' : {"lowerLimit" : 0, "upperLimit" : 45},
'MED_ACTIVE_COOLING' : {"lowerLimit" : 0, "upperLimit" : 40}
}
if coolingType in coolingtype_limits.keys():
return(coolingtype_limits[coolingType])
else:
return({"lowerLimit" : 'NA', "upperLimit" : 'NA'})
def infer_breach(value, lowerLimit, upperLimit):
if value < lowerLimit:
return 'TOO_LOW'
if value > upperLimit:
return 'TOO_HIGH'
return 'NORMAL'
def classify_temperature_breach(coolingType, temperatureInC):
limits = DefineCoolingtype_limits(coolingType)
if 'NA' not in limits.values():
return infer_breach(temperatureInC, limits['lowerLimit'], limits['upperLimit'])
else:
return "Invalid cooling type"
def IsbatteryCharValid(batteryChar):
batteryChar_types = ['PASSIVE_COOLING', 'HI_ACTIVE_COOLING', 'MED_ACTIVE_COOLING']
if batteryChar in batteryChar_types:
return True
return False
def GetBreachType(batteryChar, temperatureInC):
breachType = classify_temperature_breach(batteryChar, temperatureInC) if IsbatteryCharValid(batteryChar) else False
return breachType if breachType!=False else 'Invalid_Param'
def check_and_alert(alertTarget, batteryChar, temperatureInC):
breachType = GetBreachType(batteryChar, temperatureInC)
alert_status = alertTarget(breachType) if breachType!='Invalid_Param' else False
return(breachType)
def send_to_controller(breachType):
header = 0xfeed
command_to_controller = (f'{header}, {breachType}')
PrintMessageONConsole(command_to_controller)
return(command_to_controller)
def Generate_email_content(breachtype, email_messages):
return email_messages[breachtype]
def PrintMessageONConsole(message):
print(message)
return True
def send_to_email(breachType):
mail_content = Generate_email_content(breachType, email_info['messages'])
sent_email = f"To: {email_info['recepient']} : {mail_content}"
PrintMessageONConsole(sent_email)
return(sent_email)
|
#Задачи на циклы и оператор условия------
#----------------------------------------
'''
Задача 1
Вывести на экран циклом пять строк из нулей, причем каждая строка должна быть пронумерована.
'''
str = '00000000000000000000000000000000'
for i in range(1,6):
print(i, '. ',str)
'''
Задача 2
Пользователь в цикле вводит 10 цифр. Найти количество введеных пользователем цифр 5.
'''
print('Task_2')
it = 1
num = 0
while (it<11):
a = input(f'Введите число {it} ')
if (int(a)==5): num+=1
it+=1
print(num, '\n')
'''
Задача 3
Найти сумму ряда чисел от 1 до 100. Полученный результат вывести на экран.
'''
sum = 0
for i in range(1,101):
sum+=i
print('Task_3')
print(sum, '\n')
'''
Задача 4
Найти произведение ряда чисел от 1 до 10. Полученный результат вывести на экран.
'''
mult = 1
for i in range(1,11):
mult*=i
print('Task_4')
print(mult, '\n')
'''
Задача 5
Вывести цифры числа на каждой строчке.
'''
print('Task_5')
integer_number = 2129
while integer_number>0:
print(integer_number%10)
integer_number = integer_number//10
print('\n')
'''
Задача 6
Найти сумму цифр числа.
'''
print('Task_6')
integer_number = 23291
sum = 0
while integer_number>0:
sum+=integer_number%10
integer_number = integer_number//10
print('Sum is: ', sum)
print('\n')
'''
Задача 7
Найти произведение цифр числа.
'''
print('Task_7')
integer_number = 23210
mult = 1
while integer_number>0:
mult*=integer_number%10
integer_number = integer_number//10
print('Mult is: ', mult)
print('\n')
'''
Задача 8
Дать ответ на вопрос: есть ли среди цифр числа 5?
'''
print('Task_8')
integer_number = 2134513
while integer_number>0:
if integer_number%10 == 5:
print('Yes')
break
integer_number = integer_number//10
else: print('No')
print('\n')
'''
Задача 9
Найти максимальную цифру в числе
'''
print('Task_6')
integer_number = 9232718
print('The number is:', integer_number)
max = 0
while integer_number>0:
max = integer_number%10 if max < integer_number%10 else max
integer_number = integer_number//10
print('Max is: ', max)
print('\n')
'''
Задача 10
Найти количество цифр 5 в числе
'''
integer_number = 592375185
print('The number is:', integer_number)
num = 0
while integer_number>0:
if integer_number%10==5: num+=1
integer_number = integer_number//10
print('Num is: ', num)
print('\n') |
# -*- coding: utf-8 -*-
# vim: set sw=4 ts=4 expandtab :
class ArgError(Exception):
def __init__(self, message):
if message == None:
self.message = 'node error'
else:
self.message = message
|
@PixieApp
class Test():
@route()
def main_screen(self):
return """
<button type="submit"
pd_script="call_me()"
pd_target="target{{prefix}}">
<pd_script>
self.name="some value"
print("This is a multi-line pd_script")
</pd_script>
Click me
</button>
<div id="target{{prefix}}"></div>
"""
Test().run()
|
def formula_transform(formula):
"""
:param formula: dependent variable ~ covariant | fixed_effect |clusters'
:type formula: str
:return: Lists of out_col, consist_col, category_col, cluster_col, respectively.
:rtype: (list[str], list[str], list[str], list[str])
"""
phenotype = formula.replace(' ', '').split("~")
assert len(phenotype) == 2, f"Formula must have a phenotype separated by ~ yet failed to find via splitting " \
f"for {formula}"
# Split the right hand side out, validate there is only one phenotype
phenotype, rhs = phenotype
assert len(phenotype.split("+")) == 1, f"Can only provide a single phenotype per OLS yet found " \
f"{phenotype.split('+')}"
segments = rhs.split("|")
assert 1 <= len(segments) < 4 and sum([len(seg) for seg in segments]) != 0, \
f"Right hand side should be 'covariant | fixed_effect | cluster's meaning.\nAll models should have at least " \
f"a covariant, and can be max length of 3 yet found: {segments}"
# Ensure segments are of length 3
segments = segments + ["" for _ in range(3 - len(segments))]
# Split each section on + then return the phenotype, covariant, fixed_effect and cluster variables
sections = [[phenotype]] + [section.split("+") if len(section) > 0 else [] for section in segments]
phenotype, covariant, fixed_effects, clusters = sections
return phenotype, covariant, fixed_effects, clusters
|
# encoding: utf-8
# module System.Custom calls itself Custom
# from Wms.RemotingObjects,Version=1.23.1.0,Culture=neutral,PublicKeyToken=null
# by generator 1.145
# no doc
# no important
# functions
def Tuple(args,kwargs): # real signature unknown
""" """
pass
# no classes
|
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
if head is None:
return head
l = 1
tail = head
while tail.next:
tail = tail.next
l += 1
k %= l
p = head
for _ in range(l - 1 - k):
p = p.next
tail.next = head
head = p.next
p.next = None
return head
|
"""VIC Emergency Incidents constants."""
ATTR_CATEGORY1 = "category1"
ATTR_CATEGORY2 = "category2"
ATTR_DESCRIPTION = "description"
ATTR_ID = "id"
ATTR_PUB_DATE = "updated"
ATTR_SOURCE_TITLE = "sourceTitle"
ATTR_SOURCE_ORG = "sourceOrg"
ATTR_ESTA_ID = "estaid"
ATTR_RESOURCES = "resources"
ATTRIBUTION = "VICEmergency"
ATTR_SIZE = "size"
ATTR_SIZE_FMT = "sizefmt"
ATTR_LOCATION = "location"
ATTR_TEXT = "text"
ATTR_STATUS = "status"
ATTR_TYPE = "feedtype"
ATTR_STATEWIDE = "statewide"
ATTR_WEBBODY = "webBody"
CUSTOM_ATTRIBUTE = "custom_attribute"
URL = "http://emergency.vic.gov.au/public/osom-geojson.json"
|
class ApiException(Exception):
def __init__(self, response):
if response.status_code == 404:
self._rollbar_ignore = True
message = response.text
super(ApiException, self).__init__(message)
|
__author__ = 'Chirag'
x = {"Tom", 2.71, 36, 36} # is a set. REPETITION NOT ALLOWED
y = ["Tom", 2.71, 36, 36] # is a list. MUTABLE
print("x is a SET : ", x)
print("y is a LIST : ", y)
print()
#===========================================
# CREATE sets
s = {1,2,3,4,5} # direct declare
print(s)
s = set()
for i in range(1,6):
s.add(i) # using .add() method
print(s)
s = set([x for x in range(1,6)])
print(s) # list comprehension + conversion
print()
#===========================================
# SETS don't have order. Therefore no
# indexing access is available
list1 = [1,1,2,2,3,4,5,6,1,1]
print(f"list1 = {list1}")
s = set(list1)
print(f"s = set(list1) = {s}")
print()
#===========================================
# METHODS for sets include .intersection()
# .union() .issubset() etc.
print(f"len(s) = {len(s)}")
#===========================================
|
# -*- coding: utf-8 -*-
"""
File Name: countSmaller.py
Author : jynnezhang
Date: 2020/9/25 1:15 下午
Description:
https://leetcode-cn.com/leetbook/read/top-interview-questions/xajl22/
"""
class Solution:
def countSmaller(self, nums):
result = []
new_nums = nums[::-1]
for index, num in enumerate(new_nums):
_c = 0
while index > 0:
index -= 1
if num > new_nums[index]:
_c += 1
result.append(_c)
return result[::-1]
if __name__ == '__main__':
print(Solution().countSmaller([2,0,1]))
|
# Python3 program to Merge Two Binary Trees
# Helper class that allocates a new node
# with the given data and None left and
# right pointers.
class newNode:
def __init__(self, data):
self.data = data
self.left = self.right = None
# Given a binary tree, prints nodes
# in inorder
def inorder(node):
if not node:
return
# first recur on left child
inorder(node.left)
# then print the data of node
print(node.data, end=" ")
# now recur on right child
inorder(node.right)
# Function to merge given two
# binary trees
def MergeTrees(t1, t2):
if not t1:
return t2
if not t2:
return t1
t1.data += t2.data
t1.left = MergeTrees(t1.left, t2.left)
t1.right = MergeTrees(t1.right, t2.right)
return t1
# Driver code
if __name__ == "__main__":
# Let us construct the first Binary Tree
# 1
# / \
# 2 3
# / \ \
# 4 5 6
root1 = newNode(1)
root1.left = newNode(2)
root1.right = newNode(3)
root1.left.left = newNode(4)
root1.left.right = newNode(5)
root1.right.right = newNode(6)
# Let us construct the second Binary Tree
# 4
# / \
# 1 7
# / / \
# 3 2 6
root2 = newNode(4)
root2.left = newNode(1)
root2.right = newNode(7)
root2.left.left = newNode(3)
root2.right.left = newNode(2)
root2.right.right = newNode(6)
root3 = MergeTrees(root1, root2)
print("The Merged Binary Tree is:")
inorder(root3)
# This code is contributed by PranchalK
|
def find_lis(a):
T = [None]*len(a)
prev = [None]*len(a)
for i in range(len(a)):
T[i] = 1
prev[i] = -1
for j in range(i):
if a[j] <= a[i] and T[i]< T[j]+1:
T[i] = T[j]+1
prev[i] = j
longest =max(T)
i = 0
for i in range( len(a)):
if T[i] == longest:
break
store = []
while i > 0:
store.append(a[i])
i = prev[i]
return store
if __name__ =='__main__':
a= [7, 2, 1, 3, 8, 4, 9, 1, 2, 6]
# a= [1, 7,2, 3, 8, 4, 9 ]
print(find_lis(a)) |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 6 23:56:31 2010
@author: Alexander Tsepkov
"""
"""
This class wraps around ImageData HTML5 Canvas object and allows easier
per-pixel access
"""
class ImageData:
def __init__(self, imagedata):
self.width = imagedata.width
self.height = imagedata.height
self.data = imagedata.data
def getWidth(self):
return self.width
def getHeight(self):
return self.height
def getData(self):
return self.data
def setData(self, data):
self.data = data
def getPixel(self, x, y):
offset = (y*self.width + x)*4
return self.data[offset:offset+4]
"""
rgba must be an array of 4 integers ranging from 0 to 255
"""
def setPixel(self, x, y, rgba):
offset = (y*self.width + x)*4
self.data[offset:offset+4] = rgba |
# Problem 3
# Largest prime factor
# The prime factors of 13195 are 5, 7, 13 and 29.
# What is the largest prime factor of the number 600851475143 ?
def is_prime(num):
if num == 1:
return False
i = 2
while i*i <= num:
if num % i == 0:
return False
i += 1
return True
huge = 600851475143
# 600851475143 / 71 = 8462696833 / 839 = 10086647 / 1471 = 6857
for x in reversed(range(1,10000)):
if is_prime(x):
if huge % x == 0:
print(x)
# result is 6857
# 6857
# 1471
# 839
# 71 |
# defines a mutable class
class Mutable():
def __init__(self):
self.layers = []
def getGen(self):
gen = []
for layer in self.layers:
gen += layer.getWeights()
return gen
def mutateWith(self, lover):
genSelf = self.getGen()
genLover = lover.getGen()
self.setGen(self.mutationFunction(genSelf, genLover))
def setGen(self, gen):
for layer in self.layers:
layer.setWeights(gen[:layer.size])
del gen[:layer.size]
print("Layer added")
if len(gen) > 0:
print("error, some genes were not used")
|
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
__author__ = 'Florents Tselai'
REDIS_URI = '127.0.0.1'
REDIS_CAR_KEYSPACE = 'pycargr:car:{}'
SEARCH_BASE_URL = 'https://www.car.gr/classifieds/cars/'
CACHE_EXPIRE_IN = 24 * 3600
|
"""
[2015-07-06] Challenge #222 [Easy] Balancing Words
https://www.reddit.com/r/dailyprogrammer/comments/3c9a9h/20150706_challenge_222_easy_balancing_words/
# Description
Today we're going to balance words on one of the letters in them. We'll use the position and letter itself to calculate
the weight around the balance point. A word can be balanced if the weight on either side of the balance point is equal.
Not all words can be balanced, but those that can are interesting for this challenge.
The formula to calculate the weight of the word is to look at the letter position in the English alphabet (so A=1, B=2,
C=3 ... Z=26) as the letter weight, then multiply that by the distance from the balance point, so the first letter away
is multiplied by 1, the second away by 2, etc.
As an example:
STEAD balances at T: 1 * S(19) = 1 * E(5) + 2 * A(1) + 3 * D(4))
# Input Description
You'll be given a series of English words. Example:
STEAD
# Output Description
Your program or function should emit the words split by their balance point and the weight on either side of the
balance point. Example:
S T EAD - 19
This indicates that the T is the balance point and that the weight on either side is 19.
# Challenge Input
CONSUBSTANTIATION
WRONGHEADED
UNINTELLIGIBILITY
SUPERGLUE
# Challenge Output
*Updated* - the weights and answers I had originally were wrong. My apologies.
CONSUBST A NTIATION - 456
WRO N GHEADED - 120
UNINTELL I GIBILITY - 521
SUPERGLUE DOES NOT BALANCE
# Notes
This was found on a [word games page](http://www.questrel.com/records.html) suggested by /u/cDull, thanks! If you have
your own idea for a challenge, submit it to /r/DailyProgrammer_Ideas, and there's a good chance we'll post it.
"""
def main():
pass
if __name__ == "__main__":
main()
|
a = 28
b = 1.5
c = 'hello'
d = True
e = None
print(a,b,c,d,e) |
# -*- coding: utf-8 -*-
class Fila:
def __init__(self):
self.element = list()
def inserir(self,name):
self.element.append(name)
print(f'Inserindo o elemento {name}: ' + ' '.join(self.element))
def remover(self):
self.element.pop(0)
print(f'Removendo o primeiro elemento: ' + ' '.join(self.element))
def exibir(self):
print('Fila: ' + ' '.join(self.element))
fila = Fila()
fila.inserir('apple')
fila.inserir('grape')
fila.inserir('lemon')
fila.remover()
fila.exibir()
|
# 2. What is the time complexity of this code?
# La comlejidad es O(n^2), porque tiene for anidado.
def every_other(array):
# Este algoritmo imprime en consola los números del arreglo aumentados en m,
# tal que m es un número del arrelgo en una posición impar.
for i in range(len(array)):
if i % 2 == 0:
for j in range(len(array)):
print(array[i] + array[j])
print()
# Test
a = [2, 6, 3, 7, 4]
every_other(a)
a = [5, 2, 8, 4, 2]
every_other(a)
a = [10, 45, 21, 5, 31]
every_other(a) |
load("@bazel_skylib//lib:shell.bzl", "shell")
load("@bazel_skylib//lib:paths.bzl", "paths")
AsciidocInfo = provider(
doc = "Information about the asciidoc-generated files.",
fields = {
"primary_output_path": "Path of the primary output file beneath {resource_dir}.",
"resource_dir": "File for the directory containing all of the generated resources.",
},
)
_toolchain_type = "//tools/build_rules/external_tools:external_tools_toolchain_type"
def _asciidoc_impl(ctx):
resource_dir = ctx.actions.declare_directory(ctx.label.name + ".d")
primary_output = "{name}.html".format(name = ctx.label.name)
# Declared as an output, but not saved as part of the default output group.
# Build with --output_groups=+asciidoc_logfile to retain.
logfile = ctx.actions.declare_file(ctx.label.name + ".logfile")
# Locate the asciidoc binary from the toolchain and construct its args.
asciidoc = ctx.toolchains[_toolchain_type].asciidoc
args = ["--backend", "html", "--no-header-footer"]
for key, value in ctx.attr.attrs.items():
if value:
args.append("--attribute=%s=%s" % (key, value))
else:
args.append("--attribute=%s!" % (key,))
if ctx.attr.example_script:
args.append("--attribute=example_script=" + ctx.file.example_script.path)
args += ["--conf-file=%s" % c.path for c in ctx.files.confs]
args += ["-o", paths.join(resource_dir.path, primary_output)]
args.append(ctx.file.src.path)
# Get the path where all our necessary tools are located so it can be set
# to PATH in our run_shell command.
tool_path = ctx.toolchains[_toolchain_type].path
# Resolve data targets to get input files and runfiles manifests.
data, _, manifests = ctx.resolve_command(tools = ctx.attr.data)
# Run asciidoc and capture stderr to logfile. If it succeeds, look in the
# captured log for error messages and fail if we find any.
ctx.actions.run_shell(
inputs = ([ctx.file.src] +
ctx.files.confs +
([ctx.file.example_script] if ctx.file.example_script else []) +
data),
input_manifests = manifests,
outputs = [resource_dir, logfile],
arguments = args,
command = "\n".join([
"set -e",
"mkdir -p {resource_dir}".format(resource_dir = shell.quote(resource_dir.path)),
# Run asciidoc itself, and fail if it returns nonzero.
"{asciidoc} \"$@\" 2> >(tee -a {logfile} >&2)".format(
logfile = shell.quote(logfile.path),
asciidoc = shell.quote(asciidoc),
),
# The tool succeeded, but now check for error diagnostics.
'if grep -q -e "filter non-zero exit code" -e "no output from filter" {logfile}; then'.format(
logfile = shell.quote(logfile.path),
),
"exit 1",
"fi",
# Move SVGs to the appropriate directory.
"find . -name '*.svg' -maxdepth 1 -exec mv '{{}}' {out}/ \\;".format(out = shell.quote(resource_dir.path)),
]),
env = {"PATH": tool_path},
mnemonic = "RunAsciidoc",
)
return [
DefaultInfo(files = depset([resource_dir])),
OutputGroupInfo(asciidoc_logfile = depset([logfile])),
AsciidocInfo(primary_output_path = primary_output, resource_dir = resource_dir),
]
asciidoc = rule(
implementation = _asciidoc_impl,
toolchains = ["//tools/build_rules/external_tools:external_tools_toolchain_type"],
attrs = {
"src": attr.label(
doc = "asciidoc file to process",
allow_single_file = True,
),
"attrs": attr.string_dict(
doc = "Dict of attributes to pass to asciidoc as --attribute=KEY=VALUE",
),
"confs": attr.label_list(
doc = "`conf-file`s to pass to asciidoc",
allow_files = True,
),
"data": attr.label_list(
doc = "Files/targets used during asciidoc generation. Only needed for tools used in example_script.",
allow_files = True,
),
"example_script": attr.label(
doc = "Script to pass to asciidoc as --attribute=example_script=VALUE.",
allow_single_file = True,
),
},
doc = "Generate asciidoc",
)
|
# return the keys of a dictionary
def keys(dictionary):
return dictionary.keys()
# return the values of a dictionary
def values(dictionary):
return dictionary.values()
# return the string representation of a dictionary
def dict_to_string(d):
return str(d)
# merge two dictionaries
def merge(d1, d2):
for k, v in d2.iteritems():
if k in d1.keys():
if type(v) is dict:
if type(d1[k]) is dict:
merge(d1[k], v)
elif d1[k] == 'none' or d1[k] is None:
d1[k] = v
else:
n = [v, d1[k]]
d1[k] = n
elif type(v) is list:
if type(d1[k]) is list:
d1[k].extend(v)
elif d1[k] == 'none' or d1[k] is None:
d1[k] = v
else:
n = [v, d1[k]]
d1[k] = n
elif v == 'none' or v is None:
pass
else:
n = [v, d1[k]]
d1[k] = n
else:
d1.update({
k: v
})
return d1 |
"""Questão 2.A ACME Inc., uma empresa de 500 funcionários, está tendo problemas de espaço em disco no
seu servidor de arquivos. Para tentar resolver este problema, o Administrador de Rede precisa saber
qual o espaço ocupado pelos usuários, e identificar os usuários com maior espaço ocupado. Através de
um programa, baixado da Internet, ele conseguiu gerar o seguinte arquivo, chamado "usuarios.txt":
alexandre 456123789
anderson 1245698456
antonio 123456456
carlos 91257581
cesar 987458
rosemary 789456125
Neste arquivo, o nome do usuário possui 15 caracteres. A partir deste arquivo, você deve criar um programa
que gere um relatório, chamado "relatório.txt", no seguinte formato:
O arquivo de entrada deve ser lido uma única vez, e os dados armazenados em memória, caso sejam necessários,
de forma a agilizar a execução do programa. A conversão da espaço ocupado em disco, de bytes para megabytes
deverá ser feita através de uma função separada, que será chamada pelo programa principal. O cálculo do
percentual de uso também deverá ser feito através de uma função, que será chamada pelo programa principal."""
def converter(num):
num = num/1024
num = num/1024
return num
def percentualCalcula(lista, num):
num = float(num) * 100
num = num / sum(lista)
return num
arqEntrada = open("./usuarios.txt", "r")
lista = arqEntrada.readlines()
arqEntrada.close()
relatorio = "ACME Inc. Uso do espaco em disco pelos usuarios\n"
relatorio += "--------------------------------------------------\n"
relatorio += "Nr.\tUsuario\t\tEspaco utilizado\t % do uso\n"
usuario = []
espaco = []
percentual = []
soma = 0
for numero in lista:
soma += (float(numero[14:]))
for i in lista:
usuario.append(i[0:14])
num = converter(int(i[14:]))
espaco.append(num)
for i in range (len(usuario)):
percentualNum = percentualCalcula(espaco, espaco[i])
percentual.append(percentualNum)
relatorio += str(i+1) + "\t"
relatorio += usuario[i] + "\t"
relatorio += str(round((espaco[i]), 2)) + "\tMB" + "\t\t"
relatorio += str(round((percentual[i]), 2)) + "\n"
arqSaida = open("./relatorio.txt", "w")
arqSaida.writelines(relatorio)
arqSaida.close() |
def parse_line(line):
splitted = line.strip().split()
instruction, count = splitted[0], int(splitted[1])
return instruction, count
def parse_input(filename):
with open(filename) as file:
lines = file.readlines()
return [parse_line(l) for l in lines]
def evaluate_til_repeat(instructions):
seen_instructions_idx = set()
program_length = len(instructions)
instruction_counter = 0
acc = 0
while instruction_counter < program_length:
if instruction_counter in seen_instructions_idx:
return "Failed", acc
seen_instructions_idx.add(instruction_counter)
instr, count = instructions[instruction_counter]
# print(instr, count, acc)
if instr == "nop":
instruction_counter += 1
elif instr == "jmp":
instruction_counter += count
elif instr == "acc":
instruction_counter += 1
acc += count
return "Succeeded", acc
def swapped(instructions, idx):
swap = lambda i: "nop" if i == "jmp" else "jmp"
instr, count = instructions[idx]
copy = list(instructions)
copy[idx] = (swap(instr), count)
return copy
def bruteforce(instructions):
"""
It's kinda lame that I had to resort to this.
I would have preferd to find some more clever solution
which does not involve simulating every possible program
but I'm too tired today to search for a more elaborate solution.
Maybe if I have the energy, I will do that for the scala version.
"""
swappable_instructions = [
idx for idx, (instr, c) in enumerate(instructions)
if instr == "jmp" or instr == "nop"
]
for idx in swappable_instructions:
status, acc = evaluate_til_repeat(swapped(instructions, idx))
if status == "Succeeded":
return acc
def main():
instructions = parse_input("input.txt")
status, acc = evaluate_til_repeat(instructions)
print(acc)
acc = bruteforce(instructions)
print(acc)
if __name__ == '__main__':
main() |
def runonce():
# This is only ran when OSIRIS is restarted, unlike normal live updates
return {}
def depends():
# this is list of modules to import from app
return ['testmodule', 'osirisd']
def reply(msg):
"""
code, header, and template are optional
header is another json dict thing
template is another, but entries in the msg called (or in the file passed) {{ something }} will get replaced with the value
If you don't pass msg you can pass the path to a file with file:, if you do both file has higher priority
'runonce':1 being added causes it to re-run the runonce function
'reload':1 being added causes the current app to be reloaded
'modload':[list] being added causes it to import the modules listed
'type' optionally accepts a mimetype used in the Content-Type header
If no type is passed it logically figures it out based on path or falls back to text/html
Passes object with the body and headers
headers come in an object called header, keys are names
body is the posted data
IP is the IP, (X-Real-IP is proxy = 1 in osiris.conf)
TYPE is the type (get, post, etc)
PATH is the requested path, the /
DNT support: If <tracker></tracker> tags are used in the sent data and the browser enables DNT that data will be removed from the request
Also, dht is passed in the payload sent to reply
A sample dict passed:
{'body': '', 'header': {'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip,deflate,sdch', 'Connection': 'keep-alive', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'User-Agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36', 'DNT': '1', 'Host': 'localhost:8000', 'Cache-Control': 'max-age=0', 'PATH': '/', 'TYPE': 'GET'}, 'ip': '127.0.0.1'}
"""
ip = msg['ip']
try:
msg['runonce'][ip] += 1
except:
msg['runonce'][ip] = 0
# Starts searching in app/{module name}/
if msg['header']['PATH'] == '/ip_stats':
dat = "<p>"
for ip in msg['runonce']:
dat = dat + \
'%s has visited this page %s times<br>' % (
ip, msg['runonce'][ip])
dat += "</p>"
return {"code": 200, "msg": dat}
elif msg['header']['PATH'].startswith('/code'):
request = int(msg['header']['PATH'].split('/')[2])
return {"code": request, "msg": str(msg['depends']['osirisd'].app().code(request))}
elif msg['header']['PATH'] == '/test.html':
return {"code": 200, "file": "test.html", "template": {"name.first": "Test", "name.last": "user"}}
else:
msg2srv = "Hello, {0}!\r\nYour IP is {1}\r\nYour name is {{name.first}} {{ name.last }}!\r\nYour key is '{2}'<br><br><tracker>Botnet mode is enabled</tracker>".format(
msg['header']['User-Agent'], msg['ip'], msg['depends']['testmodule'].test())
send = {"code": 200, "msg": msg2srv, "template": {"name.first": "Test",
"name.last": "user"}, 'modload': ['testmodule'], 'reload': 1, 'type': 'text/html'}
return send
|
class Data:
def __init__(self):
self.__dia = 0
self.__mes = 0
self.__ano = 0
def le_data(self):
self.dia = int(input('Digite o dia: '))
self.mes = int(input('Digite o mes: '))
self.ano = int(input('Digite o ano: '))
def formatada(self):
print(f'{self.dia}/{self.mes}/{self.ano}')
|
"""
Given two strings A and B, return whether or not A can be shifted some number of times to get B.
For example, if A is abcde and B is cdeab, return true. If A is abc and B is acb, return false
"""
class Solution:
def rotateString(self, A, B):
N = len(A)
if N != len(B):
return False
if N == 0:
return True
# Compute shift table
shifts = [1] * (N+1)
left = -1
for right in range(N):
while left >= 0 and B[left] != B[right]:
left -= shifts[left]
shifts[right + 1] = right - left
left += 1
print('left ', left)
print('right ', right)
print('shifts ', shifts)
# Find match of B in A+A
match_len = 0
for char in A + A:
while match_len >= 0 and B[match_len] != char:
match_len -= shifts[match_len]
match_len += 1
if match_len == N:
return True
return False
if __name__ == '__main__':
s = Solution()
print(s.rotateString('abc', 'acb'))
|
print('=========DESAFIO52=========')
numero = int(input('Digite um número: '))
if numero / 1 and numero / numero:
print('Número primo')
else:
print('Nao é um número primo')
|
#este es el ejercicio 3.1
def ejercicio01():
print ("Como saber si puedes votar por tu edad")
mensaje=""
#Ingreso de datos
edadP=int(input("ingrese la edad que tiene:"))
#Proceso
if edadP>=18:
mensaje="Usted tiene la edad necesaria para votar"
else:
mensaje="Usted no cumple con la edad minima para votar"
print(mensaje)
ejercicio01() |
"""Faça um algoritmo que leia o preço de um produto e mostre seu novo preço, com 5% de desconto"""
preco = float(input('Informe o preço do produto: '))
print(f'O preço do produto com 5% de desconto será de R${preco-(preco*0.05):.2f}')
|
spam = {'name': 'Pooka', 'age': 5}
print("Before:")
print(spam)
#Traditional
if 'color' not in spam:
spam['color'] = 'black'
print("After:")
print(spam)
#With setDefault()
spam.setdefault("color", "white")
print(spam)
message = 'It was a bright cold day in April, and the clocks were striking thirteen.'
count = {}
for character in message:
count.setdefault(character, 0)
count[character] = count[character] + 1
print(count)
|
"""This solution uses addition repititively
to find largest power n of 2 such that 2**n*b < a.
Then you keep subtracting these multiples of b of
the form 2**i*b for smaller powers until the remainder
is smaller than b. Each time you subtract,
take the previous quotient and multiply by two.
If there is any remaining in the end,
just multiply them all by 2 iteratively."""
class Solution(object):
def divide(self, dividend, divisor):
"""
:type dividend: int
:type divisor: int
:rtype: int
"""
# e.g. a=100, b=3
a, b = dividend, divisor
negative = False if (a>0) == (b>0) else True
a = a if a>0 else -a
b = b if b>0 else -b
mult = [b]
c = b
while c + c <= a:
c += c
mult.append(c)
# here len(mult)=6, then n=5, which is the largest n
# s.t. 2**n*b < a
# mult = [3,6,12,24,48,96]
# Here is the main step. After getting i's
# where 2**i*b < a, keeping substracing them
# from a and add the 2**i to 'out'.
i = 0
out = 0
while a >= b:
i += 1
out += out # here is to iteratively calcuate 2**i
if a >= mult[-i]:
a -= mult[-i]
out += 1
# If there is any remaining in the end,
# keeping finishing the calculation of 2**i
while i < len(mult):
out += out
i += 1
if negative:
out = -out
if out>2147483647 or out<-2147483648:
return 2147483647
else:
return out
|
# Problem 2.
# Write the function subStringMatchExact. This function takes two arguments: a target string,
# and a key string. It should return a tuple of the starting points of matches of the key
# string in the target string, when indexing starts at 0. Complete the definition for
#
# def subStringMatchExact(target,key):
#
# For example,
# subStringMatchExact("atgacatgcacaagtatgcat","atgc")
# would return the tuple (5, 15).
def subStringMatchExact(target, key):
position_list = []
begin_point = 0
temp_position = 0
while temp_position >= 0:
temp_position = target.find(key, begin_point)
if temp_position >= 0:
begin_point = temp_position + 1
position_list.append(temp_position)
position_tuple = tuple(position_list)
return position_tuple
target1 = 'atgacatgcacaagtatgcat'
key1 = 'atgc'
print(subStringMatchExact(target1, key1)) |
#Exercício Python 014: Escreva um programa que converta uma temperatura
# digitando em graus Celsius e converta para graus Fahrenheit.
c = float(input('Digite a temperatura em C°: '))
f = ((c*1.8)+32)
print('{} C° convertido para Fahrenheit fica em {}°F.'.format(c,f))
|
'''
Palindrome checker by python
'''
#Palindrome check for String inputs.
def palindrome (s):
r=s[::-1]
if(r==s):
print("Yes It is a palindrome")
else:
print("No It is not a palindrome")
s = input("Enter a String to check whether it is palindrome or not")
palindrome(s)
#Palindrome check for Number (Integer) inputs.
num=int(input("Enter a number:"))
temp=num
rev=0
while(num>0):
dig=num%10
rev=rev*10+dig
num=num//10
if(temp==rev):
print("The number is Palindrome!")
else:
print("The number is Not a palindrome!")
|
""" Number Data types
Integers(int)
Floating Point(float)
Integer is a w
"""
|
class BaseError(Exception):
...
class InternalError(BaseError):
_default = "An internal error has occurred."
def __init__(self):
super().__init__(self._default)
|
"""
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example:
Given the array [-2,1,-3,4,-1,2,1,-5,4],
the contiguous subarray [4,-1,2,1] has the largest sum = 6.
For this problem, return the maximum sum.
"""
class Solution:
# @param A : tuple of integers
# @return an integer
def maxSubArray(self, A):
l = len(A)
if l < 1:
return 0
max_ending_here = A[0]
max_so_far = A[0]
for i in xrange(1, l):
max_ending_here = max(max_ending_here + A[i], A[i])
max_so_far = max(max_ending_here, max_so_far)
return max_so_far
|
class Solution:
def hammingDistance(self, x: int, y: int) -> int:
dis = 0
while x != 0 or y !=0:
x,resx = x //2, x%2
y,resy = y//2, y%2
if resx!= resy:
dis +=1
return dis
class Solution:
def hammingDistance(self, x: int, y: int) -> int:
return bin(x^y).count('1')
|
QUERIES = {
'average_movies_per_user': (
'select avg(movies_watched) '
'from ( '
'select count(movie_id) as movies_watched '
'from views '
'group by user_id '
' ) as movies_count;'
),
'average_view_times': 'select avg(viewed_frame) from views;',
'top_20_users_by_total_view_time': (
'select user_id, sum(viewed_frame) as view_time '
'from views '
'group by user_id '
'order by view_time desc '
'limit 20;'
),
'top_20_movies_by_view_time': (
'select movie_id, max(viewed_frame) as view_time '
'from views '
'group by movie_id '
'order by view_time desc '
'limit 20;'
),
'unique_movies_count': 'select count(distinct movie_id) from views;',
'unique_users_count': 'select count(distinct user_id) from views;'
}
|
# Logic: Write a program that find the maximum positive integer from user input.
# Algorithm: append all the numbers to a list and use the built-in method 'max()' to get the highest number in the list.
num_int = int(input("Input a number: "))
num_list = []
while num_int >= 0:
num_int = int(input("Input a number: "))
num_list.append(num_int)
print("The maximum is",max(num_list))
|
def _print_aspect_impl(target, ctx):
# Make sure the rule has a srcs attribute.
if hasattr(ctx.rule.attr, 'srcs'):
# Iterate through the files that make up the sources and
# print their paths.
for src in ctx.rule.attr.srcs:
for f in src.files.to_list():
print(f.path)
return []
print_aspect = aspect(
implementation = _print_aspect_impl,
attr_aspects = ['deps'],
)
|
for t in range(int(input())):
n=int(input())
k = 3 + 5**(1/2)
s = str(int(k**n))
if len(s) <3:
s = "0"*(3-len(s)) +s
print("Case #{}: {}".format(t+1,s[-3:])) |
load(
"@rules_scala3//rules:providers.bzl",
_ScalaConfiguration = "ScalaConfiguration",
_ScalaRulePhase = "ScalaRulePhase",
)
def run_phases(ctx, phases):
phase_providers = [
p[_ScalaRulePhase]
for p in [ctx.attr.scala] + ctx.attr.plugins + ctx.attr._phase_providers
if _ScalaRulePhase in p
]
if phase_providers != []:
phases = adjust_phases(phases, [p for pp in phase_providers for p in pp.phases])
gd = {
"init": struct(
scala_configuration = ctx.attr.scala[_ScalaConfiguration],
),
"out": struct(
output_groups = {},
providers = [],
),
}
g = struct(**gd)
for (name, function) in phases:
p = function(ctx, g)
if p != None:
gd[name] = p
g = struct(**gd)
return g
def adjust_phases(phases, adjustments):
if len(adjustments) == 0:
return phases
phases = phases[:]
for (relation, peer_name, name, function) in adjustments:
for idx, (needle, _) in enumerate(phases):
if needle == peer_name:
if relation in ["-", "before"]:
phases.insert(idx, (name, function))
elif relation in ["+", "after"]:
phases.insert(idx + 1, (name, function))
elif relation in ["=", "replace"]:
phases[idx] = (name, function)
return phases
|
# Copyright 2017-2020 EPAM Systems, Inc. (https://www.epam.com/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
class ShareMountModel(object):
def __init__(self):
self.identifier = None
self.region_id = None
self.mount_root = None
self.mount_type = None
self.mount_options = None
@classmethod
def load(cls, json):
instance = ShareMountModel()
if not json:
return None
instance.identifier = json['id']
instance.region_id = json['regionId']
instance.mount_root = json['mountRoot']
instance.mount_type = json['mountType']
instance.mount_options = json['mountOptions'] if 'mountOptions' in json else None
return instance
|
X, Y, N = map(int, input().split())
grid = []
win = ''
for i in range(X):
grid.append([])
for j, val in enumerate(input().split()):
grid[i].append({'R':0,'B':0, 'dir':'none'})
if val != 'O':
grid[i][j][val] = 1
up, left, upleft, upright = 0, 0, 0, 0
if i > 0: up = grid[i-1][j][val] if grid[i-1][j]['dir']=='up' or grid[i-1][j]['dir']=='none' else 0
if j > 0: left = grid[i][j-1][val] if grid[i][j-1]['dir']=='left' or grid[i][j-1]['dir']=='none' else 0
if i*j > 0: upleft = grid[i-1][j-1][val] if grid[i-1][j-1]['dir']=='upleft' or grid[i-1][j-1]['dir']=='none' else 0
if i > 0 and j < Y-1: upright = grid[i-1][j+1][val] if grid[i-1][j+1]['dir']=='upright' or grid[i-1][j+1]['dir']=='none' else 0
grid[i][j][val] += max(up, left, upleft, upright)
if max(up, left, upleft, upright)==up: grid[i][j]['dir']='up'
if max(up, left, upleft, upright)==left: grid[i][j]['dir']='left'
if max(up, left, upleft, upright)==upleft: grid[i][j]['dir']='upleft'
if max(up, left, upleft, upright)==upright: grid[i][j]['dir']='upright'
if max(up, left, upleft, upright)==0: grid[i][j]['dir']='none'
if grid[i][j][val] == N:
win = {'B':'BLUE', 'R':'RED'}[val]
break
if win: break
if win: print(win, 'WINS')
else: print('NONE') |
# Copied from https://rosettacode.org/wiki/Shortest_common_supersequence#Python
# Use the Longest Common Subsequence algorithm
def shortest_common_supersequence(a, b):
lcs = longest_common_subsequence(a, b)
scs = ""
# Consume lcs
while len(lcs) > 0:
if a[0]==lcs[0] and b[0]==lcs[0]:
# Part of the LCS, so consume from all strings
scs += lcs[0]
lcs = lcs[1:]
a = a[1:]
b = b[1:]
elif a[0]==lcs[0]:
scs += b[0]
b = b[1:]
else:
scs += a[0]
a = a[1:]
# append remaining characters
return scs + a + b
|
def extract_tib_only(csv_dump):
lines = csv_dump.strip().split('\n') # cut dump in lines
lines = [l.split(',')[1] for l in lines] # only keep the text
lines = [lines[i] for i in range(0, len(lines), 2)] # only keep the tibetan
return ''.join(lines)
def extract_all(csv_dump):
lines = csv_dump.strip().split('\n') # cut dump in lines
lines = [l.split(',')[1] for l in lines] # only keep the text
return ''.join(lines)
|
#! /usr/bin/env python3
description = """
Power digit sum
Problem 16
215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 21000?
"""
print(sum(int(x) for x in str(2**1000)))
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/7/31 17:52
# @Author : Leishichi
# @File : 27.py
# @Software: PyCharm
# @Tag:
class Solution:
def removeElement(self, nums, val):
"""
:type nums: List[int]
:type val: int
:rtype: int
"""
if len(nums) == 0:
return 0
length = 0
for i in range(len(nums)):
if val != nums[i]:
nums[length] = nums[i]
length += 1
return length |
# 26.05.2019
# Tuples vs Lists
# Tuples are read only
# Tuples have ( ) brackets
# Example with a List:
awesomeList= ['hello', 45, 'Marc', 89.4]
awesomeList[3] = 6
# List can be updated
print(awesomeList)
# now a tuple
awesomeTuple = ('MarcTuple', 1, 213.2, 'Hello')
print(awesomeTuple)
print(awesomeTuple[2])
# ERROR awesomeTuple[2] = 3
# Tuple object does not support item assignment
# ERROR awesomeTuple[1] +=3
# but slicing is working
print(awesomeTuple[0][2:5])
var7 = awesomeTuple[0][2:5]
var8 = awesomeTuple[2]
print(var7*3)
print(var8*3)
|
def dfCheckAvailability(df, baseTrackingMap):
#####
# step number -- iStep
bIStep = False if not ("iStep" in df.columns) else True
print("scan step number (iStep) availability: %s \n--" % str(bIStep))
#####
# Unix time -- epoch
bEpoch = False if not ("epoch" in df.columns) else True
print("Unix time (epoch) availability: %s \n--" % str(bEpoch))
#####
# goniometer DOF -- xGonioRaw...
lsGonio = [s.replace("xGonioRaw", "") for s in df.columns if "xGonioRaw" in s] # list of the full raw goniometer DOF names -- without prefix
bXGonio = False if len(lsGonio) == 0 else True
printNr = ("(%d)" % len(lsGonio)) if bXGonio else ""
print("goniometer DOF availability: %s %s" % (str(bXGonio), printNr))
print("xGonioRaw + %s" % str(lsGonio))
print("--")
#####
# input (all 4) & output (both 2) tracking data...
print("input modules should be: %s" % str(baseTrackingMap[0]))
print("output modules should be: %s" % str(baseTrackingMap[1]))
#####
# positions -- xRaw...
bXRaw = {"in": True, "out": True}
for iLayer in baseTrackingMap[0]:
if not ("xRaw"+iLayer in df.columns):
bXRaw["in"] = False # input
for iLayer in baseTrackingMap[1]:
if not ("xRaw"+iLayer in df.columns):
bXRaw["out"] = False # output
print("input tracking availability (xRaw...): %s" % str(bXRaw["in"]))
print("output tracking availability (xRaw...): %s" % str(bXRaw["out"]))
#####
# multiplicities -- nHit...
bNHit = {"in": True, "out": True}
for iLayer in baseTrackingMap[0]:
if not ("nHit"+iLayer in df.columns):
bNHit["in"] = False # input
for iLayer in baseTrackingMap[1]:
if not ("nHit"+iLayer in df.columns):
bNHit["out"] = False # output
print("input multiplicity availability (nHit...): %s" % str(bNHit["in"]))
print("output multiplicity availability (nHit...): %s" % str(bNHit["out"]))
print("--")
#####
# digitizer data -- digiPHRaw... & digiTime...
lsDigiRawCh = [s for s in sorted(df.columns) if "digiPHRaw" in s] # list of the full raw digitizer PH names
lsDigiCh = [s.replace("digiPHRaw", "") for s in lsDigiRawCh] # list of the digitizer channel names -- without any prefix
bDigiPHAny = False if len(lsDigiCh) == 0 else True # global PH availability -- single channels listed in lsDigiRawCh
print("digitizer channel availability: %s" % str(bDigiPHAny))
bDigiTime = {}
if bDigiPHAny:
print("%d channels: digiPHRaw + %s" % (len(lsDigiCh), str(lsDigiCh)))
for i, iCh in enumerate(lsDigiRawCh):
# digitizer time availability for each of the available PH (listed in lsDigiRawCh)
bDigiTime.update({iCh.replace("digiPHRaw", ""): True if iCh.replace("PHRaw", "Time") in df.columns else False})
print("%d with time: digiTime + %s" % (len([s for s in bDigiTime if bDigiTime[s]]), str([s for s in bDigiTime if bDigiTime[s]])))
print("--")
#####
# forward calorimeter total PH & energy in GeV -- PHCaloFwd & EFwd
bPHCaloFwd = False if not ("PHCaloFwd" in df.columns) else True
print("forward calorimeter total signal (PHCaloFwd) availability a priori: %s" % str(bPHCaloFwd))
bEFwd = False if not ("EFwd" in df.columns) else True
print("forward calorimeter total in GeV (EFwd) availability a priori: %s" % str(bEFwd))
return df, bIStep, bEpoch, bXGonio, bXRaw, bNHit, bDigiPHAny, lsDigiCh, bDigiTime, bPHCaloFwd, bEFwd
###############################################################################
###############################################################################
def zBaseCheckAvailability(z, lsRun, baseTrackingMap):
for iRun in lsRun:
if iRun in z:
bGlobalAvailability = True
else:
bGlobalAvailability = False
z.update({iRun: {}})
# goniometer
if not ("gonio" in z[iRun]):
bGlobalAvailability = False
print("z[%s][\"gonio\"] unavailable --> setting 0" % iRun)
z[iRun].update({"gonio": 0})
# forward calorimeter
if not ("caloFwd" in z[iRun]):
bGlobalAvailability = False
print("z[%s][\"caloFwd\"] unavailable --> setting 0" % iRun)
z[iRun].update({"caloFwd": 0})
# input/output base tracking layers
for iLayer in baseTrackingMap[0]+baseTrackingMap[1]:
if not (iLayer in z[iRun]):
bGlobalAvailability = False
print("z[%s][\"%s\"] unavailable --> setting 0" % (iRun, iLayer))
z[iRun].update({iLayer: 0})
if bGlobalAvailability:
print("all mandatory z[%s] available" % iRun)
return z |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 14 13:26:18 2020
@author: abhi0
"""
class Solution:
def isSubsequence(self, s: str, t: str) -> bool:
for i in s:
if i in t:
tempIdx=t.index(i)
t=t[tempIdx+1:]
else:
return False
return True |
list1 = [1, 7, 16, 11, 14, 19, 20, 18]
list2 = [85, 111, 117, 43, 104, 127, 117, 117, 33, 110, 99, 43, 72, 95, 85, 85, 94, 66, 120, 98, 79, 117, 68, 83, 64, 94, 39, 65, 73, 32, 65, 72, 51]
ans = ''
for i in range(len(list2)):
ans += chr(list2[i] ^ list1[i % len(list1)])
print(ans)
|
"""
A nevelty COVID-19 Infections estimator function.
"""
def estimator(data):
#calculations for the currentlyInfected property
impact_ci = data['reportedCases']*10
severe_ci = data['reportedCases']*50
#calculations for the inFectedByRequestTime
if data['periodType'] == 'days':
impact_ibrt = int(impact_ci*(2**int((data['timeToElapse']/3))))
severe_ibrt = int(severe_ci*(2**int((data['timeToElapse']/3))))
elif data['periodType'] == 'weeks':
factor = int((data['timeToElapse']*7)/3)
impact_ibrt = int(impact_ci*(2**factor))
severe_ibrt = int(severe_ci*(2**factor))
elif data['periodType'] == 'months':
factor = int((data['timeToElapse']*30)/3)
impact_ibrt = int(impact_ci*(2**factor))
severe_ibrt = int(severe_ci*(2**factor))
impact_scbrt = int(0.15*impact_ibrt)
severe_scbrt = int(0.15*severe_ibrt)
impact_hbbrt = int(0.35*data['totalHospitalBeds']-impact_scbrt)
severe_hbbrt = int(0.35*data['totalHospitalBeds']-severe_scbrt)
impact_icu = int(0.05*impact_ibrt)
severe_icu = int(0.05*severe_ibrt)
impact_venti = int(0.02*impact_ibrt)
severe_venti = int(0.02*severe_ibrt)
if data['periodType'] == 'days':
impact_dnflight = ((impact_ibrt*data['region']['avgDailyIncomeInUSD']*data['region']\
['avgDailyIncomePopulation'])/data['timeToElapse'])
severe_dnflight = ((severe_ibrt*data['region']['avgDailyIncomeInUSD']*data['region'][\
'avgDailyIncomePopulation'])/data['timeToElapse'])
elif data['periodType'] == 'weeks':
denum_var = data['timeToElapse']*7
impact_dnflight = ((impact_ibrt*data['region']['avgDailyIncomeInUSD']*data['region']\
['avgDailyIncomePopulation'])/denum_var)
severe_dnflight = ((severe_ibrt* data['region']['avgDailyIncomeInUSD'] * data['region']\
['avgDailyIncomePopulation'])/denum_var)
elif data['periodType'] == 'months':
denum_var = data['timeToElapse']*30
impact_dnflight = ((impact_ibrt*data['region']['avgDailyIncomeInUSD'] * data['region']\
['avgDailyIncomePopulation'])/denum_var)
severe_dnflight = ((severe_ibrt*data['region']['avgDailyIncomeInUSD'] * data['region']\
['avgDailyIncomePopulation'])/denum_var)
#The returned data
python_return_data = {
"data": {
"region": {
"name": data['region']['name'],
"avgAge": data['region']['avgAge'],
"avgDailyIncomeInUSD": data['region']['avgDailyIncomeInUSD'],
"avgDailyIncomePopulation": data['region']['avgDailyIncomePopulation']
},
"periodType": data['periodType'],
"timeToElapse": data['timeToElapse'],
"reportedCases": data['reportedCases'],
"population": data['population'],
"totalHospitalBeds": data['totalHospitalBeds']
},
"impact": {
"currentlyInfected": impact_ci,
"infectionsByRequestedTime": impact_ibrt,
"severeCasesByRequestedTime": impact_scbrt,
"hospitalBedsByRequestedTime": impact_hbbrt,
"casesForICUByRequestedTime": impact_icu,
"casesForVentilatorsByRequestedTime": impact_venti,
"dollarsInFlight": int(impact_dnflight),
},
"severeImpact": {
"currentlyInfected": severe_ci,
"infectionsByRequestedTime": severe_ibrt,
"severeCasesByRequestedTime": severe_scbrt,
"hospitalBedsByRequestedTime": severe_hbbrt,
"casesForICUByRequestedTime": severe_icu,
"casesForVentilatorsByRequestedTime": severe_venti,
"dollarsInFlight": int(severe_dnflight),
}
}
#return the json format of the input data and python return data
return python_return_data
|
class Array(object):
def __init__(self, capacity, fill_value=None):
"""Capacity is the static size of the array.
fillValue is placed at each position."""
self._items = list()
for count in range(capacity):
self._items.append(fill_value)
def __len__(self):
"""-> The capacity of the array."""
return len(self._items)
def __str__(self):
"""-> The string representation of the array."""
return str(self._items)
def __iter__(self):
"""Supports traversal with a for loop."""
return iter(self._items)
def __getitem__(self, index):
"""Subscript operator for access at index."""
return self._items[index]
def __setitem__(self, index, new_item):
"""Subscript operator for replacement at index."""
self._items[index] = new_item
|
f = open("Street_Centrelines.csv",'r')
def tup():
for v in f:
v = v.split(",")
t = (v[2], v[4], v[6], v[7])
print(t)
def maintenance():
h = dict()
for f2 in f:
f2 = f2.split(",")
if f2[12] not in h:
h[f2[12]] = 1
else:
h[f[12]] += 1
print(h)
def street_owner():
owner_list = f[11]
final_list = []
for a in f:
a = a.split(",")
if a[11] not in final_list:
final_list.append(a[11])
print(final_list)
tup()
maintenance()
street_owner()
|
words = ['one', 'fish', 'two', 'fish', 'red', 'fish', 'blue', 'fish']
words2 = ['have', 'you', 'seen', 'a', 'blue', 'fish']
# what if we did the first example as a generator?
def get_word_lengths(word_list):
for word in word_list:
yield len(word)
for length in get_word_lengths(words):
print(length)
print('--------------------')
for length in (len(word) for word in words):
print(length)
|
# Time: O(n)
# Space: O(1)
# We are given two strings, A and B.
#
# A shift on A consists of taking string A and moving the leftmost character to the rightmost position.
# For example, if A = 'abcde', then it will be 'bcdea' after one shift on A. Return True
# if and only if A can become B after some number of shifts on A.
#
# Example 1:
# Input: A = 'abcde', B = 'cdeab'
# Output: true
#
# Example 2:
# Input: A = 'abcde', B = 'abced'
# Output: false
#
# Note:
# - A and B will have length at most 100.
# Rabin-Karp Algorithm (rolling hash)
class Solution(object):
def rotateString(self, A, B):
"""
:type A: str
:type B: str
:rtype: bool
Our approach comes down to quickly checking whether B is a substring of A2 = A+A. Specifically, check whether
B = A2[0:N], or B = A2[1:N+1], or B = A2[2:N+2] and so on. To check this, we can use a rolling hash.
Algorithm
For a string S, say hash(S) = (S[0] * P^0 + S[1] * P^1 + S[2] * P^2 + ...) % MOD, where S[i] is the ASCII code of the string at that index.
The idea is that hash(S) has output that is approximately uniformly distributed between [0, 1, 2, ..., MOD-1],
and so if MOD is big enough and hash(S) == hash(T) it is very likely that S == T.
Say we have a hash hash(A), and we want the hash of A[1], A[2], ..., A[N-1], A[0]. We can subtract A[0] from the hash,
divide by P, and add A[0] * P**(N-1). (Our division is done by multiplying by the modular inverse Pinv = pow(P, MOD-2, MOD).)
"""
def check(index):
return all(A[(i+index) % len(A)] == c
for i, c in enumerate(B))
if len(A) != len(B):
return False
M, p = 10**9+7, 113
p_inv = pow(p, M-2, M)
b_hash, power = 0, 1
for c in B:
b_hash += power * ord(c)
b_hash %= M
power = (power*p) % M
a_hash, power = 0, 1
for i in xrange(len(B)):
a_hash += power * ord(A[i%len(A)])
a_hash %= M
power = (power*p) % M
if a_hash == b_hash and check(0): return True
power = (power*p_inv) % M
for i in xrange(len(B), 2*len(A)):
a_hash = (a_hash-ord(A[(i-len(B))%len(A)])) * p_inv
a_hash += power * ord(A[i%len(A)])
a_hash %= M
if a_hash == b_hash and check(i-len(B)+1):
return True
return False
# Time: O(n)
# Space: O(n)
# KMP algorithm
class Solution2(object):
def rotateString(self, A, B):
"""
:type A: str
:type B: str
:rtype: bool
Intuition
We want to find whether B exists in A+A. The KMP algorithm is a textbook algo. that does string matching in linear time, faster than brute force.
Algorithm
The algorithm is broken up into two steps, building the shifts table (or failure table), and using it to find whether a match exists.
The shift table tells about the largest prefix of B that ends here. More specifically,
B[:shifts[i+1]] == B[i - shifts[i+1] : i] is the largest possible prefix of B ending before B[i].
We use a dynamic programming approach to build the shift table, where all previously calculated values of shifts are correct.
Then, left will be the end of the candidate prefix of B, and right will be the end of the candidate section that
should match the prefix B[0], B[1], ..., B[left]. Call positions (left, right) "matching" if the prefix ending
at B[left] matches the same length string ending at B[right]. The invariant in our loop will be that
(left-1, right-1) is matching by the end of each for-block.
In a new for-block, if (left, right) is matching (ie. (left - 1, right - 1) is matching from before,
plus B[left] == B[right]), then we know the shift (right - left) is the same number as before.
Otherwise, when (left, right) is not matching, we need to find a shorter prefix.
Our strategy is to find a matching of (left2, right) where left2 < left, by finding matchings
(left2 - 1, right - 1) plus checking B[left2] == B[right]. Since (left - 1, right - 1) is a matching,
by transitivity we want to find matchings (left2 - 1, left - 1). The largest such left2 is left2 = left - shifts[left].
We repeatedly check these left2's in greedy order from largest to smallest.
To find a match of B in A+A with such a shift table ready, we employ a similar strategy. We maintain a matching
(match_len - 1, i - 1), where these positions correspond to strings of length match_len that end at B[match_len - 1] and (A+A)[i-1] respectively.
Now when trying to find the largest length matching for (A+A) at position i, it must be at most (match_len - 1) + 1,
where the quantity in brackets is the largest length matching to position i-1.
Again, our strategy is to find a matching (match_len2 - 1, i - 1) plus check that B[match_len2] == (A+A)[i].
Similar to before, if B[match_len] != (A+A)[i], then because (match_len - 1, i - 1) was a matching,
by transitivity (match_len2 - 1, match_len - 1) must be a matching, of which the largest is found by
match_len2 = match_len - shifts[match_len]. We also repeatedly check these match_len's in order from largest to smallest.
If at any point in this algorithm our match length is N, we've found B in A+A successfully.
"""
def strStr(haystack, needle):
def KMP(text, pattern):
prefix = getPrefix(pattern)
j = -1
for i in xrange(len(text)):
while j > -1 and pattern[j + 1] != text[i]:
j = prefix[j]
if pattern[j + 1] == text[i]:
j += 1
if j == len(pattern) - 1:
return i - j
return -1
def getPrefix(pattern):
prefix = [-1] * len(pattern)
j = -1
for i in xrange(1, len(pattern)):
while j > -1 and pattern[j + 1] != pattern[i]:
j = prefix[j]
if pattern[j + 1] == pattern[i]:
j += 1
prefix[i] = j
return prefix
if not needle:
return 0
return KMP(haystack, needle)
if len(A) != len(B):
return False
return strStr(A*2, B) != -1
# Time: O(n^2)
# Space: O(1)
class Solution3(object):
def rotateString(self, A, B):
if len(A) != len(B):
return False
if len(A) == 0:
return True
for s in xrange(len(A)):
if all(A[(s+i) % len(A)] == B[i] for i in xrange(len(A))):
return True
return False
# Time: O(n^2)
# Space: O(n)
# Brute force
class Solution4(object):
def rotateString(self, A, B):
return len(A) == len(B) and B in A*2
|
def mfouri(self, oper="", coeff="", mode="", isym="", theta="", curve="",
**kwargs):
"""Calculates the coefficients for, or evaluates, a Fourier series.
APDL Command: *MFOURI
Parameters
----------
oper
Type of Fourier operation:
Calculate Fourier coefficients COEFF from MODE, ISYM, THETA, and CURVE. - Evaluate the Fourier curve CURVE from COEFF, MODE, ISYM andTHETA
coeff
Name of the array parameter vector containing the Fourier
coefficients (calculated if Oper = FIT, required as input if Oper =
EVAL). See *SET for name restrictions.
mode
Name of the array parameter vector containing the mode numbers of
the desired Fourier terms.
isym
Name of the array parameter vector containing the symmetry key for
the corresponding Fourier terms. The vector should contain keys
for each term as follows:
Symmetric (cosine) term - Antisymmetric (sine) term.
theta, curve
Names of the array parameter vectors containing the theta vs. curve
description, respectively. Theta values should be input in
degrees. If Oper = FIT, one curve value should be supplied with
each theta value. If Oper = EVAL, one curve value will be
calculated for each theta value.
Notes
-----
Calculates the coefficients of a Fourier series for a given curve, or
evaluates the Fourier curve from the given (or previously calculated)
coefficients. The lengths of the COEFF, MODE, and ISYM vectors must be
the same--typically two times the number of modes desired, since two
terms (sine and cosine) are generally required for each mode. The
lengths of the CURVE and THETA vectors should be the same or the
smaller of the two will be used. There should be a sufficient number
of points to adequately define the curve--at least two times the number
of coefficients. A starting array element number (1) must be defined
for each array parameter vector. The vector specifications *VLEN,
*VCOL, *VABS, *VFACT, and *VCUM do not apply to this command. Array
elements should not be skipped with the *VMASK and the NINC value of
the *VLEN specifications. The vector being calculated (COEFF if Oper
is FIT, or CURVE if Oper is EVAL) must exist as a dimensioned array
[*DIM].
This command is valid in any processor.
"""
command = f"*MFOURI,{oper},{coeff},{mode},{isym},{theta},{curve}"
return self.run(command, **kwargs)
def mfun(self, parr="", func="", par1="", **kwargs):
"""Copies or transposes an array parameter matrix.
APDL Command: *MFUN
Parameters
----------
parr
The name of the resulting array parameter matrix. See *SET for
name restrictions.
func
Copy or transpose function:
Par1 is copied to ParR - Par1 is transposed to ParR. Rows (m) and columns (n) of Par1 matrix are
transposed to resulting ParR matrix of shape
(n,m).
par1
Array parameter matrix input to the operation.
Notes
-----
Operates on one input array parameter matrix and produces one output
array parameter matrix according to:
ParR = f(Par1)
where the function (f) is either a copy or transpose, as described
above.
Functions are based on the standard FORTRAN definitions where possible.
ParR may be the same as Par1. Starting array element numbers must be
defined for each array parameter matrix if it does not start at the
first location. For example, *MFUN,A(1,5),COPY,B(2,3) copies matrix B
(starting at element (2,3)) to matrix A (starting at element (1,5)).
The diagonal corner elements for each submatrix must be defined: the
upper left corner by the array starting element (on this command), the
lower right corner by the current values from the *VCOL and *VLEN
commands. The default values are the (1,1) element and the last
element in the matrix. No operations progress across matrix planes (in
the 3rd dimension). Absolute values and scale factors may be applied
to all parameters [*VABS, *VFACT]. Results may be cumulative [*VCUM].
Array elements should not be skipped with the *VMASK and the NINC value
of the *VLEN specifications. The number of rows [*VLEN] applies to the
Par1 array. See the *VOPER command for details.
This command is valid in any processor.
"""
command = f"*MFUN,{parr},{func},{par1}"
return self.run(command, **kwargs)
def moper(self, parr="", par1="", oper="", val1="", val2="",
val3="", val4="", val5="", val6="", **kwargs):
""" Performs matrix operations on array parameter matrices.
APDL Command: *MOPER
Parameters
----------
parr
The name of the resulting array parameter matrix. See *SET for
name restrictions.
par1
First array parameter matrix input to the operation. For Oper =
MAP, this is an N x 3 array of coordinate locations at which to
interpolate. ParR will then be an N(out) x M array containing the
interpolated values.
oper
Matrix operations:
INVERT - (*MOPER, ParR, Par1, INVERT)
Square matrix invert: Inverts the n x n matrix in Par1
into ParR. The matrix must be well conditioned.
Warning: Non-independent or ill-conditioned equations can
cause erroneous results. - For large matrices, use the
APDL Math operation *LSFACTOR for efficiency (see APDL
Math).
MULT - (*MOPER, ParR, Par1, MULT, Par2)
Matrix multiply: Multiplies Par1 by Par2. The number of
rows of Par2 must equal the number of columns of Par1 for
the operation. If Par2 is input with a number of rows
greater than the number of columns of Par1, matrices are
still multiplied. However, the operation only uses a
number of rows of Par2 equal to the number of columns of
Par1.
COVAR - (*MOPER, ParR, Par1, COVAR, Par2)
Covariance: The measure of association between two columns
of the input matrix (Par1). Par1, of size m runs (rows)
by n data (columns) is first processed to produce a row
vector containing the mean of each column which is
transposed to a column vector (Par2) of n array elements.
The Par1 and Par2 operation then produces a resulting n x
n matrix (ParR) of covariances (with the variances as the
diagonal terms).
CORR - (*MOPER, ParR, Par1, CORR, Par2)
Correlation: The correlation coefficient between two
variables. The input matrix (Par1), of size m runs (rows)
by n data (columns), is first processed to produce a row
vector containing the mean of each column which is then
transposed to a column vector (Par2) of n array elements.
The Par1 and Par2 operation then produces a resulting n x
n matrix (ParR) of correlation coefficients (with a value
of 1.0 for the diagonal terms).
SOLV - (*MOPER, ParR, Par1, SOLV, Par2)
Solution of simultaneous equations: Solves the set of n
equations of n terms of the form an1x1 + an2x2 + ... +
annxn = bn where Par1 contains the matrix of
a-coefficients, Par2 the vector(s) of b-values, and ParR
the vector(s) of x-results. Par1 must be a square matrix.
The equations must be linear, independent, and well
conditioned.
Warning: Non-independent or ill-conditioned equations can
cause erroneous results. - For large matrices, use the
APDL Math operation *LSFACTOR for efficiency (see APDL
Math).
SORT - (*MOPER, ParR, Par1, SORT, Par2, n1, n2, n3)
Matrix sort: Sorts matrix Par1 according to sort vector
Par2 and places the result back in Par1. Rows of Par1 are
moved to the corresponding positions indicated by the
values of Par2. Par2 may be a column of Par1 (in which
case it will also be reordered). Alternatively, you may
specify the column of Par1 to sort using n1 (leaving Par2
blank). A secondary sort can be specified by column n2,
and a third sort using n3. ParR is the vector of initial
row positions (the permutation vector). Sorting Par1
according to ParR should reproduce the initial ordering.
NNEAR - (*MOPER, ParR, Par1, NNEAR, Toler)
Nearest Node: Quickly determine all the nodes within a
specified tolerance of a given array. ParR is a vector of
the nearest selected nodes, or 0 if no nodes are nearer
than Toler. Par1 is the n x 3 array of coordinate
locations. Toler defaults to 1 and is limited to the
maximum model size. - (*MOPER, ParR, Par1, ENEAR, Toler)
ENEAR - (*MOPER, ParR, Par1, ENEAR, Toler)
Nearest Element: Quickly determine the elements with
centroids that are within a specified tolerance of the
points in a given array. - ParR is a vector of the nearest
selected elements, or 0 if no element centroids are nearer
than Toler. Par1 is the n x 3 array of coordinate
locations.
MAP - (*MOPER, ParR, Par1, MAP, Par2, Par3, kDim, --, kOut, LIMIT)
Maps the results from one set of points to another. For
example, you can map pressures from a CFD analysis onto
your model for a structural analysis.
Par1 is the Nout x 3 array of points that will be mapped
to. Par2 is the Nin x M array that contains M values of
data to be interpolated at each point and corresponds to
the Nin x 3 points in Par3. The resulting ParR is the Nout
x M array of mapped data points.
For each point in the destination mesh, all possible
triangles in the source mesh are searched to find the best
triangle containing each point. It then does a linear
interpolation inside this triangle. You should carefully
specify your interpolation method and search criteria in
order to provide faster and more accurate results (see
LIMIT, below).
kDim is the interpolation criteria. If kDim = 2 or 0, two
dimensional interpolation is applied (interpolate on a
surface). If kDim = 3, three dimensional interpolation is
applied (interpolate on a volume).
kOut specified how points outside of the domain are
handled. If kOut = 0, use the value(s) of the nearest
region point for points outside of the region. If kOut =
1, set results outside of the region to zero.
LIMIT specifies the number of nearby points considered for
interpolation. The default is 20, and the minimum is
5. Lower values will reduce processing time; however, some
distorted or irregular sets of points will require a
higher LIMIT value to encounter three nodes for
triangulation.
Output points are incorrect if they are not within the
domain (area or volume) defined by the specified input
points. Also, calculations for out-of-bound points require
much more processing time than do points that are within
bounds. Results mapping is available from the command line
only.
INTP - (*MOPER, ParR, Par1, INTP, Par2)
Finds the elements that contain each point in the array of
n x 3 points in Par1. Par2 will contain the set of element
ID numbers and ParR will contain their n x 3 set of
natural element coordinates (values between -1 and
1). Par1 must be in global Cartesian coordinates.
SGET - (*MOPER, ParR, Par1, SGET, Par2, Label, Comp)
Gets the nodal solution item corresponding to Label and
Comp (see the PLNSOL command) and interpolates it to the
given element locations. Par1 contains the n x 3 array of
natural element coordinates (values between -1 and 1) of
the n element ID numbers in Par2. Par1 and Par2 are
usually the output of the *MOPER,,,INTP operation. ParR
contains the n interpolated results.
Val1, Val2, ..., Val6
Additional input used in the operation. The meanings of
Val1 through Val6 vary depending on the specified matrix
operation. See the description of Oper for details.
"""
command = f"*MOPER,{parr},{par1},{oper},{val1},{val2},{val3},{val4},{val5},{val6}"
return self.run(command, **kwargs)
def mwrite(self, parr="", fname="", ext="", label="", n1="", n2="", n3="",
**kwargs):
"""Writes a matrix to a file in a formatted sequence.
APDL Command: *MWRITE
Parameters
----------
parr
The name of the array parameter. See *SET for name restrictions.
fname
File name and directory path (248 characters maximum, including the
characters needed for the directory path). An unspecified
directory path defaults to the working directory; in this case, you
can use all 248 characters for the file name.
ext
Filename extension (eight-character maximum).
label
Can use a value of IJK, IKJ, JIK, JKI, KIJ, KJI, or blank (JIK).
n1, n2, n3
Write as (((ParR(i,j,k), k = 1,n1), i = 1, n2), j = 1, n3) for
Label = KIJ. n1, n2, and n3 default to the corresponding dimensions
of the array parameter ParR.
Notes
-----
Writes a matrix or vector to a specified file in a formatted sequence.
You can also use the *VWRITE command to write data to a specified file.
Both commands contain format descriptors on the line immediately
following the command. The format descriptors can be in either Fortran
or C format.
Fortran format descriptors are enclosed in parentheses. They must
immediately follow the *MWRITE command on a separate line of the same
input file. The word FORMAT should not be included. The format must
specify the number of fields to be written per line, the field width,
the placement of the decimal point, etc. There should be one field
descriptor for each data item written. The write operation uses the
available system FORTRAN FORMAT conventions (see your system FORTRAN
manual). Any standard FORTRAN real format (such as (4F6.0),
(E10.3,2X,D8.2), etc.) and character format (A) may be used. Integer
(I) and list-directed (*) descriptors may not be used. Text may be
included in the format as a quoted string. The FORTRAN descriptor must
be enclosed in parentheses and the format must not exceed 80 characters
(including parentheses).
The "C" format descriptors are used if the first character of the
format descriptor line is not a left parenthesis. "C" format
descriptors may be up to 80 characters long, consisting of text strings
and predefined "data descriptors" between the strings where numeric or
alphanumeric character data are to be inserted. The normal descriptors
are %I for integer data, %G for double precision data, %C for
alphanumeric character data, and %/ for a line break. There must be one
data descriptor for each specified value in the order of the specified
values. The enhanced formats described in *MSG may also be used.
The starting array element number must be defined. Looping continues in
the directions indicated by the Label argument. The number of loops and
loop skipping may also be controlled with the *VLEN and *VMASK
commands, which work in the n2 direction (by row on the output file),
and by the *VCOL command, which works in the n1 direction (by column
in the output file). The vector specifications *VABS and *VFACT apply
to this command, while *VCUM does not apply to this command. See the
*VOPER command for details. If you are in the GUI, the *MWRITE command
must be contained in an externally prepared file and read into ANSYS
(i.e., *USE, /INPUT, etc.).
This command is valid in any processor.
"""
command = f"*MWRITE,{parr},{fname},{ext},,{label},{n1},{n2},{n3}"
return self.run(command, **kwargs)
def starvput(self, parr="", entity="", entnum="", item1="", it1num="",
item2="", it2num="", kloop="", **kwargs):
"""Restores array parameter values into the ANSYS database.
APDL Command: *VPUT
Parameters
----------
parr
The name of the input vector array parameter. See *SET for name
restrictions. The parameter must exist as a dimensioned array
[*DIM] with data input.
entity
Entity keyword. Valid keywords are shown for Entity = in the table
below.
entnum
The number of the entity (as shown for ENTNUM= in the table below).
item1
The name of a particular item for the given entity. Valid items
are as shown in the Item1 columns of the table below.
it1num
The number (or label) for the specified Item1 (if any). Valid
IT1NUM values are as shown in the IT1NUM columns of the table
below. Some Item1 labels do not require an IT1NUM value.
item2, it2num
A second set of item labels and numbers to further qualify the item
for which data is to be stored. Most items do not require this
level of information.
kloop
Field to be looped on:
Loop on the ENTNUM field (default). - Loop on the Item1 field.
Loop on the IT1NUM field. Successive items are as shown with IT1NUM. - Loop on the Item2 field.
Notes
-----
The *VPUT command is not supported for PowerGraphics displays.
Inconsistent results may be obtained if this command is not used in
/GRAPHICS, FULL.
Plot and print operations entered via the GUI (Utility Menu> Pltcrtls,
Utility Menu> Plot) incorporate the AVPRIN command. This means that the
principal and equivalent values are recalculated. If you use *VPUT to
put data back into the database, issue the plot commands from the
command line to preserve your data.
This operation is basically the inverse of the *VGET operation. Vector
items are put directly (without any coordinate system transformation)
into the ANSYS database. Items can only replace existing items of the
database and not create new items. Degree of freedom results that are
replaced in the database are available for all subsequent
postprocessing operations. Other results are changed temporarily and
are available mainly for the immediately following print and display
operations. The vector specification *VCUM does not apply to this
command. The valid labels for the location fields (Entity, ENTNUM,
Item1, and IT1NUM) are listed below. Item2 and IT2NUM are not
currently used. Not all items from the *VGET list are allowed on *VPUT
since putting values into some locations could cause the database to be
inconsistent.
This command is valid in any processor.
Table: 250:: : *VPUT - POST1 Items
X, Y, or Z fluid velocity. X, Y, or Z nodal velocity in a transient
structural analysis (LS-DYNA analysis or analysis with ANTYPE,TRANS).
X, Y, or Z magnetic vector potential. X, Y, or Z nodal acceleration in
a transient structural analysis (LS-DYNA analysis or analysis with
ANTYPE,TRANS).
"""
command = f"*VPUT,{parr},{entity},{entnum},{item1},{it1num},{item2},{it2num},{kloop}"
return self.run(command, **kwargs)
def sread(self, strarray="", fname="", ext="", nchar="", nskip="",
nread="", **kwargs):
"""Reads a file into a string array parameter.
APDL Command: *SREAD
Parameters
----------
strarray
Name of the "string array" parameter which will hold the read file.
String array parameters are similar to character arrays, but each
array element can be as long as 128 characters. If the string
parameter does not exist, it will be created. The array will be
created as: *DIM,StrArray,STRING,nChar,nRead
fname
File name and directory path (248 characters maximum, including the
characters needed for the directory path). An unspecified
directory path defaults to the working directory; in this case, you
can use all 248 characters for the file name.
ext
Filename extension (eight-character maximum).
nchar
Number of characters per line to read (default is length of the
longest line in the file).
nskip
Number of lines to skip at the start of the file (default is 0).
nread
Number of lines to read from the file (default is the entire file).
Notes
-----
The *SREAD command reads from a file into a string array
parameter. The file must be an ASCII text file.
"""
command = f"*SREAD,{strarray},{fname},{ext},,{nchar},{nskip},{nread}"
return self.run(command, **kwargs)
def toper(self, parr="", par1="", oper="", par2="", fact1="", fact2="",
con1="", **kwargs):
"""Operates on table parameters.
APDL Command: *TOPER
Parameters
----------
parr
Name of the resulting table parameter. The command will create a
table array parameter with this name. Any existing parameter with
this name will be overwritten.
par1
Name of the first table parameter.
oper
The operation to be performed: ADD. The operation is: ParR(i,j,k)
= FACT1*Par1(i,j,k) + FACT2 *Par2(i,j,k) +CON1
par2
Name of the second table parameter.
fact1
The first table parameter multiplying constant. Defaults to 1.
fact2
The second table parameter multiplying constant. Defaults to 1.
con1
The constant increment for offset. Defaults to 0.
Notes
-----
*TOPER operates on table parameters according to: ParR(i,j,k) =
FACT1*Par1(i,j,k) + FACT2 *Par2(i,j,k) +CON1
Par1 and Par2 must have the same dimensions and the same variable names
corresponding to those dimensions. Par1 and Par2 must also have
identical index values for rows, columns, etc.
If you want a local coordinate system for the resulting array, you must
dimension it as such using the *DIM command before issuing *TOPER.
This command is valid in any processor.
"""
command = f"*TOPER,{parr},{par1},{oper},{par2},{fact1},{fact2},{con1}"
return self.run(command, **kwargs)
def vabs(self, kabsr="", kabs1="", kabs2="", kabs3="", **kwargs):
"""Applies the absolute value function to array parameters.
APDL Command: *VABS
Parameters
----------
kabsr
Absolute value of results parameter:
Do not take absolute value of results parameter (ParR). - Take absolute value.
kabs1
Absolute value of first parameter:
Do not take absolute value of first parameter (Par1 or ParI). - Take absolute value.
kabs2
Absolute value of second parameter:
Do not take absolute value of second parameter (Par2 or ParJ). - Take absolute value.
kabs3
Absolute value of third parameter:
Do not take absolute value of third parameter (Par3 or ParK). - Take absolute value.
Notes
-----
Applies an absolute value to parameters used in certain *VXX and *MXX
operations. Typical absolute value applications are of the form:
ParR = |f(|Par1|)|
or
ParR = |(|Par1| o |Par2|)|
The absolute values are applied to each input parameter value before
the operation and to the result value after the operation. Absolute
values are applied before the scale factors so that negative scale
factors may be used. The absolute value settings are reset to the
default (no absolute value) after each *VXX or *MXX operation. Use
*VSTAT to list settings.
This command is valid in any processor.
"""
command = f"*VABS,{kabsr},{kabs1},{kabs2},{kabs3}"
return self.run(command, **kwargs)
def vcol(self, ncol1="", ncol2="", **kwargs):
"""Specifies the number of columns in matrix operations.
APDL Command: *VCOL
Parameters
----------
ncol1
Number of columns to be used for Par1 with *MXX operations.
Defaults to whatever is needed to fill the result array.
ncol2
Number of columns to be used for Par2 with *MXX operations.
Defaults to whatever is needed to fill the result array.
Notes
-----
Specifies the number of columns to be used in array parameter matrix
operations. The size of the submatrix used is determined from the
upper left starting array element (defined on the operation command) to
the lower right array element (defined by the number of columns on this
command and the number of rows on the *VLEN command).
The default NCOL is calculated from the maximum number of columns of
the result array (the *DIM column dimension) minus the starting
location + 1. For example, *DIM,R,,1,10 and a starting location of
R(1,7) gives a default of 4 columns ( starting with R(1,7), R(1,8),
R(1,9), and R(1,10)). Repeat operations automatically terminate at the
last column of the result array. Existing values in the rows and
columns of the results matrix remain unchanged where not overwritten by
the requested input or operation values.
The column control settings are reset to the defaults after each *MXX
operation. Use *VSTAT to list settings.
This command is valid in any processor.
"""
command = f"*VCOL,{ncol1},{ncol2}"
return self.run(command, **kwargs)
def vcum(self, key="", **kwargs):
"""Allows array parameter results to add to existing results.
APDL Command: *VCUM
Parameters
----------
key
Accumulation key:
Overwrite results. - Add results to the current value of the results parameter.
Notes
-----
Allows results from certain *VXX and *MXX operations to overwrite or
add to existing results. The cumulative operation is of the form:
ParR = ParR + ParR(Previous)
The cumulative setting is reset to the default (overwrite) after each
*VXX or *MXX operation. Use *VSTAT to list settings.
This command is valid in any processor.
"""
command = f"*VCUM,{key}"
return self.run(command, **kwargs)
def vfact(self, factr="", fact1="", fact2="", fact3="", **kwargs):
"""Applies a scale factor to array parameters.
APDL Command: *VFACT
Parameters
----------
factr
Scale factor applied to results (ParR) parameter. Defaults to 1.0.
fact1
Scale factor applied to first parameter (Par1 or ParI). Defaults
to 1.0.
fact2
Scale factor applied to second parameter (Par2 or ParJ). Defaults
to 1.0.
fact3
Scale factor applied to third parameter (Par3 or ParK). Defaults
to 1.0.
Notes
-----
Applies a scale factor to parameters used in certain *VXX and *MXX
operations. Typical scale factor applications are of the form:
ParR = FACTR*f(FACT1*Par1)
or
ParR = FACTR*((FACT1*Par1) o (FACT2*Par2))
The factors are applied to each input parameter value before the
operation and to the result value after the operation. The scale
factor settings are reset to the default (1.0) after each *VXX or *MXX
operation. Use *VSTAT to list settings.
This command is valid in any processor.
"""
command = f"*VFACT,{factr},{fact1},{fact2},{fact3}"
return self.run(command, **kwargs)
def vfun(self, parr="", func="", par1="", con1="", con2="", con3="",
**kwargs):
"""Performs a function on a single array parameter.
APDL Command: *VFUN
Parameters
----------
parr
The name of the resulting numeric array parameter vector. See *SET
for name restrictions.
func
Function to be performed:
Arccosine: ACOS(Par1). - Arcsine: ASIN(Par1).
Par1 is sorted in ascending order. *VCOL, *VMASK, *VCUM, and *VLEN,,NINC do not apply. *VLEN,NROW does apply. - Arctangent: ATAN(Par1).
Compress: Selectively compresses data set. "True" (*VMASK) values of Par1 (or row positions to be considered according to the NINC value on the *VLEN command) are written in compressed form to ParR, starting at the specified position. - Copy: Par1 copied to ParR.
Cosine: COS(Par1). - Hyperbolic cosine: COSH(Par1).
Direction cosines of the principal stresses (nX9). Par1 contains the nX6 component stresses for the n locations of the calculations. - Par1 is sorted in descending order. *VCOL, *VMASK, *VCUM, and *VLEN,,NINC do
not apply. *VLEN,NROW does apply.
Euler angles of the principal stresses (nX3). Par1 contains the nX6 component stresses for the n locations of the calculations. - Exponential: EXP(Par1).
Expand: Reverse of the COMP function. All elements of Par1 (starting at the position specified) are written in expanded form to corresponding "true" (*VMASK) positions (or row positions to be considered according to the NINC value on the *VLEN command) of ParR. - Natural logarithm: LOG(Par1).
Common logarithm: LOG10(Par1). - Nearest integer: 2.783 becomes 3.0, -1.75 becomes -2.0.
Logical complement: values 0.0 (false) become 1.0 (true). Values > 0.0 (true) become 0.0 (false). - Principal stresses (nX5). Par1 contains the nX6 component stresses for the n
locations of the calculations.
Power function: Par1**CON1. Exponentiation of any negative number in the vector Par1 to a non-integer power is performed by exponentiating the positive number and prepending the minus sign. For example, -4**2.3 is -(4**2.3). - Sine: SIN(Par1).
Hyperbolic sine: SINH(Par1). - Square root: SQRT(Par1).
Tangent: TAN(Par1). - Hyperbolic tangent: TANH(Par1).
Tangent to a path at a point: the slope at a point is determined by linear interpolation half way between the previous and next points. Points are assumed to be in the global Cartesian coordinate system. Path points are specified in array Par1 (having 3 consecutive columns of data, with the columns containing the x, y, and z coordinate locations, respectively, of the points). Only the starting row index and the column index for the x coordinates are specified, such as A(1,1). The y and z coordinates of the vector are assumed to begin in the corresponding next columns, such as A(1,2) and A(1,3). The tangent result, ParR, must also have 3 consecutive columns of data and will contain the tangent direction vector (normalized to 1.0); such as 1,0,0 for an x-direction vector. - Normal to a path and an input vector at a point: determined from the cross-
product of the calculated tangent vector (see
TANG) and the input direction vector (with the i,
j, and k components input as CON1, CON2, and
CON3). Points are assumed to be in the global
Cartesian coordinate system. Path points are
specified in array Par1 (having 3 consecutive
columns of data, with the columns containing the
x, y, and z coordinate locations, respectively,
of the points). Only the starting row index and
the column index for the x coordinates are
specified, such as A(1,1). The y and z
coordinates of the vector are assumed to begin in
the corresponding next columns, such as A(1,2)
and A(1,3). The normal result, ParR, must also
have 3 consecutive columns of data and will
contain the normal direction vector (normalized
to 1.0); such as 1,0,0 for an x-direction vector.
Transforms global Cartesian coordinates of a point to the coordinates of a specified system: points to be transformed are specified in array Par1 (having 3 consecutive columns of data, with the columns containing the x, y, and z global Cartesian coordinate locations, respectively, of the points). Only the starting row index and the column index for the x coordinates are specified, such as A(1,1). The y and z coordinates of the vector are assumed to begin in the corresponding next columns, such as A(1,2) and A(1,3). Results are transformed to coordinate system CON1 (which may be any valid coordinate system number, such as 1,2,11,12, etc.). The transformed result, ParR, must also have 3 consecutive columns of data and will contain the corresponding transformed coordinate locations. - Transforms specified coordinates of a point to global Cartesian coordinates:
points to be transformed are specified in array
Par1 (having 3 consecutive columns of data, with
the columns containing the local coordinate
locations (x, y, z or r, θ, z or etc.) of the
points). Only the starting row index and the
column index for the x coordinates are specified,
such as A(1,1). The y and z coordinates (or θ
and z, or etc.) of the vector are assumed to
begin in the corresponding next columns, such as
A(1,2) and A(1,3). Local coordinate locations
are assumed to be in coordinate system CON1
(which may be any valid coordinate system number,
such as 1,2,11,12, etc.). The transformed
result, ParR, must also have 3 consecutive
columns of data, with the columns containing the
global Cartesian x, y, and z coordinate
locations, respectively.
par1
Array parameter vector in the operation.
con1, con2, con3
Constants (used only with the PWR, NORM, LOCAL, and GLOBAL
functions).
Notes
-----
Operates on one input array parameter vector and produces one output
array parameter vector according to:
ParR = f(Par1)
where the functions (f) are described below. Functions are based on
the standard FORTRAN definitions where possible. Out-of-range function
results (or results with exponents whose magnitudes are approximately
greater than 32 or less than -32) produce a zero value. Input and
output for angular functions may be radians (default) or degrees
[*AFUN]. ParR may be the same as Par1. Starting array element numbers
must be defined for each array parameter vector if it does not start at
the first location. For example, *VFUN,A,SQRT,B(5) takes the square
root of the fifth element of B and stores the result in the first
element of A. Operations continue on successive array elements [*VLEN,
*VMASK] with the default being all successive elements. Absolute
values and scale factors may be applied to all parameters [*VABS,
*VFACT]. Results may be cumulative [*VCUM]. Skipping array elements
via *VMASK or *VLEN for the TANG and NORM functions skips only the
writing of the results (skipped array element data are used in all
calculations). See the *VOPER command for detail s . / p >
p > T h i s c o m m a n d i s
v a l i d i n a n y p r o c e
s s o r . / p > / d i v > d i v c
l a s s = " r e f s e c t 1 " t i
t l e = " M e n u P a t h s " > a
n a m e = " d 0 e 2 9 2 8 5 8 " > /
a > h 2 > M e n u P a t h s / h 2
> t a b l e b o r d e r = " 0 "
s u m m a r y = " S i m p l e l i
s t " c l a s s = " s i m p l e l
i s t " > t r > t d > s p a n c l
a s s = " g u i m e n u " > s t r o
n g > U t i l i t y M e n u &g t ;
P a r a m e t e r s &g t ; A r r a y
O p e r a t i o n s &g t ; V e c t o
r F u n c t i o n s / s t r o n g
> / s p a n > / t d > / t r > / t a
b l e > / d i v > / d i v > h r > p
c l a s s = " l e g a l f o o t e r
" > s m a l l > i > R e l e a s e
1 6 . 2 - &c o p y ; S A S I
P , I n c . A l l r i g h t s
r e s e r v e d . / i > / s m a l l
> / p > / b o d y > / h t m l >
"""
command = f"*VFUN,{parr},{func},{par1},{con1},{con2},{con3}"
return self.run(command, **kwargs)
def vitrp(self, parr="", part="", pari="", parj="", park="", **kwargs):
"""Forms an array parameter by interpolation of a table.
APDL Command: *VITRP
Parameters
----------
parr
The name of the resulting array parameter. See *SET for name
restrictions.
part
The name of the TABLE array parameter. The parameter must exist as
a dimensioned array of type TABLE [*DIM].
pari
Array parameter vector of I (row) index values for interpolation in
ParT.
parj
Array parameter vector of J (column) index values for interpolation
in ParT (which must be at least 2-D).
park
Array parameter vector of K (depth) index values for interpolation
in ParT (which must be 3-D).
Notes
-----
Forms an array parameter (of type ARRAY) by interpolating values of an
array parameter (of type TABLE) at specified table index locations
according to:
ParR = f(ParT, Parl, ParJ, ParK)
where ParT is the type TABLE array parameter, and ParI, ParJ, ParK are
the type ARRAY array parameter vectors of index values for
interpolation in ParT. See the *DIM command for TABLE and ARRAY
declaration types. Linear interpolation is used. The starting array
element number for the TABLE array (ParT) is not used (but a value must
be input). Starting array element numbers must be defined for each
array parameter vector if it does not start at the first location. For
example, *VITRP,R(5),TAB(1,1),X(2),Y(4) uses the second element of X
and the fourth element of Y as index values (row and column) for a 2-D
interpolation in TAB and stores the result in the fifth element of R.
Operations continue on successive array elements [*VLEN, *VMASK] with
the default being all successive elements. Absolute values and scale
factors may be applied to the result parameter [*VABS, *VFACT].
Results may be cumulative [*VCUM]. See the *VOPER command for details.
This command is valid in any processor.
"""
command = f"*VITRP,{parr},{part},{pari},{parj},{park}"
return self.run(command, **kwargs)
def vlen(self, nrow="", ninc="", **kwargs):
"""Specifies the number of rows to be used in array parameter operations.
APDL Command: *VLEN
Parameters
----------
nrow
Number of rows to be used with the *VXX or *MXX operations.
Defaults to the number of rows needed to fill the result array.
ninc
Perform the operation on every NINC row (defaults to 1).
Notes
-----
Specifies the number of rows to be used in array parameter operations.
The size of the submatrix used is determined from the upper left
starting array element (defined on the operation command) to the lower
right array element (defined by the number of rows on this command and
the number of columns on the *VCOL command). NINC allows skipping row
operations for some operation commands. Skipped rows are included in
the row count. The starting row number must be defined on the
operation command for each parameter read and for the result written.
The default NROW is calculated from the maximum number of rows of the
result array (the *DIM row dimension) minus the starting location + 1.
For example, *DIM,R,,10 and a starting location of R(7) gives a default
of 4 loops (filling R(7), R(8), R(9), and R(10)). Repeat operations
automatically terminate at the last row of the result array. Existing
values in the rows and columns of the results matrix remain unchanged
where not overwritten by the requested input or operation values.
The stride (NINC) allows operations to be performed at regular
intervals. It has no effect on the total number of row operations.
Skipped operations retain the previous result. For example, *DIM,R,,6,
with a starting location of R(1), NROW = 10, and NINC = 2 calculates
values for locations R(1), R(3), and R(5) and retains values for
locations R(2), R(4), and R(6). A more general skip control may be
done by masking [*VMASK]. The row control settings are reset to the
defaults after each *VXX or *MXX operation. Use *VSTAT to list
settings.
This command is valid in any processor.
"""
command = f"*VLEN,{nrow},{ninc}"
return self.run(command, **kwargs)
def vmask(self, par="", **kwargs):
"""Specifies an array parameter as a masking vector.
APDL Command: *VMASK
Parameters
----------
par
Name of the mask parameter. The starting subscript must also be
specified.
Notes
-----
Specifies the name of the parameter whose values are to be checked for
each resulting row operation. The mask vector usually contains only 0
(for false) and 1 (for true) values. For each row operation the
corresponding mask vector value is checked. A true value allows the
operation to be done. A false value skips the operation (and retains
the previous results). A mask vector can be created from direct input,
such as M(1) = 1,0,0,1,1,0,1; or from the DATA function of the *VFILL
command. The NOT function of the *VFUN command can be used to reverse
the logical sense of the mask vector. The logical compare operations
(LT, LE, EQ, NE, GE, and GT) of the *VOPER command also produce a mask
vector by operating on two other vectors. Any numeric vector can be
used as a mask vector since the actual interpretation assumes values
less than 0.0 are 0.0 (false) and values greater than 0.0 are 1.0
(true). If the mask vector is not specified (or has fewer values than
the result vector), true (1.0) values are assumed for the unspecified
values. Another skip control may be input with NINC on the *VLEN
command. If both are present, operations occur only when both are
true. The mask setting is reset to the default (no mask) after each
*VXX or *MXX operation. Use *VSTAT to list settings.
This command is valid in any processor.
"""
command = f"*VMASK,{par}"
return self.run(command, **kwargs)
def voper(self, parr="", par1="", oper="", par2="", con1="", con2="",
**kwargs):
"""Operates on two array parameters.
APDL Command: *VOPER
Parameters
----------
parr
The name of the resulting array parameter vector. See *SET for
name restrictions.
par1
First array parameter vector in the operation. May also be a
scalar parameter or a literal constant.
oper
Operations:
Addition: Par1+Par2. - Subtraction: Par1-Par2.
Multiplication: Par1*Par2. - Division: Par1/Par2 (a divide by zero results in a value of zero).
Minimum: minimum of Par1 and Par2. - Maximum: maximum of Par1 and Par2.
Less than comparison: Par1<Par2 gives 1.0 if true, 0.0 if false. - Less than or equal comparison: Par1 Par2 gives 1.0 if true, 0.0 if false.
Equal comparison: Par1 = Par2 gives 1.0 if true, 0.0 if false. - Not equal comparison: Par1 ≠ Par2 gives 1.0 if true, 0.0 if false.
Greater than or equal comparison: Par1 Par2 gives 1.0 if true, 0.0 if false. - Greater than comparison: Par1>Par2 gives 1.0 if true, 0.0 if false.
First derivative: d(Par1)/d(Par2). The derivative at a point is determined over points half way between the previous and next points (by linear interpolation). Par1 must be a function (a unique Par1 value for each Par2 value) and Par2 must be in ascending order. - Second derivative: d2(Par1)/d(Par2)2. See also DER1.
Single integral: Par1 d(Par2), where CON1 is the integration constant. The integral at a point is determined by using the single integration procedure described in the Mechanical APDL Theory Reference. - Double integral: Par1 d(Par2), where CON1 is the integration constant of
the first integral and CON2 is the integration
constant of the second integral. If Par1
contains acceleration data, CON1 is the initial
velocity and CON2 is the initial displacement.
See also INT1.
Dot product: Par1 . Par2. Par1 and Par2 must each have three consecutive columns of data, with the columns containing the i, j, and k vector components, respectively. Only the starting row index and the column index for the i components are specified for Par1 and Par2, such as A(1,1). The j and k components of the vector are assumed to begin in the corresponding next columns, such as A(1,2) and A(1,3). - Cross product: Par1 x Par2. Par1, Par2, and ParR must each have 3 components,
respectively. Only the starting row index and
the column index for the i components are
specified for Par1, Par2, and ParR, such as
A(1,1). The j and k components of the vector are
assumed to begin in the corresponding next
columns, such as A(1,2) and A(1,3).
Gather: For a vector of position numbers, Par2, copy the value of Par1 at each position number to ParR. Example: for Par1 = 10,20,30,40 and Par2 = 2,4,1; ParR = 20,40,10. - Scatter: Opposite of GATH operation. For a vector of position numbers, Par2,
copy the value of Par1 to that position number in
ParR. Example: for Par1 = 10,20,30,40,50 and
Par2 = 2,1,0,5,3; ParR = 20,10,50,0,40.
Arctangent: arctangent of Par1/Par2 with the sign of each component considered. - Transform the data in Par1 from the global Cartesian coordinate system to the
local coordinate system given in CON1. Par1 must
be an N x 3 (i.e., vector) or an N x 6 (i.e.,
stress or strain tensor) array. If the local
coordinate system is a cylindrical, spherical, or
toroidal system, then you must provide the global
Cartesian coordinates in Par2 as an N x 3 array.
Set CON2 = 1 if the data is strain data.
par2
Second array parameter vector in the operation. May also be a
scalar parameter or a literal constant.
con1
First constant (used only with the INT1 and INT2 operations).
con2
Second constant (used only with the INT2 operation).
Notes
-----
Operates on two input array parameter vectors and produces one output
array parameter vector according to:
ParR = Par1 o Par2
where the operations (o) are described below. ParR may be the same as
Par1 or Par2. Absolute values and scale factors may be applied to all
parameters [*VABS, *VFACT]. Results may be cumulative [*VCUM].
Starting array element numbers must be defined for each array parameter
vector if it does not start at the first location, such as
*VOPER,A,B(5),ADD,C(3) which adds the third element of C to the fifth
element of B and stores the result in the first element of A.
Operations continue on successive array elements [*VLEN, *VMASK] with
the default being all successive elements. Skipping array elements via
*VMASK or *VLEN for the DER_ and INT_ functions skips only the writing
of the results (skipped array element data are used in all
calculations).
Parameter functions and operations are available to operate on a scalar
parameter or a single element of an array parameter, such as SQRT(B) or
SQRT(A(4)). See the *SET command for details. Operations on a
sequence of array elements can be done by repeating the desired
function or operation in a do-loop [*DO]. The vector operations within
the ANSYS program (*VXX commands) are internally programmed do-loops
that conveniently perform the indicated operation over a sequence of
array elements. If the array is multidimensional, only the first
subscript is incremented in the do-loop, that is, the operation repeats
in column vector fashion "down" the array. For example, for A(1,5),
A(2,5), A(3,5), etc. The starting location of the row index must be
defined for each parameter read and for the result written.
The default number of loops is from the starting result location to the
last result location and can be altered with the *VLEN command. A
logical mask vector may be defined to control at which locations the
operations are to be skipped [*VMASK]. The default is to skip no
locations. Repeat operations automatically terminate at the last array
element of the result array column if the number of loops is undefined
or if it exceeds the last result array element. Zeroes are used in
operations for values read beyond the last array element of an input
array column. Existing values in the rows and columns of the results
matrix
"""
command = f"*VOPER,{parr},{par1},{oper},{par2},{con1},{con2}"
return self.run(command, **kwargs)
def vscfun(self, parr="", func="", par1="", **kwargs):
"""Determines properties of an array parameter.
APDL Command: *VSCFUN
Parameters
----------
parr
The name of the resulting scalar parameter. See *SET for name
restrictions.
func
Functions:
Maximum: the maximum Par1 array element value. - Minimum: the minimum Par1 array element value.
Index location of the maximum Par1 array element value. Array Par1 is searched starting from its specified index. - Index location of the minimum Par1 array element value. Array Par1 is searched
starting from its specified index.
Index location of the first nonzero value in array Par1. Array Par1 is searched starting from its specified index. - Index location of the last nonzero value in array Par1. Array Par1 is searched
starting from its specified index.
Sum: Par1 (the summation of the Par1 array element values). - Median: value of Par1 at which there are an equal number of values above and
below.
Mean: (σ Par1)/NUM, where NUM is the number of summed values. - Variance: (σ ((Par1-MEAN)**2))/NUM.
Standard deviation: square root of VARI. - Root-mean-square: square root of (σ (Par1**2))/NUM.
par1
Array parameter vector in the operation.
Notes
-----
Operates on one input array parameter vector and produces one output
scalar parameter according to:
ParR = f(Par1)
where the functions (f) are described below. The starting array element
number must be defined for the array parameter vector. For example,
*VSCFUN,MU,MEAN,A(1) finds the mean of the A vector values, starting
from the first value and stores the result as parameter MU. Operations
use successive array elements [*VLEN, *VMASK] with the default being
all successive array elements. Absolute values and scale factors may
be applied to all parameters [*VABS, *VFACT]. Results may be
cumulative [*VCUM]. See the *VOPER command for details.
This command is valid in any processor.
"""
command = f"*VSCFUN,{parr},{func},{par1}"
return self.run(command, **kwargs)
def vstat(self, **kwargs):
"""Lists the current specifications for the array parameters.
APDL Command: *VSTAT
Notes
-----
Lists the current specifications for the *VABS, *VCOL, *VCUM, *VFACT,
*VLEN, and *VMASK commands.
This command is valid in any processor.
"""
command = f"*VSTAT,"
return self.run(command, **kwargs)
def vwrite(self, par1="", par2="", par3="", par4="", par5="", par6="",
par7="", par8="", par9="", par10="", par11="", par12="",
par13="", par14="", par15="", par16="", par17="", par18="",
par19="", **kwargs):
"""Writes data to a file in a formatted sequence.
APDL Command: *VWRITE
Parameters
----------
par1, par2, par3, . . . , par19
You can write up to 19 parameters (or constants) at a time. Any Par
values after a blank Par value are ignored. If you leave them all
blank, one line will be written (to write a title or a blank line).
If you input the keyword SEQU, a sequence of numbers (starting from
1) will be written for that item.
Notes
-----
You use *VWRITE to write data to a file in a formatted sequence. Data
items (Par1, Par2, etc.) may be array parameters, scalar parameters,
character parameters (scalar or array), or constants. You must
evaluate expressions and functions in the data item fields before using
the *VWRITE command, since initially they will be evaluated to a
constant and remain constant throughout the operation. Unless a file
is defined with the *CFOPEN command, data is written to the standard
output file. Data written to the standard output file may be diverted
to a different file by first switching the current output file with the
/OUTPUT command. You can also use the *MWRITE command to write data to
a specified file. Both commands contain format descriptors on the line
immediately following the command. The format descriptors can be in
either Fortran or C format.
You must enclose Fortran format descriptors in parentheses. They must
immediately follow the *VWRITE command on a separate line of the same
input file. Do not include the word FORMAT. The format must specify
the number of fields to be written per line, the field width, the
placement of the decimal point, etc. You should use one field
descriptor for each data item written. The write operation uses your
system's available FORTRAN FORMAT conventions (see your system FORTRAN
manual). You can use any standard FORTRAN real format (such as
(4F6.0), (E10.3,2X,D8.2), etc.) and alphanumeric format (A).
Alphanumeric strings are limited to a maximum of 8 characters for any
field (A8) using the Fortran format. Use the "C" format for string
arrays larger than 8 characters. Integer (I) and list-directed (*)
descriptors may not be used. You can include text in the format as a
quoted string. The parentheses must be included in the format and the
format must not exceed 80 characters (including parentheses). The
output line length is limited to 128 characters.
The "C" format descriptors are used if the first character of the
format descriptor line is not a left parenthesis. "C" format
descriptors are up to 80 characters long, consisting of text strings
and predefined "data descriptors" between the strings where numeric or
alphanumeric character data will be inserted. The normal descriptors
are %I for integer data, %G for double precision data, %C for
alphanumeric character data, and %/ for a line break. There must be one
data descriptor for each specified value (8 maximum) in the order of
the specified values. The enhanced formats described in *MSG may also
be used.
For array parameter items, you must define the starting array element
number. Looping continues (incrementing the vector index number of each
array parameter by one) each time you output a line, until the maximum
array vector element is written. For example, *VWRITE,A(1) followed by
(F6.0) will write one value per output line, i.e., A(1), A(2), A(3),
A(4), etc. You write constants and scalar parameters with the same
values for each loop. You can also control the number of loops and
loop skipping with the *VLEN and *VMASK commands. The vector
specifications *VABS, *VFACT, and *VCUM do not apply to this command.
If looping continues beyond the supplied data array's length, zeros
will be output for numeric array parameters and blanks for character
array parameters. For multi-dimensioned array parameters, only the
first (row) subscript is incremented. See the *VOPER command for
details. If you are in the GUI, the *VWRITE command must be contained
in an externally prepared file and read into ANSYS (i.e., *USE, /INPUT,
etc.).
This command is valid in any processor.
"""
# cannot be in interactive mode
if not self._store_commands:
raise RuntimeError('VWRTIE cannot run interactively. \n\nPlease use '
'``with mapdl.non_interactive:``')
command = f"*VWRITE,{par1},{par2},{par3},{par4},{par5},{par6},{par7},{par8},{par9},{par10},{par11},{par12},{par13},{par14},{par15},{par16},{par17},{par18},{par19}"
return self.run(command, **kwargs)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.