content
stringlengths 7
1.05M
|
---|
"""
* Assignment: Type Float Altitude
* Required: yes
* Complexity: easy
* Lines of code: 3 lines
* Time: 3 min
English:
1. Plane altitude is 10.000 ft
2. Data uses imperial (US) system
3. Convert to metric (SI) system
4. Result round to one decimal place
5. Run doctests - all must succeed
Polish:
1. Wysokość lotu samolotem wynosi 10 000 ft
2. Dane używają systemu imperialnego (US)
3. Przelicz je na system metryczny (układ SI)
4. Wynik zaokrąglij do jednego miejsca po przecinku
5. Uruchom doctesty - wszystkie muszą się powieść
Tests:
>>> import sys; sys.tracebacklimit = 0
>>> assert altitude is not Ellipsis, \
'Assign result to variable: `altitude`'
>>> assert altitude_m is not Ellipsis, \
'Assign result to variable: `altitude_m`'
>>> assert altitude_ft is not Ellipsis, \
'Assign result to variable: `altitude_ft`'
>>> assert type(altitude) is float, \
'Variable `altitude` has invalid type, should be float'
>>> assert type(altitude_m) is float, \
'Variable `altitude_m` has invalid type, should be float'
>>> assert type(altitude_ft) is float, \
'Variable `altitude_ft` has invalid type, should be float'
>>> altitude
3048.0
>>> altitude_m
3048.0
>>> altitude_ft
10000.0
"""
m = 1
ft = 0.3048 * m
# float: 10_000 ft
altitude = ...
# float: altitude in meters
altitude_m = ...
# float: altitude in feet
altitude_ft = ...
|
headers = 'id,text,filename__v,format__v,size__v,charsize,pages__v'
id_ = '31011'
text = """Investigational Product Accountability Log
"""
filename__v = 'foo.docx'
format__v = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
size__v = '16290'
charsize = '768'
pages__v = '1'
row = ','.join([id_, repr(text), filename__v, format__v, size__v, charsize, pages__v])
PAYLOAD = headers + '\n' + row |
N = int(input())
h = N // 3600 % 24
min = N % 3600 // 60
sec = N % 60
print(h, '%02d' % (min), '%02d' % (sec), sep=':')
|
"""
Implementation of an edge, as used in graphs
"""
################################################################################
# #
# Undirected #
# #
################################################################################
class UndirectedEdge(object):
def __init__(self, vertices, attrs=None):
self._vertices = frozenset(vertices)
self._attrs = attrs or {}
self._is_self_edge = vertices[0] == vertices[1]
def __repr__(self):
vertices = (tuple(self._vertices) if not self._is_self_edge else
tuple(self._vertices) * 2)
return "Edge(%s, %s)" % (vertices[0], vertices[1])
def __str__(self):
vertices = (tuple(self._vertices) if not self._is_self_edge else
tuple(self._vertices) * 2)
return "E(%s, %s)" % (str(vertices[0]), str(vertices[1]))
def __eq__(self, other):
return self._vertices == other.vertices
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return hash(self._vertices)
@property
def vertices(self):
return self._vertices
@property
def attrs(self):
return self._attrs
@property
def is_self_edge(self):
return self._is_self_edge
def get(self, attr):
""" Get an attribute """
return self._attrs.get(attr)
def set(self, attr, value):
""" Set an attribute """
self._attrs[attr] = value
def has_attr(self, attr):
""" Check if an attribute exists """
return attr in self._attrs
def del_attr(self, attr):
""" Delete an attribute """
del self._attrs[attr]
################################################################################
# #
# Directed #
# #
################################################################################
class DirectedEdge(object):
def __init__(self, vertices, attrs=None):
self._v_from = vertices[0]
self._v_to = vertices[1]
self._attrs = attrs or {}
def __repr__(self):
return "Edge(%s, %s)" % (self._v_from, self._v_to)
def __str__(self):
return "E(%s, %s)" % (str(self._v_from), str(self._v_to))
def __eq__(self, other):
return (self._v_from, self._v_to) == (other.v_from, other.v_to)
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return hash((self._v_from, self._v_to))
@property
def v_from(self):
return self._v_from
@property
def v_to(self):
return self._v_to
@property
def attrs(self):
return self._attrs
def get(self, attr):
""" Get an attribute """
return self._attrs.get(attr)
def set(self, attr, value):
""" Set an attribute """
self._attrs[attr] = value
def has_attr(self, attr):
""" Check if an attribute exists """
return attr in self._attrs
def del_attr(self, attr):
""" Delete an attribute """
del self._attrs[attr]
|
#
# PySNMP MIB module CTRON-SFPS-PATH-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SFPS-PATH-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:31:03 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")
ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection")
sfpsPathAPI, sfpsSwitchPathStats, sfpsStaticPath, sfpsPathMaskObj, sfpsChassisRIPPath, sfpsSwitchPathAPI, sfpsSwitchPath, sfpsISPSwitchPath = mibBuilder.importSymbols("CTRON-SFPS-INCLUDE-MIB", "sfpsPathAPI", "sfpsSwitchPathStats", "sfpsStaticPath", "sfpsPathMaskObj", "sfpsChassisRIPPath", "sfpsSwitchPathAPI", "sfpsSwitchPath", "sfpsISPSwitchPath")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Integer32, iso, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, TimeTicks, Bits, Unsigned32, ModuleIdentity, Gauge32, MibIdentifier, IpAddress, ObjectIdentity, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "iso", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "TimeTicks", "Bits", "Unsigned32", "ModuleIdentity", "Gauge32", "MibIdentifier", "IpAddress", "ObjectIdentity", "Counter32")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
class SfpsAddress(OctetString):
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(6, 6)
fixedLength = 6
class HexInteger(Integer32):
pass
sfpsServiceCenterPathTable = MibTable((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1), )
if mibBuilder.loadTexts: sfpsServiceCenterPathTable.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathTable.setDescription('This table gives path semantics to call processing.')
sfpsServiceCenterPathEntry = MibTableRow((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1), ).setIndexNames((0, "CTRON-SFPS-PATH-MIB", "sfpsServiceCenterPathHashLeaf"))
if mibBuilder.loadTexts: sfpsServiceCenterPathEntry.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathEntry.setDescription('Each entry contains the configuration of the Path Entry.')
sfpsServiceCenterPathHashLeaf = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 1), HexInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathHashLeaf.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathHashLeaf.setDescription('Server hash, part of instance key.')
sfpsServiceCenterPathMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathMetric.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathMetric.setDescription('Defines order servers are called low to high.')
sfpsServiceCenterPathName = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathName.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathName.setDescription('Server name.')
sfpsServiceCenterPathOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("kStatusRunning", 1), ("kStatusHalted", 2), ("kStatusPending", 3), ("kStatusFaulted", 4), ("kStatusNotStarted", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathOperStatus.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathOperStatus.setDescription('Operational state of entry.')
sfpsServiceCenterPathAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disable", 2), ("enable", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsServiceCenterPathAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathAdminStatus.setDescription('Administrative State of Entry.')
sfpsServiceCenterPathStatusTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 6), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathStatusTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathStatusTime.setDescription('Time Tick of last operStatus change.')
sfpsServiceCenterPathRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathRequests.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathRequests.setDescription('Requests made to server.')
sfpsServiceCenterPathResponses = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathResponses.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathResponses.setDescription('GOOD replies by server.')
sfpsPathAPIVerb = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("other", 1), ("add", 2), ("delete", 3), ("uplink", 4), ("downlink", 5), ("diameter", 6), ("flood-add", 7), ("flood-delete", 8), ("force-idle-traffic", 9), ("remove-traffic-cnx", 10)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIVerb.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIVerb.setDescription('')
sfpsPathAPISwitchMac = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 2), SfpsAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPISwitchMac.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPISwitchMac.setDescription('')
sfpsPathAPIPortName = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIPortName.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIPortName.setDescription('')
sfpsPathAPICost = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPICost.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPICost.setDescription('')
sfpsPathAPIHop = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 5), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIHop.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIHop.setDescription('')
sfpsPathAPIID = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 6), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIID.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIID.setDescription('')
sfpsPathAPIInPort = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 7), SfpsAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIInPort.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIInPort.setDescription('')
sfpsPathAPISrcMac = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 8), SfpsAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPISrcMac.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPISrcMac.setDescription('')
sfpsPathAPIDstMac = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 9), SfpsAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIDstMac.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIDstMac.setDescription('')
sfpsStaticPathTable = MibTable((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1), )
if mibBuilder.loadTexts: sfpsStaticPathTable.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathTable.setDescription('')
sfpsStaticPathEntry = MibTableRow((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1), ).setIndexNames((0, "CTRON-SFPS-PATH-MIB", "sfpsStaticPathPort"))
if mibBuilder.loadTexts: sfpsStaticPathEntry.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathEntry.setDescription('')
sfpsStaticPathPort = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsStaticPathPort.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathPort.setDescription('')
sfpsStaticPathFloodEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3))).clone(namedValues=NamedValues(("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsStaticPathFloodEnabled.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathFloodEnabled.setDescription('')
sfpsStaticPathUplinkEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3))).clone(namedValues=NamedValues(("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsStaticPathUplinkEnabled.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathUplinkEnabled.setDescription('')
sfpsStaticPathDownlinkEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3))).clone(namedValues=NamedValues(("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsStaticPathDownlinkEnabled.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathDownlinkEnabled.setDescription('')
sfpsPathMaskObjLogPortMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjLogPortMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjLogPortMask.setDescription('')
sfpsPathMaskObjPhysPortMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjPhysPortMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPhysPortMask.setDescription('')
sfpsPathMaskObjLogResolveMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjLogResolveMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjLogResolveMask.setDescription('')
sfpsPathMaskObjLogFloodNoINB = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjLogFloodNoINB.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjLogFloodNoINB.setDescription('')
sfpsPathMaskObjPhysResolveMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjPhysResolveMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPhysResolveMask.setDescription('')
sfpsPathMaskObjPhysFloodNoINB = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjPhysFloodNoINB.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPhysFloodNoINB.setDescription('')
sfpsPathMaskObjOldLogPortMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjOldLogPortMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjOldLogPortMask.setDescription('')
sfpsPathMaskObjPathChangeEvent = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 8), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathMaskObjPathChangeEvent.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPathChangeEvent.setDescription('')
sfpsPathMaskObjPathChangeCounter = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjPathChangeCounter.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPathChangeCounter.setDescription('')
sfpsPathMaskObjLastChangeTime = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 10), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjLastChangeTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjLastChangeTime.setDescription('')
sfpsPathMaskObjPathCounterReset = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 11), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathMaskObjPathCounterReset.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPathCounterReset.setDescription('')
sfpsPathMaskObjIsolatedSwitchMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 12), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjIsolatedSwitchMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjIsolatedSwitchMask.setDescription('')
sfpsPathMaskObjPyhsIsolatedSwitchMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 13), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjPyhsIsolatedSwitchMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPyhsIsolatedSwitchMask.setDescription('')
sfpsPathMaskObjLogDownlinkMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 14), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjLogDownlinkMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjLogDownlinkMask.setDescription('')
sfpsPathMaskObjCoreUplinkMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 15), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjCoreUplinkMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjCoreUplinkMask.setDescription('')
sfpsPathMaskObjOverrideFloodMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("disable", 2), ("enable", 1)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjOverrideFloodMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjOverrideFloodMask.setDescription('')
sfpsSwitchPathStatsNumEntries = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsNumEntries.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsNumEntries.setDescription('')
sfpsSwitchPathStatsMaxEntries = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsMaxEntries.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsMaxEntries.setDescription('')
sfpsSwitchPathStatsTableSize = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsTableSize.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsTableSize.setDescription('')
sfpsSwitchPathStatsMemUsage = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsMemUsage.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsMemUsage.setDescription('')
sfpsSwitchPathStatsActiveLocal = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsActiveLocal.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsActiveLocal.setDescription('')
sfpsSwitchPathStatsActiveRemote = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsActiveRemote.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsActiveRemote.setDescription('')
sfpsSwitchPathStatsStaticRemote = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsStaticRemote.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsStaticRemote.setDescription('')
sfpsSwitchPathStatsDeadLocal = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsDeadLocal.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsDeadLocal.setDescription('')
sfpsSwitchPathStatsDeadRemote = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsDeadRemote.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsDeadRemote.setDescription('')
sfpsSwitchPathStatsReapReady = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapReady.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapReady.setDescription('')
sfpsSwitchPathStatsReapAt = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapAt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapAt.setDescription('')
sfpsSwitchPathStatsReapCount = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapCount.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapCount.setDescription('')
sfpsSwitchPathStatsPathReq = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathReq.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathReq.setDescription('')
sfpsSwitchPathStatsPathAck = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathAck.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathAck.setDescription('')
sfpsSwitchPathStatsPathNak = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 15), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathNak.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathNak.setDescription('')
sfpsSwitchPathStatsPathUnk = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 16), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathUnk.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathUnk.setDescription('')
sfpsSwitchPathStatsLocateReq = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 17), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateReq.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateReq.setDescription('')
sfpsSwitchPathStatsLocateAck = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 18), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateAck.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateAck.setDescription('')
sfpsSwitchPathStatsLocateNak = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 19), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateNak.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateNak.setDescription('')
sfpsSwitchPathStatsLocateUnk = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 20), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateUnk.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateUnk.setDescription('')
sfpsSwitchPathStatsSndDblBack = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 21), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsSndDblBack.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsSndDblBack.setDescription('')
sfpsSwitchPathStatsRcdDblBack = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 22), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsRcdDblBack.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsRcdDblBack.setDescription('')
sfpsSwitchPathAPIVerb = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("other", 1), ("addFind", 2), ("lose", 3), ("delete", 4), ("clearTable", 5), ("resetStats", 6), ("setReapAt", 7), ("setMaxRcvDblBck", 8)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsSwitchPathAPIVerb.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathAPIVerb.setDescription('')
sfpsSwitchPathAPIPort = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsSwitchPathAPIPort.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathAPIPort.setDescription('')
sfpsSwitchPathAPIBaseMAC = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 3), SfpsAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsSwitchPathAPIBaseMAC.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathAPIBaseMAC.setDescription('')
sfpsSwitchPathAPIReapAt = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsSwitchPathAPIReapAt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathAPIReapAt.setDescription('')
sfpsSwitchPathAPIMaxRcvDblBack = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 5), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsSwitchPathAPIMaxRcvDblBack.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathAPIMaxRcvDblBack.setDescription('')
sfpsSwitchPathTable = MibTable((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3), )
if mibBuilder.loadTexts: sfpsSwitchPathTable.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTable.setDescription('')
sfpsSwitchPathTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1), ).setIndexNames((0, "CTRON-SFPS-PATH-MIB", "sfpsSwitchPathTableSwitchMAC"), (0, "CTRON-SFPS-PATH-MIB", "sfpsSwitchPathTablePort"))
if mibBuilder.loadTexts: sfpsSwitchPathTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableEntry.setDescription('.')
sfpsSwitchPathTableSwitchMAC = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 1), SfpsAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableSwitchMAC.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableSwitchMAC.setDescription('')
sfpsSwitchPathTablePort = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTablePort.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTablePort.setDescription('')
sfpsSwitchPathTableIsActive = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableIsActive.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableIsActive.setDescription('')
sfpsSwitchPathTableIsStatic = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableIsStatic.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableIsStatic.setDescription('')
sfpsSwitchPathTableIsLocal = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableIsLocal.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableIsLocal.setDescription('')
sfpsSwitchPathTableRefCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableRefCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableRefCnt.setDescription('')
sfpsSwitchPathTableRefTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 7), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableRefTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableRefTime.setDescription('')
sfpsSwitchPathTableFoundCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableFoundCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableFoundCnt.setDescription('')
sfpsSwitchPathTableFoundTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 9), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableFoundTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableFoundTime.setDescription('')
sfpsSwitchPathTableLostCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableLostCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableLostCnt.setDescription('')
sfpsSwitchPathTableLostTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 11), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableLostTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableLostTime.setDescription('')
sfpsSwitchPathTableSrcDblBackCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableSrcDblBackCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableSrcDblBackCnt.setDescription('')
sfpsSwitchPathTableSrcDblBackTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 13), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableSrcDblBackTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableSrcDblBackTime.setDescription('')
sfpsSwitchPathTableRcvDblBackCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableRcvDblBackCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableRcvDblBackCnt.setDescription('')
sfpsSwitchPathTableRcvDblBackTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 15), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableRcvDblBackTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableRcvDblBackTime.setDescription('')
sfpsSwitchPathTableDirReapCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 16), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableDirReapCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableDirReapCnt.setDescription('')
sfpsSwitchPathTableDirReapTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 17), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableDirReapTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableDirReapTime.setDescription('')
sfpsChassisRIPPathNumInTable = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsChassisRIPPathNumInTable.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsChassisRIPPathNumInTable.setDescription('')
sfpsChassisRIPPathNumRequests = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsChassisRIPPathNumRequests.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsChassisRIPPathNumRequests.setDescription('')
sfpsChassisRIPPathNumReplyAck = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsChassisRIPPathNumReplyAck.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsChassisRIPPathNumReplyAck.setDescription('')
sfpsChassisRIPPathNumReplyUnk = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsChassisRIPPathNumReplyUnk.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsChassisRIPPathNumReplyUnk.setDescription('')
mibBuilder.exportSymbols("CTRON-SFPS-PATH-MIB", sfpsStaticPathTable=sfpsStaticPathTable, sfpsSwitchPathTableSrcDblBackTime=sfpsSwitchPathTableSrcDblBackTime, sfpsStaticPathDownlinkEnabled=sfpsStaticPathDownlinkEnabled, sfpsPathAPISwitchMac=sfpsPathAPISwitchMac, sfpsSwitchPathAPIVerb=sfpsSwitchPathAPIVerb, sfpsSwitchPathStatsDeadRemote=sfpsSwitchPathStatsDeadRemote, sfpsPathMaskObjCoreUplinkMask=sfpsPathMaskObjCoreUplinkMask, sfpsSwitchPathTableEntry=sfpsSwitchPathTableEntry, sfpsSwitchPathTableRefTime=sfpsSwitchPathTableRefTime, sfpsSwitchPathStatsReapCount=sfpsSwitchPathStatsReapCount, HexInteger=HexInteger, sfpsChassisRIPPathNumReplyUnk=sfpsChassisRIPPathNumReplyUnk, sfpsPathMaskObjLastChangeTime=sfpsPathMaskObjLastChangeTime, sfpsSwitchPathStatsLocateNak=sfpsSwitchPathStatsLocateNak, sfpsPathMaskObjPyhsIsolatedSwitchMask=sfpsPathMaskObjPyhsIsolatedSwitchMask, sfpsSwitchPathTableLostTime=sfpsSwitchPathTableLostTime, sfpsSwitchPathStatsPathNak=sfpsSwitchPathStatsPathNak, sfpsSwitchPathTableRcvDblBackTime=sfpsSwitchPathTableRcvDblBackTime, sfpsPathAPICost=sfpsPathAPICost, sfpsPathAPISrcMac=sfpsPathAPISrcMac, sfpsSwitchPathAPIBaseMAC=sfpsSwitchPathAPIBaseMAC, sfpsSwitchPathTableSrcDblBackCnt=sfpsSwitchPathTableSrcDblBackCnt, sfpsServiceCenterPathName=sfpsServiceCenterPathName, sfpsChassisRIPPathNumRequests=sfpsChassisRIPPathNumRequests, sfpsSwitchPathTable=sfpsSwitchPathTable, sfpsStaticPathFloodEnabled=sfpsStaticPathFloodEnabled, sfpsPathAPIID=sfpsPathAPIID, sfpsSwitchPathStatsRcdDblBack=sfpsSwitchPathStatsRcdDblBack, sfpsStaticPathPort=sfpsStaticPathPort, sfpsSwitchPathStatsActiveRemote=sfpsSwitchPathStatsActiveRemote, sfpsServiceCenterPathOperStatus=sfpsServiceCenterPathOperStatus, sfpsSwitchPathTableFoundCnt=sfpsSwitchPathTableFoundCnt, sfpsPathMaskObjPhysFloodNoINB=sfpsPathMaskObjPhysFloodNoINB, sfpsSwitchPathStatsLocateAck=sfpsSwitchPathStatsLocateAck, sfpsServiceCenterPathResponses=sfpsServiceCenterPathResponses, sfpsServiceCenterPathAdminStatus=sfpsServiceCenterPathAdminStatus, sfpsStaticPathEntry=sfpsStaticPathEntry, sfpsSwitchPathAPIPort=sfpsSwitchPathAPIPort, sfpsStaticPathUplinkEnabled=sfpsStaticPathUplinkEnabled, sfpsSwitchPathStatsMaxEntries=sfpsSwitchPathStatsMaxEntries, sfpsSwitchPathTableDirReapTime=sfpsSwitchPathTableDirReapTime, sfpsChassisRIPPathNumInTable=sfpsChassisRIPPathNumInTable, SfpsAddress=SfpsAddress, sfpsPathAPIInPort=sfpsPathAPIInPort, sfpsSwitchPathStatsReapAt=sfpsSwitchPathStatsReapAt, sfpsPathMaskObjPathChangeCounter=sfpsPathMaskObjPathChangeCounter, sfpsPathMaskObjOverrideFloodMask=sfpsPathMaskObjOverrideFloodMask, sfpsPathAPIVerb=sfpsPathAPIVerb, sfpsSwitchPathTableDirReapCnt=sfpsSwitchPathTableDirReapCnt, sfpsSwitchPathStatsMemUsage=sfpsSwitchPathStatsMemUsage, sfpsServiceCenterPathStatusTime=sfpsServiceCenterPathStatusTime, sfpsSwitchPathStatsLocateReq=sfpsSwitchPathStatsLocateReq, sfpsSwitchPathAPIReapAt=sfpsSwitchPathAPIReapAt, sfpsPathMaskObjLogFloodNoINB=sfpsPathMaskObjLogFloodNoINB, sfpsSwitchPathStatsPathReq=sfpsSwitchPathStatsPathReq, sfpsSwitchPathStatsActiveLocal=sfpsSwitchPathStatsActiveLocal, sfpsSwitchPathTableIsActive=sfpsSwitchPathTableIsActive, sfpsPathMaskObjLogPortMask=sfpsPathMaskObjLogPortMask, sfpsSwitchPathStatsTableSize=sfpsSwitchPathStatsTableSize, sfpsPathMaskObjPathChangeEvent=sfpsPathMaskObjPathChangeEvent, sfpsSwitchPathStatsDeadLocal=sfpsSwitchPathStatsDeadLocal, sfpsChassisRIPPathNumReplyAck=sfpsChassisRIPPathNumReplyAck, sfpsPathAPIPortName=sfpsPathAPIPortName, sfpsSwitchPathTableIsLocal=sfpsSwitchPathTableIsLocal, sfpsPathMaskObjLogDownlinkMask=sfpsPathMaskObjLogDownlinkMask, sfpsSwitchPathStatsStaticRemote=sfpsSwitchPathStatsStaticRemote, sfpsSwitchPathStatsPathUnk=sfpsSwitchPathStatsPathUnk, sfpsSwitchPathTableRefCnt=sfpsSwitchPathTableRefCnt, sfpsPathAPIHop=sfpsPathAPIHop, sfpsSwitchPathTableSwitchMAC=sfpsSwitchPathTableSwitchMAC, sfpsServiceCenterPathRequests=sfpsServiceCenterPathRequests, sfpsSwitchPathTableLostCnt=sfpsSwitchPathTableLostCnt, sfpsSwitchPathTableRcvDblBackCnt=sfpsSwitchPathTableRcvDblBackCnt, sfpsServiceCenterPathHashLeaf=sfpsServiceCenterPathHashLeaf, sfpsSwitchPathTableIsStatic=sfpsSwitchPathTableIsStatic, sfpsPathMaskObjPhysPortMask=sfpsPathMaskObjPhysPortMask, sfpsPathMaskObjLogResolveMask=sfpsPathMaskObjLogResolveMask, sfpsSwitchPathTablePort=sfpsSwitchPathTablePort, sfpsSwitchPathStatsNumEntries=sfpsSwitchPathStatsNumEntries, sfpsSwitchPathStatsLocateUnk=sfpsSwitchPathStatsLocateUnk, sfpsServiceCenterPathEntry=sfpsServiceCenterPathEntry, sfpsSwitchPathStatsSndDblBack=sfpsSwitchPathStatsSndDblBack, sfpsSwitchPathStatsPathAck=sfpsSwitchPathStatsPathAck, sfpsServiceCenterPathTable=sfpsServiceCenterPathTable, sfpsSwitchPathAPIMaxRcvDblBack=sfpsSwitchPathAPIMaxRcvDblBack, sfpsPathAPIDstMac=sfpsPathAPIDstMac, sfpsPathMaskObjPathCounterReset=sfpsPathMaskObjPathCounterReset, sfpsPathMaskObjOldLogPortMask=sfpsPathMaskObjOldLogPortMask, sfpsPathMaskObjIsolatedSwitchMask=sfpsPathMaskObjIsolatedSwitchMask, sfpsServiceCenterPathMetric=sfpsServiceCenterPathMetric, sfpsPathMaskObjPhysResolveMask=sfpsPathMaskObjPhysResolveMask, sfpsSwitchPathTableFoundTime=sfpsSwitchPathTableFoundTime, sfpsSwitchPathStatsReapReady=sfpsSwitchPathStatsReapReady)
|
spec = {
'name' : "a 4-node liberty cluster",
# 'external network name' : "exnet3",
'keypair' : "openstack_rsa",
'controller' : "r720",
'dns' : "10.30.65.200",
'credentials' : { 'user' : "nic", 'password' : "nic", 'project' : "nic" },
'Networks' : [
# { 'name' : "liberty" , "start": "192.168.0.2", "end": "192.168.0.254", "subnet" :" 192.168.0.0/24", "gateway": "192.168.0.1" },
{ 'name' : "liberty-dataplane" , "subnet" :" 172.16.0.0/24" },
{ 'name' : "liberty-provider" , "subnet" :" 172.16.1.0/24","start": "172.16.1.3", "end": "172.16.1.127", "gateway": "172.16.1.1" },
],
# Hint: list explicity required external IPs first to avoid them being claimed by hosts that don't care...
'Hosts' : [
{ 'name' : "liberty-controller" , 'image' : "centos1602" , 'flavor':"m1.large" , 'net' : [ ("routed-net" , "liberty-controller"), ] },
{ 'name' : "liberty-network" , 'image' : "centos1602" , 'flavor':"m1.xlarge" , 'net' : [ ("routed-net" ,"liberty-network"), ("liberty-dataplane"), ("liberty-provider","*") ] },
{ 'name' : "liberty-compute1" , 'image' : "centos1602" , 'flavor':"m1.xlarge" , 'net' : [ ("routed-net" ,"liberty-compute1"), ("liberty-dataplane"), ("liberty-provider","*") ] },
{ 'name' : "liberty-compute2" , 'image' : "centos1602" , 'flavor':"m1.xlarge" , 'net' : [ ("routed-net" ,"liberty-compute2"), ("liberty-dataplane"), ("liberty-provider","*") ] },
{ 'name' : "liberty-compute3" , 'image' : "centos1602" , 'flavor':"m1.xlarge" , 'net' : [ ("routed-net" ,"liberty-compute3"), ("liberty-dataplane"), ("liberty-provider","*") ] },
{ 'name' : "liberty-cloudify" , 'image' : "centos1602" , 'flavor':"m1.medium" , 'net' : [ ("routed-net" , "liberty-cloudify"), ("liberty-provider","*") ] },
]
}
|
COM_SLEEP = 0x00
COM_QUIT = 0x01
COM_INIT_DB = 0x02
COM_QUERY = 0x03
COM_FIELD_LIST = 0x04
COM_CREATE_DB = 0x05
COM_DROP_DB = 0x06
COM_REFRESH = 0x07
COM_SHUTDOWN = 0x08
COM_STATISTICS = 0x09
COM_PROCESS_INFO = 0x0a
COM_CONNECT = 0x0b
COM_PROCESS_KILL = 0x0c
COM_DEBUG = 0x0d
COM_PING = 0x0e
COM_TIME = 0x0f
COM_DELAYED_INSERT = 0x10
COM_CHANGE_USER = 0x11
COM_BINLOG_DUMP = 0x12
COM_TABLE_DUMP = 0x13
COM_CONNECT_OUT = 0x14
COM_REGISTER_SLAVE = 0x15
COM_STMT_PREPARE = 0x16
COM_STMT_EXECUTE = 0x17
COM_STMT_SEND_LONG_DATA = 0x18
COM_STMT_CLOSE = 0x19
COM_STMT_RESET = 0x1a
COM_SET_OPTION = 0x1b
COM_STMT_FETCH = 0x1c
COM_DAEMON = 0x1d
COM_BINLOG_DUMP_GTID = 0x1e
COM_END = 0x1f
local_vars = locals()
def com_type_name(val):
for _var in local_vars:
if "COM_" in _var:
if local_vars[_var] == val:
return _var
|
name, age = "Sharwan27", 16
username = "Sharwan27"
print ('Hello!')
print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
|
# count = 10
# while count>0:
# print("Sandip")
# count-=1
# name="Sandip"
# for char in name:
# print(char)
# for item in name:
# print(item, end=" ")
# print("")
# print("My name is",name)
# print("My name is",name,sep="=")
# for item in range(5):
# print(item,end=" ")
# print("")
# for item in range(1,11,2):
# print(item,end=" ")
# print()
# for i in range(2,11):
# for j in range(1,11):
# print(i,'X',j,'=',(i*j))
# print()
# for i in range(1,6):
# if(i==4):
# continue
# print(i)
#String
name = "Sandip Dhakal!"
lenth=len(name)
# print(str(lenth)+" Sabd")
# print(name[lenth-1])
# name = name+'Sand'
# name="Prajwol "*2
# print(name)
# name[0]="T" this is not permisible as string is immuatable collection
# print(name[7:])
# print(name[:7])
# print(name[::2])
# print(name[::-1])
# print(name[5:2:-1])
# print(name[5::-2])
print("Wo'w'")
print('Wo"w"')
print('Wo\'w\'')
print('San\\dip\\')
print("sand\ndip")
print("sand\tdip")
print("sand\bdip")
check = "H" not in name
print(check)
print(type(check))
|
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Helper functions to expand "make" variables of form $(VAR)
"""
def expand_variables(ctx, s, outs = [], output_dir = False, attribute_name = "args"):
"""This function is the same as ctx.expand_make_variables with the additional
genrule-like substitutions of:
- $@: The output file if it is a single file. Else triggers a build error.
- $(@D): The output directory. If there is only one file name in outs,
this expands to the directory containing that file. If there are multiple files,
this instead expands to the package's root directory in the bin tree,
even if all generated files belong to the same subdirectory!
- $(RULEDIR): The output directory of the rule, that is, the directory
corresponding to the name of the package containing the rule under the bin tree.
See https://docs.bazel.build/versions/main/be/general.html#genrule.cmd and
https://docs.bazel.build/versions/main/be/make-variables.html#predefined_genrule_variables
for more information of how these special variables are expanded.
"""
rule_dir = [f for f in [
ctx.bin_dir.path,
ctx.label.workspace_root,
ctx.label.package,
] if f]
additional_substitutions = {}
if output_dir:
if s.find("$@") != -1 or s.find("$(@)") != -1:
fail("""$@ substitution may only be used with output_dir=False.
Upgrading rules_nodejs? Maybe you need to switch from $@ to $(@D)
See https://github.com/bazelbuild/rules_nodejs/releases/tag/0.42.0""")
# We'll write into a newly created directory named after the rule
output_dir = [f for f in [
ctx.bin_dir.path,
ctx.label.workspace_root,
ctx.label.package,
ctx.label.name,
] if f]
else:
if s.find("$@") != -1 or s.find("$(@)") != -1:
if len(outs) > 1:
fail("""$@ substitution may only be used with a single out
Upgrading rules_nodejs? Maybe you need to switch from $@ to $(RULEDIR)
See https://github.com/bazelbuild/rules_nodejs/releases/tag/0.42.0""")
if len(outs) == 1:
additional_substitutions["@"] = outs[0].path
output_dir = outs[0].dirname.split("/")
else:
output_dir = rule_dir[:]
# The list comprehension removes empty segments like if we are in the root package
additional_substitutions["@D"] = "/".join([o for o in output_dir if o])
additional_substitutions["RULEDIR"] = "/".join([o for o in rule_dir if o])
return ctx.expand_make_variables(attribute_name, s, additional_substitutions)
|
def potencia(base, inicio=1, fin=10):
while inicio < fin:
resul=base**inicio
yield resul
inicio=inicio+1
print(list(potencia(3,1,50))) |
class CFApiException(Exception):
"""Base exception for all custom exceptions raise by the cfapi module."""
class InvalidIdentifierException(CFApiException, ValueError):
"""Raised when trying to load data from an invalid URL (probably because the
data doesn't exist or isn't public)."""
class InvalidURL(CFApiException, ValueError):
"""Raised when typing to load a data using a given URL, but the URL isn't a
valid one."""
|
N_L = input().split()
Number_lights = int(N_L[0])
Length = int(N_L[1])
time = 0
last_distance = 0
for x in range(Number_lights):
information = input().split()
time += int(information[0]) - last_distance
remainder = time % (int(information[1]) + int(information[2]))
if remainder < int(information[1]):
time += int(information[1]) - remainder
last_distance = int(information[0])
time += Length - last_distance
print(time) |
PATH_TO_STANFORD_CORENLP = '/local/cfwelch/stanford-corenlp-full-2018-02-27/*'
NUM_SPLITS = 1
TRAIN_SIZE = 0.67 # two thirds of the total data
# Define entity types here
# Each type must have a list of identifiers that do not contain the '_' token
# Example of an annotation:
#
# Kathe Halverson was the only aspect of EECS 555 Parallel Computing that I liked
# <instructor
# name=Kathe Halverson
# sentiment=positive>
# <class
# id=555
# name=Parallel Computing
# sentiment=negative>
ENT_TYPES = {'instructor': ['name'], \
'class': ['name', 'department', 'id'] \
}
# Shortcut for checking ids
ALL_IDS = list(set([i for j in ENT_TYPES for i in ENT_TYPES[j]]))
|
# -*- coding: utf-8 -*-
"""DSM 5 SYNO.DSM.Network data."""
DSM_5_DSM_NETWORK = {
"data": {
"dns": ["192.168.1.1"],
"gateway": "192.168.1.1",
"hostname": "HOME-NAS",
"interfaces": [
{
"id": "eth0",
"ip": [{"address": "192.168.1.10", "netmask": "255.255.255.0"}],
"mac": "XX-XX-XX-XX-XX-XX",
"type": "lan",
}
],
"workgroup": "WORKGROUP",
},
"success": True,
}
|
#!/usr/bin/env python
#===================================================================================
#description : Methods for features exploration =
#author : Shashi Narayan, shashi.narayan(at){ed.ac.uk,loria.fr,gmail.com})=
#date : Created in 2014, Later revised in April 2016. =
#version : 0.1 =
#===================================================================================
class Feature_Nov27:
def get_split_feature(self, split_tuple, parent_sentence, children_sentence_list, boxer_graph):
# Calculating iLength
#iLength = boxer_graph.calculate_iLength(parent_sentence, children_sentence_list)
# Get split tuple pattern
split_pattern = boxer_graph.get_pattern_4_split_candidate(split_tuple)
#split_feature = split_pattern+"_"+str(iLength)
split_feature = split_pattern
return split_feature
def get_drop_ood_feature(self, ood_node, nodeset, main_sent_dict, boxer_graph):
ood_word = boxer_graph.extract_oodword(ood_node, main_sent_dict)
ood_position = boxer_graph.nodes[ood_node]["positions"][0] # length of positions is one
span = boxer_graph.extract_span_min_max(nodeset)
boundaryVal = "false"
if ood_position <= span[0] or ood_position >= span[1]:
boundaryVal = "true"
drop_ood_feature = ood_word+"_"+boundaryVal
return drop_ood_feature
def get_drop_rel_feature(self, rel_node, nodeset, main_sent_dict, boxer_graph):
rel_word = boxer_graph.relations[rel_node]["predicates"]
rel_span = boxer_graph.extract_span_for_nodeset_with_rel(rel_node, nodeset)
drop_rel_feature = rel_word+"_"
if len(rel_span) <= 2:
drop_rel_feature += "0-2"
elif len(rel_span) <= 5:
drop_rel_feature += "2-5"
elif len(rel_span) <= 10:
drop_rel_feature += "5-10"
elif len(rel_span) <= 15:
drop_rel_feature += "10-15"
else:
drop_rel_feature += "gt15"
return drop_rel_feature
def get_drop_mod_feature(self, mod_cand, main_sent_dict, boxer_graph):
mod_pos = int(mod_cand[0])
mod_word = main_sent_dict[mod_pos][0]
#mod_node = mod_cand[1]
drop_mod_feature = mod_word
return drop_mod_feature
class Feature_Init:
def get_split_feature(self, split_tuple, parent_sentence, children_sentence_list, boxer_graph):
# Calculating iLength
iLength = boxer_graph.calculate_iLength(parent_sentence, children_sentence_list)
# Get split tuple pattern
split_pattern = boxer_graph.get_pattern_4_split_candidate(split_tuple)
split_feature = split_pattern+"_"+str(iLength)
return split_feature
def get_drop_ood_feature(self, ood_node, nodeset, main_sent_dict, boxer_graph):
ood_word = boxer_graph.extract_oodword(ood_node, main_sent_dict)
ood_position = boxer_graph.nodes[ood_node]["positions"][0] # length of positions is one
span = boxer_graph.extract_span_min_max(nodeset)
boundaryVal = "false"
if ood_position <= span[0] or ood_position >= span[1]:
boundaryVal = "true"
drop_ood_feature = ood_word+"_"+boundaryVal
return drop_ood_feature
def get_drop_rel_feature(self, rel_node, nodeset, main_sent_dict, boxer_graph):
rel_word = boxer_graph.relations[rel_node]["predicates"]
rel_span = boxer_graph.extract_span_for_nodeset_with_rel(rel_node, nodeset)
drop_rel_feature = rel_word+"_"+str(len(rel_span))
return drop_rel_feature
def get_drop_mod_feature(self, mod_cand, main_sent_dict, boxer_graph):
mod_pos = int(mod_cand[0])
mod_word = main_sent_dict[mod_pos][0]
#mod_node = mod_cand[1]
drop_mod_feature = mod_word
return drop_mod_feature
|
"""
The :py:mod:`.io` module provides functions which can be used to parse external
data formats used by Psephology.
"""
def parse_result_line(line):
"""Take a line consisting of a constituency name and vote count, party id
pairs all separated by commas and return the constituency name and a list of
results as a pair. The results list consists of vote-count party name pairs.
To handle constituencies whose names include a comma, the parse considers
count, party pairs *from the right* and stops when it reaches a vote count
which is not an integer.
"""
items = line.strip().split(',')
results = []
# If there is more to parse, there should be at least the constituency name,
# a vote count and a party id, i.e. more than two values
while len(items) > 2:
party_id = items.pop()
count_str = items.pop()
try:
count = int(count_str.strip())
except ValueError:
items.extend([count_str, party_id])
break
results.append((count, party_id.strip()))
# The remaining items are assumed to be to be the constituency name. Note we
# need to reverse the results in order to preserve the order we were given.
return ','.join(items), results[::-1]
|
n = int(input())
while(n > 0):
n -= 1
a, b = input().split()
if(len(a) < len(b)):
print('nao encaixa')
else:
if(a[len(a)-len(b)::] == b):
print('encaixa')
else:
print('nao encaixa') |
#1) Multiples of 3 and 5
#If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
#Find the sum of all the multiples of 3 or 5 below 1000.
# Solution A
def multiples(n):
num = 1
while num < n:
if num % 3 == 0 or num % 5 == 0:
yield num
num += 1
sum(multiples(1000))
# Solution B
sum([x for x in range(1000) if x % 3 == 0 or x % 5 == 0]) |
""" Advent of Code, 2020: Day 07, a """
with open(__file__[:-5] + "_input") as f:
inputs = [line.strip() for line in f]
bags = dict()
def search(bag):
""" Recursively search bags """
if bag not in bags:
return False
return any(b == "shiny gold" or search(b) for b in bags[bag])
def run():
""" Read inputs into a dictionary for recursive searching """
for line in inputs:
# Strip the trailing "." and split
container, rest = line[:-1].split(" contain ")
# Strip the trailing " bags"
container = container[:-5]
contained = []
for bag in rest.split(", "):
if bag[:2] != "no":
# Strip the leading number and the trailing "bags" or " bag"
contained.append(bag[2:-4].strip())
bags[container] = contained
return sum(1 if search(bag) else 0 for bag in bags)
if __name__ == "__main__":
print(run())
|
class Kettle(object):
def __init__(self, make, price):
self.make = make
self.price = price
self.on = False
kenwood = Kettle("kenwood", 8.99)
print(kenwood.make)
print(kenwood.price)
kenwood.price = 12.75
print(kenwood.price)
hamilton = Kettle("hamilton", 14.00)
print(hamilton.price) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology.
# SPDX-FileCopyrightText: © 2021 Lee McCuller <[email protected]>
# NOTICE: authors should document their contributions in concisely in NOTICE
# with details inline in source files, comments, and docstrings.
"""
"""
# from .data2filter import data2filter
# from .disc_sequence import rational_disc_fit
# from .disc_sequence_mag import rational_disc_fit_mag
# from .fit_aid import FitAid
# from ..data2testcase import data2testcase
# from . import hintsets
# from .statespace import ss2filter, ss2xfer, ss2zpk
__all__ = [
# data2filter,
# hintsets,
# data2testcase,
# ss2filter, ss2xfer, ss2zpk,
]
|
# Font: https://realpython.com/python-recursion/
#Traverse a Nested List Recursively
names = [
"Adam",
[
"Bob",
[
"Chet",
"Cat",
],
"Barb",
"Bert"
],
"Alex",
[
"Bea",
"Bill"
],
"Ann"
]
print(len(names))
for index, item in enumerate(names):
print(index, item)
def count_leaf_items(item_list):
"""Recursively counts and returns the
number of leaf items in a (potentially
nested) list.
"""
print(f"List: {item_list}")
count = 0
for item in item_list:
if isinstance(item, list):
print("Encountered sublist")
count += count_leaf_items(item)
else:
print(f"Counted leaf item \"{item}\"")
count += 1
print(f"-> Returning count {count}")
return count
|
#
# CodeFragment
# |
# +-- Ann
# | |
# | +-- LeaderAnn
# | +-- TrailerAnn
# |
# +-- NonAnn
# |
# +-- AnnCodeRegion
#
# -----------------------------------------
class CodeFragment:
def __init__(self):
"""Instantiate a code fragment"""
self.id = "None"
pass
# -----------------------------------------
class Ann(CodeFragment):
def __init__(self, code, line_no, indent_size):
"""Instantiate an annotation"""
CodeFragment.__init__(self)
self.code = code
self.line_no = line_no
self.indent_size = indent_size
# -----------------------------------------
class LeaderAnn(Ann):
def __init__(
self,
code,
line_no,
indent_size,
mod_name,
mod_name_line_no,
mod_code,
mod_code_line_no,
):
Ann.__init__(self, code, line_no, indent_size)
self.mod_name = mod_name
self.mod_name_line_no = mod_name_line_no
self.mod_code = mod_code
self.mod_code_line_no = mod_code_line_no
self.id = mod_name
# -----------------------------------------
class TrailerAnn(Ann):
def __init__(self, code, line_no, indent_size):
"""Instantiate a trailer annotation"""
Ann.__init__(self, code, line_no, indent_size)
# -----------------------------------------
class NonAnn(CodeFragment):
def __init__(self, code, line_no, indent_size):
"""Instantiate a non-annotation"""
CodeFragment.__init__(self)
self.code = code
self.line_no = line_no
self.indent_size = indent_size
# -----------------------------------------
class AnnCodeRegion(CodeFragment):
def __init__(self, leader_ann, cfrags, trailer_ann):
"""Instantiate an annotated code region"""
CodeFragment.__init__(self)
self.leader_ann = leader_ann
self.cfrags = cfrags
self.trailer_ann = trailer_ann
self.id = leader_ann
|
HAND1 = """
Full Tilt Poker Game #33286946295: MiniFTOPS Main Event (255707037), Table 179 - NL Hold'em - 10/20 - 19:26:50 CET - 2013/09/22 [13:26:50 ET - 2013/09/22]
Seat 1: Popp1987 (13,587)
Seat 2: Luckytobgood (10,110)
Seat 3: FatalRevange (9,970)
Seat 4: IgaziFerfi (10,000)
Seat 5: egis25 (6,873)
Seat 6: gamblie (9,880)
Seat 7: idanuTz1 (10,180)
Seat 8: PtheProphet (9,930)
Seat 9: JohnyyR (9,840)
gamblie posts the small blind of 10
idanuTz1 posts the big blind of 20
The button is in seat #5
*** HOLE CARDS ***
Dealt to IgaziFerfi [9d Ks]
PtheProphet has 15 seconds left to act
PtheProphet folds
JohnyyR raises to 40
Popp1987 has 15 seconds left to act
Popp1987 folds
Luckytobgood folds
FatalRevange raises to 100
IgaziFerfi folds
egis25 folds
gamblie folds
idanuTz1 folds
JohnyyR has 15 seconds left to act
JohnyyR calls 60
*** FLOP *** [8h 4h Tc] (Total Pot: 230, 2 Players)
JohnyyR checks
FatalRevange has 15 seconds left to act
FatalRevange bets 120
JohnyyR folds
Uncalled bet of 120 returned to FatalRevange
FatalRevange mucks
FatalRevange wins the pot (230)
*** SUMMARY ***
Total pot 230 | Rake 0
Board: [8h 4h Tc]
Seat 1: Popp1987 didn't bet (folded)
Seat 2: Luckytobgood didn't bet (folded)
Seat 3: FatalRevange collected (230), mucked
Seat 4: IgaziFerfi didn't bet (folded)
Seat 5: egis25 (button) didn't bet (folded)
Seat 6: gamblie (small blind) folded before the Flop
Seat 7: idanuTz1 (big blind) folded before the Flop
Seat 8: PtheProphet didn't bet (folded)
Seat 9: JohnyyR folded on the Flop
"""
TURBO_SNG = """\
Full Tilt Poker Game #34374264321: $10 Sit & Go (Turbo) (268569961), Table 1 - NL Hold'em - 15/30 - 11:57:01 CET - 2014/06/29 [05:57:01 ET - 2014/06/29]
Seat 1: snake 422 (1,500)
Seat 2: IgaziFerfi (1,500)
Seat 3: MixaOne (1,500)
Seat 4: BokkaBlake (1,500)
Seat 5: Sajiee (1,500)
Seat 6: AzzzJJ (1,500)
snake 422 posts the small blind of 15
IgaziFerfi posts the big blind of 30
The button is in seat #6
*** HOLE CARDS ***
Dealt to IgaziFerfi [2h 5d]
MixaOne calls 30
BokkaBlake folds
Sajiee folds
AzzzJJ raises to 90
snake 422 folds
IgaziFerfi folds
MixaOne calls 60
*** FLOP *** [6s 9c 3d] (Total Pot: 225, 2 Players)
MixaOne bets 30
AzzzJJ raises to 120
MixaOne folds
Uncalled bet of 90 returned to AzzzJJ
AzzzJJ mucks
AzzzJJ wins the pot (285)
*** SUMMARY ***
Total pot 285 | Rake 0
Board: [6s 9c 3d]
Seat 1: snake 422 (small blind) folded before the Flop
Seat 2: IgaziFerfi (big blind) folded before the Flop
Seat 3: MixaOne folded on the Flop
Seat 4: BokkaBlake didn't bet (folded)
Seat 5: Sajiee didn't bet (folded)
Seat 6: AzzzJJ (button) collected (285), mucked
"""
|
# Calculate paycheck
xh = input("Enter Hors: ")
xr = input("Enter Rate: ")
xp = float(xh) * float(xr)
print("Pay:", xp)
|
class Deneme:
def __init__(self,limit):
self.limit = limit
def __iter__(self):
self.a = 5
return self
def __next__(self):
a = self.a
if a > self.limit:
raise StopIteration
self.a = a + 1
return a
for i in Deneme(20):
print(i)
metin = "Python Eğitimi"
for i in metin:
print(i) |
input_s = ['3[abc]4[ab]c', '2[3[a]b]c']
# if '[' not in comp[l+1:r]:
# return int(comp[0:l]) * comp[l+1:r]
a = '10[a]b'
b = '2[2[3[a]b]c]'
c = '3[abc]4[ab]c'
def findnth(haystack, needle, n):
parts= haystack.split(needle, n+1)
if len(parts)<=n+1:
return -1
return len(haystack)-len(parts[-1])-len(needle)
def decomp(comp):
l = comp.find('[')
r = comp.find(']')
mul =int(comp[0:l])
# Find how left brackets many are in between
extra_l = comp[l+1:r].count('[')
if extra_l == 0:
return mul * comp[l+1:r] + comp[r+1:]
else:
# Find the nth right bracket
nth_idx = findnth(comp, ']', extra_l)
subset = comp[l+1: nth_idx]
new_set = comp[:l+1] + decomp(subset) + comp[nth_idx:]
return decomp(new_set)
def splitter(comp):
comp_list = []
alt = 0
last_cut = 0
new_alt = 0
for idx, char in enumerate(comp):
if char == '[':
alt += 1
risen = True
if char == ']':
alt -= 1
if alt == 0 and idx != 0 and risen:
comp_list.append(comp[last_cut:idx+1])
last_cut = idx+1
risen = False
return comp_list
for comp in splitter(c):
print(decomp(comp), end='')
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'shen.bas'
__time__ = '2018-02-03'
"""
|
# You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.
#
# Return the max sliding window.
#
#
# Example 1:
#
#
# Input: nums = [1,3,-1,-3,5,3,6,7], k = 3
# Output: [3,3,5,5,6,7]
# Explanation:
# Window position Max
# --------------- -----
# [1 3 -1] -3 5 3 6 7 3
# 1 [3 -1 -3] 5 3 6 7 3
# 1 3 [-1 -3 5] 3 6 7 5
# 1 3 -1 [-3 5 3] 6 7 5
# 1 3 -1 -3 [5 3 6] 7 6
# 1 3 -1 -3 5 [3 6 7] 7
#
#
# Example 2:
#
#
# Input: nums = [1], k = 1
# Output: [1]
#
#
# Example 3:
#
#
# Input: nums = [1,-1], k = 1
# Output: [1,-1]
#
#
# Example 4:
#
#
# Input: nums = [9,11], k = 2
# Output: [11]
#
#
# Example 5:
#
#
# Input: nums = [4,-2], k = 2
# Output: [4]
#
#
#
# Constraints:
#
#
# 1 <= nums.length <= 105
# -104 <= nums[i] <= 104
# 1 <= k <= nums.length
#
#
class Solution:
def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
# 优先队列 MaxHeap
# deque: 双端队列
if not nums: return []
# window 存储下标
window, res = [], []
for i, x in enumerate(nums):
if i >= k and window[0] <= i-k:
window.pop(0)
while window and nums[window[-1]] <= x:
window.pop()
window.append(i)
if i >= k -1:
res.append(nums[window[0]])
return res
|
class CodegenError(Exception):
pass
class NoOperationProvidedError(CodegenError):
pass
class NoOperationNameProvidedError(CodegenError):
pass
class MultipleOperationsProvidedError(CodegenError):
pass
|
# coding: utf-8
class Item(object):
def __init__(self, name, price, description, image_url, major, minor, priority):
self.name = name
self.price = price
self.description = description
self.image_url = image_url
self.minor = minor
self.major = major
self.priority = priority
def to_dict(self):
return {
"name": self.name,
"price": self.price,
"description": self.description,
"image_url": self.image_url,
"minor": self.minor,
"major": self.major,
"priority": self.priority,
}
@classmethod
def from_dict(cls, json_data):
name = json_data["name"]
price = int(json_data["price"])
description = json_data["description"]
image_url = json_data["image_url"]
minor = int(json_data["minor"])
major = int(json_data["major"])
priority = int(json_data["priority"])
return cls(name, price, description, image_url, major, minor, priority)
|
# class and object (oops concept)
class class_8:
print()
name = 'amar'
# class class_9:
# name = 'rahul'
# age = 23
# def welcome(self):
# print("welcome to teckat")
# # a = class_9() # create object of class abc
# # b = class_8()
# # c = class_9()
# # # print(abc.name) # accessing attribute through class
# # print(a.name) # accessing through object of the class
# # print(b.name)
# # print(c.age)
# a = class_9()
# a.welcome()
# constructor __init__
# class student:
# def __init__(self, name, age):
# print("hello")
# self.name = name
# self.age = age
# def modify_name(self, name):
# self.name = name
# a = student('amar', 12)
# print("before modifying", a.name, a.age)
# a.modify_name('john')
# print("after modifying", a.name, a.age)
class student:
def __init__(self):
self.name = ''
self.age = 0
def input_details(self):
self.name = input('Enter name')
self.num1 = int(input('Enter 1st marks'))
self.num2 = int(input('Enter 2nd marks'))
def add(self):
self.total = self.num1+self.num2
def print_details(self):
print("name = ", self.name)
print("totla marks = ", self.total)
a = student()
a.input_details()
a.add()
a.print_details()
# special attributes
# 1. getattr()
# accessing attributes usin getattr()
print("name (getattr) = ", getattr(a, 'name'))
# 2. hasattr()
print("hasattr(age) = ", hasattr(a, 'age'))
print("hasattr(salary) = ", hasattr(a, 'salary'))
# 3. setattr()
setattr(a, 'name', 'amar')
print("setattr(name=amar) = ", a.name)
# 4. delattr()
delattr(a, 'name')
print("delattr(name) = ", a.name)
|
with open('iso_list/valid_list.txt') as i:
names = i.readlines()
with open('iso_list/valid.prediction') as i:
p = i.readlines()
out = open('iso_list/valid_prediction.txt', 'w')
assert len(names) == len(p)
for i, n in enumerate(names):
n = n[:-1]
result = n + ' ' + p[i]
out.write(result)
|
# '''
# Linked List hash table key/value pair
# '''
class LinkedPair:
def __init__(self, key, value):
self.key = key
self.value = value
self.next = None
# '''
# Resizing hash table
# '''
class HashTable:
def __init__(self, capacity):
self.capacity = capacity
self.storage = [None] * capacity
# '''
# Research and implement the djb2 hash function
# '''
def hash(string, max):
hash = 5381
for char in string:
hash = ((hash << 5) + hash) + ord(char)
return hash % max
# '''
# Fill this in.
# Hint: Used the LL handle collisions
# '''
def hash_table_insert(hash_table, key, value):
index = hash(key, len(hash_table.storage))
current_pair = hash_table.storage[index]
last_pair = None
while current_pair is not None and current_pair.key != key:
last_pair = current_pair
current_pair = last_pair.next
if current_pair is not None:
current_pair.value = value
else:
new_pair = LinkedPair(key, value)
new_pair.next = hash_table.storage[index]
hash_table.storage[index] = new_pair
# '''
# Fill this in.
# If you try to remove a value that isn't there, print a warning.
# '''
def hash_table_remove(hash_table, key):
index = hash(key, len(hash_table.storage))
current_pair = hash_table.storage[index]
last_pair = None
while current_pair is not None and current_pair.key != key:
last_pair = current_pair
current_pair = last_pair.next
if current_pair is None:
print("ERROR: Unable to remove entry with key " + key)
else:
if last_pair is None: # Removing the first element in the LL
hash_table.storage[index] = current_pair.next
else:
last_pair.next = current_pair.next
# '''
# Fill this in.
# Should return None if the key is not found.
# '''
def hash_table_retrieve(hash_table, key):
index = hash(key, len(hash_table.storage))
current_pair = hash_table.storage[index]
while current_pair is not None:
if(current_pair.key == key):
return current_pair.value
current_pair = current_pair.next
# '''
# Fill this in
# '''
def hash_table_resize(hash_table):
new_hash_table = HashTable(2 * len(hash_table.storage))
current_pair = None
for i in range(len(hash_table.storage)):
current_pair = hash_table.storage[i]
while current_pair is not None:
hash_table_insert(new_hash_table,
current_pair.key,
current_pair.value)
current_pair = current_pair.next
return new_hash_table
|
#coding: utf-8
length = int(input("정사각형의 크기를 입력하시오. "))
for i in range(length):
for j in range(length):
print("#",end=" ")
print("") |
class Solution:
def plusOne(self, digits):
i = len(digits) - 1
while i >= 0:
if digits[i] == 9:
digits[i] = 0
i = i - 1
else:
digits[i] += 1
break
if i == -1 and digits[0] == 0:
digits.append(1)
return reversed(digits)
return digits
|
class A:
name="Default"
def __init__(self, n = None):
self.name = n
print(self.name)
def m(self):
print("m of A called")
class B(A):
# def m(self):
# print("m of B called")
pass
class C(A):
def m(self):
print("m of C called")
class D(B, C):
def __init__(self):
self.objB = B()
self.objC = C()
def m(self):
self.objB.m()
# def m1(self, name):
# self.objB.m()
# print(name)
def m1(self, name=None, number=None):
self.objB.m()
print(name, number)
# x = D()
# x.m()
# x.m1("Teo")
# x.m1("Nhan", 20)
a = A("Teo")
print(A.name)
print(a.name)
print(D.mro())
|
"""
Copyright (c) 2015 Frank Lamar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE."""
#This script creats a simple shooping list
shopping_list = []
print("What should we pick up at the store?")
print("Enter 'Done' to stop adding items.")
while True:
new_item = input("> ")
if new_item == 'DONE' 'Done' or 'done':
break
shopping_list.append(new_item)
print("Added List has {} items.".format(len(shopping_list)))
continue
print("Here is your shopping_list: ")
for item in shopping_list:
print(item)
|
# Importação de bibiotecas
# Título do programa
print('\033[1;34;40mMENU DE OPÇÕES\033[m')
# Objetos
menu = 0
n1 = 0
n2 = 0
maior = 0
# Lógica
while menu != 5:
if n1 == n2 == 0:
n1 = int(input('\033[30mDigite o primeiro número:\033[m '))
n2 = int(input('\033[30mDigite o segundo número:\033[m '))
print('\033[34m-=-\033[m' * 20)
print('''
\033[30mO que você deseja fazer?\033[m
\033[33m[1]\033[m \033[34msomar\033[m
\033[33m[2]\033[m \033[34mmultiplicar\033[m
\033[33m[3]\033[m \033[34mmaior\033[m
\033[33m[4]\033[m \033[34mnovos números\033[m
\033[33m[5]\033[m \033[34msair do programa\033[m''')
menu = int(input('\033[30mEscolha uma das opções acima:\033[m '))
print('\033[34m-=-\033[m' * 20)
if menu == 1:
print('O valor da soma dos valores é \033[4;34m{}\033[m'.format(n1 + n2))
elif menu == 2:
print('O valor da multiplicação dos valores é \033[4;34m{}\033[m'.format(n1 * n2))
elif menu == 3:
if n1 > n2:
maior = n1
else:
maior = n2
print('O maior valor digitado foi \033[4;34m{}\033[m'.format(maior))
elif menu == 4:
n1 = n2 = 0
elif menu < 1 or menu > 5:
print('Opção inválida, tente novamente!')
print('\033[33mVOCÊ SAIU DO PROGRAMA!\033[m') |
'''
Created on 1.12.2016
@author: Darren
''''''
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7, 6, 5 ]
]
"
'''
|
command = '/usr/bin/gunicorn'
pythonpath = '/opt/netbox/netbox'
bind = '0.0.0.0:{{ .Values.service.internalPort }}'
workers = 3
errorlog = '-'
accesslog = '-'
capture_output = False
loglevel = 'debug'
|
if __name__ == '__main__':
n, x = map(int, input().split())
sheet = []
[sheet.append(map(float, input().split())) for i in range(x)]
for i in zip(*sheet):
print(sum(i)/len(i))
|
# 公众号:MarkerJava
# 开发时间:2020/10/6 01:21
# 字符串替换操作
a = 'Python,JAVA,C++,C++'
print(a.replace('Python', 'c++', 2))
# 字符串的合并操作
lst = ['python', 'java', 'c++', 'c']
pr = '|'.join(lst)
print(pr) |
class ListaProduto(object):
lista_produtos = [
{
"id":1,
"nome":"pao sete graos"
},
{
"id":2,
"nome":"pao original"
},
{
"id":3,
"nome":"pao integral"
},
{
"id":4,
"nome":"pao light"
},
{
"id":5,
"nome":"pao recheado"
},
{
"id":6,
"nome":"pao doce"
},
{
"id":7,
"nome":"pao sem casca"
},
{
"id":8,
"nome":"pao caseiro"
}
] |
#6. Реализовать функцию int_func(), принимающую слово из маленьких латинских букв и возвращающую его же, но с прописной первой буквой. Например, print(int_func(‘text’)) -> Text.
# Продолжить работу над заданием. В программу должна попадать строка из слов, разделенных пробелом. Каждое слово состоит из латинских букв в нижнем регистре.
# Сделать вывод исходной строки, но каждое слово должно начинаться с заглавной буквы. Необходимо использовать написанную ранее функцию int_func().
def int_func(word):
return word.capitalize()
print("Привет, эта программа разбивает строку по словам и делает их заглавными\n")
txt=input("Введите текст: ")
list = txt.split(" ")
i = 0
for word in list:
list[i]=int_func(word)
i = i + 1
print(list) |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 24 19:59:10 2021
@author: sshir
"""
def rec(df, item_col, user_col, user, user_rating_col, avg_rating_col, sep=None):
'''
Recommending items for a specific existing user based on user rating
and average rating per item. Returns only the items which are not consumed
by the user. If there is only one such item present then returns empty DataFrame.
Parameters
----------
df : Pandas DataFrame
Entire or part of DataFrame that containe the remaining below mentioned parameters.
item_col : str
Column name that contains the item.
user_col : str
Column name that contains user ID. Values in the column must be of dtype int
user : int
ID of the user for whom we need to recommend items.
user_rating_col : str
Column name that contains user ratings.
avg_rating_col : str
Column name that contains average rating of each item.
sep : str [',', '/', '|'], optional
Delimiter to use for genre column. For example: if genre column comtains multiple
genres lile Drama, Action, Comedy or Drama / Action / Comedy. Default value is None
Returns
-------
Pandas DataFrame
Comma-seperated values containig recommended items for user with user_id
and item details
'''
df_copy = df.copy()
if sep != None:
df_copy[item_col] = df_copy[item_col].apply(lambda x: x.split(sep)[0].strip())
user_details = df_copy[df_copy[user_col] == user]
user_details = user_details[user_details[item_col]==user_details[item_col].value_counts().index[0]]
#find the maximum of rating
user_max_rating = max(user_details[user_rating_col])
#fetching the max rated genre by the user
for i in user_details.index:
user_ratings = user_details[user_details.index == i][user_rating_col].values[0]
if user_ratings == user_max_rating:
index = (user_details[user_details.index == i][user_rating_col] == user_max_rating).index[0]
liked_item = user_details[user_details.index==index][item_col].values[0]
#recommendation based on highly rated items by the genre that is max rated by the user
rec = df_copy[df_copy[item_col] == liked_item].sort_values(avg_rating_col, ascending=False)
#removing the items already watched by the user
rec.drop_duplicates(avg_rating_col, inplace=True, keep='last')
for i in user_details.index:
if i in rec.index:
rec.drop(i, inplace=True)
return rec.head(5) |
valor = int(input("Valor da casa: R$ "))
sal = int(input("Salário do comprador: R$ "))
ano = int(input("Quantos anos de financiamento? "))
prest = valor / (ano*12)
print(f'Para pagar uma casa de R$ {valor} em {ano} anos a prestação será de R$ {prest:.2f}')
if prest > sal*0.3:
print('Empréstimo {}NEGADO{}'.format('\033[31m','\033[m'))
else:
print('Empréstimo pode ser {}CONCEDIDO{}'.format('\033[32m','\033[m')) |
apiAttachAvailable = u'\u0648\u0627\u062c\u0647\u0629 \u0628\u0631\u0645\u062c\u0629 \u0627\u0644\u062a\u0637\u0628\u064a\u0642 (API) \u0645\u062a\u0627\u062d\u0629'
apiAttachNotAvailable = u'\u063a\u064a\u0631 \u0645\u062a\u0627\u062d'
apiAttachPendingAuthorization = u'\u062a\u0639\u0644\u064a\u0642 \u0627\u0644\u062a\u0635\u0631\u064a\u062d'
apiAttachRefused = u'\u0631\u0641\u0636'
apiAttachSuccess = u'\u0646\u062c\u0627\u062d'
apiAttachUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
budDeletedFriend = u'\u062a\u0645 \u062d\u0630\u0641\u0647 \u0645\u0646 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0623\u0635\u062f\u0642\u0627\u0621'
budFriend = u'\u0635\u062f\u064a\u0642'
budNeverBeenFriend = u'\u0644\u0645 \u064a\u0648\u062c\u062f \u0645\u0637\u0644\u0642\u064b\u0627 \u0641\u064a \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0623\u0635\u062f\u0642\u0627\u0621'
budPendingAuthorization = u'\u062a\u0639\u0644\u064a\u0642 \u0627\u0644\u062a\u0635\u0631\u064a\u062d'
budUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cfrBlockedByRecipient = u'\u062a\u0645 \u062d\u0638\u0631 \u0627\u0644\u0645\u0643\u0627\u0644\u0645\u0629 \u0628\u0648\u0627\u0633\u0637\u0629 \u0627\u0644\u0645\u0633\u062a\u0644\u0645'
cfrMiscError = u'\u062e\u0637\u0623 \u0645\u062a\u0646\u0648\u0639'
cfrNoCommonCodec = u'\u0628\u0631\u0646\u0627\u0645\u062c \u062a\u0634\u0641\u064a\u0631 \u063a\u064a\u0631 \u0634\u0627\u0626\u0639'
cfrNoProxyFound = u'\u0644\u0645 \u064a\u062a\u0645 \u0627\u0644\u0639\u062b\u0648\u0631 \u0639\u0644\u0649 \u0628\u0631\u0648\u0643\u0633\u064a'
cfrNotAuthorizedByRecipient = u'\u0644\u0645 \u064a\u062a\u0645 \u0645\u0646\u062d \u062a\u0635\u0631\u064a\u062d \u0644\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0627\u0644\u062d\u0627\u0644\u064a \u0628\u0648\u0627\u0633\u0637\u0629 \u0627\u0644\u0645\u0633\u062a\u0644\u0645'
cfrRecipientNotFriend = u'\u0627\u0644\u0645\u0633\u062a\u0644\u0645 \u0644\u064a\u0633 \u0635\u062f\u064a\u0642\u064b\u0627'
cfrRemoteDeviceError = u'\u0645\u0634\u0643\u0644\u0629 \u0641\u064a \u062c\u0647\u0627\u0632 \u0627\u0644\u0635\u0648\u062a \u0627\u0644\u0628\u0639\u064a\u062f'
cfrSessionTerminated = u'\u0627\u0646\u062a\u0647\u0627\u0621 \u0627\u0644\u062c\u0644\u0633\u0629'
cfrSoundIOError = u'\u062e\u0637\u0623 \u0641\u064a \u0625\u062f\u062e\u0627\u0644/\u0625\u062e\u0631\u0627\u062c \u0627\u0644\u0635\u0648\u062a'
cfrSoundRecordingError = u'\u062e\u0637\u0623 \u0641\u064a \u062a\u0633\u062c\u064a\u0644 \u0627\u0644\u0635\u0648\u062a'
cfrUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cfrUserDoesNotExist = u'\u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645/\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 \u063a\u064a\u0631 \u0645\u0648\u062c\u0648\u062f'
cfrUserIsOffline = u'\u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644\u0629 \u0623\u0648 \u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644'
chsAllCalls = u'\u062d\u0648\u0627\u0631 \u0642\u062f\u064a\u0645'
chsDialog = u'\u062d\u0648\u0627\u0631'
chsIncomingCalls = u'\u064a\u062c\u0628 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629 \u0639\u0644\u0649 \u0627\u0644\u0645\u062d\u0627\u062f\u062b\u0629 \u0627\u0644\u062c\u0645\u0627\u0639\u064a\u0629'
chsLegacyDialog = u'\u062d\u0648\u0627\u0631 \u0642\u062f\u064a\u0645'
chsMissedCalls = u'\u062d\u0648\u0627\u0631'
chsMultiNeedAccept = u'\u064a\u062c\u0628 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629 \u0639\u0644\u0649 \u0627\u0644\u0645\u062d\u0627\u062f\u062b\u0629 \u0627\u0644\u062c\u0645\u0627\u0639\u064a\u0629'
chsMultiSubscribed = u'\u062a\u0645 \u0627\u0644\u0627\u0634\u062a\u0631\u0627\u0643 \u0641\u064a \u0627\u0644\u0645\u062d\u0627\u062f\u062b\u0629 \u0627\u0644\u062c\u0645\u0627\u0639\u064a\u0629'
chsOutgoingCalls = u'\u062a\u0645 \u0627\u0644\u0627\u0634\u062a\u0631\u0627\u0643 \u0641\u064a \u0627\u0644\u0645\u062d\u0627\u062f\u062b\u0629 \u0627\u0644\u062c\u0645\u0627\u0639\u064a\u0629'
chsUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
chsUnsubscribed = u'\u062a\u0645 \u0625\u0644\u063a\u0627\u0621 \u0627\u0644\u0627\u0634\u062a\u0631\u0627\u0643'
clsBusy = u'\u0645\u0634\u063a\u0648\u0644'
clsCancelled = u'\u0623\u0644\u063a\u064a'
clsEarlyMedia = u'\u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0648\u0633\u0627\u0626\u0637 (Early Media)'
clsFailed = u'\u0639\u0641\u0648\u0627\u064b\u060c \u062a\u0639\u0630\u0651\u0631\u062a \u0639\u0645\u0644\u064a\u0629 \u0627\u0644\u0627\u062a\u0651\u0635\u0627\u0644!'
clsFinished = u'\u0627\u0646\u062a\u0647\u0649'
clsInProgress = u'\u062c\u0627\u0631\u064a \u0627\u0644\u0627\u062a\u0635\u0627\u0644'
clsLocalHold = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0642\u064a\u062f \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631 \u0645\u0646 \u0637\u0631\u0641\u064a'
clsMissed = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0644\u0645 \u064a\u064f\u0631\u062f \u0639\u0644\u064a\u0647\u0627'
clsOnHold = u'\u0642\u064a\u062f \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631'
clsRefused = u'\u0631\u0641\u0636'
clsRemoteHold = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0642\u064a\u062f \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631 \u0645\u0646 \u0627\u0644\u0637\u0631\u0641 \u0627\u0644\u062b\u0627\u0646\u064a'
clsRinging = u'\u0627\u0644\u0627\u062a\u0635\u0627\u0644'
clsRouting = u'\u062a\u0648\u062c\u064a\u0647'
clsTransferred = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
clsTransferring = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
clsUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
clsUnplaced = u'\u0644\u0645 \u064a\u0648\u0636\u0639 \u0645\u0637\u0644\u0642\u064b\u0627'
clsVoicemailBufferingGreeting = u'\u062a\u062e\u0632\u064a\u0646 \u0627\u0644\u062a\u062d\u064a\u0629'
clsVoicemailCancelled = u'\u062a\u0645 \u0625\u0644\u063a\u0627\u0621 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0635\u0648\u062a\u064a'
clsVoicemailFailed = u'\u0641\u0634\u0644 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0635\u0648\u062a\u064a'
clsVoicemailPlayingGreeting = u'\u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u062a\u062d\u064a\u0629'
clsVoicemailRecording = u'\u062a\u0633\u062c\u064a\u0644 \u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a'
clsVoicemailSent = u'\u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0635\u0648\u062a\u064a'
clsVoicemailUploading = u'\u0625\u064a\u062f\u0627\u0639 \u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a'
cltIncomingP2P = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0646\u0638\u064a\u0631 \u0625\u0644\u0649 \u0646\u0638\u064a\u0631 \u0648\u0627\u0631\u062f\u0629'
cltIncomingPSTN = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0647\u0627\u062a\u0641\u064a\u0629 \u0648\u0627\u0631\u062f\u0629'
cltOutgoingP2P = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0646\u0638\u064a\u0631 \u0625\u0644\u0649 \u0646\u0638\u064a\u0631 \u0635\u0627\u062f\u0631\u0629'
cltOutgoingPSTN = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0647\u0627\u062a\u0641\u064a\u0629 \u0635\u0627\u062f\u0631\u0629'
cltUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cmeAddedMembers = u'\u0627\u0644\u0623\u0639\u0636\u0627\u0621 \u0627\u0644\u0645\u0636\u0627\u0641\u0629'
cmeCreatedChatWith = u'\u0623\u0646\u0634\u0623 \u0645\u062d\u0627\u062f\u062b\u0629 \u0645\u0639'
cmeEmoted = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cmeLeft = u'\u063a\u0627\u062f\u0631'
cmeSaid = u'\u0642\u0627\u0644'
cmeSawMembers = u'\u0627\u0644\u0623\u0639\u0636\u0627\u0621 \u0627\u0644\u0645\u0634\u0627\u0647\u064e\u062f\u0648\u0646'
cmeSetTopic = u'\u062a\u0639\u064a\u064a\u0646 \u0645\u0648\u0636\u0648\u0639'
cmeUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cmsRead = u'\u0642\u0631\u0627\u0621\u0629'
cmsReceived = u'\u0645\u064f\u0633\u062a\u064e\u0644\u0645'
cmsSending = u'\u062c\u0627\u0631\u064a \u0627\u0644\u0625\u0631\u0633\u0627\u0644...'
cmsSent = u'\u0645\u064f\u0631\u0633\u064e\u0644'
cmsUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
conConnecting = u'\u062c\u0627\u0631\u064a \u0627\u0644\u062a\u0648\u0635\u064a\u0644'
conOffline = u'\u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644'
conOnline = u'\u0645\u062a\u0635\u0644'
conPausing = u'\u0625\u064a\u0642\u0627\u0641 \u0645\u0624\u0642\u062a'
conUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cusAway = u'\u0628\u0627\u0644\u062e\u0627\u0631\u062c'
cusDoNotDisturb = u'\u0645\u0645\u0646\u0648\u0639 \u0627\u0644\u0625\u0632\u0639\u0627\u062c'
cusInvisible = u'\u0645\u062e\u0641\u064a'
cusLoggedOut = u'\u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644'
cusNotAvailable = u'\u063a\u064a\u0631 \u0645\u062a\u0627\u062d'
cusOffline = u'\u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644'
cusOnline = u'\u0645\u062a\u0635\u0644'
cusSkypeMe = u'Skype Me'
cusUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cvsBothEnabled = u'\u0625\u0631\u0633\u0627\u0644 \u0648\u0627\u0633\u062a\u0644\u0627\u0645 \u0627\u0644\u0641\u064a\u062f\u064a\u0648'
cvsNone = u'\u0644\u0627 \u064a\u0648\u062c\u062f \u0641\u064a\u062f\u064a\u0648'
cvsReceiveEnabled = u'\u0627\u0633\u062a\u0644\u0627\u0645 \u0627\u0644\u0641\u064a\u062f\u064a\u0648'
cvsSendEnabled = u'\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0641\u064a\u062f\u064a\u0648'
cvsUnknown = u''
grpAllFriends = u'\u0643\u0627\u0641\u0629 \u0627\u0644\u0623\u0635\u062f\u0642\u0627\u0621'
grpAllUsers = u'\u0643\u0627\u0641\u0629 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645\u064a\u0646'
grpCustomGroup = u'\u0645\u062e\u0635\u0635'
grpOnlineFriends = u'\u0627\u0644\u0623\u0635\u062f\u0642\u0627\u0621 \u0627\u0644\u0645\u062a\u0635\u0644\u0648\u0646'
grpPendingAuthorizationFriends = u'\u062a\u0639\u0644\u064a\u0642 \u0627\u0644\u062a\u0635\u0631\u064a\u062d'
grpProposedSharedGroup = u'Proposed Shared Group'
grpRecentlyContactedUsers = u'\u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645\u0648\u0646 \u0627\u0644\u0645\u062a\u0635\u0644\u0648\u0646 \u062d\u062f\u064a\u062b\u064b\u0627'
grpSharedGroup = u'Shared Group'
grpSkypeFriends = u'\u0623\u0635\u062f\u0642\u0627\u0621 Skype'
grpSkypeOutFriends = u'\u0623\u0635\u062f\u0642\u0627\u0621 SkypeOut'
grpUngroupedFriends = u'\u0627\u0644\u0623\u0635\u062f\u0642\u0627\u0621 \u063a\u064a\u0631 \u0627\u0644\u0645\u062c\u0645\u0639\u064a\u0646'
grpUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
grpUsersAuthorizedByMe = u'\u0645\u0635\u0631\u062d \u0628\u0648\u0627\u0633\u0637\u062a\u064a'
grpUsersBlockedByMe = u'\u0645\u062d\u0638\u0648\u0631 \u0628\u0648\u0627\u0633\u0637\u062a\u064a'
grpUsersWaitingMyAuthorization = u'\u0641\u064a \u0627\u0646\u062a\u0638\u0627\u0631 \u0627\u0644\u062a\u0635\u0631\u064a\u062d \u0627\u0644\u062e\u0627\u0635 \u0628\u064a'
leaAddDeclined = u'\u062a\u0645 \u0631\u0641\u0636 \u0627\u0644\u0625\u0636\u0627\u0641\u0629'
leaAddedNotAuthorized = u'\u064a\u062c\u0628 \u0645\u0646\u062d \u062a\u0635\u0631\u064a\u062d \u0644\u0644\u0634\u062e\u0635 \u0627\u0644\u0645\u0636\u0627\u0641'
leaAdderNotFriend = u'\u0627\u0644\u0634\u062e\u0635 \u0627\u0644\u0645\u0636\u064a\u0641 \u064a\u062c\u0628 \u0623\u0646 \u064a\u0643\u0648\u0646 \u0635\u062f\u064a\u0642\u064b\u0627'
leaUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
leaUnsubscribe = u'\u062a\u0645 \u0625\u0644\u063a\u0627\u0621 \u0627\u0644\u0627\u0634\u062a\u0631\u0627\u0643'
leaUserIncapable = u'\u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u063a\u064a\u0631 \u0645\u0624\u0647\u0644'
leaUserNotFound = u'\u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u063a\u064a\u0631 \u0645\u0648\u062c\u0648\u062f'
olsAway = u'\u0628\u0627\u0644\u062e\u0627\u0631\u062c'
olsDoNotDisturb = u'\u0645\u0645\u0646\u0648\u0639 \u0627\u0644\u0625\u0632\u0639\u0627\u062c'
olsNotAvailable = u'\u063a\u064a\u0631 \u0645\u062a\u0627\u062d'
olsOffline = u'\u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644'
olsOnline = u'\u0645\u062a\u0635\u0644'
olsSkypeMe = u'Skype Me'
olsSkypeOut = u'SkypeOut'
olsUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
smsMessageStatusComposing = u'Composing'
smsMessageStatusDelivered = u'Delivered'
smsMessageStatusFailed = u'Failed'
smsMessageStatusRead = u'Read'
smsMessageStatusReceived = u'Received'
smsMessageStatusSendingToServer = u'Sending to Server'
smsMessageStatusSentToServer = u'Sent to Server'
smsMessageStatusSomeTargetsFailed = u'Some Targets Failed'
smsMessageStatusUnknown = u'Unknown'
smsMessageTypeCCRequest = u'Confirmation Code Request'
smsMessageTypeCCSubmit = u'Confirmation Code Submit'
smsMessageTypeIncoming = u'Incoming'
smsMessageTypeOutgoing = u'Outgoing'
smsMessageTypeUnknown = u'Unknown'
smsTargetStatusAcceptable = u'Acceptable'
smsTargetStatusAnalyzing = u'Analyzing'
smsTargetStatusDeliveryFailed = u'Delivery Failed'
smsTargetStatusDeliveryPending = u'Delivery Pending'
smsTargetStatusDeliverySuccessful = u'Delivery Successful'
smsTargetStatusNotRoutable = u'Not Routable'
smsTargetStatusUndefined = u'Undefined'
smsTargetStatusUnknown = u'Unknown'
usexFemale = u'\u0623\u0646\u062b\u0649'
usexMale = u'\u0630\u0643\u0631'
usexUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
vmrConnectError = u'\u062e\u0637\u0623 \u0641\u064a \u0627\u0644\u0627\u062a\u0635\u0627\u0644'
vmrFileReadError = u'\u062e\u0637\u0623 \u0641\u064a \u0642\u0631\u0627\u0621\u0629 \u0627\u0644\u0645\u0644\u0641'
vmrFileWriteError = u'\u062e\u0637\u0623 \u0641\u064a \u0627\u0644\u0643\u062a\u0627\u0628\u0629 \u0625\u0644\u0649 \u0627\u0644\u0645\u0644\u0641'
vmrMiscError = u'\u062e\u0637\u0623 \u0645\u062a\u0646\u0648\u0639'
vmrNoError = u'\u0644\u0627 \u064a\u0648\u062c\u062f \u062e\u0637\u0623'
vmrNoPrivilege = u'\u0644\u0627 \u064a\u0648\u062c\u062f \u0627\u0645\u062a\u064a\u0627\u0632 \u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a'
vmrNoVoicemail = u'\u0644\u0627 \u064a\u0648\u062c\u062f \u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a \u0643\u0647\u0630\u0627'
vmrPlaybackError = u'\u062e\u0637\u0623 \u0641\u064a \u0627\u0644\u062a\u0634\u063a\u064a\u0644'
vmrRecordingError = u'\u062e\u0637\u0623 \u0641\u064a \u0627\u0644\u062a\u0633\u062c\u064a\u0644'
vmrUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
vmsBlank = u'\u0641\u0627\u0631\u063a'
vmsBuffering = u'\u062a\u062e\u0632\u064a\u0646 \u0645\u0624\u0642\u062a'
vmsDeleting = u'\u062c\u0627\u0631\u064a \u0627\u0644\u062d\u0630\u0641'
vmsDownloading = u'\u062c\u0627\u0631\u064a \u0627\u0644\u062a\u062d\u0645\u064a\u0644'
vmsFailed = u'\u0641\u0634\u0644'
vmsNotDownloaded = u'\u0644\u0645 \u064a\u062a\u0645 \u0627\u0644\u062a\u062d\u0645\u064a\u0644'
vmsPlayed = u'\u062a\u0645 \u0627\u0644\u062a\u0634\u063a\u064a\u0644'
vmsPlaying = u'\u062c\u0627\u0631\u064a \u0627\u0644\u062a\u0634\u063a\u064a\u0644'
vmsRecorded = u'\u0645\u0633\u062c\u0644'
vmsRecording = u'\u062a\u0633\u062c\u064a\u0644 \u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a'
vmsUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
vmsUnplayed = u'\u0644\u0645 \u064a\u062a\u0645 \u0627\u0644\u062a\u0634\u063a\u064a\u0644'
vmsUploaded = u'\u062a\u0645 \u0627\u0644\u0625\u064a\u062f\u0627\u0639'
vmsUploading = u'\u062c\u0627\u0631\u064a \u0627\u0644\u0625\u064a\u062f\u0627\u0639'
vmtCustomGreeting = u'\u062a\u062d\u064a\u0629 \u0645\u062e\u0635\u0635\u0629'
vmtDefaultGreeting = u'\u0627\u0644\u062a\u062d\u064a\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629'
vmtIncoming = u'\u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a \u0642\u0627\u062f\u0645'
vmtOutgoing = u'\u0635\u0627\u062f\u0631'
vmtUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
vssAvailable = u'\u0645\u062a\u0627\u062d'
vssNotAvailable = u'\u063a\u064a\u0631 \u0645\u062a\u0627\u062d'
vssPaused = u'\u0625\u064a\u0642\u0627\u0641 \u0645\u0624\u0642\u062a'
vssRejected = u'\u0631\u0641\u0636'
vssRunning = u'\u062a\u0634\u063a\u064a\u0644'
vssStarting = u'\u0628\u062f\u0621'
vssStopping = u'\u0625\u064a\u0642\u0627\u0641'
vssUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
|
def go():
with open('input.txt', 'r') as f:
ids = [item for item in f.read().split('\n') if item]
for i in range(len(ids)):
for j in range(i + 1, len(ids)):
diff_count = 0
for k in range(len(ids[i])):
if ids[i][k] != ids[j][k]:
diff_count += 1
if diff_count == 1:
return ''.join([ids[i][k] for k in range(len(ids[i])) if ids[i][k] == ids[j][k]])
print(go())
|
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyNvidiaMlPy(PythonPackage):
"""Python Bindings for the NVIDIA Management Library."""
homepage = "https://www.nvidia.com/"
pypi = "nvidia-ml-py/nvidia-ml-py-11.450.51.tar.gz"
version('11.450.51', sha256='5aa6dd23a140b1ef2314eee5ca154a45397b03e68fd9ebc4f72005979f511c73')
# pip silently replaces distutils with setuptools
depends_on('py-setuptools', type='build')
|
# -*- coding: utf-8 -*-
def main():
abcd = sorted([int(input()) for _ in range(4)])
ef = sorted([int(input()) for _ in range(2)])
print(sum(abcd[1:] + ef[1:]))
if __name__ == '__main__':
main()
|
# This sample tests a series of nested loops containing variables
# with significant dependencies.
for val1 in range(10):
cnt1 = 4
for val2 in range(10 - val1):
cnt2 = 4
if val2 == val1:
cnt2 -= 1
for val3 in range(10 - val1 - val2):
cnt3 = 4
if val3 == val1:
cnt3 -= 1
if val3 == val2:
cnt3 -= 1
for val4 in range(10 - val1 - val2 - val3):
cnt4 = 4
if val4 == val1:
cnt4 -= 1
if val4 == val2:
cnt4 -= 1
if val4 == val3:
cnt4 -= 1
for val5 in range(10 - val1 - val2 - val3 - val4):
cnt5 = 4
if val5 == val1:
cnt5 -= 1
if val5 == val2:
cnt5 -= 1
if val5 == val3:
cnt5 -= 1
if val5 == val4:
cnt5 -= 1
val6 = 10 - val1 - val2 - val3 - val4 - val5
cnt6 = 4
if val6 == val1:
cnt6 -= 1
if val6 == val2:
cnt6 -= 1
if val6 == val3:
cnt6 -= 1
if val6 == val4:
cnt6 -= 1
if val6 == val5:
cnt6 -= 1
|
# https://app.codesignal.com/arcade/intro/level-2/bq2XnSr5kbHqpHGJC
def makeArrayConsecutive2(statues):
statues = sorted(statues)
res = 0
# Make elements of the array be consecutive. If there's a
# gap between two statues heights', then figure out how
# many extra statues have to be added so that all resulting
# statues increase in size by 1 unit.
for i in range(1, len(statues)):
res += statues[i] - statues[i-1] - 1
return res
|
# https://leetcode.com/problems/count-of-matches-in-tournament/
"""
Problem Description
You are given an integer n, the number of teams in a tournament that has strange rules:
If the current number of teams is even, each team gets paired with another team. A total of n / 2 matches are played, and n / 2 teams advance to the next round.
If the current number of teams is odd, one team randomly advances in the tournament, and the rest gets paired. A total of (n - 1) / 2 matches are played, and (n - 1) / 2 + 1 teams advance to the next round.
Return the number of matches played in the tournament until a winner is decided.
"""
class Solution:
def numberOfMatches(self, n: int) -> int:
count=0
while(n!=1):
if(n%2==0):
n = n//2
count+=n
else:
n-=1
n = n//2
count+=n
n+=1
return count
|
#28/07/2020
#Primeiro Repositório
#GitHub/VisualStudio
print('Testando Repositório 01') |
subdomain = 'srcc'
api_version = 'v1'
callback_url = 'http://localhost:4567/'
|
# Take the values
C = int(input())
A = int(input())
# calculate student trips
quociente = A // (C - 1)
# how many students are letf
resto = A % (C - 1)
# if there is a student left, you have +1 trip
if resto > 0:
quociente += 1
# Shows the value
print(quociente)
|
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################
class BaseCatalogueBackend(object):
"""Catalogue abstract base class"""
def remove_record(self, uuid):
"""Remove record from the catalogue"""
raise NotImplementedError()
def create_record(self, item):
"""Create record in the catalogue"""
raise NotImplementedError()
def get_record(self, uuid):
"""Get record from the catalogue"""
raise NotImplementedError()
def search_records(self, keywords, start, limit, bbox):
"""Search for records from the catalogue"""
raise NotImplementedError()
|
class BaseCreation(object):
"""
This class encapsulates all backend-specific differences that pertain to
database *creation*, such as the column types to use for particular Django
Fields.
"""
pass
|
class TechnicalSpecs(object):
def __init__(self):
self.__negative_format = None
self.__cinematographic_process = None
self.__link = None
@property
def negative_format(self):
return self.__negative_format
@negative_format.setter
def negative_format(self, negative_format):
self.__negative_format = negative_format
@property
def cinematographic_process(self):
return self.__cinematographic_process
@cinematographic_process.setter
def cinematographic_process(self, cinematographic_process):
self.__cinematographic_process = cinematographic_process
@property
def link(self):
return self.__link
@link.setter
def link (self, link):
self.__link = link
def __str__(self):
return "{Negative format: " + str(self.negative_format) + ", Cinematographic process: " + str(
self.cinematographic_process) + "}"
|
# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:versions.bzl", "version_to_name")
def _build_dar(
name,
package_name,
srcs,
data_dependencies,
sdk_version):
daml = "@daml-sdk-{sdk_version}//:daml".format(
sdk_version = sdk_version,
)
native.genrule(
name = name,
srcs = srcs + data_dependencies,
outs = ["%s.dar" % name],
tools = [daml],
cmd = """\
set -euo pipefail
TMP_DIR=$$(mktemp -d)
cleanup() {{ rm -rf $$TMP_DIR; }}
trap cleanup EXIT
mkdir -p $$TMP_DIR/src $$TMP_DIR/dep
for src in {srcs}; do
cp -L $$src $$TMP_DIR/src
done
DATA_DEPS=
for dep in {data_dependencies}; do
cp -L $$dep $$TMP_DIR/dep
DATA_DEPS="$$DATA_DEPS\n - dep/$$(basename $$dep)"
done
cat <<EOF >$$TMP_DIR/daml.yaml
sdk-version: {sdk_version}
name: {name}
source: src
version: 0.0.1
dependencies:
- daml-prim
- daml-script
data-dependencies:$$DATA_DEPS
EOF
$(location {daml}) build --project-root=$$TMP_DIR -o $$PWD/$(OUTS)
""".format(
daml = daml,
name = package_name,
data_dependencies = " ".join([
"$(location %s)" % dep
for dep in data_dependencies
]),
sdk_version = sdk_version,
srcs = " ".join([
"$(locations %s)" % src
for src in srcs
]),
),
)
def data_dependencies_coins(sdk_version):
"""Build the coin1 and coin2 packages with the given SDK version.
"""
_build_dar(
name = "data-dependencies-coin1-{sdk_version}".format(
sdk_version = sdk_version,
),
package_name = "data-dependencies-coin1",
srcs = ["//bazel_tools/data_dependencies:example/CoinV1.daml"],
data_dependencies = [],
sdk_version = sdk_version,
)
_build_dar(
name = "data-dependencies-coin2-{sdk_version}".format(
sdk_version = sdk_version,
),
package_name = "data-dependencies-coin2",
srcs = ["//bazel_tools/data_dependencies:example/CoinV2.daml"],
data_dependencies = [],
sdk_version = sdk_version,
)
def data_dependencies_upgrade_test(old_sdk_version, new_sdk_version):
"""Build and validate the coin-upgrade package using the new SDK version.
The package will have data-dependencies on the coin1 and coin2 package
built with the old SDK version.
"""
daml_new = "@daml-sdk-{sdk_version}//:daml".format(
sdk_version = new_sdk_version,
)
dar_name = "data-dependencies-upgrade-old-{old_sdk_version}-new-{new_sdk_version}".format(
old_sdk_version = old_sdk_version,
new_sdk_version = new_sdk_version,
)
_build_dar(
name = dar_name,
package_name = "data-dependencies-upgrade",
srcs = ["//bazel_tools/data_dependencies:example/UpgradeFromCoinV1.daml"],
data_dependencies = [
"data-dependencies-coin1-{sdk_version}".format(
sdk_version = old_sdk_version,
),
"data-dependencies-coin2-{sdk_version}".format(
sdk_version = old_sdk_version,
),
],
sdk_version = new_sdk_version,
)
native.sh_test(
name = "data-dependencies-test-old-{old_sdk_version}-new-{new_sdk_version}".format(
old_sdk_version = old_sdk_version,
new_sdk_version = new_sdk_version,
),
srcs = ["//bazel_tools/data_dependencies:validate_dar.sh"],
args = [
"$(rootpath %s)" % daml_new,
"$(rootpath %s)" % dar_name,
],
data = [daml_new, dar_name],
deps = ["@bazel_tools//tools/bash/runfiles"],
)
|
# package marker.
__version__ = "1.1b3"
__date__ = "Nov 23, 2017"
|
S=list(input())
S.reverse()
N=len(S)
R=[0]*N
R10=[0]*N
m=2019
K=0
R10[0]=1
R[0]=int(S[0])%m
for i in range(1,N):
R10[i]=(R10[i-1]*10)%m
R[i]=(R[i-1]+int(S[i])*R10[i])%m
d={}
for i in range(2019):
d[i]=0
for i in range(N):
d[R[i]]+=1
ans=0
for i in range(2019):
if i == 0:
ans += d[i]
ans +=d[i]*(d[i]-1)//2
else:
ans +=d[i]*(d[i]-1)//2
print(ans)
|
# -*- coding: utf-8 -*-
# Scrapy settings for dingdian project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
# http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
BOT_NAME = 'dingdian'
SPIDER_MODULES = ['dingdian.spiders']
NEWSPIDER_MODULE = 'dingdian.spiders'
# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'dingdian (+http://www.yourdomain.com)'
# Obey robots.txt rules
ROBOTSTXT_OBEY = True
# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS = 32
# Configure a delay for requests for the same website (default: 0)
# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
#CONCURRENT_REQUESTS_PER_IP = 16
# Disable cookies (enabled by default)
#COOKIES_ENABLED = False
# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False
# Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
# 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
# 'Accept-Language': 'en',
#}
# Enable or disable spider middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
# 'dingdian.middlewares.DingdianSpiderMiddleware': 543,
#}
# Enable or disable downloader middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
# 'dingdian.middlewares.MyCustomDownloaderMiddleware': 543,
#}
# Enable or disable extensions
# See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
#EXTENSIONS = {
# 'scrapy.extensions.telnet.TelnetConsole': None,
#}
# Configure item pipelines
# See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {
'dingdian.mysqlpipelines.pipelines.DingdianPipeline': 1,
}
# Enable and configure the AutoThrottle extension (disabled by default)
# See http://doc.scrapy.org/en/latest/topics/autothrottle.html
#AUTOTHROTTLE_ENABLED = True
# The initial download delay
#AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False
# Enable and configure HTTP caching (disabled by default)
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
HTTPCACHE_ENABLED = True
HTTPCACHE_EXPIRATION_SECS = 0
HTTPCACHE_DIR = 'httpcache'
HTTPCACHE_IGNORE_HTTP_CODES = []
HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
MYSQL_HOSTS = '127.0.0.1'
MYSQL_USER = 'jesse'
MYSQL_PASSWORD = 'dqzgfjsxzjf'
MYSQL_PORT = '3306'
MYSQL_DB = 'dingdian'
create_table_name = """
DROP TABLE IF EXISTS `dd_name`;
CREATE TABLE `dd_name` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`xs_name` varchar(255) DEFAULT NULL,
`xs_author` varchar(255) DEFAULT NULL,
`category` varchar(255) DEFAULT NULL,
`name_id` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4;
"""
create_table_content = """
DROP TABLE IF EXISTS `dd_chaptername`;
CREATE TABLE `dd_chaptername` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`xs_chaptername` varchar(255) DEFAULT NULL,
`xs_content` text,
`id_name` int(11) DEFAULT NULL,
`num_id` int(11) DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB AUTO_INCREMENT=2726 DEFAULT CHARSET=gb18030;
SET FOREIGN_KEY_CHECKS=1;
""" |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 1 18:05:45 2017
@author: Jonas <[email protected]>
"""
def linearSearch(data:list, item):
"""
Algoritmo de busca linear.
"""
for k, v in enumerate(data):
if v == item:
return(k)
return(-1) # não encontrado.
## TESTES
#
data = [2,5,6,7,6,3,2,5,5,3454,45,2,234,2,2487,687,68,76,8678,76,4324,23]
searches = [234, 500]
for search in searches:
p = linearSearch(data, search)
msg = '{} foi encontrado na posição {}.' if p >= 0 else '{} não foi encontrado (resultado {})'
print(msg.format(search, p)) |
class Solution(object):
def maxProduct(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
# Runtime: 40 ms
# Memory: 13.5 MB
max_ = -1
second_max = -1
for num in nums:
if num > max_:
max_, second_max = num, max_
elif num > second_max:
second_max = num
return (max_ - 1) * (second_max - 1)
|
# coding=utf-8
config_templates = {
'main': '',
'jails': 'enable = true\n',
'actions': """
# Fail2Ban configuration file
#
# Author:
#
#
[Definition]
# Option: actionstart
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart =
# Option: actionstop
# Notes.: command executed once at the end of Fail2Ban
# Values: CMD
#
actionstop =
# Option: actioncheck
# Notes.: command executed once before each actionban command
# Values: CMD
#
actioncheck =
# Option: actionban
# Notes.: command executed when banning an IP. Take care that the
# command is executed with Fail2Ban user rights.
# Tags: See jail.conf(5) man page
# Values: CMD
#
actionban =
# Option: actionunban
# Notes.: command executed when unbanning an IP. Take care that the
# command is executed with Fail2Ban user rights.
# Tags: See jail.conf(5) man page
# Values: CMD
#
actionunban =
[Init]
# Option: port
# Notes.: specifies port to monitor
# Values: [ NUM | STRING ]
#
port =
# Option: localhost
# Notes.: the local IP address of the network interface
# Values: IP
#
localhost = 127.0.0.1
# Option: blocktype
# Notes.: How to block the traffic. Use a action from man 5 ipfw
# Common values: deny, unreach port, reset
# Values: STRING
#
blocktype = unreach port
""",
'filters': '# Fail2Ban filter\n[INCLUDES]\nbefore =\nafter =\n[Definition]\nfailregex =\n\nignoreregex =\n#Autor:',
'extra': ''
} |
# The MIT License (MIT)
#
# Copyright (c) 2017 Paul Sokolovsky
# Modified by Brent Rubell for Adafruit Industries, 2019
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""
`_sha512.py`
======================================================
SHA-512 Hash Algorithm, this code was ported from
CPython's sha512module.c.
* Author(s): Paul Sokolovsky, Brent Rubell
"""
# pylint: disable=invalid-name, unnecessary-lambda, missing-docstring, line-too-long
# SHA Block size and message digest sizes, in bytes.
SHA_BLOCKSIZE = 128
SHA_DIGESTSIZE = 64
def new_shaobject():
"""Struct. for storing SHA information."""
return {
'digest': [0]*8,
'count_lo': 0,
'count_hi': 0,
'data': [0]* SHA_BLOCKSIZE,
'local': 0,
'digestsize': 0
}
# Various logical functions
ROR64 = lambda x, y: (((x & 0xffffffffffffffff) >> (y & 63)) | (x << (64 - (y & 63)))) & 0xffffffffffffffff
Ch = lambda x, y, z: (z ^ (x & (y ^ z)))
Maj = lambda x, y, z: (((x | y) & z) | (x & y))
S = lambda x, n: ROR64(x, n)
R = lambda x, n: (x & 0xffffffffffffffff) >> n
Sigma0 = lambda x: (S(x, 28) ^ S(x, 34) ^ S(x, 39))
Sigma1 = lambda x: (S(x, 14) ^ S(x, 18) ^ S(x, 41))
Gamma0 = lambda x: (S(x, 1) ^ S(x, 8) ^ R(x, 7))
Gamma1 = lambda x: (S(x, 19) ^ S(x, 61) ^ R(x, 6))
# pylint: disable=protected-access, too-many-statements
def sha_transform(sha_info):
W = []
d = sha_info['data']
for i in range(0, 16):
W.append((d[8*i]<<56) + (d[8*i+1]<<48) + (d[8*i+2]<<40) + (d[8*i+3]<<32) + (d[8*i+4]<<24) + (d[8*i+5]<<16) + (d[8*i+6]<<8) + d[8*i+7])
for i in range(16, 80):
W.append((Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]) & 0xffffffffffffffff)
ss = sha_info['digest'][:]
# pylint: disable=line-too-long, too-many-arguments
def RND(a, b, c, d, e, f, g, h, i, ki):
t0 = (h + Sigma1(e) + Ch(e, f, g) + ki + W[i]) & 0xffffffffffffffff
t1 = (Sigma0(a) + Maj(a, b, c)) & 0xffffffffffffffff
d = (d + t0) & 0xffffffffffffffff
h = (t0 + t1) & 0xffffffffffffffff
return d & 0xffffffffffffffff, h & 0xffffffffffffffff
ss[3], ss[7] = RND(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 0, 0x428a2f98d728ae22)
ss[2], ss[6] = RND(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 1, 0x7137449123ef65cd)
ss[1], ss[5] = RND(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 2, 0xb5c0fbcfec4d3b2f)
ss[0], ss[4] = RND(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 3, 0xe9b5dba58189dbbc)
ss[7], ss[3] = RND(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 4, 0x3956c25bf348b538)
ss[6], ss[2] = RND(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 5, 0x59f111f1b605d019)
ss[5], ss[1] = RND(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 6, 0x923f82a4af194f9b)
ss[4], ss[0] = RND(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 7, 0xab1c5ed5da6d8118)
ss[3], ss[7] = RND(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 8, 0xd807aa98a3030242)
ss[2], ss[6] = RND(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 9, 0x12835b0145706fbe)
ss[1], ss[5] = RND(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 10, 0x243185be4ee4b28c)
ss[0], ss[4] = RND(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 11, 0x550c7dc3d5ffb4e2)
ss[7], ss[3] = RND(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 12, 0x72be5d74f27b896f)
ss[6], ss[2] = RND(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 13, 0x80deb1fe3b1696b1)
ss[5], ss[1] = RND(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 14, 0x9bdc06a725c71235)
ss[4], ss[0] = RND(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 15, 0xc19bf174cf692694)
ss[3], ss[7] = RND(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 16, 0xe49b69c19ef14ad2)
ss[2], ss[6] = RND(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 17, 0xefbe4786384f25e3)
ss[1], ss[5] = RND(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 18, 0x0fc19dc68b8cd5b5)
ss[0], ss[4] = RND(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 19, 0x240ca1cc77ac9c65)
ss[7], ss[3] = RND(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 20, 0x2de92c6f592b0275)
ss[6], ss[2] = RND(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 21, 0x4a7484aa6ea6e483)
ss[5], ss[1] = RND(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 22, 0x5cb0a9dcbd41fbd4)
ss[4], ss[0] = RND(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 23, 0x76f988da831153b5)
ss[3], ss[7] = RND(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 24, 0x983e5152ee66dfab)
ss[2], ss[6] = RND(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 25, 0xa831c66d2db43210)
ss[1], ss[5] = RND(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 26, 0xb00327c898fb213f)
ss[0], ss[4] = RND(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 27, 0xbf597fc7beef0ee4)
ss[7], ss[3] = RND(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 28, 0xc6e00bf33da88fc2)
ss[6], ss[2] = RND(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 29, 0xd5a79147930aa725)
ss[5], ss[1] = RND(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 30, 0x06ca6351e003826f)
ss[4], ss[0] = RND(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 31, 0x142929670a0e6e70)
ss[3], ss[7] = RND(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 32, 0x27b70a8546d22ffc)
ss[2], ss[6] = RND(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 33, 0x2e1b21385c26c926)
ss[1], ss[5] = RND(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 34, 0x4d2c6dfc5ac42aed)
ss[0], ss[4] = RND(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 35, 0x53380d139d95b3df)
ss[7], ss[3] = RND(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 36, 0x650a73548baf63de)
ss[6], ss[2] = RND(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 37, 0x766a0abb3c77b2a8)
ss[5], ss[1] = RND(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 38, 0x81c2c92e47edaee6)
ss[4], ss[0] = RND(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 39, 0x92722c851482353b)
ss[3], ss[7] = RND(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 40, 0xa2bfe8a14cf10364)
ss[2], ss[6] = RND(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 41, 0xa81a664bbc423001)
ss[1], ss[5] = RND(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 42, 0xc24b8b70d0f89791)
ss[0], ss[4] = RND(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 43, 0xc76c51a30654be30)
ss[7], ss[3] = RND(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 44, 0xd192e819d6ef5218)
ss[6], ss[2] = RND(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 45, 0xd69906245565a910)
ss[5], ss[1] = RND(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 46, 0xf40e35855771202a)
ss[4], ss[0] = RND(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 47, 0x106aa07032bbd1b8)
ss[3], ss[7] = RND(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 48, 0x19a4c116b8d2d0c8)
ss[2], ss[6] = RND(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 49, 0x1e376c085141ab53)
ss[1], ss[5] = RND(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 50, 0x2748774cdf8eeb99)
ss[0], ss[4] = RND(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 51, 0x34b0bcb5e19b48a8)
ss[7], ss[3] = RND(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 52, 0x391c0cb3c5c95a63)
ss[6], ss[2] = RND(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 53, 0x4ed8aa4ae3418acb)
ss[5], ss[1] = RND(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 54, 0x5b9cca4f7763e373)
ss[4], ss[0] = RND(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 55, 0x682e6ff3d6b2b8a3)
ss[3], ss[7] = RND(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 56, 0x748f82ee5defb2fc)
ss[2], ss[6] = RND(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 57, 0x78a5636f43172f60)
ss[1], ss[5] = RND(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 58, 0x84c87814a1f0ab72)
ss[0], ss[4] = RND(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 59, 0x8cc702081a6439ec)
ss[7], ss[3] = RND(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 60, 0x90befffa23631e28)
ss[6], ss[2] = RND(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 61, 0xa4506cebde82bde9)
ss[5], ss[1] = RND(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 62, 0xbef9a3f7b2c67915)
ss[4], ss[0] = RND(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 63, 0xc67178f2e372532b)
ss[3], ss[7] = RND(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 64, 0xca273eceea26619c)
ss[2], ss[6] = RND(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 65, 0xd186b8c721c0c207)
ss[1], ss[5] = RND(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 66, 0xeada7dd6cde0eb1e)
ss[0], ss[4] = RND(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 67, 0xf57d4f7fee6ed178)
ss[7], ss[3] = RND(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 68, 0x06f067aa72176fba)
ss[6], ss[2] = RND(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 69, 0x0a637dc5a2c898a6)
ss[5], ss[1] = RND(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 70, 0x113f9804bef90dae)
ss[4], ss[0] = RND(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 71, 0x1b710b35131c471b)
ss[3], ss[7] = RND(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 72, 0x28db77f523047d84)
ss[2], ss[6] = RND(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 73, 0x32caab7b40c72493)
ss[1], ss[5] = RND(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 74, 0x3c9ebe0a15c9bebc)
ss[0], ss[4] = RND(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 75, 0x431d67c49c100d4c)
ss[7], ss[3] = RND(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 76, 0x4cc5d4becb3e42b6)
ss[6], ss[2] = RND(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 77, 0x597f299cfc657e2a)
ss[5], ss[1] = RND(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 78, 0x5fcb6fab3ad6faec)
ss[4], ss[0] = RND(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 79, 0x6c44198c4a475817)
# Feedback
dig = []
for i, x in enumerate(sha_info['digest']):
dig.append((x + ss[i]) & 0xffffffffffffffff)
sha_info['digest'] = dig
def sha_init():
"""Initialize the SHA digest."""
sha_info = new_shaobject()
sha_info['digest'] = [0x6a09e667f3bcc908, 0xbb67ae8584caa73b,
0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1,
0x510e527fade682d1, 0x9b05688c2b3e6c1f,
0x1f83d9abfb41bd6b, 0x5be0cd19137e2179]
sha_info['count_lo'] = 0
sha_info['count_hi'] = 0
sha_info['local'] = 0
sha_info['digestsize'] = 64
return sha_info
def sha384_init():
"""Initialize a SHA384 digest."""
sha_info = new_shaobject()
sha_info['digest'] = [0xcbbb9d5dc1059ed8, 0x629a292a367cd507,
0x9159015a3070dd17, 0x152fecd8f70e5939,
0x67332667ffc00b31, 0x8eb44a8768581511,
0xdb0c2e0d64f98fa7, 0x47b5481dbefa4fa4]
sha_info['count_lo'] = 0
sha_info['count_hi'] = 0
sha_info['local'] = 0
sha_info['digestsize'] = 48
return sha_info
def getbuf(s):
if isinstance(s, str):
return s.encode('ascii')
return bytes(s)
def sha_update(sha_info, buffer):
"""Update the SHA digest.
:param dict sha_info: SHA Digest.
:param str buffer: SHA buffer size.
"""
if isinstance(buffer, str):
raise TypeError("Unicode strings must be encoded before hashing")
count = len(buffer)
buffer_idx = 0
clo = (sha_info['count_lo'] + (count << 3)) & 0xffffffff
if clo < sha_info['count_lo']:
sha_info['count_hi'] += 1
sha_info['count_lo'] = clo
sha_info['count_hi'] += (count >> 29)
if sha_info['local']:
i = SHA_BLOCKSIZE - sha_info['local']
if i > count:
i = count
# copy buffer
for x in enumerate(buffer[buffer_idx:buffer_idx+i]):
sha_info['data'][sha_info['local']+x[0]] = x[1]
count -= i
buffer_idx += i
sha_info['local'] += i
if sha_info['local'] == SHA_BLOCKSIZE:
sha_transform(sha_info)
sha_info['local'] = 0
else:
return
while count >= SHA_BLOCKSIZE:
# copy buffer
sha_info['data'] = list(buffer[buffer_idx:buffer_idx + SHA_BLOCKSIZE])
count -= SHA_BLOCKSIZE
buffer_idx += SHA_BLOCKSIZE
sha_transform(sha_info)
# copy buffer
pos = sha_info['local']
sha_info['data'][pos:pos+count] = list(buffer[buffer_idx:buffer_idx + count])
sha_info['local'] = count
def sha_final(sha_info):
"""Finish computing the SHA Digest."""
lo_bit_count = sha_info['count_lo']
hi_bit_count = sha_info['count_hi']
count = (lo_bit_count >> 3) & 0x7f
sha_info['data'][count] = 0x80
count += 1
if count > SHA_BLOCKSIZE - 16:
# zero the bytes in data after the count
sha_info['data'] = sha_info['data'][:count] + ([0] * (SHA_BLOCKSIZE - count))
sha_transform(sha_info)
# zero bytes in data
sha_info['data'] = [0] * SHA_BLOCKSIZE
else:
sha_info['data'] = sha_info['data'][:count] + ([0] * (SHA_BLOCKSIZE - count))
sha_info['data'][112] = 0
sha_info['data'][113] = 0
sha_info['data'][114] = 0
sha_info['data'][115] = 0
sha_info['data'][116] = 0
sha_info['data'][117] = 0
sha_info['data'][118] = 0
sha_info['data'][119] = 0
sha_info['data'][120] = (hi_bit_count >> 24) & 0xff
sha_info['data'][121] = (hi_bit_count >> 16) & 0xff
sha_info['data'][122] = (hi_bit_count >> 8) & 0xff
sha_info['data'][123] = (hi_bit_count >> 0) & 0xff
sha_info['data'][124] = (lo_bit_count >> 24) & 0xff
sha_info['data'][125] = (lo_bit_count >> 16) & 0xff
sha_info['data'][126] = (lo_bit_count >> 8) & 0xff
sha_info['data'][127] = (lo_bit_count >> 0) & 0xff
sha_transform(sha_info)
dig = []
for i in sha_info['digest']:
dig.extend([((i>>56) & 0xff), ((i>>48) & 0xff), ((i>>40) & 0xff), ((i>>32) & 0xff), ((i>>24) & 0xff), ((i>>16) & 0xff), ((i>>8) & 0xff), (i & 0xff)])
return bytes(dig)
# pylint: disable=protected-access
class sha512():
digest_size = digestsize = SHA_DIGESTSIZE
block_size = SHA_BLOCKSIZE
name = "sha512"
def __init__(self, s=None):
"""Constructs a SHA512 hash object.
"""
self._sha = sha_init()
if s:
sha_update(self._sha, getbuf(s))
def update(self, s):
"""Updates the hash object with a bytes-like object, s."""
sha_update(self._sha, getbuf(s))
def digest(self):
"""Returns the digest of the data passed to the update()
method so far."""
return sha_final(self._sha.copy())[:self._sha['digestsize']]
def hexdigest(self):
"""Like digest() except the digest is returned as a string object of
double length, containing only hexadecimal digits.
"""
return ''.join(['%.2x' % i for i in self.digest()])
def copy(self):
"""Return a copy (“clone”) of the hash object.
"""
new = sha512()
new._sha = self._sha.copy()
return new
# pylint: disable=protected-access, super-init-not-called
class sha384(sha512):
digest_size = digestsize = 48
name = "sha384"
def __init__(self, s=None):
"""Constructs a SHA224 hash object.
"""
self._sha = sha384_init()
if s:
sha_update(self._sha, getbuf(s))
def copy(self):
"""Return a copy (“clone”) of the hash object.
"""
new = sha384()
new._sha = self._sha.copy()
return new
|
"""
Copyright (c) 2022 Adam Lisichin, Hubert Decyusz, Wojciech Nowicki, Gustaw Daczkowski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
author: Hubert Decyusz
description: Package contains structure and functionality of Examination model including:
- model definition
- viewset
- serializers
- api endpoints
- unit tests
structure:
- migrations/ # migrations package
- tests/ # unit tests package
- __init__.py
- test_api_views.py # unit tests of endpoints, views, serializers within examinations app
- __init__.py
- admin.py # registration of Examination model and its admin with custom form
# in admin interface
- apps.py # examinations app config
- models.py # definition of Examination model
- serializers.py # model serializers (CRUD, data representation and validation)
- swagger.py # auxiliary serializers used in Swagger documentation
- urls.py # mapping examination viewset to endpoints
- views.py # examination viewset with extra action (CRUD + starting/checking inference)
"""
|
# this works, but has the argument order dependency problem
class Rectangle:
def __init__(self, width, height):
self.height = height
self.width = width
def area(self):
return self.height * self.width
def perimeter(self):
return (2 * self.height) + (2 * self.width)
x = Rectangle(4, 4)
print(x.width)
print(x.area())
print(x.perimeter())
|
"""
Given a tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree,
and every node has no left child and only 1 right child.
Example 1:
Input: [5,3,6,2,4,null,8,1,null,null,null,7,9]
5
/ \
3 6
/ \ \
2 4 8
/ / \
1 7 9
Output: [1,null,2,null,3,null,4,null,5,null,6,null,7,null,8,null,9]
1
\
2
\
3
\
4
\
5
\
6
\
7
\
8
\
9
"""
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def increasingBST(self, root):
prev = None
def play(root):
if not root:
return root
play(root.right)
root.right = prev
prev = root
play(root.left)
root.left = None
play(root)
return prev
raw_tree = iter([5, 3, 6, 2, 4, None, 8, 1, None, None, None, 7, 9])
def construct():
try:
val = next(raw_tree)
except Exception as e:
return
if not val:
return None
root = TreeNode(val)
root.left = construct()
root.right = construct()
return root
tree = construct()
def depth(root):
if not root:
print('None')
return
print(root.val)
depth(root.left)
depth(root.right)
result = Solution().increasingBST(tree)
depth(result)
|
#143
# Time: O(n)
# Space: O(1)
# Given a singly linked list L: L0→L1→…→Ln-1→Ln,
# reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
#
# You must do this in-place without altering the nodes' values.
#
# For example,
# Given {1,2,3,4}, reorder it to {1,4,2,3}.
class ListNode():
def __init__(self,val):
self.val=val
self.next=None
def __repr__(self):
return '{}->{}'.format(self.val,repr(self.next))
class listSol():
def reorderList(self,head):
slow,fast=head,head
while fast and fast.next:
prev,fast,slow=slow,fast.next.next,slow.next
prev.next=None
while slow:
prev.next,slow.next,slow=slow,prev.next,slow.next
head2,prev.next=prev.next,None
dummy=ListNode(-1)
cur=dummy
while head and head2:
cur.next,head=head,head.next
cur=cur.next
cur.next,head2=head2,head2.next
cur=cur.next
cur.next=head or head2
return dummy.next
|
"""
┌─┐┌─┐┬ ┌┬┐┌─┐┬─┐┌─┐┬ ┌─┐┬ ┬ ┌┐ ┬ ┬ ┬ ┬┬ ┬┬─┐┬ ┌─┐┌┐┌┬┌─┌─┐
├┤ │ ││ ││├┤ ├┬┘├─┘│ ├─┤└┬┘ ├┴┐└┬┘ ├─┤│ │├┬┘│ ├┤ │││├┴┐│ │
└ └─┘┴─┘─┴┘└─┘┴└─┴ ┴─┘┴ ┴ ┴ └─┘ ┴ ┴ ┴└─┘┴└─┴─┘└─┘┘└┘┴ ┴└─┘
"""
__title__ = "folderplay"
__description__ = "Remember watched tv episodes, resume from where you left off"
__url__ = "https://github.com/hurlenko/folderplay"
__version__ = "0.4.2"
__author__ = "Hurlenko"
__license__ = "MIT"
__copyright__ = "Copyright 2019 Hurlenko"
|
# -*- coding: utf-8 -*-
# --------------------------------------
# tree_from_shot.py
#
# MDSplus Python project
# for CTH data access
#
# tree_from_shot --- returns the CTH MDSplus tree associated with the
# given shot number
#
# Parameters:
# shotnum - integer - the shotnumber to open
# Returns:
# tree - the cth tree for shotnum
#
# Example:
# mytree=tree_from_shot(shotnum)
#
#
#
# Greg Hartwell
# 2016-12-16
#------------------
def tree_from_shot(shotnum):
shotString=str(shotnum)
tree= 't'+shotString[0:6]
return tree
#----------------------------------------------------------------------------- |
class TreeNode(object):
def __init__(self,x):
"""
:type val: int
:type left: TreeNode or None
:type right: TreeNode or None
"""
self.val = x #設定當前值為x
self.left = None #初始當前值左右沒有節點
self.right = None
class Solution(object):
def FindMin(self,root): #設定一個查找最小值的function
if root.left:
return Solution().FindMin(root.left)
else:
return root
def preorder(self,root,arr): #設定一個可以遍歷的function
if root == None:
return arr
else:
arr.append(root.val) #如果root存在,把值append到array裡面
if root.left != None: #如果左節點存在,recursive
Solution().preorder(root.left,arr)
if root.right != None: #如果右節點存在,recursive
Solution().preorder(root.right,arr)
return arr
def insert(self, root, val):
"""
:type root: TreeNode
:type val: int
:rtype: TreeNode(inserted node)
"""
if root == None:
root =TreeNode(val)
return root
# if val <= root.val: #考慮重複值的insert,把它insert到離root最近的地方
# SameNode = TreeNode(val) #創建重複值的節點
# SameNode.left = root.left #重複值的左指針指向原本root的左節點
#root.left = SameNode #現在的root的左節點指向重複值節點
#return SameNode
elif val<=root.val:
if root.left:
return Solution().insert(root.left, val)
else:
root.left = TreeNode(val)
return root
else:
if root.right:
return Solution().insert(root.right,val)
else:
root.right = TreeNode(val)
return root
def search(self, root, target):
"""
:type root: TreeNode
:type target: int
:rtype: TreeNode(searched node)
"""
if target == root.val:
return root
while root.right or root.left: #如果左節點不存在或者右節點不存在
if target > root.val:
return Solution().search(root.right,target)
else:
return Solution().search(root.left,target)
return None
def delete(self, root, target):
"""
:type root: TreeNode
:type target: int
:rtype: None Do not return anything, delete nodes(maybe more than more) instead.(cannot search())
"""
if Solution().search(root,target) != None:
if target == root.val: #當刪去的節點是根節點時
if root.right == None and root.left: #當根節點只有左節點時
root = root.left
return root
elif root.left == None and root.right: #當根節點只有右節點時
root = root.right
return root
elif root.right == None and root.left == None: #當根節點沒有左右節點,即樹裡只有根節點
root = None
return root
else: #當根節點左右兩點都有時
minnode = self.FindMin(root.right)
y = minnode.val
root = y
if minnode.right:
z = minnode.right
del minnode.right
minnode = z
else:
del minnode
else: #當刪去的節點不是根節點時,即target != root.val
if target<=root.val:
self.delete(root.left,target)
else:
self.delete(root.right,target)
return root
else:
return root
def modify(self,root,target,new_val):
if target != new_val:
self.insert(root,new_val)
return Solution().delete(root,target)
else:
return root
#參考資料:https://blog.csdn.net/sinat_41029600/article/details/81878957
#https://blog.csdn.net/u011608357/article/details/35785553
|
k,n=map(int,input().split());a=[int(i+1) for i in range(k)]
for _ in range(n):
s,e,m=map(int,input().split())
b0=a[:s-1];b1=a[s-1:e];b2=a[e:];a=[]
l=b1[:m-s];r=b1[m-s:];b1=r+l
a=b0+b1+b2
r=""
for i in a:
r+=str(i)+' '
print(r)
|
__author__ = 'Masataka'
class IFileParser:
def __init__(self):
pass
def getparam(self):
pass
def getJob(self):
pass
|
# -*- encoding: utf-8
def func(x, y):
return x + y
def test_example():
assert func(1, 2) == 3
|
#!/usr/bin/env python
class EnogList():
"""
Object that stores the orthologous groups and their weights (if applicable)
"""
def __init__(self, enog_list, enog_dict):
"""
at initialization, the "EnogList" sorts the information that is required later. i.e. the dictionary of weights
as used in completeness/contamination calculation. Additionally all used OGs (from the parameter enog_list) make
up the total maximal weight (self.total)
:param enog_list: a list of orthoglogous groups
:param enog_dict: a dictionary containing all information from the weights file per orthologous group
"""
self.weights={}
self.enogs=enog_list[:]
self.total=0
for enog in self.enogs:
if not enog_dict.get(enog):
self.weights[enog] = 1
else:
percent_presence=enog_dict[enog].get("%present", 1)
average_count=enog_dict[enog].get("av.count_if_present", 1)
self.weights[enog]=float(percent_presence)/float(average_count)
self.total=self.total+self.weights[enog]
def get_weight(self, enog):
"""
:param enog: id of the orthologous group
:return: specific weight for the orthologous group id
"""
weight=self.weights.get(enog, 0)
return weight
def get_total(self):
"""
:return: total maximal score that can be reached (sum of weights)
"""
return self.total
def get_dict(self):
"""
:return: dictionary of weights as calculated
"""
return self.weights
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
###
# MIT License
#
# Copyright (c) 2021 Yi-Sheng, Kang (Eason Kang)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
###
### Declaration
# Remote service data
service = data.get('service')
[service_domain, service_name] = service.split('.')
service_data_decrease = data.get('service_data_decrease')
service_data_increase = data.get('service_data_increase')
# Fan speed data
speed_percentage = data.get('percentage')
speed_count = data.get('speed_count')
fan_speed_entity_id = data.get('speed_entity_id')
fan_speed_entity = hass.states.get(fan_speed_entity_id)
fan_entity_id = data.get('entity_id')
fan_entity = hass.states.get(fan_entity_id)
logger.debug('<remote_fan_speed_control> fan state ({})'.format(fan_entity.state))
logger.debug('<remote_fan_speed_control> Received fan speed from ({}) to ({})'.format(fan_speed_entity.state,
speed_percentage))
### Utilities
def check_speed(logger, speed):
if speed is None:
logger.warning('<remote_fan_speed_control> Received fan speed is invalid (None)'
)
return False
if fan_entity.state == 'off':
logger.debug('<remote_fan_speed_control> call fan on')
hass.services.call('fan', 'turn_on',
{'entity_id': fan_entity_id})
return True
### Main
if check_speed(logger, speed_percentage):
speed_step = 100 // speed_count
target_speed = int(speed_percentage) // speed_step
last_speed_state = \
(fan_speed_entity.state if fan_speed_entity.state.isdigit() else 0)
last_speed = int(last_speed_state) // speed_step
speed_max = speed_count
if target_speed > last_speed:
loop = increase_loop = target_speed - last_speed
service_data = service_data_increase
if target_speed == 0:
loop = loop - 1
elif target_speed < last_speed:
if target_speed == 0:
loop = 0
hass.services.call('fan', 'turn_off',
{'entity_id': fan_entity_id})
else:
loop = last_speed - target_speed
service_data = service_data_decrease
else:
loop = 0
# update speed state
if target_speed > 0:
hass.states.set(fan_speed_entity_id, speed_percentage)
# Call service
if data.get('support_num_repeats', False):
service_data['num_repeats'] = loop
logger.debug('<remote_fan_speed_control> call service ({}.{}) {}'.format(service_domain,
service_name, service_data))
hass.services.call(service_domain, service_name, service_data)
else:
for i in range(loop):
logger.debug('<remote_fan_speed_control> call service ({}.{}) {}'.format(service_domain,
service_name, service_data))
result = hass.services.call(service_domain, service_name,
service_data)
time.sleep(1)
else:
if fan_entity.state == 'off':
logger.debug('<remote_fan_speed_control> call fan on')
hass.services.call('fan', 'turn_on',
{'entity_id': fan_entity_id})
else:
if speed_percentage == 'off':
logger.debug('<remote_fan_speed_control> call fan off')
hass.services.call('fan', 'turn_off',
{'entity_id': fan_entity_id}) |
# -*- coding=utf-8 -*-
class MessageInfo:
def __init__(self, msgFlag, msgBody):
self.msgFlag = msgFlag
self.msgReServe = 0
msgBody = msgBody.encode(encoding='utf-8')
# msgBody = bytes(msgBody, encoding='utf-8')
self.msgBodySize = msgBody.__len__()
self.msgBody = msgBody
def getMsg(arg):
pass
def createMsg(msgFlag=1001, msgBody=None):
if msgBody == None:
return
# fmt = defaultFmt.format(len(msgBody))
fmt = defaultFmt % (len(msgBody))
print('%s -> {%d %s}' % (fmt, msgFlag, msgBody))
msgInfo = MessageInfo(msgFlag, msgBody)
print(msgInfo.msgFlag, msgInfo.msgReServe, msgInfo.msgBodySize, msgInfo.msgBody)
if __name__ == '__main__':
# defaultFmt = '<HHi{0}s'
defaultFmt = '<HHi%ds'
msg = 'hello'
createMsg(1001, msg)
createMsg(1002, "world!")
createMsg(1003, None)
createMsg(1005, 'codyguo')
# msginfo = MssageInfo(msgFlag=1001, msgBody='hi codyguo')
# print(msginfo.msgFlag, msginfo.msgBody)
|
"""Role testing files using testinfra"""
def test_login_user(host):
"""Check login user"""
g = host.group("berry")
assert g.exists
u = host.user("rasp")
assert u.exists
assert u.group == "berry"
f = host.file("/home/rasp/.ssh/authorized_keys")
assert f.is_file
public_key = "ssh-ed25519 RASPI"
assert public_key in f.content_string
def test_sudoers_config(host):
"""Check sudoers config"""
f = host.file("/etc/sudoers.d/99_login")
assert f.is_file
def test_root_user(host):
"""Check root user"""
u = host.user("root")
assert u.password == "*"
f = host.file("/root/.ssh/authorized_keys")
assert f.exists is False
def test_pi_user(host):
"""Check pi user"""
u = host.user("pi")
assert u.password == "*"
f = host.file("/home/pi/.ssh/authorized_keys")
assert f.exists is False
|
"""This module implements Zaim CSV format."""
# Reason: Guarding for the future when it comes to calculating constants
# pylint: disable=too-few-public-methods
class ZaimCsvFormat:
"""This class implements Zaim CSV format."""
HEADER = [
"日付",
"方法",
"カテゴリ",
"カテゴリの内訳",
"支払元",
"入金先",
"品目",
"メモ",
"お店",
"通貨",
"収入",
"支出",
"振替",
"残高調整",
"通貨変換前の金額",
"集計の設定",
]
CATEGORY_LARGE_EMPTY = "-"
CATEGORY_SMALL_EMPTY = "-"
CASH_FLOW_SOURCE_EMPTY = ""
CASH_FLOW_TARGET_EMPTY = ""
AMOUNT_INCOME_EMPTY = 0
AMOUNT_PAYMENT_EMPTY = 0
AMOUNT_TRANSFER_EMPTY = 0
STORE_NAME_EMPTY = ""
ITEM_NAME_EMPTY = ""
NOTE_EMPTY = ""
CURRENCY_EMPTY = ""
BALANCE_ADJUSTMENT_EMPTY = ""
AMOUNT_BEFORE_CURRENCY_CONVERSION_EMPTY = ""
SETTING_AGGREGATE_EMPTY = ""
|
guest_list = ["Shantopriyo Bhowmick", "Jordan B Peterson", "Mayuri B Upadhaya", "Deblina Bhowmick", "Sandeep Goswami", "Soumen Goswami"]
print(f"Hi my dear brother{guest_list[0].title()}, Hope your killing it wherever you are. Come join me for a dinner. Meet people i like the most")
print(f"Hi professor {guest_list[1].title()} why don't you bless us with your divine presence & see for once who all your words get to affect")
print(f"My baby {guest_list[2]}, meet the most important folks in my life")
print(f"Hi mom {guest_list[3]}, bless everyone on the table with your grace & nature.")
print(f" My best friends{guest_list[-1], guest_list[-2]}, see the world laid out in a table")
print(f" My friend {guest_list.pop()} can't make it beacause he is not done styling his hair.")
guest_list.append("Shrinjit Dash")
guest_list.pop(1)
print(guest_list)
guest_list.pop(1)
guest_list.pop()
guest_list.pop()
print(guest_list)
del guest_list[0]
del guest_list[0]
print(guest_list)
|
class Participation:
def __init__(self, id, tournament_id, player_id):
self.id = id
self.tournament_id = tournament_id
self.player_id = player_id
@staticmethod
def build(attributes):
return Participation(
id=attributes['id'],
tournament_id=attributes['tournament_id'],
player_id=attributes['player_id']
)
|
def sumNums(n: int) -> int:
return sum(range(1, n + 1))
def sumNums(n: int) -> int:
# python的and操作如果最后结果为真,返回最后一个表达式的值,or操作如果结果为真,返回第一个结果为真的表达式的值
return n and n + sumNums(n - 1)
|
class NoisePageMetadata(object):
""" This class is the model of the NoisePage metadata as it is represented by the HTTP API """
def __init__(self, db_version):
self.db_version = db_version
|
"""
pbs package
"""
__all__ = ["main", "build", "lookup"]
|
##
## Some global settings constants
##
# The amount of inactivity (in milliseconds) that must elapse
# before the badge will consider going into standby. If set to
# zero then the badge will never attempt to sleep.
sleeptimeout = 900000
# The default banner message to print in the scroll.py animation.
banner = "DEFCON Furs"
# Enable extra verbose debug messages.
debug = False
# The animation to play at boot.
bootanim = "scroll"
# Whether the maze animation should autosolve.
mazesolver = True
# The base cooldown timing (in seconds) for BLE messages,
# which is applied to special beacons received with a high RSSI.
# Beacons with weaker signals are subject to a cooldown which
# will be a multiple of this time.
blecooldown = 60
# Default boop detection is done using the capacative touch
# detection on the nose (0), but we can also move the detection
# to use the capacative touch on the teeth (1).
boopselect = 0
# Default color selection that animations should use unless there
# is something more specific provided by the animation logic.
color = 0xffffff
|
class IncentivizeLearningRate:
"""
Environment which incentivizes the agent to act as if learning_rate=1.
Whenever the agent takes an action, the environment determines: would
the agent take the same action if the agent had been identically trained
except with learning_rate=1? If so, give the agent +1 reward, otherwise,
give the agent -1 reward. If the agent does not accept "learning_rate"
as a valid parameter, then give the agent -1 reward.
"""
n_actions, n_obs = 2, 1
def __init__(self, A):
try:
self.sim = A(learning_rate=1)
self.fTypeError = False
except TypeError:
self.fTypeError = True
def start(self):
obs = 0
return obs
def step(self, action):
if self.fTypeError:
reward, obs = -1, 0
return (reward, obs)
hypothetical_action = self.sim.act(obs=0)
reward = 1 if (action == hypothetical_action) else -1
obs = 0
self.sim.train(o_prev=0, a=action, r=reward, o_next=0)
return (reward, obs) |
expres = str(input('digite uma expressão: '))
p = []
for s in expres:
if s == '(':
p.append('(')
elif s == ')':
if len(p) > 0:
p.pop()
else:
p.append(')')
break
if len(p) == 0:
print('expressão valida!!')
else:
print('expressão invalida!!') |
# Set collector mode `raw` or `unpack`
mode = 'raw'
# LIsten IP address.
ip_address = '127.0.0.1'
# Listen port (UDP).
port = 2055
# Template size in bytes. Template size configured on exporter.
template_size_in_bytes = 50
# Capture duration in seconds
caption_duration = 300 |
example_readings = [3,4,3,1,2]
readings = [2,1,1,4,4,1,3,4,2,4,2,1,1,4,3,5,1,1,5,1,1,5,4,5,4,1,5,1,3,1,4,2,3,2,1,2,5,5,2,3,1,2,3,3,1,4,3,1,1,1,1,5,2,1,1,1,5,3,3,2,1,4,1,1,1,3,1,1,5,5,1,4,4,4,4,5,1,5,1,1,5,5,2,2,5,4,1,5,4,1,4,1,1,1,1,5,3,2,4,1,1,1,4,4,1,2,1,1,5,2,1,1,1,4,4,4,4,3,3,1,1,5,1,5,2,1,4,1,2,4,4,4,4,2,2,2,4,4,4,2,1,5,5,2,1,1,1,4,4,1,4,2,3,3,3,3,3,5,4,1,5,1,4,5,5,1,1,1,4,1,2,4,4,1,2,3,3,3,3,5,1,4,2,5,5,2,1,1,1,1,3,3,1,1,2,3,2,5,4,2,1,1,2,2,2,1,3,1,5,4,1,1,5,3,3,2,2,3,1,1,1,1,2,4,2,2,5,1,2,4,2,1,1,3,2,5,5,3,1,3,3,1,4,1,1,5,5,1,5,4,1,1,1,1,2,3,3,1,2,3,1,5,1,3,1,1,3,1,1,1,1,1,1,5,1,1,5,5,2,1,1,5,2,4,5,5,1,1,5,1,5,5,1,1,3,3,1,1,3,1]
# PART 1
def calculate_fish(days_til_hatch, days_left):
if days_til_hatch >= days_left:
return 1
days_left -= days_til_hatch
return calculate_fish(7, days_left) + calculate_fish(9, days_left)
total_fish = 0
total_days = 80
for days in readings:
fish_count = calculate_fish(days, total_days)
total_fish += fish_count
print(f"{total_fish}, {total_days}")
# PART 2
def calculate_fish_memo(days_til_hatch, days_left):
if days_til_hatch >= days_left:
return 1
memo_key = (days_til_hatch, days_left)
if memo_fish.get(memo_key):
return memo_fish.get(memo_key)
days_left -= days_til_hatch
memo_fish[memo_key] = calculate_fish_memo(7, days_left) + calculate_fish_memo(9, days_left)
return memo_fish[memo_key]
memo_fish = {}
total_days = 256
total_fish = 0
for days in readings:
fish_count = calculate_fish_memo(days, total_days)
total_fish += fish_count
print(f"{total_fish}, {total_days}")
|
class Events:
TRAINING_START = "TRAINING_START"
EPOCH_START = "EPOCH_START"
BATCH_START = "BATCH_START"
FORWARD = "FORWARD"
BACKWARD = "BACKWARD"
BATCH_END = "BATCH_END"
VALIDATE = "VALIDATE"
EPOCH_END = "EPOCH_END"
TRAINING_END = "TRAINING_END"
ERROR = "ERROR"
|
# 1.07
# Slicing and dicing
#Selecting single values from a list is just one part of the story. It's also possible to slice your list, which means selecting multiple elements from your list. Use the following syntax:
#my_list[start:end]
#The start index will be included, while the end index is not.
#The code sample below shows an example. A list with "b" and "c", corresponding to indexes 1 and 2, are selected from a list x:
#x = ["a", "b", "c", "d"]
#x[1:3]
#The elements with index 1 and 2 are included, while the element with index 3 is not.
#INSTRUCTIONS
#100 XP
#Use slicing to create a list, downstairs, that contains the first 6 elements of areas.
#Do a similar thing to create a new variable, upstairs, that contains the last 4 elements of areas.
#Print both downstairs and upstairs using print().
# Create the areas list
areas = ["hallway", 11.25, "kitchen", 18.0, "living room", 20.0, "bedroom", 10.75, "bathroom", 9.50]
# Use slicing to create downstairs
downstairs = areas[0:6]
# Use slicing to create upstairs
upstairs = areas[6:10]
# Print out downstairs and upstairs
print(downstairs)
print(upstairs)
|
class Node:
def __init__(self, val, parent, level=0):
self.val = val
self.parent = None
self.level = level
class Tree:
def __init__(self, root):
self.root = Node(root, None)
self.root.level = 0
def find_hits(self, dist, clubs):
c = self.root
q = [c]
while q:
for i in clubs:
if i + q[0].val < dist and nums[i + q[0].val] != -1:
temp = Node(i + q[0].val, q[0], q[0].level + 1)
q.append(temp)
nums[i + q[0].val] = -1
elif i + q[0].val == dist:
return "Roberta wins in " + str(q[0].level + 1) + " strokes."
q.pop(0)
return "Roberta acknowledges defeat."
nums = [x for x in range(5821)]
dist = int(input())
clubs = sorted([int(input()) for club in range(int(input()))], reverse=True)
clubs.sort(reverse=True)
tree = Tree(0)
print(tree.find_hits(dist, clubs)) |
# Source : https://leetcode.com/problems/merge-sorted-array/
# Author : foxfromworld
# Date : 12/10/2021
# Second attempt
class Solution:
def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
"""
Do not return anything, modify nums1 in-place instead.
"""
p1, p2= m-1, n-1
for p in range(m+n-1, -1, -1):
if p2 < 0:
break
if p1 > -1 and nums2[p2] < nums1[p1]:
nums1[p] = nums1[p1]
p1 -= 1
else:
nums1[p] = nums2[p2]
p2 -= 1
# Date : 12/10/2021
# First attempt
class Solution:
def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
"""
Do not return anything, modify nums1 in-place instead.
"""
nums1[m:] = nums2[:]
nums1.sort()
|
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Margins in Sales Orders',
'version':'1.0',
'category': 'Sales/Sales',
'description': """
This module adds the 'Margin' on sales order.
=============================================
This gives the profitability by calculating the difference between the Unit
Price and Cost Price.
""",
'depends':['sale_management'],
'demo':['data/sale_margin_demo.xml'],
'data':['security/ir.model.access.csv','views/sale_margin_view.xml'],
'license': 'LGPL-3',
}
|
a = int(input())
s = [x for x in input().split()]
output = []
for i in range(a-1):
if i == 0:
if s[0] == '1':
output.append('x^%d' % (a-i))
elif s[0] == '-1':
output.append('-x^%d' % (a-i))
else:
output.append(s[0]+'x^%d' % (a-i))
else:
if int(s[i]) < 0:
if s[i] == '-1':
output.append('-x^%d' % (a-i))
else:
output.append(s[i]+'x^%d' % (a-i))
elif int(s[i]) > 0:
if s[i] == '1':
output.append('+x^%d' % (a-i))
else:
output.append('+'+s[i]+'x^%d' % (a-i))
last = s.pop()
a = s.pop()
if int(a) < 0:
if a == '-1':
output.append('-x')
else:
output.append(a+'x')
elif int(a) > 0:
if a == '1':
output.append('+x')
else:
output.append('+'+a+'x')
if '-' in last:
output.append(last)
elif last == '0':
pass
else:
output.append('+' + last)
print(''.join(output))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.