content
stringlengths 7
1.05M
| fixed_cases
stringlengths 1
1.28M
|
---|---|
BROKER_URL = "redis://localhost:6379/0"
CELERY_RESULT_BACKEND = "redis://localhost:6379/0"
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT=['json']
CELERY_ENABLE_UTC = True
CELERY_TRACK_STARTED=True | broker_url = 'redis://localhost:6379/0'
celery_result_backend = 'redis://localhost:6379/0'
celery_task_serializer = 'json'
celery_result_serializer = 'json'
celery_accept_content = ['json']
celery_enable_utc = True
celery_track_started = True |
def substring (Str,n):
for i in range(n):
print(i) #0 #1
for j in range(i ,n): #0 to 3 #1 to 3
for k in range(i, (j + 1)): #0 to 1 => 0 #1 to 2 => 1
print(Str[k], end="") #print 0th element of the string. #print 0th and 1st element side by side.
print()
Str = "abc"
n = len(Str)
substring(Str,n)
| def substring(Str, n):
for i in range(n):
print(i)
for j in range(i, n):
for k in range(i, j + 1):
print(Str[k], end='')
print()
str = 'abc'
n = len(Str)
substring(Str, n) |
class MockPresenterFactory:
def __init__(self):
self.__presented_logs = []
def register_presenter(self, presenter):
pass
def present(self, obj):
text = ""
if isinstance(obj, str):
text = obj
elif isinstance(obj, list):
if len(obj) > 0:
text = "A list of %s" % (type(obj[0]).__name__)
else:
text = "A list"
else:
text = type(obj).__name__
self.__presented_logs.append(text)
def clear(self):
self.__presented_logs.clear()
@property
def presented_logs(self):
return self.__presented_logs | class Mockpresenterfactory:
def __init__(self):
self.__presented_logs = []
def register_presenter(self, presenter):
pass
def present(self, obj):
text = ''
if isinstance(obj, str):
text = obj
elif isinstance(obj, list):
if len(obj) > 0:
text = 'A list of %s' % type(obj[0]).__name__
else:
text = 'A list'
else:
text = type(obj).__name__
self.__presented_logs.append(text)
def clear(self):
self.__presented_logs.clear()
@property
def presented_logs(self):
return self.__presented_logs |
def is_growth(numbers):
for i in range(1, len(numbers)):
if numbers[i] <= numbers[i - 1]:
return False
return True
def main():
numbers = list(map(int, input().split()))
if is_growth(numbers):
print('YES')
else:
print('NO')
if __name__ == '__main__':
main()
| def is_growth(numbers):
for i in range(1, len(numbers)):
if numbers[i] <= numbers[i - 1]:
return False
return True
def main():
numbers = list(map(int, input().split()))
if is_growth(numbers):
print('YES')
else:
print('NO')
if __name__ == '__main__':
main() |
a="#"
b="@"
c=1
d=int(input("Enter Number:"))
if d%2==0:
f=d/2
else:
f=d//2+1
h=f-3
e=1
g=2
while c<=d:
if c<=2 or c==f:
print (a*c)
c+=1
elif c>2 and c<f:
print (a+(b*e)+a)
c+=1
e+=1
elif c>f and c<d-1:
print (a+(b*h)+a)
c+=1
h=h-1
else:
print (a*g)
c+=1
g=g-1
| a = '#'
b = '@'
c = 1
d = int(input('Enter Number:'))
if d % 2 == 0:
f = d / 2
else:
f = d // 2 + 1
h = f - 3
e = 1
g = 2
while c <= d:
if c <= 2 or c == f:
print(a * c)
c += 1
elif c > 2 and c < f:
print(a + b * e + a)
c += 1
e += 1
elif c > f and c < d - 1:
print(a + b * h + a)
c += 1
h = h - 1
else:
print(a * g)
c += 1
g = g - 1 |
# substitution ciphers
# or, how to transform data from one thing to another
encode_table = {
'A': 'H',
'B': 'Z',
'C': 'Y',
'D': 'W',
'E': 'O',
'F': 'R',
'G': 'J',
'H': 'D',
'I': 'P',
'J': 'T',
'K': 'I',
'L': 'G',
'M': 'L',
'N': 'C',
'O': 'E',
'P': 'X',
'Q': 'K',
'R': 'U',
'S': 'N',
'T': 'F',
'U': 'A',
'V': 'M',
'W': 'B',
'X': 'Q',
'Y': 'V',
'Z': 'S'
}
# decode_table = {}
# for key, value in encode_table.items():
# decode_table[value] = key
decode_table = {value: key for key, value in encode_table.items()}
def encode(plain_text):
cipher = ""
for char in plain_text:
if char.isspace():
cipher += ' '
else:
cipher += encode_table[char.upper()]
return cipher
def decode(cipher_text):
plain_text = ""
for char in cipher_text:
if char.isspace():
plain_text += ' '
else:
plain_text += decode_table[char.upper()]
return plain_text
cipher = encode("Super secret message just for you")
print(cipher)
reversed_plain_text = decode(cipher)
print(reversed_plain_text)
| encode_table = {'A': 'H', 'B': 'Z', 'C': 'Y', 'D': 'W', 'E': 'O', 'F': 'R', 'G': 'J', 'H': 'D', 'I': 'P', 'J': 'T', 'K': 'I', 'L': 'G', 'M': 'L', 'N': 'C', 'O': 'E', 'P': 'X', 'Q': 'K', 'R': 'U', 'S': 'N', 'T': 'F', 'U': 'A', 'V': 'M', 'W': 'B', 'X': 'Q', 'Y': 'V', 'Z': 'S'}
decode_table = {value: key for (key, value) in encode_table.items()}
def encode(plain_text):
cipher = ''
for char in plain_text:
if char.isspace():
cipher += ' '
else:
cipher += encode_table[char.upper()]
return cipher
def decode(cipher_text):
plain_text = ''
for char in cipher_text:
if char.isspace():
plain_text += ' '
else:
plain_text += decode_table[char.upper()]
return plain_text
cipher = encode('Super secret message just for you')
print(cipher)
reversed_plain_text = decode(cipher)
print(reversed_plain_text) |
class Color:
pass
class rgb(Color):
"A representation of an RGBA color"
def __init__(self, r, g, b, a=1.0):
self.r = r
self.g = g
self.b = b
self.a = a
def __repr__(self):
return "rgba({}, {}, {}, {})".format(self.r, self.g, self.b, self.a)
@property
def rgb(self):
return self
class hsl(Color):
"A representation of an HSLA color"
def __init__(self, h, s, l, a=1.0): # noqa: E741
self.h = h
self.s = s
self.l = l # noqa
self.a = a
def __repr__(self):
return "hsla({}, {}, {}, {})".format(self.h, self.s, self.l, self.a)
@property
def rgb(self):
c = (1.0 - abs(2.0 * self.l - 1.0)) * self.s
h = self.h / 60.0
x = c * (1.0 - abs(h % 2 - 1.0))
m = self.l - 0.5 * c
if h < 1.0:
r, g, b = c + m, x + m, m
elif h < 2.0:
r, g, b = x + m, c + m, m
elif h < 3.0:
r, g, b = m, c + m, x + m
elif h < 4.0:
r, g, b = m, x + m, c + m
elif h < 5.0:
r, g, b = m, x + m, c + m
else:
r, g, b = c + m, m, x + m
return rgb(
round(r * 0xff),
round(g * 0xff),
round(b * 0xff),
self.a
)
ALICEBLUE = 'aliceblue'
ANTIQUEWHITE = 'antiquewhite'
AQUA = 'aqua'
AQUAMARINE = 'aquamarine'
AZURE = 'azure'
BEIGE = 'beige'
BISQUE = 'bisque'
BLACK = 'black'
BLANCHEDALMOND = 'blanchedalmond'
BLUE = 'blue'
BLUEVIOLET = 'blueviolet'
BROWN = 'brown'
BURLYWOOD = 'burlywood'
CADETBLUE = 'cadetblue'
CHARTREUSE = 'chartreuse'
CHOCOLATE = 'chocolate'
CORAL = 'coral'
CORNFLOWERBLUE = 'cornflowerblue'
CORNSILK = 'cornsilk'
CRIMSON = 'crimson'
CYAN = 'cyan'
DARKBLUE = 'darkblue'
DARKCYAN = 'darkcyan'
DARKGOLDENROD = 'darkgoldenrod'
DARKGRAY = 'darkgray'
DARKGREY = 'darkgrey'
DARKGREEN = 'darkgreen'
DARKKHAKI = 'darkkhaki'
DARKMAGENTA = 'darkmagenta'
DARKOLIVEGREEN = 'darkolivegreen'
DARKORANGE = 'darkorange'
DARKORCHID = 'darkorchid'
DARKRED = 'darkred'
DARKSALMON = 'darksalmon'
DARKSEAGREEN = 'darkseagreen'
DARKSLATEBLUE = 'darkslateblue'
DARKSLATEGRAY = 'darkslategray'
DARKSLATEGREY = 'darkslategrey'
DARKTURQUOISE = 'darkturquoise'
DARKVIOLET = 'darkviolet'
DEEPPINK = 'deeppink'
DEEPSKYBLUE = 'deepskyblue'
DIMGRAY = 'dimgray'
DIMGREY = 'dimgrey'
DODGERBLUE = 'dodgerblue'
FIREBRICK = 'firebrick'
FLORALWHITE = 'floralwhite'
FORESTGREEN = 'forestgreen'
FUCHSIA = 'fuchsia'
GAINSBORO = 'gainsboro'
GHOSTWHITE = 'ghostwhite'
GOLD = 'gold'
GOLDENROD = 'goldenrod'
GRAY = 'gray'
GREY = 'grey'
GREEN = 'green'
GREENYELLOW = 'greenyellow'
HONEYDEW = 'honeydew'
HOTPINK = 'hotpink'
INDIANRED = 'indianred'
INDIGO = 'indigo'
IVORY = 'ivory'
KHAKI = 'khaki'
LAVENDER = 'lavender'
LAVENDERBLUSH = 'lavenderblush'
LAWNGREEN = 'lawngreen'
LEMONCHIFFON = 'lemonchiffon'
LIGHTBLUE = 'lightblue'
LIGHTCORAL = 'lightcoral'
LIGHTCYAN = 'lightcyan'
LIGHTGOLDENRODYELLOW = 'lightgoldenrodyellow'
LIGHTGRAY = 'lightgray'
LIGHTGREY = 'lightgrey'
LIGHTGREEN = 'lightgreen'
LIGHTPINK = 'lightpink'
LIGHTSALMON = 'lightsalmon'
LIGHTSEAGREEN = 'lightseagreen'
LIGHTSKYBLUE = 'lightskyblue'
LIGHTSLATEGRAY = 'lightslategray'
LIGHTSLATEGREY = 'lightslategrey'
LIGHTSTEELBLUE = 'lightsteelblue'
LIGHTYELLOW = 'lightyellow'
LIME = 'lime'
LIMEGREEN = 'limegreen'
LINEN = 'linen'
MAGENTA = 'magenta'
MAROON = 'maroon'
MEDIUMAQUAMARINE = 'mediumaquamarine'
MEDIUMBLUE = 'mediumblue'
MEDIUMORCHID = 'mediumorchid'
MEDIUMPURPLE = 'mediumpurple'
MEDIUMSEAGREEN = 'mediumseagreen'
MEDIUMSLATEBLUE = 'mediumslateblue'
MEDIUMSPRINGGREEN = 'mediumspringgreen'
MEDIUMTURQUOISE = 'mediumturquoise'
MEDIUMVIOLETRED = 'mediumvioletred'
MIDNIGHTBLUE = 'midnightblue'
MINTCREAM = 'mintcream'
MISTYROSE = 'mistyrose'
MOCCASIN = 'moccasin'
NAVAJOWHITE = 'navajowhite'
NAVY = 'navy'
OLDLACE = 'oldlace'
OLIVE = 'olive'
OLIVEDRAB = 'olivedrab'
ORANGE = 'orange'
ORANGERED = 'orangered'
ORCHID = 'orchid'
PALEGOLDENROD = 'palegoldenrod'
PALEGREEN = 'palegreen'
PALETURQUOISE = 'paleturquoise'
PALEVIOLETRED = 'palevioletred'
PAPAYAWHIP = 'papayawhip'
PEACHPUFF = 'peachpuff'
PERU = 'peru'
PINK = 'pink'
PLUM = 'plum'
POWDERBLUE = 'powderblue'
PURPLE = 'purple'
REBECCAPURPLE = 'rebeccapurple'
RED = 'red'
ROSYBROWN = 'rosybrown'
ROYALBLUE = 'royalblue'
SADDLEBROWN = 'saddlebrown'
SALMON = 'salmon'
SANDYBROWN = 'sandybrown'
SEAGREEN = 'seagreen'
SEASHELL = 'seashell'
SIENNA = 'sienna'
SILVER = 'silver'
SKYBLUE = 'skyblue'
SLATEBLUE = 'slateblue'
SLATEGRAY = 'slategray'
SLATEGREY = 'slategrey'
SNOW = 'snow'
SPRINGGREEN = 'springgreen'
STEELBLUE = 'steelblue'
TAN = 'tan'
TEAL = 'teal'
THISTLE = 'thistle'
TOMATO = 'tomato'
TURQUOISE = 'turquoise'
VIOLET = 'violet'
WHEAT = 'wheat'
WHITE = 'white'
WHITESMOKE = 'whitesmoke'
YELLOW = 'yellow'
YELLOWGREEN = 'yellowgreen'
NAMED_COLOR = {
ALICEBLUE: rgb(0xF0, 0xF8, 0xFF),
ANTIQUEWHITE: rgb(0xFA, 0xEB, 0xD7),
AQUA: rgb(0x00, 0xFF, 0xFF),
AQUAMARINE: rgb(0x7F, 0xFF, 0xD4),
AZURE: rgb(0xF0, 0xFF, 0xFF),
BEIGE: rgb(0xF5, 0xF5, 0xDC),
BISQUE: rgb(0xFF, 0xE4, 0xC4),
BLACK: rgb(0x00, 0x00, 0x00),
BLANCHEDALMOND: rgb(0xFF, 0xEB, 0xCD),
BLUE: rgb(0x00, 0x00, 0xFF),
BLUEVIOLET: rgb(0x8A, 0x2B, 0xE2),
BROWN: rgb(0xA5, 0x2A, 0x2A),
BURLYWOOD: rgb(0xDE, 0xB8, 0x87),
CADETBLUE: rgb(0x5F, 0x9E, 0xA0),
CHARTREUSE: rgb(0x7F, 0xFF, 0x00),
CHOCOLATE: rgb(0xD2, 0x69, 0x1E),
CORAL: rgb(0xFF, 0x7F, 0x50),
CORNFLOWERBLUE: rgb(0x64, 0x95, 0xED),
CORNSILK: rgb(0xFF, 0xF8, 0xDC),
CRIMSON: rgb(0xDC, 0x14, 0x3C),
CYAN: rgb(0x00, 0xFF, 0xFF),
DARKBLUE: rgb(0x00, 0x00, 0x8B),
DARKCYAN: rgb(0x00, 0x8B, 0x8B),
DARKGOLDENROD: rgb(0xB8, 0x86, 0x0B),
DARKGRAY: rgb(0xA9, 0xA9, 0xA9),
DARKGREY: rgb(0xA9, 0xA9, 0xA9),
DARKGREEN: rgb(0x00, 0x64, 0x00),
DARKKHAKI: rgb(0xBD, 0xB7, 0x6B),
DARKMAGENTA: rgb(0x8B, 0x00, 0x8B),
DARKOLIVEGREEN: rgb(0x55, 0x6B, 0x2F),
DARKORANGE: rgb(0xFF, 0x8C, 0x00),
DARKORCHID: rgb(0x99, 0x32, 0xCC),
DARKRED: rgb(0x8B, 0x00, 0x00),
DARKSALMON: rgb(0xE9, 0x96, 0x7A),
DARKSEAGREEN: rgb(0x8F, 0xBC, 0x8F),
DARKSLATEBLUE: rgb(0x48, 0x3D, 0x8B),
DARKSLATEGRAY: rgb(0x2F, 0x4F, 0x4F),
DARKSLATEGREY: rgb(0x2F, 0x4F, 0x4F),
DARKTURQUOISE: rgb(0x00, 0xCE, 0xD1),
DARKVIOLET: rgb(0x94, 0x00, 0xD3),
DEEPPINK: rgb(0xFF, 0x14, 0x93),
DEEPSKYBLUE: rgb(0x00, 0xBF, 0xFF),
DIMGRAY: rgb(0x69, 0x69, 0x69),
DIMGREY: rgb(0x69, 0x69, 0x69),
DODGERBLUE: rgb(0x1E, 0x90, 0xFF),
FIREBRICK: rgb(0xB2, 0x22, 0x22),
FLORALWHITE: rgb(0xFF, 0xFA, 0xF0),
FORESTGREEN: rgb(0x22, 0x8B, 0x22),
FUCHSIA: rgb(0xFF, 0x00, 0xFF),
GAINSBORO: rgb(0xDC, 0xDC, 0xDC),
GHOSTWHITE: rgb(0xF8, 0xF8, 0xFF),
GOLD: rgb(0xFF, 0xD7, 0x00),
GOLDENROD: rgb(0xDA, 0xA5, 0x20),
GRAY: rgb(0x80, 0x80, 0x80),
GREY: rgb(0x80, 0x80, 0x80),
GREEN: rgb(0x00, 0x80, 0x00),
GREENYELLOW: rgb(0xAD, 0xFF, 0x2F),
HONEYDEW: rgb(0xF0, 0xFF, 0xF0),
HOTPINK: rgb(0xFF, 0x69, 0xB4),
INDIANRED: rgb(0xCD, 0x5C, 0x5C),
INDIGO: rgb(0x4B, 0x00, 0x82),
IVORY: rgb(0xFF, 0xFF, 0xF0),
KHAKI: rgb(0xF0, 0xE6, 0x8C),
LAVENDER: rgb(0xE6, 0xE6, 0xFA),
LAVENDERBLUSH: rgb(0xFF, 0xF0, 0xF5),
LAWNGREEN: rgb(0x7C, 0xFC, 0x00),
LEMONCHIFFON: rgb(0xFF, 0xFA, 0xCD),
LIGHTBLUE: rgb(0xAD, 0xD8, 0xE6),
LIGHTCORAL: rgb(0xF0, 0x80, 0x80),
LIGHTCYAN: rgb(0xE0, 0xFF, 0xFF),
LIGHTGOLDENRODYELLOW: rgb(0xFA, 0xFA, 0xD2),
LIGHTGRAY: rgb(0xD3, 0xD3, 0xD3),
LIGHTGREY: rgb(0xD3, 0xD3, 0xD3),
LIGHTGREEN: rgb(0x90, 0xEE, 0x90),
LIGHTPINK: rgb(0xFF, 0xB6, 0xC1),
LIGHTSALMON: rgb(0xFF, 0xA0, 0x7A),
LIGHTSEAGREEN: rgb(0x20, 0xB2, 0xAA),
LIGHTSKYBLUE: rgb(0x87, 0xCE, 0xFA),
LIGHTSLATEGRAY: rgb(0x77, 0x88, 0x99),
LIGHTSLATEGREY: rgb(0x77, 0x88, 0x99),
LIGHTSTEELBLUE: rgb(0xB0, 0xC4, 0xDE),
LIGHTYELLOW: rgb(0xFF, 0xFF, 0xE0),
LIME: rgb(0x00, 0xFF, 0x00),
LIMEGREEN: rgb(0x32, 0xCD, 0x32),
LINEN: rgb(0xFA, 0xF0, 0xE6),
MAGENTA: rgb(0xFF, 0x00, 0xFF),
MAROON: rgb(0x80, 0x00, 0x00),
MEDIUMAQUAMARINE: rgb(0x66, 0xCD, 0xAA),
MEDIUMBLUE: rgb(0x00, 0x00, 0xCD),
MEDIUMORCHID: rgb(0xBA, 0x55, 0xD3),
MEDIUMPURPLE: rgb(0x93, 0x70, 0xDB),
MEDIUMSEAGREEN: rgb(0x3C, 0xB3, 0x71),
MEDIUMSLATEBLUE: rgb(0x7B, 0x68, 0xEE),
MEDIUMSPRINGGREEN: rgb(0x00, 0xFA, 0x9A),
MEDIUMTURQUOISE: rgb(0x48, 0xD1, 0xCC),
MEDIUMVIOLETRED: rgb(0xC7, 0x15, 0x85),
MIDNIGHTBLUE: rgb(0x19, 0x19, 0x70),
MINTCREAM: rgb(0xF5, 0xFF, 0xFA),
MISTYROSE: rgb(0xFF, 0xE4, 0xE1),
MOCCASIN: rgb(0xFF, 0xE4, 0xB5),
NAVAJOWHITE: rgb(0xFF, 0xDE, 0xAD),
NAVY: rgb(0x00, 0x00, 0x80),
OLDLACE: rgb(0xFD, 0xF5, 0xE6),
OLIVE: rgb(0x80, 0x80, 0x00),
OLIVEDRAB: rgb(0x6B, 0x8E, 0x23),
ORANGE: rgb(0xFF, 0xA5, 0x00),
ORANGERED: rgb(0xFF, 0x45, 0x00),
ORCHID: rgb(0xDA, 0x70, 0xD6),
PALEGOLDENROD: rgb(0xEE, 0xE8, 0xAA),
PALEGREEN: rgb(0x98, 0xFB, 0x98),
PALETURQUOISE: rgb(0xAF, 0xEE, 0xEE),
PALEVIOLETRED: rgb(0xDB, 0x70, 0x93),
PAPAYAWHIP: rgb(0xFF, 0xEF, 0xD5),
PEACHPUFF: rgb(0xFF, 0xDA, 0xB9),
PERU: rgb(0xCD, 0x85, 0x3F),
PINK: rgb(0xFF, 0xC0, 0xCB),
PLUM: rgb(0xDD, 0xA0, 0xDD),
POWDERBLUE: rgb(0xB0, 0xE0, 0xE6),
PURPLE: rgb(0x80, 0x00, 0x80),
REBECCAPURPLE: rgb(0x66, 0x33, 0x99),
RED: rgb(0xFF, 0x00, 0x00),
ROSYBROWN: rgb(0xBC, 0x8F, 0x8F),
ROYALBLUE: rgb(0x41, 0x69, 0xE1),
SADDLEBROWN: rgb(0x8B, 0x45, 0x13),
SALMON: rgb(0xFA, 0x80, 0x72),
SANDYBROWN: rgb(0xF4, 0xA4, 0x60),
SEAGREEN: rgb(0x2E, 0x8B, 0x57),
SEASHELL: rgb(0xFF, 0xF5, 0xEE),
SIENNA: rgb(0xA0, 0x52, 0x2D),
SILVER: rgb(0xC0, 0xC0, 0xC0),
SKYBLUE: rgb(0x87, 0xCE, 0xEB),
SLATEBLUE: rgb(0x6A, 0x5A, 0xCD),
SLATEGRAY: rgb(0x70, 0x80, 0x90),
SLATEGREY: rgb(0x70, 0x80, 0x90),
SNOW: rgb(0xFF, 0xFA, 0xFA),
SPRINGGREEN: rgb(0x00, 0xFF, 0x7F),
STEELBLUE: rgb(0x46, 0x82, 0xB4),
TAN: rgb(0xD2, 0xB4, 0x8C),
TEAL: rgb(0x00, 0x80, 0x80),
THISTLE: rgb(0xD8, 0xBF, 0xD8),
TOMATO: rgb(0xFF, 0x63, 0x47),
TURQUOISE: rgb(0x40, 0xE0, 0xD0),
VIOLET: rgb(0xEE, 0x82, 0xEE),
WHEAT: rgb(0xF5, 0xDE, 0xB3),
WHITE: rgb(0xFF, 0xFF, 0xFF),
WHITESMOKE: rgb(0xF5, 0xF5, 0xF5),
YELLOW: rgb(0xFF, 0xFF, 0x00),
YELLOWGREEN: rgb(0x9A, 0xCD, 0x32),
}
| class Color:
pass
class Rgb(Color):
"""A representation of an RGBA color"""
def __init__(self, r, g, b, a=1.0):
self.r = r
self.g = g
self.b = b
self.a = a
def __repr__(self):
return 'rgba({}, {}, {}, {})'.format(self.r, self.g, self.b, self.a)
@property
def rgb(self):
return self
class Hsl(Color):
"""A representation of an HSLA color"""
def __init__(self, h, s, l, a=1.0):
self.h = h
self.s = s
self.l = l
self.a = a
def __repr__(self):
return 'hsla({}, {}, {}, {})'.format(self.h, self.s, self.l, self.a)
@property
def rgb(self):
c = (1.0 - abs(2.0 * self.l - 1.0)) * self.s
h = self.h / 60.0
x = c * (1.0 - abs(h % 2 - 1.0))
m = self.l - 0.5 * c
if h < 1.0:
(r, g, b) = (c + m, x + m, m)
elif h < 2.0:
(r, g, b) = (x + m, c + m, m)
elif h < 3.0:
(r, g, b) = (m, c + m, x + m)
elif h < 4.0:
(r, g, b) = (m, x + m, c + m)
elif h < 5.0:
(r, g, b) = (m, x + m, c + m)
else:
(r, g, b) = (c + m, m, x + m)
return rgb(round(r * 255), round(g * 255), round(b * 255), self.a)
aliceblue = 'aliceblue'
antiquewhite = 'antiquewhite'
aqua = 'aqua'
aquamarine = 'aquamarine'
azure = 'azure'
beige = 'beige'
bisque = 'bisque'
black = 'black'
blanchedalmond = 'blanchedalmond'
blue = 'blue'
blueviolet = 'blueviolet'
brown = 'brown'
burlywood = 'burlywood'
cadetblue = 'cadetblue'
chartreuse = 'chartreuse'
chocolate = 'chocolate'
coral = 'coral'
cornflowerblue = 'cornflowerblue'
cornsilk = 'cornsilk'
crimson = 'crimson'
cyan = 'cyan'
darkblue = 'darkblue'
darkcyan = 'darkcyan'
darkgoldenrod = 'darkgoldenrod'
darkgray = 'darkgray'
darkgrey = 'darkgrey'
darkgreen = 'darkgreen'
darkkhaki = 'darkkhaki'
darkmagenta = 'darkmagenta'
darkolivegreen = 'darkolivegreen'
darkorange = 'darkorange'
darkorchid = 'darkorchid'
darkred = 'darkred'
darksalmon = 'darksalmon'
darkseagreen = 'darkseagreen'
darkslateblue = 'darkslateblue'
darkslategray = 'darkslategray'
darkslategrey = 'darkslategrey'
darkturquoise = 'darkturquoise'
darkviolet = 'darkviolet'
deeppink = 'deeppink'
deepskyblue = 'deepskyblue'
dimgray = 'dimgray'
dimgrey = 'dimgrey'
dodgerblue = 'dodgerblue'
firebrick = 'firebrick'
floralwhite = 'floralwhite'
forestgreen = 'forestgreen'
fuchsia = 'fuchsia'
gainsboro = 'gainsboro'
ghostwhite = 'ghostwhite'
gold = 'gold'
goldenrod = 'goldenrod'
gray = 'gray'
grey = 'grey'
green = 'green'
greenyellow = 'greenyellow'
honeydew = 'honeydew'
hotpink = 'hotpink'
indianred = 'indianred'
indigo = 'indigo'
ivory = 'ivory'
khaki = 'khaki'
lavender = 'lavender'
lavenderblush = 'lavenderblush'
lawngreen = 'lawngreen'
lemonchiffon = 'lemonchiffon'
lightblue = 'lightblue'
lightcoral = 'lightcoral'
lightcyan = 'lightcyan'
lightgoldenrodyellow = 'lightgoldenrodyellow'
lightgray = 'lightgray'
lightgrey = 'lightgrey'
lightgreen = 'lightgreen'
lightpink = 'lightpink'
lightsalmon = 'lightsalmon'
lightseagreen = 'lightseagreen'
lightskyblue = 'lightskyblue'
lightslategray = 'lightslategray'
lightslategrey = 'lightslategrey'
lightsteelblue = 'lightsteelblue'
lightyellow = 'lightyellow'
lime = 'lime'
limegreen = 'limegreen'
linen = 'linen'
magenta = 'magenta'
maroon = 'maroon'
mediumaquamarine = 'mediumaquamarine'
mediumblue = 'mediumblue'
mediumorchid = 'mediumorchid'
mediumpurple = 'mediumpurple'
mediumseagreen = 'mediumseagreen'
mediumslateblue = 'mediumslateblue'
mediumspringgreen = 'mediumspringgreen'
mediumturquoise = 'mediumturquoise'
mediumvioletred = 'mediumvioletred'
midnightblue = 'midnightblue'
mintcream = 'mintcream'
mistyrose = 'mistyrose'
moccasin = 'moccasin'
navajowhite = 'navajowhite'
navy = 'navy'
oldlace = 'oldlace'
olive = 'olive'
olivedrab = 'olivedrab'
orange = 'orange'
orangered = 'orangered'
orchid = 'orchid'
palegoldenrod = 'palegoldenrod'
palegreen = 'palegreen'
paleturquoise = 'paleturquoise'
palevioletred = 'palevioletred'
papayawhip = 'papayawhip'
peachpuff = 'peachpuff'
peru = 'peru'
pink = 'pink'
plum = 'plum'
powderblue = 'powderblue'
purple = 'purple'
rebeccapurple = 'rebeccapurple'
red = 'red'
rosybrown = 'rosybrown'
royalblue = 'royalblue'
saddlebrown = 'saddlebrown'
salmon = 'salmon'
sandybrown = 'sandybrown'
seagreen = 'seagreen'
seashell = 'seashell'
sienna = 'sienna'
silver = 'silver'
skyblue = 'skyblue'
slateblue = 'slateblue'
slategray = 'slategray'
slategrey = 'slategrey'
snow = 'snow'
springgreen = 'springgreen'
steelblue = 'steelblue'
tan = 'tan'
teal = 'teal'
thistle = 'thistle'
tomato = 'tomato'
turquoise = 'turquoise'
violet = 'violet'
wheat = 'wheat'
white = 'white'
whitesmoke = 'whitesmoke'
yellow = 'yellow'
yellowgreen = 'yellowgreen'
named_color = {ALICEBLUE: rgb(240, 248, 255), ANTIQUEWHITE: rgb(250, 235, 215), AQUA: rgb(0, 255, 255), AQUAMARINE: rgb(127, 255, 212), AZURE: rgb(240, 255, 255), BEIGE: rgb(245, 245, 220), BISQUE: rgb(255, 228, 196), BLACK: rgb(0, 0, 0), BLANCHEDALMOND: rgb(255, 235, 205), BLUE: rgb(0, 0, 255), BLUEVIOLET: rgb(138, 43, 226), BROWN: rgb(165, 42, 42), BURLYWOOD: rgb(222, 184, 135), CADETBLUE: rgb(95, 158, 160), CHARTREUSE: rgb(127, 255, 0), CHOCOLATE: rgb(210, 105, 30), CORAL: rgb(255, 127, 80), CORNFLOWERBLUE: rgb(100, 149, 237), CORNSILK: rgb(255, 248, 220), CRIMSON: rgb(220, 20, 60), CYAN: rgb(0, 255, 255), DARKBLUE: rgb(0, 0, 139), DARKCYAN: rgb(0, 139, 139), DARKGOLDENROD: rgb(184, 134, 11), DARKGRAY: rgb(169, 169, 169), DARKGREY: rgb(169, 169, 169), DARKGREEN: rgb(0, 100, 0), DARKKHAKI: rgb(189, 183, 107), DARKMAGENTA: rgb(139, 0, 139), DARKOLIVEGREEN: rgb(85, 107, 47), DARKORANGE: rgb(255, 140, 0), DARKORCHID: rgb(153, 50, 204), DARKRED: rgb(139, 0, 0), DARKSALMON: rgb(233, 150, 122), DARKSEAGREEN: rgb(143, 188, 143), DARKSLATEBLUE: rgb(72, 61, 139), DARKSLATEGRAY: rgb(47, 79, 79), DARKSLATEGREY: rgb(47, 79, 79), DARKTURQUOISE: rgb(0, 206, 209), DARKVIOLET: rgb(148, 0, 211), DEEPPINK: rgb(255, 20, 147), DEEPSKYBLUE: rgb(0, 191, 255), DIMGRAY: rgb(105, 105, 105), DIMGREY: rgb(105, 105, 105), DODGERBLUE: rgb(30, 144, 255), FIREBRICK: rgb(178, 34, 34), FLORALWHITE: rgb(255, 250, 240), FORESTGREEN: rgb(34, 139, 34), FUCHSIA: rgb(255, 0, 255), GAINSBORO: rgb(220, 220, 220), GHOSTWHITE: rgb(248, 248, 255), GOLD: rgb(255, 215, 0), GOLDENROD: rgb(218, 165, 32), GRAY: rgb(128, 128, 128), GREY: rgb(128, 128, 128), GREEN: rgb(0, 128, 0), GREENYELLOW: rgb(173, 255, 47), HONEYDEW: rgb(240, 255, 240), HOTPINK: rgb(255, 105, 180), INDIANRED: rgb(205, 92, 92), INDIGO: rgb(75, 0, 130), IVORY: rgb(255, 255, 240), KHAKI: rgb(240, 230, 140), LAVENDER: rgb(230, 230, 250), LAVENDERBLUSH: rgb(255, 240, 245), LAWNGREEN: rgb(124, 252, 0), LEMONCHIFFON: rgb(255, 250, 205), LIGHTBLUE: rgb(173, 216, 230), LIGHTCORAL: rgb(240, 128, 128), LIGHTCYAN: rgb(224, 255, 255), LIGHTGOLDENRODYELLOW: rgb(250, 250, 210), LIGHTGRAY: rgb(211, 211, 211), LIGHTGREY: rgb(211, 211, 211), LIGHTGREEN: rgb(144, 238, 144), LIGHTPINK: rgb(255, 182, 193), LIGHTSALMON: rgb(255, 160, 122), LIGHTSEAGREEN: rgb(32, 178, 170), LIGHTSKYBLUE: rgb(135, 206, 250), LIGHTSLATEGRAY: rgb(119, 136, 153), LIGHTSLATEGREY: rgb(119, 136, 153), LIGHTSTEELBLUE: rgb(176, 196, 222), LIGHTYELLOW: rgb(255, 255, 224), LIME: rgb(0, 255, 0), LIMEGREEN: rgb(50, 205, 50), LINEN: rgb(250, 240, 230), MAGENTA: rgb(255, 0, 255), MAROON: rgb(128, 0, 0), MEDIUMAQUAMARINE: rgb(102, 205, 170), MEDIUMBLUE: rgb(0, 0, 205), MEDIUMORCHID: rgb(186, 85, 211), MEDIUMPURPLE: rgb(147, 112, 219), MEDIUMSEAGREEN: rgb(60, 179, 113), MEDIUMSLATEBLUE: rgb(123, 104, 238), MEDIUMSPRINGGREEN: rgb(0, 250, 154), MEDIUMTURQUOISE: rgb(72, 209, 204), MEDIUMVIOLETRED: rgb(199, 21, 133), MIDNIGHTBLUE: rgb(25, 25, 112), MINTCREAM: rgb(245, 255, 250), MISTYROSE: rgb(255, 228, 225), MOCCASIN: rgb(255, 228, 181), NAVAJOWHITE: rgb(255, 222, 173), NAVY: rgb(0, 0, 128), OLDLACE: rgb(253, 245, 230), OLIVE: rgb(128, 128, 0), OLIVEDRAB: rgb(107, 142, 35), ORANGE: rgb(255, 165, 0), ORANGERED: rgb(255, 69, 0), ORCHID: rgb(218, 112, 214), PALEGOLDENROD: rgb(238, 232, 170), PALEGREEN: rgb(152, 251, 152), PALETURQUOISE: rgb(175, 238, 238), PALEVIOLETRED: rgb(219, 112, 147), PAPAYAWHIP: rgb(255, 239, 213), PEACHPUFF: rgb(255, 218, 185), PERU: rgb(205, 133, 63), PINK: rgb(255, 192, 203), PLUM: rgb(221, 160, 221), POWDERBLUE: rgb(176, 224, 230), PURPLE: rgb(128, 0, 128), REBECCAPURPLE: rgb(102, 51, 153), RED: rgb(255, 0, 0), ROSYBROWN: rgb(188, 143, 143), ROYALBLUE: rgb(65, 105, 225), SADDLEBROWN: rgb(139, 69, 19), SALMON: rgb(250, 128, 114), SANDYBROWN: rgb(244, 164, 96), SEAGREEN: rgb(46, 139, 87), SEASHELL: rgb(255, 245, 238), SIENNA: rgb(160, 82, 45), SILVER: rgb(192, 192, 192), SKYBLUE: rgb(135, 206, 235), SLATEBLUE: rgb(106, 90, 205), SLATEGRAY: rgb(112, 128, 144), SLATEGREY: rgb(112, 128, 144), SNOW: rgb(255, 250, 250), SPRINGGREEN: rgb(0, 255, 127), STEELBLUE: rgb(70, 130, 180), TAN: rgb(210, 180, 140), TEAL: rgb(0, 128, 128), THISTLE: rgb(216, 191, 216), TOMATO: rgb(255, 99, 71), TURQUOISE: rgb(64, 224, 208), VIOLET: rgb(238, 130, 238), WHEAT: rgb(245, 222, 179), WHITE: rgb(255, 255, 255), WHITESMOKE: rgb(245, 245, 245), YELLOW: rgb(255, 255, 0), YELLOWGREEN: rgb(154, 205, 50)} |
aggregate_genres = [{"rock": ["symphonic rock", "jazz-rock", "heartland rock", "rap rock", "garage rock", "folk-rock", "roots rock", "adult alternative pop rock", "rock roll", "punk rock", "arena rock", "pop-rock", "glam rock", "southern rock", "indie rock", "funk rock", "country rock", "piano rock", "art rock", "rockabilly", "acoustic rock", "progressive rock", "folk rock", "psychedelic rock", "rock & roll", "blues rock", "alternative rock", "rock and roll", "soft rock", "rock and indie", "hard rock", "pop/rock", "pop rock", "rock", "classic pop and rock", "psychedelic", "british psychedelia", "punk", "metal", "heavy metal"]},
{"alternative/indie": ["adult alternative pop rock", "alternative rock", "alternative metal", "alternative", "lo-fi indie", "indie", "indie folk", "indietronica", "indie pop", "indie rock", "rock and indie"]},
{"electronic/dance": ["dance and electronica", "electro house", "electronic", "electropop", "progressive house", "hip house", "house", "eurodance", "dancehall", "dance", "trap"]},
{"soul": ["psychedelic soul", "deep soul", "neo-soul", "neo soul", "southern soul", "smooth soul", "blue-eyed soul", "soul and reggae", "soul"]},
{"classical/soundtrack": ["classical", "orchestral", "film soundtrack", "composer"]},
{"pop": ["country-pop", "latin pop", "classical pop", "pop-metal", "orchestral pop", "instrumental pop", "indie pop", "sophisti-pop", "pop punk", "pop reggae", "britpop", "traditional pop", "power pop", "sunshine pop", "baroque pop", "synthpop", "art pop", "teen pop", "psychedelic pop", "folk pop", "country pop", "pop rap", "pop soul", "pop and chart", "dance-pop", "pop", "top 40"]},
{"hip-hop/rnb": ["conscious hip hop", "east coast hip hop", "hardcore hip hop", "west coast hip hop", "hiphop", "southern hip hop", "hip-hop", "hip hop", "hip hop rnb and dance hall", "contemporary r b", "gangsta rap", "rapper", "rap", "rhythm and blues", "contemporary rnb", "contemporary r&b", "rnb", "rhythm & blues","r&b", "blues"]},
{"disco": ["disco"]},
{"swing": ["swing"]},
{"folk": ["contemporary folk", "folk"]},
{"country": ["country rock", "country-pop", "country pop", "contemporary country", "country"]},
{"jazz": ["vocal jazz", "jazz", "jazz-rock"]},
{"religious": ["christian", "christmas music", "gospel"]},
{"blues": ["delta blues", "rock blues", "urban blues", "electric blues", "acoustic blues", "soul blues", "country blues", "jump blues", "classic rock. blues rock", "jazz and blues", "piano blues", "british blues", "british rhythm & blues", "rhythm and blues", "blues", "blues rock", "rhythm & blues"]},
{"reggae": ["reggae fusion", "roots reggae", "reggaeton", "pop reggae", "reggae", "soul and reggae"]}] | aggregate_genres = [{'rock': ['symphonic rock', 'jazz-rock', 'heartland rock', 'rap rock', 'garage rock', 'folk-rock', 'roots rock', 'adult alternative pop rock', 'rock roll', 'punk rock', 'arena rock', 'pop-rock', 'glam rock', 'southern rock', 'indie rock', 'funk rock', 'country rock', 'piano rock', 'art rock', 'rockabilly', 'acoustic rock', 'progressive rock', 'folk rock', 'psychedelic rock', 'rock & roll', 'blues rock', 'alternative rock', 'rock and roll', 'soft rock', 'rock and indie', 'hard rock', 'pop/rock', 'pop rock', 'rock', 'classic pop and rock', 'psychedelic', 'british psychedelia', 'punk', 'metal', 'heavy metal']}, {'alternative/indie': ['adult alternative pop rock', 'alternative rock', 'alternative metal', 'alternative', 'lo-fi indie', 'indie', 'indie folk', 'indietronica', 'indie pop', 'indie rock', 'rock and indie']}, {'electronic/dance': ['dance and electronica', 'electro house', 'electronic', 'electropop', 'progressive house', 'hip house', 'house', 'eurodance', 'dancehall', 'dance', 'trap']}, {'soul': ['psychedelic soul', 'deep soul', 'neo-soul', 'neo soul', 'southern soul', 'smooth soul', 'blue-eyed soul', 'soul and reggae', 'soul']}, {'classical/soundtrack': ['classical', 'orchestral', 'film soundtrack', 'composer']}, {'pop': ['country-pop', 'latin pop', 'classical pop', 'pop-metal', 'orchestral pop', 'instrumental pop', 'indie pop', 'sophisti-pop', 'pop punk', 'pop reggae', 'britpop', 'traditional pop', 'power pop', 'sunshine pop', 'baroque pop', 'synthpop', 'art pop', 'teen pop', 'psychedelic pop', 'folk pop', 'country pop', 'pop rap', 'pop soul', 'pop and chart', 'dance-pop', 'pop', 'top 40']}, {'hip-hop/rnb': ['conscious hip hop', 'east coast hip hop', 'hardcore hip hop', 'west coast hip hop', 'hiphop', 'southern hip hop', 'hip-hop', 'hip hop', 'hip hop rnb and dance hall', 'contemporary r b', 'gangsta rap', 'rapper', 'rap', 'rhythm and blues', 'contemporary rnb', 'contemporary r&b', 'rnb', 'rhythm & blues', 'r&b', 'blues']}, {'disco': ['disco']}, {'swing': ['swing']}, {'folk': ['contemporary folk', 'folk']}, {'country': ['country rock', 'country-pop', 'country pop', 'contemporary country', 'country']}, {'jazz': ['vocal jazz', 'jazz', 'jazz-rock']}, {'religious': ['christian', 'christmas music', 'gospel']}, {'blues': ['delta blues', 'rock blues', 'urban blues', 'electric blues', 'acoustic blues', 'soul blues', 'country blues', 'jump blues', 'classic rock. blues rock', 'jazz and blues', 'piano blues', 'british blues', 'british rhythm & blues', 'rhythm and blues', 'blues', 'blues rock', 'rhythm & blues']}, {'reggae': ['reggae fusion', 'roots reggae', 'reggaeton', 'pop reggae', 'reggae', 'soul and reggae']}] |
# Number of images used for training (rest goes for validation)
train_size = 55000
# Image width and height of mnist
width = 28
height = 28
# The total number of labels
num_labels = 10
# The number of batches to prefetch when training on GPU
num_prefetch = 5
# Number of neurons the weight matrices as specified in the document about the challenge
num_neurons = [1000, 1000, 500, 200]
# Testing with prunning for
prune_k = [0.0, 0.25, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.97, 0.99]
# Prune types
prune_types = [None, "weight_pruning", "unit_pruning"]
| train_size = 55000
width = 28
height = 28
num_labels = 10
num_prefetch = 5
num_neurons = [1000, 1000, 500, 200]
prune_k = [0.0, 0.25, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.97, 0.99]
prune_types = [None, 'weight_pruning', 'unit_pruning'] |
#recursive solution
def fib(n):
if (n<=2):
return 1
return fib(n-1)+fib(n-2)
#print(fib(6)) #should be 8
#dp solution
def fib_dp(n):
a = [0]*n
a[0] = a[1] = 1
for i in range(2, n):
a[i] = a[i-1] + a[i-2]
#print(a)
return a
fib_dp(6) | def fib(n):
if n <= 2:
return 1
return fib(n - 1) + fib(n - 2)
def fib_dp(n):
a = [0] * n
a[0] = a[1] = 1
for i in range(2, n):
a[i] = a[i - 1] + a[i - 2]
return a
fib_dp(6) |
## configuration settings
c = get_config()
## Configure SSL -----------------------------------------------
c.JupyterHub.ssl_key = "/srv/jupyterhub/ssl/jhub.privkey.pem"
c.JupyterHub.ssl_cert = "/srv/jupyterhub/ssl/jhub.fullchain.pem"
c.JupyterHub.ip = '128.59.232.200'
c.JupyterHub.port = 443
## Configure OAuth ----------------------------------------------
c.JupyterHub.authenticator_class = 'oauthenticator.GitHubOAuthenticator'
c.Authenticator.oauth_callback_url = 'https://jhub.eaton-lab.org/hub/oauth_callback'
c.Authenticator.client_id = 'fee71ad7b23fe4daa861'
c.Authenticator.client_secret = '...'
## any members of these GH organization are whitelisted
c.Authenticator.admin_users = {"eaton-lab", "isaacovercast"}
c.Authenticator.whitelist = {
"dereneaton",
"eaton-lab",
"isaacovercast",
"pdsb-test-student",
"pmckenz1",
}
# Mount the real user's Docker volume on the host to the notebook user's
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
c.DockerSpawner.notebook_dir = '/home/jovyan/'
c.DockerSpawner.image = 'dereneaton/jhub'
c.DockerSpawner.volumes = {
# user's persistent volume
'jhub-user-{username}': '/home/jovyan/work',
# admin's r/o pre-made data dir
'data': {
'bind': '/home/jovyan/data',
'mode': 'ro',
},
}
c.DockerSpawner.remove_containers = True
c.DockerSpawner.mem_limit = '16G'
# set docker containers need to find the hub IP
c.JupyterHub.hub_ip = c.JupyterHub.ip
# max days to stay connected
c.JupyterHub.cookie_max_age_days = 5
# max number of users
c.JupyterHub.active_server_limit = 40
| c = get_config()
c.JupyterHub.ssl_key = '/srv/jupyterhub/ssl/jhub.privkey.pem'
c.JupyterHub.ssl_cert = '/srv/jupyterhub/ssl/jhub.fullchain.pem'
c.JupyterHub.ip = '128.59.232.200'
c.JupyterHub.port = 443
c.JupyterHub.authenticator_class = 'oauthenticator.GitHubOAuthenticator'
c.Authenticator.oauth_callback_url = 'https://jhub.eaton-lab.org/hub/oauth_callback'
c.Authenticator.client_id = 'fee71ad7b23fe4daa861'
c.Authenticator.client_secret = '...'
c.Authenticator.admin_users = {'eaton-lab', 'isaacovercast'}
c.Authenticator.whitelist = {'dereneaton', 'eaton-lab', 'isaacovercast', 'pdsb-test-student', 'pmckenz1'}
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
c.DockerSpawner.notebook_dir = '/home/jovyan/'
c.DockerSpawner.image = 'dereneaton/jhub'
c.DockerSpawner.volumes = {'jhub-user-{username}': '/home/jovyan/work', 'data': {'bind': '/home/jovyan/data', 'mode': 'ro'}}
c.DockerSpawner.remove_containers = True
c.DockerSpawner.mem_limit = '16G'
c.JupyterHub.hub_ip = c.JupyterHub.ip
c.JupyterHub.cookie_max_age_days = 5
c.JupyterHub.active_server_limit = 40 |
class Config(object):
DEBUG = True
DEVELOPMENT = True
class ProductionConfig(Config):
DEBUG = False
DEVELOPMENT = False
| class Config(object):
debug = True
development = True
class Productionconfig(Config):
debug = False
development = False |
N, M = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(M):
A, B = map(int, input().split())
G[A].append(B)
G[B].append(A)
dist = [-1] * N
nodes = [[] for _ in range(N)]
dist[0] = 0
nodes[0] = [0]
for k in range(1, N):
for v in nodes[k-1]:
for next_v in G[v]:
if dist[next_v] != -1:
continue
dist[next_v] = dist[v] + 1
nodes[k].append(next_v)
print(max(dist))
| (n, m) = map(int, input().split())
g = [[] for _ in range(N)]
for _ in range(M):
(a, b) = map(int, input().split())
G[A].append(B)
G[B].append(A)
dist = [-1] * N
nodes = [[] for _ in range(N)]
dist[0] = 0
nodes[0] = [0]
for k in range(1, N):
for v in nodes[k - 1]:
for next_v in G[v]:
if dist[next_v] != -1:
continue
dist[next_v] = dist[v] + 1
nodes[k].append(next_v)
print(max(dist)) |
def store_value(redis_client,key_name,value):
redis_client.setnx(key_name,value)
return True
def get_key_value(redis_client,key_name):
return redis_client.get(key_name)
| def store_value(redis_client, key_name, value):
redis_client.setnx(key_name, value)
return True
def get_key_value(redis_client, key_name):
return redis_client.get(key_name) |
class HTTPException(Exception):
def __init__(self, status: int, reason: str):
self.status = status
self.reason = reason
def __str__(self):
return "HTTPException: {}: {}".format(self.status, self.reason) | class Httpexception(Exception):
def __init__(self, status: int, reason: str):
self.status = status
self.reason = reason
def __str__(self):
return 'HTTPException: {}: {}'.format(self.status, self.reason) |
#!/usr/bin/env python3
def find_root(n, m):
r = int(pow(m, 1 / n))
if r**n == m:
return r
if (r + 1)**n == m:
return r + 1
return -1
for t in range(int(input())):
print(find_root(*map(int, input().split())))
| def find_root(n, m):
r = int(pow(m, 1 / n))
if r ** n == m:
return r
if (r + 1) ** n == m:
return r + 1
return -1
for t in range(int(input())):
print(find_root(*map(int, input().split()))) |
hooked_function = None
def set_hook(hook):
global hooked_function
hooked_function = hook
hooked_function
def do_it():
if hooked_function != None:
hooked_function()
else:
print("Did not get hooked")
| hooked_function = None
def set_hook(hook):
global hooked_function
hooked_function = hook
hooked_function
def do_it():
if hooked_function != None:
hooked_function()
else:
print('Did not get hooked') |
# assign first item to dictionary, give value of 1
# go through items
# if item name isn't equal to any dictionary, set it to a new dictionary
# if item name equals existing dictionary, set that dictionary's value to +=1
# after everything, print dictionaries
people = {}
with open('tweeters.txt') as file:
for line in file:
person = line.strip()
people[person] = people.get(person, 0) + 1
with open('tweets.txt', 'a') as file:
for i in people:
file.write(str(i) + ': ' + str(people[i]) + '\n')
| people = {}
with open('tweeters.txt') as file:
for line in file:
person = line.strip()
people[person] = people.get(person, 0) + 1
with open('tweets.txt', 'a') as file:
for i in people:
file.write(str(i) + ': ' + str(people[i]) + '\n') |
class PyginationError(Exception):
pass
class PaginationError(Exception):
pass
| class Pyginationerror(Exception):
pass
class Paginationerror(Exception):
pass |
#!/usr/bin/env python3
def part_one(file):
return(min(main(file)))
def part_two(file):
return(max(main(file)))
def main(file):
distances = dict()
cities = set([s.strip().split(" ")[0] for s in open(file)])
cities.update([s.strip().split(" ")[2] for s in open(file)])
for city in cities:
distances[city] = dict()
for line in open(file):
args = line.strip().split(" ")
distances[args[0]][args[2]] = int(args[4])
distances[args[2]][args[0]] = int(args[4])
record = []
for city in distances:
travel_to_next_city(record, distances, [city], 0)
return record
def travel_to_next_city(record, distances, cities_travelled, distance_travelled):
if len(distances) == len(cities_travelled):
record.append(distance_travelled)
else:
for city in distances:
if city not in cities_travelled:
distance_to_next_city = distances[cities_travelled[-1]][city]
new_cities_travelled = cities_travelled.copy()
new_cities_travelled.append(city)
travel_to_next_city(record, distances, new_cities_travelled, distance_travelled + distance_to_next_city)
if __name__ == "__main__":
# import doctest
# doctest.testmod()
print(part_one(r"2015\2015_09_distances.txt"))
print(part_two(r"2015\2015_09_distances.txt")) | def part_one(file):
return min(main(file))
def part_two(file):
return max(main(file))
def main(file):
distances = dict()
cities = set([s.strip().split(' ')[0] for s in open(file)])
cities.update([s.strip().split(' ')[2] for s in open(file)])
for city in cities:
distances[city] = dict()
for line in open(file):
args = line.strip().split(' ')
distances[args[0]][args[2]] = int(args[4])
distances[args[2]][args[0]] = int(args[4])
record = []
for city in distances:
travel_to_next_city(record, distances, [city], 0)
return record
def travel_to_next_city(record, distances, cities_travelled, distance_travelled):
if len(distances) == len(cities_travelled):
record.append(distance_travelled)
else:
for city in distances:
if city not in cities_travelled:
distance_to_next_city = distances[cities_travelled[-1]][city]
new_cities_travelled = cities_travelled.copy()
new_cities_travelled.append(city)
travel_to_next_city(record, distances, new_cities_travelled, distance_travelled + distance_to_next_city)
if __name__ == '__main__':
print(part_one('2015\\2015_09_distances.txt'))
print(part_two('2015\\2015_09_distances.txt')) |
#Handling Exceptions
try:
age = int(input("Enter your age:"))
except ValueError as ex:
print(ex)
print(type(ex))
print("Please enter valid age!")
else:
print("else part executed")
| try:
age = int(input('Enter your age:'))
except ValueError as ex:
print(ex)
print(type(ex))
print('Please enter valid age!')
else:
print('else part executed') |
def uncycle(list):
if len(list) <= 3:
return max(list)
m = int(len(list) / 2)
if list[0] < list[m]:
return uncycle(list[m:])
else:
return uncycle(list[:m]) | def uncycle(list):
if len(list) <= 3:
return max(list)
m = int(len(list) / 2)
if list[0] < list[m]:
return uncycle(list[m:])
else:
return uncycle(list[:m]) |
def _build_csv_path(target:str, directory:str, cell_line:str):
return "{target}/{directory}/{cell_line}.csv".format(
target=target,
directory=directory,
cell_line=cell_line
)
def get_raw_epigenomic_data_path(target:str, cell_line:str):
return _build_csv_path(target, "epigenomic_data", cell_line)
def get_raw_nucleotides_sequences_path(target:str, cell_line:str):
return _build_csv_path(target, "one_hot_encoded_expanded_regions", cell_line)
def get_raw_classes_path(target:str, cell_line:str):
return _build_csv_path(target, "one_hot_encoded_classes", cell_line) | def _build_csv_path(target: str, directory: str, cell_line: str):
return '{target}/{directory}/{cell_line}.csv'.format(target=target, directory=directory, cell_line=cell_line)
def get_raw_epigenomic_data_path(target: str, cell_line: str):
return _build_csv_path(target, 'epigenomic_data', cell_line)
def get_raw_nucleotides_sequences_path(target: str, cell_line: str):
return _build_csv_path(target, 'one_hot_encoded_expanded_regions', cell_line)
def get_raw_classes_path(target: str, cell_line: str):
return _build_csv_path(target, 'one_hot_encoded_classes', cell_line) |
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Wayne Witzel III <[email protected]>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
class ModuleDocFragment(object):
# Ansible Tower documentation fragment
DOCUMENTATION = r'''
options:
tower_host:
description:
- URL to your Tower instance.
type: str
tower_username:
description:
- Username for your Tower instance.
type: str
tower_password:
description:
- Password for your Tower instance.
type: str
validate_certs:
description:
- Whether to allow insecure connections to Tower.
- If C(no), SSL certificates will not be validated.
- This should only be used on personally controlled sites using self-signed certificates.
type: bool
aliases: [ tower_verify_ssl ]
tower_config_file:
description:
- Path to the Tower config file.
type: path
requirements:
- ansible-tower-cli >= 3.0.2
notes:
- If no I(config_file) is provided we will attempt to use the tower-cli library
defaults to find your Tower host information.
- I(config_file) should contain Tower configuration in the following format
host=hostname
username=username
password=password
'''
| class Moduledocfragment(object):
documentation = '\noptions:\n tower_host:\n description:\n - URL to your Tower instance.\n type: str\n tower_username:\n description:\n - Username for your Tower instance.\n type: str\n tower_password:\n description:\n - Password for your Tower instance.\n type: str\n validate_certs:\n description:\n - Whether to allow insecure connections to Tower.\n - If C(no), SSL certificates will not be validated.\n - This should only be used on personally controlled sites using self-signed certificates.\n type: bool\n aliases: [ tower_verify_ssl ]\n tower_config_file:\n description:\n - Path to the Tower config file.\n type: path\n\nrequirements:\n- ansible-tower-cli >= 3.0.2\n\nnotes:\n- If no I(config_file) is provided we will attempt to use the tower-cli library\n defaults to find your Tower host information.\n- I(config_file) should contain Tower configuration in the following format\n host=hostname\n username=username\n password=password\n' |
def main():
question = input("Please what type of variation is it ... |> ")
if question == "direct":
question = input("Please what is the value of the initial 1st variable => ").isdigit()
if question:
int(question)
another_question = input("Please what is the value of the initial 2nd variable => ").isdigit()
if another_question:
int(another_question)
direct_variation(question, another_question)
elif question == "inverse":
pass
elif question == "joint":
pass
elif question == "partial":
pass
else:
print("Sorry can't find the type of variation mentioned ...")
exit()
def direct_variation(initial_var, another_initial_var):
def find_constant(value_1st_var, value_2nd_var):
side = value_1st_var / value_2nd_var
another_side = value_2nd_var / value_2nd_var
k = side
return k
k = find_constant(initial_var, another_initial_var)
print(k)
main()
| def main():
question = input('Please what type of variation is it ... |> ')
if question == 'direct':
question = input('Please what is the value of the initial 1st variable => ').isdigit()
if question:
int(question)
another_question = input('Please what is the value of the initial 2nd variable => ').isdigit()
if another_question:
int(another_question)
direct_variation(question, another_question)
elif question == 'inverse':
pass
elif question == 'joint':
pass
elif question == 'partial':
pass
else:
print("Sorry can't find the type of variation mentioned ...")
exit()
def direct_variation(initial_var, another_initial_var):
def find_constant(value_1st_var, value_2nd_var):
side = value_1st_var / value_2nd_var
another_side = value_2nd_var / value_2nd_var
k = side
return k
k = find_constant(initial_var, another_initial_var)
print(k)
main() |
def Values_Sum_Greater(Test_Dict):
return sum(list(Test_Dict.keys())) < sum(list(Test_Dict.values()))
Test_Dict = {5: 3, 1: 3, 10: 4, 7: 3, 8: 1, 9: 5}
print(Values_Sum_Greater(Test_Dict))
| def values__sum__greater(Test_Dict):
return sum(list(Test_Dict.keys())) < sum(list(Test_Dict.values()))
test__dict = {5: 3, 1: 3, 10: 4, 7: 3, 8: 1, 9: 5}
print(values__sum__greater(Test_Dict)) |
class Concept:
ID = None
descriptions = None
definition = None
def __init__(self, ID=None, descriptions=None, definition = None):
self.ID = ID
self.descriptions = [] if descriptions is None else descriptions
self.definition = None
class Description:
ID = None
concept_ID = None
term = None
def __init__(self, ID=None, concept_ID=None, term=None):
self.ID = ID
self.concept_ID = concept_ID
self.term = term
class Definition:
ID = None
concept_ID = None
text = None
def __init__(self, ID=None, concept_ID=None, text=None):
self.ID = ID
self.concept_ID = concept_ID
self.text = text
| class Concept:
id = None
descriptions = None
definition = None
def __init__(self, ID=None, descriptions=None, definition=None):
self.ID = ID
self.descriptions = [] if descriptions is None else descriptions
self.definition = None
class Description:
id = None
concept_id = None
term = None
def __init__(self, ID=None, concept_ID=None, term=None):
self.ID = ID
self.concept_ID = concept_ID
self.term = term
class Definition:
id = None
concept_id = None
text = None
def __init__(self, ID=None, concept_ID=None, text=None):
self.ID = ID
self.concept_ID = concept_ID
self.text = text |
expected_output = {
'pvst': {
'a': {
'pvst_id': 'a',
'vlans': {
2: {
'vlan_id': 2,
'designated_root_priority': 32768,
'designated_root_address': '0021.1bff.d973',
'designated_root_max_age': 20,
'designated_root_forward_delay': 15,
'bridge_priority': 32768,
'sys_id_ext': 0,
'bridge_address': '8cb6.4fff.6588',
'bridge_max_age': 20,
'bridge_forward_delay': 15,
'bridge_transmit_hold_count': 6,
'interface': {
'GigabitEthernet0/7/0/0': {
'name': 'GigabitEthernet0/7/0/0',
'cost': 20000,
'role': 'DSGN',
'port_priority': 128,
'port_num': 1,
'port_state': 'FWD',
'designated_bridge_priority': 32768,
'designated_bridge_address': '8cb6.4fff.6588',
'designated_port_priority': 128,
'designated_port_num': 1,
},
'GigabitEthernet0/7/0/1': {
'name': 'GigabitEthernet0/7/0/1',
'cost': 20000,
'role': 'DSGN',
'port_priority': 128,
'port_num': 2,
'port_state': 'FWD',
'designated_bridge_priority': 32768,
'designated_bridge_address': '8cb6.4fff.6588',
'designated_port_priority': 128,
'designated_port_num': 2,
},
'GigabitEthernet0/7/0/10': {
'name': 'GigabitEthernet0/7/0/10',
'cost': 20000,
'role': 'ROOT',
'port_priority': 128,
'port_num': 3,
'port_state': 'FWD',
'designated_bridge_priority': 32768,
'designated_bridge_address': '0021.1bff.d973',
'designated_port_priority': 128,
'designated_port_num': 3,
},
'GigabitEthernet0/7/0/11': {
'name': 'GigabitEthernet0/7/0/11',
'cost': 20000,
'role': 'ALT',
'port_priority': 128,
'port_num': 4,
'port_state': 'BLK',
'designated_bridge_priority': 32768,
'designated_bridge_address': '0021.1bff.d973',
'designated_port_priority': 128,
'designated_port_num': 4,
},
},
},
3: {
'vlan_id': 3,
'designated_root_priority': 32768,
'designated_root_address': '0021.1bff.d973',
'designated_root_max_age': 20,
'designated_root_forward_delay': 15,
'bridge_priority': 32768,
'sys_id_ext': 0,
'bridge_address': '8cb6.4fff.6588',
'bridge_max_age': 20,
'bridge_forward_delay': 15,
'bridge_transmit_hold_count': 6,
'interface': {
'GigabitEthernet0/7/0/0': {
'name': 'GigabitEthernet0/7/0/0',
'cost': 20000,
'role': 'DSGN',
'port_priority': 128,
'port_num': 1,
'port_state': 'FWD',
'designated_bridge_priority': 32768,
'designated_bridge_address': '8cb6.4fff.6588',
'designated_port_priority': 128,
'designated_port_num': 1,
},
'GigabitEthernet0/7/0/1': {
'name': 'GigabitEthernet0/7/0/1',
'cost': 20000,
'role': 'DSGN',
'port_priority': 128,
'port_num': 2,
'port_state': 'FWD',
'designated_bridge_priority': 32768,
'designated_bridge_address': '8cb6.4fff.6588',
'designated_port_priority': 128,
'designated_port_num': 2,
},
'GigabitEthernet0/7/0/10': {
'name': 'GigabitEthernet0/7/0/10',
'cost': 20000,
'role': 'ROOT',
'port_priority': 128,
'port_num': 3,
'port_state': 'FWD',
'designated_bridge_priority': 32768,
'designated_bridge_address': '0021.1bff.d973',
'designated_port_priority': 128,
'designated_port_num': 3,
},
'GigabitEthernet0/7/0/11': {
'name': 'GigabitEthernet0/7/0/11',
'cost': 20000,
'role': 'ALT',
'port_priority': 128,
'port_num': 4,
'port_state': 'BLK',
'designated_bridge_priority': 32768,
'designated_bridge_address': '0021.1bff.d973',
'designated_port_priority': 128,
'designated_port_num': 4,
},
},
},
4: {
'vlan_id': 4,
'designated_root_priority': 32768,
'designated_root_address': '0021.1bff.d973',
'designated_root_max_age': 20,
'designated_root_forward_delay': 15,
'bridge_priority': 32768,
'sys_id_ext': 0,
'bridge_address': '8cb6.4fff.6588',
'bridge_max_age': 20,
'bridge_forward_delay': 15,
'bridge_transmit_hold_count': 6,
'interface': {
'GigabitEthernet0/7/0/0': {
'name': 'GigabitEthernet0/7/0/0',
'cost': 20000,
'role': 'DSGN',
'port_priority': 128,
'port_num': 1,
'port_state': 'FWD',
'designated_bridge_priority': 32768,
'designated_bridge_address': '8cb6.4fff.6588',
'designated_port_priority': 128,
'designated_port_num': 1,
},
'GigabitEthernet0/7/0/1': {
'name': 'GigabitEthernet0/7/0/1',
'cost': 20000,
'role': 'DSGN',
'port_priority': 128,
'port_num': 2,
'port_state': 'FWD',
'designated_bridge_priority': 32768,
'designated_bridge_address': '8cb6.4fff.6588',
'designated_port_priority': 128,
'designated_port_num': 2,
},
'GigabitEthernet0/7/0/10': {
'name': 'GigabitEthernet0/7/0/10',
'cost': 20000,
'role': 'ROOT',
'port_priority': 128,
'port_num': 3,
'port_state': 'FWD',
'designated_bridge_priority': 32768,
'designated_bridge_address': '0021.1bff.d973',
'designated_port_priority': 128,
'designated_port_num': 3,
},
'GigabitEthernet0/7/0/11': {
'name': 'GigabitEthernet0/7/0/11',
'cost': 20000,
'role': 'ALT',
'port_priority': 128,
'port_num': 4,
'port_state': 'BLK',
'designated_bridge_priority': 32768,
'designated_bridge_address': '0021.1bff.d973',
'designated_port_priority': 128,
'designated_port_num': 4,
},
},
},
},
},
},
}
| expected_output = {'pvst': {'a': {'pvst_id': 'a', 'vlans': {2: {'vlan_id': 2, 'designated_root_priority': 32768, 'designated_root_address': '0021.1bff.d973', 'designated_root_max_age': 20, 'designated_root_forward_delay': 15, 'bridge_priority': 32768, 'sys_id_ext': 0, 'bridge_address': '8cb6.4fff.6588', 'bridge_max_age': 20, 'bridge_forward_delay': 15, 'bridge_transmit_hold_count': 6, 'interface': {'GigabitEthernet0/7/0/0': {'name': 'GigabitEthernet0/7/0/0', 'cost': 20000, 'role': 'DSGN', 'port_priority': 128, 'port_num': 1, 'port_state': 'FWD', 'designated_bridge_priority': 32768, 'designated_bridge_address': '8cb6.4fff.6588', 'designated_port_priority': 128, 'designated_port_num': 1}, 'GigabitEthernet0/7/0/1': {'name': 'GigabitEthernet0/7/0/1', 'cost': 20000, 'role': 'DSGN', 'port_priority': 128, 'port_num': 2, 'port_state': 'FWD', 'designated_bridge_priority': 32768, 'designated_bridge_address': '8cb6.4fff.6588', 'designated_port_priority': 128, 'designated_port_num': 2}, 'GigabitEthernet0/7/0/10': {'name': 'GigabitEthernet0/7/0/10', 'cost': 20000, 'role': 'ROOT', 'port_priority': 128, 'port_num': 3, 'port_state': 'FWD', 'designated_bridge_priority': 32768, 'designated_bridge_address': '0021.1bff.d973', 'designated_port_priority': 128, 'designated_port_num': 3}, 'GigabitEthernet0/7/0/11': {'name': 'GigabitEthernet0/7/0/11', 'cost': 20000, 'role': 'ALT', 'port_priority': 128, 'port_num': 4, 'port_state': 'BLK', 'designated_bridge_priority': 32768, 'designated_bridge_address': '0021.1bff.d973', 'designated_port_priority': 128, 'designated_port_num': 4}}}, 3: {'vlan_id': 3, 'designated_root_priority': 32768, 'designated_root_address': '0021.1bff.d973', 'designated_root_max_age': 20, 'designated_root_forward_delay': 15, 'bridge_priority': 32768, 'sys_id_ext': 0, 'bridge_address': '8cb6.4fff.6588', 'bridge_max_age': 20, 'bridge_forward_delay': 15, 'bridge_transmit_hold_count': 6, 'interface': {'GigabitEthernet0/7/0/0': {'name': 'GigabitEthernet0/7/0/0', 'cost': 20000, 'role': 'DSGN', 'port_priority': 128, 'port_num': 1, 'port_state': 'FWD', 'designated_bridge_priority': 32768, 'designated_bridge_address': '8cb6.4fff.6588', 'designated_port_priority': 128, 'designated_port_num': 1}, 'GigabitEthernet0/7/0/1': {'name': 'GigabitEthernet0/7/0/1', 'cost': 20000, 'role': 'DSGN', 'port_priority': 128, 'port_num': 2, 'port_state': 'FWD', 'designated_bridge_priority': 32768, 'designated_bridge_address': '8cb6.4fff.6588', 'designated_port_priority': 128, 'designated_port_num': 2}, 'GigabitEthernet0/7/0/10': {'name': 'GigabitEthernet0/7/0/10', 'cost': 20000, 'role': 'ROOT', 'port_priority': 128, 'port_num': 3, 'port_state': 'FWD', 'designated_bridge_priority': 32768, 'designated_bridge_address': '0021.1bff.d973', 'designated_port_priority': 128, 'designated_port_num': 3}, 'GigabitEthernet0/7/0/11': {'name': 'GigabitEthernet0/7/0/11', 'cost': 20000, 'role': 'ALT', 'port_priority': 128, 'port_num': 4, 'port_state': 'BLK', 'designated_bridge_priority': 32768, 'designated_bridge_address': '0021.1bff.d973', 'designated_port_priority': 128, 'designated_port_num': 4}}}, 4: {'vlan_id': 4, 'designated_root_priority': 32768, 'designated_root_address': '0021.1bff.d973', 'designated_root_max_age': 20, 'designated_root_forward_delay': 15, 'bridge_priority': 32768, 'sys_id_ext': 0, 'bridge_address': '8cb6.4fff.6588', 'bridge_max_age': 20, 'bridge_forward_delay': 15, 'bridge_transmit_hold_count': 6, 'interface': {'GigabitEthernet0/7/0/0': {'name': 'GigabitEthernet0/7/0/0', 'cost': 20000, 'role': 'DSGN', 'port_priority': 128, 'port_num': 1, 'port_state': 'FWD', 'designated_bridge_priority': 32768, 'designated_bridge_address': '8cb6.4fff.6588', 'designated_port_priority': 128, 'designated_port_num': 1}, 'GigabitEthernet0/7/0/1': {'name': 'GigabitEthernet0/7/0/1', 'cost': 20000, 'role': 'DSGN', 'port_priority': 128, 'port_num': 2, 'port_state': 'FWD', 'designated_bridge_priority': 32768, 'designated_bridge_address': '8cb6.4fff.6588', 'designated_port_priority': 128, 'designated_port_num': 2}, 'GigabitEthernet0/7/0/10': {'name': 'GigabitEthernet0/7/0/10', 'cost': 20000, 'role': 'ROOT', 'port_priority': 128, 'port_num': 3, 'port_state': 'FWD', 'designated_bridge_priority': 32768, 'designated_bridge_address': '0021.1bff.d973', 'designated_port_priority': 128, 'designated_port_num': 3}, 'GigabitEthernet0/7/0/11': {'name': 'GigabitEthernet0/7/0/11', 'cost': 20000, 'role': 'ALT', 'port_priority': 128, 'port_num': 4, 'port_state': 'BLK', 'designated_bridge_priority': 32768, 'designated_bridge_address': '0021.1bff.d973', 'designated_port_priority': 128, 'designated_port_num': 4}}}}}}} |
t1 = (1, 2, 3, 'a')
t2 = 4, 5, 6, 'b'
t3 = 1,
# print(t1[3])
# for v in t1:
# print(v)
# print(t1 + t2)
n1, n2, *n = t1
print(n1)
# Processo para mudar valor de uma tupla
t1 = list(t1)
t1[1] = 3000
t1 = tuple(t1)
print(t1)
| t1 = (1, 2, 3, 'a')
t2 = (4, 5, 6, 'b')
t3 = (1,)
(n1, n2, *n) = t1
print(n1)
t1 = list(t1)
t1[1] = 3000
t1 = tuple(t1)
print(t1) |
# Medium
# for loop with twoSum
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
nums.sort()
result = []
for i in range(len(nums)):
if i>0 and nums[i] == nums[i-1]:
continue
tmp = self.twoSum(nums,i+1,0-nums[i])
for t in tmp:
merge = [nums[i]] + [*t]
result.append([*merge])
return result
def twoSum(self,nums,index,tar):
check = set([])
appear = set([])
result = []
for i in range(index,len(nums)):
if tar - nums[i] in check:
if (tar-nums[i],nums[i]) not in appear:
result.append( [tar-nums[i],nums[i]] )
appear.add((tar-nums[i],nums[i]))
check.add(nums[i])
#print('2sum',result)
return result | class Solution:
def three_sum(self, nums: List[int]) -> List[List[int]]:
nums.sort()
result = []
for i in range(len(nums)):
if i > 0 and nums[i] == nums[i - 1]:
continue
tmp = self.twoSum(nums, i + 1, 0 - nums[i])
for t in tmp:
merge = [nums[i]] + [*t]
result.append([*merge])
return result
def two_sum(self, nums, index, tar):
check = set([])
appear = set([])
result = []
for i in range(index, len(nums)):
if tar - nums[i] in check:
if (tar - nums[i], nums[i]) not in appear:
result.append([tar - nums[i], nums[i]])
appear.add((tar - nums[i], nums[i]))
check.add(nums[i])
return result |
def minion_game(string):
string = string.lower()
scoreStuart = 0
scoreKevin = 0
vowels = 'aeiou'
for j, i in enumerate(string):
if i not in vowels:
scoreStuart += len(string) - j
if i in vowels:
scoreKevin += len(string) - j
if scoreStuart > scoreKevin:
print('Stuart', scoreStuart)
elif scoreKevin > scoreStuart:
print('Kevin', scoreKevin)
else:
print('Draw')
if __name__ == '__main__':
s = input()
minion_game(s)
| def minion_game(string):
string = string.lower()
score_stuart = 0
score_kevin = 0
vowels = 'aeiou'
for (j, i) in enumerate(string):
if i not in vowels:
score_stuart += len(string) - j
if i in vowels:
score_kevin += len(string) - j
if scoreStuart > scoreKevin:
print('Stuart', scoreStuart)
elif scoreKevin > scoreStuart:
print('Kevin', scoreKevin)
else:
print('Draw')
if __name__ == '__main__':
s = input()
minion_game(s) |
class CoachAthleteTable:
def __init__(self):
pass
TABLE_NAME = "Coach_Athlete"
ATHLETE_ID = "Athlete_Id"
COACH_ID = "Coach_Id"
CAN_ACCESS_TRAINING_LOG = "Can_Access_Training_Log"
CAN_ACCESS_TARGETS = "Can_Access_Targets"
IS_ACTIVE = "Is_Active"
START_DATE = "Start_Date"
INVITE_ID = "Invite_Id"
| class Coachathletetable:
def __init__(self):
pass
table_name = 'Coach_Athlete'
athlete_id = 'Athlete_Id'
coach_id = 'Coach_Id'
can_access_training_log = 'Can_Access_Training_Log'
can_access_targets = 'Can_Access_Targets'
is_active = 'Is_Active'
start_date = 'Start_Date'
invite_id = 'Invite_Id' |
T=int(input())
def is_anagram(str1, str2):
list_str1 = list(str1)
list_str1.sort()
list_str2 = list(str2)
#list_str2.sort()
return (list_str1 == list_str2)
for i in range(T):
opt=0
L=int(input())
A=str(input())
B=str(input())
for j in range(len(A)):
for k in range(len(A)):
for l in range(k):
if is_anagram(A[j:k],B[(abs(l))%3:(abs(l-k+1))%3]):
opt+=1
print("Case #"+str(i+1)+": "+str(opt))
| t = int(input())
def is_anagram(str1, str2):
list_str1 = list(str1)
list_str1.sort()
list_str2 = list(str2)
return list_str1 == list_str2
for i in range(T):
opt = 0
l = int(input())
a = str(input())
b = str(input())
for j in range(len(A)):
for k in range(len(A)):
for l in range(k):
if is_anagram(A[j:k], B[abs(l) % 3:abs(l - k + 1) % 3]):
opt += 1
print('Case #' + str(i + 1) + ': ' + str(opt)) |
__title__ = 'tmuxp'
__package_name__ = 'tmuxp'
__version__ = '0.1.12'
__description__ = 'Manage tmux sessions thru JSON, YAML configs. Features Python API'
__email__ = '[email protected]'
__author__ = 'Tony Narlock'
__license__ = 'BSD'
__copyright__ = 'Copyright 2013 Tony Narlock'
| __title__ = 'tmuxp'
__package_name__ = 'tmuxp'
__version__ = '0.1.12'
__description__ = 'Manage tmux sessions thru JSON, YAML configs. Features Python API'
__email__ = '[email protected]'
__author__ = 'Tony Narlock'
__license__ = 'BSD'
__copyright__ = 'Copyright 2013 Tony Narlock' |
list=linkedlist()
list.head=node("Monday")
list1=node("Tuesday")
list2=node("Thursday")
list.head.next=list1
list1.next=list2
print("Before insertion:")
list.printing()
print('\n')
list.push_after(list1,"Wednesday")
print("After insertion:")
list.printing()
print('\n')
list.deletion(3)
print("After deleting 4th node")
list.printing() | list = linkedlist()
list.head = node('Monday')
list1 = node('Tuesday')
list2 = node('Thursday')
list.head.next = list1
list1.next = list2
print('Before insertion:')
list.printing()
print('\n')
list.push_after(list1, 'Wednesday')
print('After insertion:')
list.printing()
print('\n')
list.deletion(3)
print('After deleting 4th node')
list.printing() |
# -*- coding: utf-8 -*-
DB_LOCATION = 'timeclock.db'
DEBUG = True
| db_location = 'timeclock.db'
debug = True |
#!/usr/bin/env python3
n = int(input())
print(n * ((n - 1) % 2))
| n = int(input())
print(n * ((n - 1) % 2)) |
result = True
another_result = result
print(id(result))
print(id(another_result))
# bool is immutable
result = False
print(id(result))
print(id(another_result))
| result = True
another_result = result
print(id(result))
print(id(another_result))
result = False
print(id(result))
print(id(another_result)) |
region='' # GCP region e.g. us-central1 etc,
dbusername=''
dbpassword=''
rabbithost=''
rabbitusername=''
rabbitpassword=''
awskey='' # if you intend to import data from S3
awssecret='' # if you intend to import data from S3
mediabucket=''
secretkey=''
superuser=''
superpass=''
superemail=''
cloudfsprefix='gs'
cors_origin='' # to set CORS on the bucket Can be * or specific website e.g. http://example.website.com
redishost = "redis-master"
redispassword = "sadnnasndaslnk" | region = ''
dbusername = ''
dbpassword = ''
rabbithost = ''
rabbitusername = ''
rabbitpassword = ''
awskey = ''
awssecret = ''
mediabucket = ''
secretkey = ''
superuser = ''
superpass = ''
superemail = ''
cloudfsprefix = 'gs'
cors_origin = ''
redishost = 'redis-master'
redispassword = 'sadnnasndaslnk' |
CheckNumber = float(input("enter your number"))
print(str(CheckNumber) +' setnumber')
while CheckNumber != 1:
numcheck = CheckNumber
if CheckNumber % 2 == 0:
CheckNumber = CheckNumber / 2
print(str(CheckNumber) +' output reduced')
else:
CheckNumber = CheckNumber * 3 + 1
print(str(CheckNumber) +' output increased')
#CheckNumber = 1
#for x in range(int(input("please let me know the number youd like to #start end with"))):
#CheckNumber = CheckNumber + x
| check_number = float(input('enter your number'))
print(str(CheckNumber) + ' setnumber')
while CheckNumber != 1:
numcheck = CheckNumber
if CheckNumber % 2 == 0:
check_number = CheckNumber / 2
print(str(CheckNumber) + ' output reduced')
else:
check_number = CheckNumber * 3 + 1
print(str(CheckNumber) + ' output increased') |
class Solution:
def asteroidCollision(self, asteroids: List[int]) -> List[int]:
'''
T: (n) and S: O(n)
'''
stack = []
for asteroid in asteroids:
# Case 1: Collision occurs
while stack and (asteroid < 0 and stack[-1] > 0):
if stack[-1] < -asteroid: # Case 1a: asteroid survives after collision
stack.pop()
continue
elif stack[-1] > -asteroid: # Case 1b: stack[-1] survives after collision
break
else: # Case 1c: None survives after collision
stack.pop()
break
else: # No collision, both survive
stack.append(asteroid)
return stack
| class Solution:
def asteroid_collision(self, asteroids: List[int]) -> List[int]:
"""
T: (n) and S: O(n)
"""
stack = []
for asteroid in asteroids:
while stack and (asteroid < 0 and stack[-1] > 0):
if stack[-1] < -asteroid:
stack.pop()
continue
elif stack[-1] > -asteroid:
break
else:
stack.pop()
break
else:
stack.append(asteroid)
return stack |
#
# PySNMP MIB module ENTERASYS-SERVICE-LEVEL-REPORTING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-SERVICE-LEVEL-REPORTING-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:50:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion")
etsysModules, = mibBuilder.importSymbols("ENTERASYS-MIB-NAMES", "etsysModules")
InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance")
Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, MibIdentifier, Unsigned32, Counter32, Gauge32, iso, ModuleIdentity, ObjectIdentity, Counter64, TimeTicks, NotificationType, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "MibIdentifier", "Unsigned32", "Counter32", "Gauge32", "iso", "ModuleIdentity", "ObjectIdentity", "Counter64", "TimeTicks", "NotificationType", "Bits")
TextualConvention, RowStatus, StorageType, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "StorageType", "DisplayString")
etsysServiceLevelReportingMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39))
etsysServiceLevelReportingMIB.setRevisions(('2003-11-06 15:15', '2003-10-24 19:02', '2003-10-22 23:32',))
if mibBuilder.loadTexts: etsysServiceLevelReportingMIB.setLastUpdated('200311061515Z')
if mibBuilder.loadTexts: etsysServiceLevelReportingMIB.setOrganization('Enterasys Networks Inc.')
class EtsysSrvcLvlOwnerString(TextualConvention, OctetString):
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 32)
class TimeUnit(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))
namedValues = NamedValues(("year", 1), ("month", 2), ("week", 3), ("day", 4), ("hour", 5), ("second", 6), ("millisecond", 7), ("microsecond", 8), ("nanosecond", 9))
class EtsysSrvcLvlStandardMetrics(TextualConvention, Bits):
status = 'current'
namedValues = NamedValues(("reserved", 0), ("instantUnidirectionConnectivity", 1), ("instantBidirectionConnectivity", 2), ("intervalUnidirectionConnectivity", 3), ("intervalBidirectionConnectivity", 4), ("intervalTemporalConnectivity", 5), ("oneWayDelay", 6), ("oneWayDelayPoissonStream", 7), ("oneWayDelayPercentile", 8), ("oneWayDelayMedian", 9), ("oneWayDelayMinimum", 10), ("oneWayDelayInversePercentile", 11), ("oneWayPacketLoss", 12), ("oneWayPacketLossPoissonStream", 13), ("oneWayPacketLossAverage", 14), ("roundtripDelay", 15), ("roundtripDelayPoissonStream", 16), ("roundtripDelayPercentile", 17), ("roundtripDelayMedian", 18), ("roundtripDelayMinimum", 19), ("roundtripDelayInversePercentile", 20), ("oneWayLossDistanceStream", 21), ("oneWayLossPeriodStream", 22), ("oneWayLossNoticeableRate", 23), ("oneWayLossPeriodTotal", 24), ("oneWayLossPeriodLengths", 25), ("oneWayInterLossPeriodLengths", 26), ("oneWayIpdv", 27), ("oneWayIpdvPoissonStream", 28), ("oneWayIpdvPercentile", 29), ("oneWayIpdvInversePercentile", 30), ("oneWayIpdvJitter", 31), ("oneWayPeakToPeakIpdv", 32), ("oneWayDelayPeriodicStream", 33), ("roundtripDelayAverage", 34), ("roundtripPacketLoss", 35), ("roundtripPacketLossAverage", 36), ("roundtripIpdv", 37))
class GMTTimeStamp(TextualConvention, OctetString):
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(8, 8)
fixedLength = 8
class TypeP(TextualConvention, OctetString):
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 512)
class TypePaddress(TextualConvention, OctetString):
status = 'current'
displayHint = '255a'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 512)
etsysSrvcLvlConfigObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1))
etsysSrvcLvlSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1))
etsysSrvcLvlOwners = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2))
etsysSrvcLvlHistory = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3))
etsysSrvcLvlMeasure = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4))
etsysSrvcLvlSystemTime = MibScalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 1), GMTTimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlSystemTime.setStatus('current')
etsysSrvcLvlSystemClockResolution = MibScalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 2), Integer32()).setUnits('picoseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlSystemClockResolution.setStatus('current')
etsysSrvcLvlMetricTable = MibTable((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3), )
if mibBuilder.loadTexts: etsysSrvcLvlMetricTable.setStatus('current')
etsysSrvcLvlMetricEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1), ).setIndexNames((0, "ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlMetricIndex"))
if mibBuilder.loadTexts: etsysSrvcLvlMetricEntry.setStatus('current')
etsysSrvcLvlMetricIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37))).clone(namedValues=NamedValues(("instantUnidirectionConnectivity", 1), ("instantBidirectionConnectivity", 2), ("intervalUnidirectionConnectivity", 3), ("intervalBidirectionConnectivity", 4), ("intervalTemporalConnectivity", 5), ("oneWayDelay", 6), ("oneWayDelayPoissonStream", 7), ("oneWayDelayPercentile", 8), ("oneWayDelayMedian", 9), ("oneWayDelayMinimum", 10), ("oneWayDelayInversePercentile", 11), ("oneWayPacketLoss", 12), ("oneWayPacketLossPoissonStream", 13), ("oneWayPacketLossAverage", 14), ("roundtripDelay", 15), ("roundtripDelayPoissonStream", 16), ("roundtripDelayPercentile", 17), ("roundtripDelayMedian", 18), ("roundtripDelayMinimum", 19), ("roundtripDelayInversePercentile", 20), ("oneWayLossDistanceStream", 21), ("oneWayLossPeriodStream", 22), ("oneWayLossNoticeableRate", 23), ("oneWayLossPeriodTotal", 24), ("oneWayLossPeriodLengths", 25), ("oneWayInterLossPeriodLengths", 26), ("oneWayIpdv", 27), ("oneWayIpdvPoissonStream", 28), ("oneWayIpdvPercentile", 29), ("oneWayIpdvInversePercentile", 30), ("oneWayIpdvJitter", 31), ("oneWayPeakToPeakIpdv", 32), ("oneWayDelayPeriodicStream", 33), ("roundtripDelayAverage", 34), ("roundtripPacketLoss", 35), ("roundtripPacketLossAverage", 36), ("roundtripIpdv", 37))))
if mibBuilder.loadTexts: etsysSrvcLvlMetricIndex.setStatus('current')
etsysSrvcLvlMetricCapabilities = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("notImplemented", 0), ("implemented", 1))).clone('implemented')).setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlMetricCapabilities.setStatus('current')
etsysSrvcLvlMetricType = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("network", 0), ("aggregated", 1))).clone('aggregated')).setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlMetricType.setStatus('current')
etsysSrvcLvlMetricUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("noUnit", 0), ("second", 1), ("millisecond", 2), ("microsecond", 3), ("nanosecond", 4), ("percentage", 5), ("packet", 6), ("byte", 7), ("kilobyte", 8), ("megabyte", 9)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlMetricUnit.setStatus('current')
etsysSrvcLvlMetricDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1, 5), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlMetricDescription.setStatus('current')
etsysSrvcLvlOwnersTable = MibTable((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1), )
if mibBuilder.loadTexts: etsysSrvcLvlOwnersTable.setStatus('current')
etsysSrvcLvlOwnersEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1), ).setIndexNames((0, "ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlOwnersIndex"))
if mibBuilder.loadTexts: etsysSrvcLvlOwnersEntry.setStatus('current')
etsysSrvcLvlOwnersIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: etsysSrvcLvlOwnersIndex.setStatus('current')
etsysSrvcLvlOwnersOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 2), EtsysSrvcLvlOwnerString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlOwnersOwner.setStatus('current')
etsysSrvcLvlOwnersGrantedMetrics = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 3), EtsysSrvcLvlStandardMetrics()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlOwnersGrantedMetrics.setStatus('current')
etsysSrvcLvlOwnersQuota = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 4), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlOwnersQuota.setStatus('current')
etsysSrvcLvlOwnersIpAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 5), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlOwnersIpAddressType.setStatus('current')
etsysSrvcLvlOwnersIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 6), InetAddress().subtype(subtypeSpec=ValueSizeConstraint(1, 128))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlOwnersIpAddress.setStatus('current')
etsysSrvcLvlOwnersEmail = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 7), SnmpAdminString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlOwnersEmail.setStatus('current')
etsysSrvcLvlOwnersSMS = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 8), SnmpAdminString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlOwnersSMS.setStatus('current')
etsysSrvcLvlOwnersStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 9), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlOwnersStatus.setStatus('current')
etsysSrvcLvlHistoryTable = MibTable((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1), )
if mibBuilder.loadTexts: etsysSrvcLvlHistoryTable.setStatus('current')
etsysSrvcLvlHistoryEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1), ).setIndexNames((0, "ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlHistoryMeasureOwner"), (0, "ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlHistoryMeasureIndex"), (0, "ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlHistoryMetricIndex"), (0, "ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlHistoryIndex"))
if mibBuilder.loadTexts: etsysSrvcLvlHistoryEntry.setStatus('current')
etsysSrvcLvlHistoryMeasureOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 1), EtsysSrvcLvlOwnerString())
if mibBuilder.loadTexts: etsysSrvcLvlHistoryMeasureOwner.setStatus('current')
etsysSrvcLvlHistoryMeasureIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: etsysSrvcLvlHistoryMeasureIndex.setStatus('current')
etsysSrvcLvlHistoryMetricIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: etsysSrvcLvlHistoryMetricIndex.setStatus('current')
etsysSrvcLvlHistoryIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: etsysSrvcLvlHistoryIndex.setStatus('current')
etsysSrvcLvlHistorySequence = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlHistorySequence.setStatus('current')
etsysSrvcLvlHistoryTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 6), GMTTimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlHistoryTimestamp.setStatus('current')
etsysSrvcLvlHistoryValue = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlHistoryValue.setStatus('current')
etsysSrvcLvlNetMeasureTable = MibTable((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1), )
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureTable.setStatus('current')
etsysSrvcLvlNetMeasureEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1), ).setIndexNames((0, "ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureOwner"), (0, "ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureIndex"))
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureEntry.setStatus('current')
etsysSrvcLvlNetMeasureOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 1), EtsysSrvcLvlOwnerString())
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureOwner.setStatus('current')
etsysSrvcLvlNetMeasureIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureIndex.setStatus('current')
etsysSrvcLvlNetMeasureName = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 3), SnmpAdminString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureName.setStatus('current')
etsysSrvcLvlNetMeasureMetrics = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 4), EtsysSrvcLvlStandardMetrics()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureMetrics.setStatus('current')
etsysSrvcLvlNetMeasureBeginTime = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 5), GMTTimeStamp()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureBeginTime.setStatus('current')
etsysSrvcLvlNetMeasureDurationUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 6), TimeUnit().clone('second')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureDurationUnit.setStatus('current')
etsysSrvcLvlNetMeasureDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 7), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureDuration.setStatus('current')
etsysSrvcLvlNetMeasureHistorySize = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 8), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureHistorySize.setStatus('current')
etsysSrvcLvlNetMeasureFailureMgmtMode = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("auto", 1), ("manual", 2), ("discarded", 3))).clone('auto')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureFailureMgmtMode.setStatus('current')
etsysSrvcLvlNetMeasureResultsMgmt = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("wrap", 1), ("suspend", 2), ("delete", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureResultsMgmt.setStatus('current')
etsysSrvcLvlNetMeasureSrcTypeP = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 11), TypeP().clone('ip')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureSrcTypeP.setStatus('current')
etsysSrvcLvlNetMeasureSrc = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 12), TypePaddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureSrc.setStatus('current')
etsysSrvcLvlNetMeasureDstTypeP = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 13), TypeP().clone('ip')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureDstTypeP.setStatus('current')
etsysSrvcLvlNetMeasureDst = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 14), TypePaddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureDst.setStatus('current')
etsysSrvcLvlNetMeasureTxMode = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("other", 0), ("periodic", 1), ("poisson", 2), ("multiburst", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureTxMode.setStatus('current')
etsysSrvcLvlNetMeasureTxPacketRateUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 16), TimeUnit()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureTxPacketRateUnit.setStatus('current')
etsysSrvcLvlNetMeasureTxPacketRate = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 17), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureTxPacketRate.setStatus('current')
etsysSrvcLvlNetMeasureDevtnOrBurstSize = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 18), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureDevtnOrBurstSize.setStatus('current')
etsysSrvcLvlNetMeasureMedOrIntBurstSize = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 19), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureMedOrIntBurstSize.setStatus('current')
etsysSrvcLvlNetMeasureLossTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 20), Integer32()).setUnits('Milliseconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureLossTimeout.setStatus('current')
etsysSrvcLvlNetMeasureL3PacketSize = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 21), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureL3PacketSize.setStatus('current')
etsysSrvcLvlNetMeasureDataPattern = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 22), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureDataPattern.setStatus('current')
etsysSrvcLvlNetMeasureMap = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 23), SnmpAdminString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureMap.setStatus('current')
etsysSrvcLvlNetMeasureSingletons = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 24), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureSingletons.setStatus('current')
etsysSrvcLvlNetMeasureOperState = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 25), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("unknown", 0), ("running", 1), ("stopped", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlNetMeasureOperState.setStatus('current')
etsysSrvcLvlAggrMeasureTable = MibTable((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2), )
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureTable.setStatus('current')
etsysSrvcLvlAggrMeasureEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1), ).setIndexNames((0, "ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureOwner"), (0, "ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureIndex"))
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureEntry.setStatus('current')
etsysSrvcLvlAggrMeasureOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 1), EtsysSrvcLvlOwnerString())
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureOwner.setStatus('current')
etsysSrvcLvlAggrMeasureIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)))
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureIndex.setStatus('current')
etsysSrvcLvlAggrMeasureName = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 3), SnmpAdminString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureName.setStatus('current')
etsysSrvcLvlAggrMeasureMetrics = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 4), EtsysSrvcLvlStandardMetrics()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureMetrics.setStatus('current')
etsysSrvcLvlAggrMeasureBeginTime = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 5), GMTTimeStamp()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureBeginTime.setStatus('current')
etsysSrvcLvlAggrMeasureAggrPeriodUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 6), TimeUnit().clone('second')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureAggrPeriodUnit.setStatus('current')
etsysSrvcLvlAggrMeasureAggrPeriod = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 7), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureAggrPeriod.setStatus('current')
etsysSrvcLvlAggrMeasureDurationUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 8), TimeUnit().clone('second')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureDurationUnit.setStatus('current')
etsysSrvcLvlAggrMeasureDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 9), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureDuration.setStatus('current')
etsysSrvcLvlAggrMeasureHistorySize = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 10), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureHistorySize.setStatus('current')
etsysSrvcLvlAggrMeasureStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 11), StorageType().clone('volatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureStorageType.setStatus('current')
etsysSrvcLvlAggrMeasureResultsMgmt = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("wrap", 1), ("suspend", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureResultsMgmt.setStatus('current')
etsysSrvcLvlAggrMeasureHistoryOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 13), EtsysSrvcLvlOwnerString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureHistoryOwner.setStatus('current')
etsysSrvcLvlAggrMeasureHistoryOwnerIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureHistoryOwnerIndex.setStatus('current')
etsysSrvcLvlAggrMeasureHistoryMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 15), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureHistoryMetric.setStatus('current')
etsysSrvcLvlAggrMeasureAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("start", 0), ("stop", 1)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureAdminState.setStatus('current')
etsysSrvcLvlAggrMeasureMap = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 17), SnmpAdminString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureMap.setStatus('current')
etsysSrvcLvlAggrMeasureStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 18), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: etsysSrvcLvlAggrMeasureStatus.setStatus('current')
etsysSrvcLvlReportingConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2))
etsysSrvcLvlReportingGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 1))
etsysSrvcLvlReportingCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 2))
etsysSrvcLvlSystemGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 1, 1)).setObjects(("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlSystemTime"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlSystemClockResolution"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlMetricCapabilities"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlMetricType"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlMetricUnit"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlMetricDescription"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsysSrvcLvlSystemGroup = etsysSrvcLvlSystemGroup.setStatus('current')
etsysSrvcLvlOwnersGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 1, 2)).setObjects(("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlOwnersOwner"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlOwnersGrantedMetrics"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlOwnersQuota"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlOwnersIpAddressType"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlOwnersIpAddress"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlOwnersEmail"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlOwnersSMS"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlOwnersStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsysSrvcLvlOwnersGroup = etsysSrvcLvlOwnersGroup.setStatus('current')
etsysSrvcLvlHistoryGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 1, 3)).setObjects(("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlHistorySequence"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlHistoryTimestamp"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlHistoryValue"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsysSrvcLvlHistoryGroup = etsysSrvcLvlHistoryGroup.setStatus('current')
etsysSrvcLvlMeasureGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 1, 4)).setObjects(("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureName"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureMetrics"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureBeginTime"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureDurationUnit"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureDuration"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureHistorySize"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureFailureMgmtMode"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureResultsMgmt"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureSrcTypeP"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureSrc"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureDstTypeP"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureDst"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureTxMode"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureTxPacketRateUnit"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureTxPacketRate"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureDevtnOrBurstSize"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureMedOrIntBurstSize"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureLossTimeout"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureL3PacketSize"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureDataPattern"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureMap"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureSingletons"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlNetMeasureOperState"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureName"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureMetrics"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureBeginTime"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureAggrPeriodUnit"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureAggrPeriod"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureDurationUnit"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureDuration"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureHistorySize"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureStorageType"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureResultsMgmt"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureHistoryOwner"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureHistoryOwnerIndex"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureHistoryMetric"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureAdminState"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureMap"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlAggrMeasureStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsysSrvcLvlMeasureGroup = etsysSrvcLvlMeasureGroup.setStatus('current')
etsysSrvcLvlReportingCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 2, 1)).setObjects(("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlSystemGroup"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlOwnersGroup"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlHistoryGroup"), ("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", "etsysSrvcLvlMeasureGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsysSrvcLvlReportingCompliance = etsysSrvcLvlReportingCompliance.setStatus('current')
mibBuilder.exportSymbols("ENTERASYS-SERVICE-LEVEL-REPORTING-MIB", etsysSrvcLvlAggrMeasureHistoryMetric=etsysSrvcLvlAggrMeasureHistoryMetric, etsysSrvcLvlHistoryMeasureIndex=etsysSrvcLvlHistoryMeasureIndex, etsysSrvcLvlNetMeasureName=etsysSrvcLvlNetMeasureName, TimeUnit=TimeUnit, etsysSrvcLvlAggrMeasureStatus=etsysSrvcLvlAggrMeasureStatus, etsysSrvcLvlAggrMeasureMetrics=etsysSrvcLvlAggrMeasureMetrics, etsysSrvcLvlAggrMeasureDuration=etsysSrvcLvlAggrMeasureDuration, etsysServiceLevelReportingMIB=etsysServiceLevelReportingMIB, etsysSrvcLvlNetMeasureIndex=etsysSrvcLvlNetMeasureIndex, etsysSrvcLvlReportingGroups=etsysSrvcLvlReportingGroups, etsysSrvcLvlNetMeasureDuration=etsysSrvcLvlNetMeasureDuration, etsysSrvcLvlHistoryEntry=etsysSrvcLvlHistoryEntry, etsysSrvcLvlAggrMeasureIndex=etsysSrvcLvlAggrMeasureIndex, etsysSrvcLvlOwnersTable=etsysSrvcLvlOwnersTable, etsysSrvcLvlNetMeasureDurationUnit=etsysSrvcLvlNetMeasureDurationUnit, EtsysSrvcLvlOwnerString=EtsysSrvcLvlOwnerString, etsysSrvcLvlNetMeasureSrcTypeP=etsysSrvcLvlNetMeasureSrcTypeP, etsysSrvcLvlAggrMeasureBeginTime=etsysSrvcLvlAggrMeasureBeginTime, etsysSrvcLvlSystemClockResolution=etsysSrvcLvlSystemClockResolution, etsysSrvcLvlHistory=etsysSrvcLvlHistory, etsysSrvcLvlConfigObjects=etsysSrvcLvlConfigObjects, etsysSrvcLvlHistoryMetricIndex=etsysSrvcLvlHistoryMetricIndex, PYSNMP_MODULE_ID=etsysServiceLevelReportingMIB, TypePaddress=TypePaddress, etsysSrvcLvlNetMeasureHistorySize=etsysSrvcLvlNetMeasureHistorySize, etsysSrvcLvlReportingConformance=etsysSrvcLvlReportingConformance, etsysSrvcLvlNetMeasureFailureMgmtMode=etsysSrvcLvlNetMeasureFailureMgmtMode, etsysSrvcLvlAggrMeasureMap=etsysSrvcLvlAggrMeasureMap, etsysSrvcLvlNetMeasureMetrics=etsysSrvcLvlNetMeasureMetrics, etsysSrvcLvlNetMeasureOwner=etsysSrvcLvlNetMeasureOwner, etsysSrvcLvlAggrMeasureHistorySize=etsysSrvcLvlAggrMeasureHistorySize, etsysSrvcLvlNetMeasureDevtnOrBurstSize=etsysSrvcLvlNetMeasureDevtnOrBurstSize, etsysSrvcLvlNetMeasureEntry=etsysSrvcLvlNetMeasureEntry, etsysSrvcLvlNetMeasureTxPacketRate=etsysSrvcLvlNetMeasureTxPacketRate, etsysSrvcLvlAggrMeasureOwner=etsysSrvcLvlAggrMeasureOwner, etsysSrvcLvlHistoryTimestamp=etsysSrvcLvlHistoryTimestamp, etsysSrvcLvlOwnersEmail=etsysSrvcLvlOwnersEmail, etsysSrvcLvlAggrMeasureTable=etsysSrvcLvlAggrMeasureTable, etsysSrvcLvlOwnersGroup=etsysSrvcLvlOwnersGroup, etsysSrvcLvlOwnersSMS=etsysSrvcLvlOwnersSMS, etsysSrvcLvlNetMeasureTable=etsysSrvcLvlNetMeasureTable, EtsysSrvcLvlStandardMetrics=EtsysSrvcLvlStandardMetrics, etsysSrvcLvlMetricIndex=etsysSrvcLvlMetricIndex, etsysSrvcLvlOwnersStatus=etsysSrvcLvlOwnersStatus, etsysSrvcLvlHistorySequence=etsysSrvcLvlHistorySequence, etsysSrvcLvlHistoryGroup=etsysSrvcLvlHistoryGroup, etsysSrvcLvlAggrMeasureAggrPeriod=etsysSrvcLvlAggrMeasureAggrPeriod, etsysSrvcLvlNetMeasureTxPacketRateUnit=etsysSrvcLvlNetMeasureTxPacketRateUnit, etsysSrvcLvlOwnersOwner=etsysSrvcLvlOwnersOwner, etsysSrvcLvlAggrMeasureEntry=etsysSrvcLvlAggrMeasureEntry, etsysSrvcLvlNetMeasureL3PacketSize=etsysSrvcLvlNetMeasureL3PacketSize, etsysSrvcLvlNetMeasureSrc=etsysSrvcLvlNetMeasureSrc, etsysSrvcLvlHistoryIndex=etsysSrvcLvlHistoryIndex, etsysSrvcLvlReportingCompliance=etsysSrvcLvlReportingCompliance, etsysSrvcLvlMetricTable=etsysSrvcLvlMetricTable, etsysSrvcLvlOwnersIpAddressType=etsysSrvcLvlOwnersIpAddressType, etsysSrvcLvlOwnersGrantedMetrics=etsysSrvcLvlOwnersGrantedMetrics, etsysSrvcLvlMeasure=etsysSrvcLvlMeasure, etsysSrvcLvlNetMeasureMap=etsysSrvcLvlNetMeasureMap, etsysSrvcLvlNetMeasureMedOrIntBurstSize=etsysSrvcLvlNetMeasureMedOrIntBurstSize, etsysSrvcLvlAggrMeasureResultsMgmt=etsysSrvcLvlAggrMeasureResultsMgmt, etsysSrvcLvlAggrMeasureAggrPeriodUnit=etsysSrvcLvlAggrMeasureAggrPeriodUnit, etsysSrvcLvlOwnersEntry=etsysSrvcLvlOwnersEntry, etsysSrvcLvlHistoryValue=etsysSrvcLvlHistoryValue, etsysSrvcLvlAggrMeasureHistoryOwnerIndex=etsysSrvcLvlAggrMeasureHistoryOwnerIndex, etsysSrvcLvlNetMeasureDataPattern=etsysSrvcLvlNetMeasureDataPattern, etsysSrvcLvlNetMeasureTxMode=etsysSrvcLvlNetMeasureTxMode, etsysSrvcLvlMetricType=etsysSrvcLvlMetricType, etsysSrvcLvlReportingCompliances=etsysSrvcLvlReportingCompliances, etsysSrvcLvlOwnersQuota=etsysSrvcLvlOwnersQuota, etsysSrvcLvlAggrMeasureName=etsysSrvcLvlAggrMeasureName, etsysSrvcLvlMetricCapabilities=etsysSrvcLvlMetricCapabilities, etsysSrvcLvlNetMeasureLossTimeout=etsysSrvcLvlNetMeasureLossTimeout, GMTTimeStamp=GMTTimeStamp, etsysSrvcLvlMetricEntry=etsysSrvcLvlMetricEntry, etsysSrvcLvlOwnersIpAddress=etsysSrvcLvlOwnersIpAddress, etsysSrvcLvlOwners=etsysSrvcLvlOwners, etsysSrvcLvlMeasureGroup=etsysSrvcLvlMeasureGroup, etsysSrvcLvlAggrMeasureDurationUnit=etsysSrvcLvlAggrMeasureDurationUnit, etsysSrvcLvlMetricUnit=etsysSrvcLvlMetricUnit, etsysSrvcLvlNetMeasureSingletons=etsysSrvcLvlNetMeasureSingletons, etsysSrvcLvlNetMeasureDstTypeP=etsysSrvcLvlNetMeasureDstTypeP, etsysSrvcLvlHistoryMeasureOwner=etsysSrvcLvlHistoryMeasureOwner, etsysSrvcLvlSystemGroup=etsysSrvcLvlSystemGroup, etsysSrvcLvlSystem=etsysSrvcLvlSystem, etsysSrvcLvlHistoryTable=etsysSrvcLvlHistoryTable, etsysSrvcLvlNetMeasureBeginTime=etsysSrvcLvlNetMeasureBeginTime, etsysSrvcLvlSystemTime=etsysSrvcLvlSystemTime, etsysSrvcLvlOwnersIndex=etsysSrvcLvlOwnersIndex, etsysSrvcLvlMetricDescription=etsysSrvcLvlMetricDescription, etsysSrvcLvlNetMeasureOperState=etsysSrvcLvlNetMeasureOperState, etsysSrvcLvlAggrMeasureHistoryOwner=etsysSrvcLvlAggrMeasureHistoryOwner, etsysSrvcLvlNetMeasureResultsMgmt=etsysSrvcLvlNetMeasureResultsMgmt, etsysSrvcLvlAggrMeasureAdminState=etsysSrvcLvlAggrMeasureAdminState, TypeP=TypeP, etsysSrvcLvlAggrMeasureStorageType=etsysSrvcLvlAggrMeasureStorageType, etsysSrvcLvlNetMeasureDst=etsysSrvcLvlNetMeasureDst)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion')
(etsys_modules,) = mibBuilder.importSymbols('ENTERASYS-MIB-NAMES', 'etsysModules')
(inet_address, inet_address_type) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddress', 'InetAddressType')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(object_group, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'NotificationGroup', 'ModuleCompliance')
(integer32, mib_scalar, mib_table, mib_table_row, mib_table_column, ip_address, mib_identifier, unsigned32, counter32, gauge32, iso, module_identity, object_identity, counter64, time_ticks, notification_type, bits) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'IpAddress', 'MibIdentifier', 'Unsigned32', 'Counter32', 'Gauge32', 'iso', 'ModuleIdentity', 'ObjectIdentity', 'Counter64', 'TimeTicks', 'NotificationType', 'Bits')
(textual_convention, row_status, storage_type, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'RowStatus', 'StorageType', 'DisplayString')
etsys_service_level_reporting_mib = module_identity((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39))
etsysServiceLevelReportingMIB.setRevisions(('2003-11-06 15:15', '2003-10-24 19:02', '2003-10-22 23:32'))
if mibBuilder.loadTexts:
etsysServiceLevelReportingMIB.setLastUpdated('200311061515Z')
if mibBuilder.loadTexts:
etsysServiceLevelReportingMIB.setOrganization('Enterasys Networks Inc.')
class Etsyssrvclvlownerstring(TextualConvention, OctetString):
status = 'current'
subtype_spec = OctetString.subtypeSpec + value_size_constraint(0, 32)
class Timeunit(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9))
named_values = named_values(('year', 1), ('month', 2), ('week', 3), ('day', 4), ('hour', 5), ('second', 6), ('millisecond', 7), ('microsecond', 8), ('nanosecond', 9))
class Etsyssrvclvlstandardmetrics(TextualConvention, Bits):
status = 'current'
named_values = named_values(('reserved', 0), ('instantUnidirectionConnectivity', 1), ('instantBidirectionConnectivity', 2), ('intervalUnidirectionConnectivity', 3), ('intervalBidirectionConnectivity', 4), ('intervalTemporalConnectivity', 5), ('oneWayDelay', 6), ('oneWayDelayPoissonStream', 7), ('oneWayDelayPercentile', 8), ('oneWayDelayMedian', 9), ('oneWayDelayMinimum', 10), ('oneWayDelayInversePercentile', 11), ('oneWayPacketLoss', 12), ('oneWayPacketLossPoissonStream', 13), ('oneWayPacketLossAverage', 14), ('roundtripDelay', 15), ('roundtripDelayPoissonStream', 16), ('roundtripDelayPercentile', 17), ('roundtripDelayMedian', 18), ('roundtripDelayMinimum', 19), ('roundtripDelayInversePercentile', 20), ('oneWayLossDistanceStream', 21), ('oneWayLossPeriodStream', 22), ('oneWayLossNoticeableRate', 23), ('oneWayLossPeriodTotal', 24), ('oneWayLossPeriodLengths', 25), ('oneWayInterLossPeriodLengths', 26), ('oneWayIpdv', 27), ('oneWayIpdvPoissonStream', 28), ('oneWayIpdvPercentile', 29), ('oneWayIpdvInversePercentile', 30), ('oneWayIpdvJitter', 31), ('oneWayPeakToPeakIpdv', 32), ('oneWayDelayPeriodicStream', 33), ('roundtripDelayAverage', 34), ('roundtripPacketLoss', 35), ('roundtripPacketLossAverage', 36), ('roundtripIpdv', 37))
class Gmttimestamp(TextualConvention, OctetString):
status = 'current'
subtype_spec = OctetString.subtypeSpec + value_size_constraint(8, 8)
fixed_length = 8
class Typep(TextualConvention, OctetString):
status = 'current'
subtype_spec = OctetString.subtypeSpec + value_size_constraint(0, 512)
class Typepaddress(TextualConvention, OctetString):
status = 'current'
display_hint = '255a'
subtype_spec = OctetString.subtypeSpec + value_size_constraint(0, 512)
etsys_srvc_lvl_config_objects = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1))
etsys_srvc_lvl_system = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1))
etsys_srvc_lvl_owners = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2))
etsys_srvc_lvl_history = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3))
etsys_srvc_lvl_measure = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4))
etsys_srvc_lvl_system_time = mib_scalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 1), gmt_time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlSystemTime.setStatus('current')
etsys_srvc_lvl_system_clock_resolution = mib_scalar((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 2), integer32()).setUnits('picoseconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlSystemClockResolution.setStatus('current')
etsys_srvc_lvl_metric_table = mib_table((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3))
if mibBuilder.loadTexts:
etsysSrvcLvlMetricTable.setStatus('current')
etsys_srvc_lvl_metric_entry = mib_table_row((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1)).setIndexNames((0, 'ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlMetricIndex'))
if mibBuilder.loadTexts:
etsysSrvcLvlMetricEntry.setStatus('current')
etsys_srvc_lvl_metric_index = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37))).clone(namedValues=named_values(('instantUnidirectionConnectivity', 1), ('instantBidirectionConnectivity', 2), ('intervalUnidirectionConnectivity', 3), ('intervalBidirectionConnectivity', 4), ('intervalTemporalConnectivity', 5), ('oneWayDelay', 6), ('oneWayDelayPoissonStream', 7), ('oneWayDelayPercentile', 8), ('oneWayDelayMedian', 9), ('oneWayDelayMinimum', 10), ('oneWayDelayInversePercentile', 11), ('oneWayPacketLoss', 12), ('oneWayPacketLossPoissonStream', 13), ('oneWayPacketLossAverage', 14), ('roundtripDelay', 15), ('roundtripDelayPoissonStream', 16), ('roundtripDelayPercentile', 17), ('roundtripDelayMedian', 18), ('roundtripDelayMinimum', 19), ('roundtripDelayInversePercentile', 20), ('oneWayLossDistanceStream', 21), ('oneWayLossPeriodStream', 22), ('oneWayLossNoticeableRate', 23), ('oneWayLossPeriodTotal', 24), ('oneWayLossPeriodLengths', 25), ('oneWayInterLossPeriodLengths', 26), ('oneWayIpdv', 27), ('oneWayIpdvPoissonStream', 28), ('oneWayIpdvPercentile', 29), ('oneWayIpdvInversePercentile', 30), ('oneWayIpdvJitter', 31), ('oneWayPeakToPeakIpdv', 32), ('oneWayDelayPeriodicStream', 33), ('roundtripDelayAverage', 34), ('roundtripPacketLoss', 35), ('roundtripPacketLossAverage', 36), ('roundtripIpdv', 37))))
if mibBuilder.loadTexts:
etsysSrvcLvlMetricIndex.setStatus('current')
etsys_srvc_lvl_metric_capabilities = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('notImplemented', 0), ('implemented', 1))).clone('implemented')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlMetricCapabilities.setStatus('current')
etsys_srvc_lvl_metric_type = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('network', 0), ('aggregated', 1))).clone('aggregated')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlMetricType.setStatus('current')
etsys_srvc_lvl_metric_unit = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=named_values(('noUnit', 0), ('second', 1), ('millisecond', 2), ('microsecond', 3), ('nanosecond', 4), ('percentage', 5), ('packet', 6), ('byte', 7), ('kilobyte', 8), ('megabyte', 9)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlMetricUnit.setStatus('current')
etsys_srvc_lvl_metric_description = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 1, 3, 1, 5), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlMetricDescription.setStatus('current')
etsys_srvc_lvl_owners_table = mib_table((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1))
if mibBuilder.loadTexts:
etsysSrvcLvlOwnersTable.setStatus('current')
etsys_srvc_lvl_owners_entry = mib_table_row((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1)).setIndexNames((0, 'ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlOwnersIndex'))
if mibBuilder.loadTexts:
etsysSrvcLvlOwnersEntry.setStatus('current')
etsys_srvc_lvl_owners_index = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535)))
if mibBuilder.loadTexts:
etsysSrvcLvlOwnersIndex.setStatus('current')
etsys_srvc_lvl_owners_owner = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 2), etsys_srvc_lvl_owner_string()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlOwnersOwner.setStatus('current')
etsys_srvc_lvl_owners_granted_metrics = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 3), etsys_srvc_lvl_standard_metrics()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlOwnersGrantedMetrics.setStatus('current')
etsys_srvc_lvl_owners_quota = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 4), integer32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlOwnersQuota.setStatus('current')
etsys_srvc_lvl_owners_ip_address_type = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 5), inet_address_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlOwnersIpAddressType.setStatus('current')
etsys_srvc_lvl_owners_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 6), inet_address().subtype(subtypeSpec=value_size_constraint(1, 128))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlOwnersIpAddress.setStatus('current')
etsys_srvc_lvl_owners_email = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 7), snmp_admin_string()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlOwnersEmail.setStatus('current')
etsys_srvc_lvl_owners_sms = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 8), snmp_admin_string()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlOwnersSMS.setStatus('current')
etsys_srvc_lvl_owners_status = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 2, 1, 1, 9), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlOwnersStatus.setStatus('current')
etsys_srvc_lvl_history_table = mib_table((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1))
if mibBuilder.loadTexts:
etsysSrvcLvlHistoryTable.setStatus('current')
etsys_srvc_lvl_history_entry = mib_table_row((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1)).setIndexNames((0, 'ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlHistoryMeasureOwner'), (0, 'ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlHistoryMeasureIndex'), (0, 'ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlHistoryMetricIndex'), (0, 'ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlHistoryIndex'))
if mibBuilder.loadTexts:
etsysSrvcLvlHistoryEntry.setStatus('current')
etsys_srvc_lvl_history_measure_owner = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 1), etsys_srvc_lvl_owner_string())
if mibBuilder.loadTexts:
etsysSrvcLvlHistoryMeasureOwner.setStatus('current')
etsys_srvc_lvl_history_measure_index = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535)))
if mibBuilder.loadTexts:
etsysSrvcLvlHistoryMeasureIndex.setStatus('current')
etsys_srvc_lvl_history_metric_index = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535)))
if mibBuilder.loadTexts:
etsysSrvcLvlHistoryMetricIndex.setStatus('current')
etsys_srvc_lvl_history_index = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535)))
if mibBuilder.loadTexts:
etsysSrvcLvlHistoryIndex.setStatus('current')
etsys_srvc_lvl_history_sequence = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlHistorySequence.setStatus('current')
etsys_srvc_lvl_history_timestamp = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 6), gmt_time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlHistoryTimestamp.setStatus('current')
etsys_srvc_lvl_history_value = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 3, 1, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlHistoryValue.setStatus('current')
etsys_srvc_lvl_net_measure_table = mib_table((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1))
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureTable.setStatus('current')
etsys_srvc_lvl_net_measure_entry = mib_table_row((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1)).setIndexNames((0, 'ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureOwner'), (0, 'ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureIndex'))
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureEntry.setStatus('current')
etsys_srvc_lvl_net_measure_owner = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 1), etsys_srvc_lvl_owner_string())
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureOwner.setStatus('current')
etsys_srvc_lvl_net_measure_index = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535)))
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureIndex.setStatus('current')
etsys_srvc_lvl_net_measure_name = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 3), snmp_admin_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureName.setStatus('current')
etsys_srvc_lvl_net_measure_metrics = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 4), etsys_srvc_lvl_standard_metrics()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureMetrics.setStatus('current')
etsys_srvc_lvl_net_measure_begin_time = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 5), gmt_time_stamp()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureBeginTime.setStatus('current')
etsys_srvc_lvl_net_measure_duration_unit = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 6), time_unit().clone('second')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureDurationUnit.setStatus('current')
etsys_srvc_lvl_net_measure_duration = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 7), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureDuration.setStatus('current')
etsys_srvc_lvl_net_measure_history_size = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 8), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureHistorySize.setStatus('current')
etsys_srvc_lvl_net_measure_failure_mgmt_mode = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('auto', 1), ('manual', 2), ('discarded', 3))).clone('auto')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureFailureMgmtMode.setStatus('current')
etsys_srvc_lvl_net_measure_results_mgmt = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('wrap', 1), ('suspend', 2), ('delete', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureResultsMgmt.setStatus('current')
etsys_srvc_lvl_net_measure_src_type_p = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 11), type_p().clone('ip')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureSrcTypeP.setStatus('current')
etsys_srvc_lvl_net_measure_src = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 12), type_paddress()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureSrc.setStatus('current')
etsys_srvc_lvl_net_measure_dst_type_p = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 13), type_p().clone('ip')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureDstTypeP.setStatus('current')
etsys_srvc_lvl_net_measure_dst = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 14), type_paddress()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureDst.setStatus('current')
etsys_srvc_lvl_net_measure_tx_mode = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3))).clone(namedValues=named_values(('other', 0), ('periodic', 1), ('poisson', 2), ('multiburst', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureTxMode.setStatus('current')
etsys_srvc_lvl_net_measure_tx_packet_rate_unit = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 16), time_unit()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureTxPacketRateUnit.setStatus('current')
etsys_srvc_lvl_net_measure_tx_packet_rate = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 17), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureTxPacketRate.setStatus('current')
etsys_srvc_lvl_net_measure_devtn_or_burst_size = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 18), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureDevtnOrBurstSize.setStatus('current')
etsys_srvc_lvl_net_measure_med_or_int_burst_size = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 19), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureMedOrIntBurstSize.setStatus('current')
etsys_srvc_lvl_net_measure_loss_timeout = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 20), integer32()).setUnits('Milliseconds').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureLossTimeout.setStatus('current')
etsys_srvc_lvl_net_measure_l3_packet_size = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 21), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureL3PacketSize.setStatus('current')
etsys_srvc_lvl_net_measure_data_pattern = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 22), octet_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureDataPattern.setStatus('current')
etsys_srvc_lvl_net_measure_map = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 23), snmp_admin_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureMap.setStatus('current')
etsys_srvc_lvl_net_measure_singletons = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 24), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureSingletons.setStatus('current')
etsys_srvc_lvl_net_measure_oper_state = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 1, 1, 25), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('unknown', 0), ('running', 1), ('stopped', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlNetMeasureOperState.setStatus('current')
etsys_srvc_lvl_aggr_measure_table = mib_table((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2))
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureTable.setStatus('current')
etsys_srvc_lvl_aggr_measure_entry = mib_table_row((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1)).setIndexNames((0, 'ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureOwner'), (0, 'ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureIndex'))
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureEntry.setStatus('current')
etsys_srvc_lvl_aggr_measure_owner = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 1), etsys_srvc_lvl_owner_string())
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureOwner.setStatus('current')
etsys_srvc_lvl_aggr_measure_index = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535)))
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureIndex.setStatus('current')
etsys_srvc_lvl_aggr_measure_name = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 3), snmp_admin_string()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureName.setStatus('current')
etsys_srvc_lvl_aggr_measure_metrics = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 4), etsys_srvc_lvl_standard_metrics()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureMetrics.setStatus('current')
etsys_srvc_lvl_aggr_measure_begin_time = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 5), gmt_time_stamp()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureBeginTime.setStatus('current')
etsys_srvc_lvl_aggr_measure_aggr_period_unit = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 6), time_unit().clone('second')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureAggrPeriodUnit.setStatus('current')
etsys_srvc_lvl_aggr_measure_aggr_period = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 7), integer32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureAggrPeriod.setStatus('current')
etsys_srvc_lvl_aggr_measure_duration_unit = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 8), time_unit().clone('second')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureDurationUnit.setStatus('current')
etsys_srvc_lvl_aggr_measure_duration = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 9), integer32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureDuration.setStatus('current')
etsys_srvc_lvl_aggr_measure_history_size = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 10), integer32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureHistorySize.setStatus('current')
etsys_srvc_lvl_aggr_measure_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 11), storage_type().clone('volatile')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureStorageType.setStatus('current')
etsys_srvc_lvl_aggr_measure_results_mgmt = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('wrap', 1), ('suspend', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureResultsMgmt.setStatus('current')
etsys_srvc_lvl_aggr_measure_history_owner = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 13), etsys_srvc_lvl_owner_string()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureHistoryOwner.setStatus('current')
etsys_srvc_lvl_aggr_measure_history_owner_index = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 14), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureHistoryOwnerIndex.setStatus('current')
etsys_srvc_lvl_aggr_measure_history_metric = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 15), integer32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureHistoryMetric.setStatus('current')
etsys_srvc_lvl_aggr_measure_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 16), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('start', 0), ('stop', 1)))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureAdminState.setStatus('current')
etsys_srvc_lvl_aggr_measure_map = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 17), snmp_admin_string()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureMap.setStatus('current')
etsys_srvc_lvl_aggr_measure_status = mib_table_column((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 1, 4, 2, 1, 18), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
etsysSrvcLvlAggrMeasureStatus.setStatus('current')
etsys_srvc_lvl_reporting_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2))
etsys_srvc_lvl_reporting_groups = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 1))
etsys_srvc_lvl_reporting_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 2))
etsys_srvc_lvl_system_group = object_group((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 1, 1)).setObjects(('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlSystemTime'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlSystemClockResolution'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlMetricCapabilities'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlMetricType'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlMetricUnit'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlMetricDescription'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsys_srvc_lvl_system_group = etsysSrvcLvlSystemGroup.setStatus('current')
etsys_srvc_lvl_owners_group = object_group((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 1, 2)).setObjects(('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlOwnersOwner'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlOwnersGrantedMetrics'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlOwnersQuota'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlOwnersIpAddressType'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlOwnersIpAddress'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlOwnersEmail'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlOwnersSMS'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlOwnersStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsys_srvc_lvl_owners_group = etsysSrvcLvlOwnersGroup.setStatus('current')
etsys_srvc_lvl_history_group = object_group((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 1, 3)).setObjects(('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlHistorySequence'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlHistoryTimestamp'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlHistoryValue'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsys_srvc_lvl_history_group = etsysSrvcLvlHistoryGroup.setStatus('current')
etsys_srvc_lvl_measure_group = object_group((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 1, 4)).setObjects(('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureName'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureMetrics'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureBeginTime'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureDurationUnit'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureDuration'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureHistorySize'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureFailureMgmtMode'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureResultsMgmt'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureSrcTypeP'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureSrc'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureDstTypeP'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureDst'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureTxMode'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureTxPacketRateUnit'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureTxPacketRate'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureDevtnOrBurstSize'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureMedOrIntBurstSize'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureLossTimeout'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureL3PacketSize'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureDataPattern'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureMap'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureSingletons'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlNetMeasureOperState'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureName'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureMetrics'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureBeginTime'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureAggrPeriodUnit'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureAggrPeriod'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureDurationUnit'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureDuration'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureHistorySize'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureStorageType'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureResultsMgmt'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureHistoryOwner'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureHistoryOwnerIndex'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureHistoryMetric'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureAdminState'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureMap'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlAggrMeasureStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsys_srvc_lvl_measure_group = etsysSrvcLvlMeasureGroup.setStatus('current')
etsys_srvc_lvl_reporting_compliance = module_compliance((1, 3, 6, 1, 4, 1, 5624, 1, 2, 39, 2, 2, 1)).setObjects(('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlSystemGroup'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlOwnersGroup'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlHistoryGroup'), ('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', 'etsysSrvcLvlMeasureGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsys_srvc_lvl_reporting_compliance = etsysSrvcLvlReportingCompliance.setStatus('current')
mibBuilder.exportSymbols('ENTERASYS-SERVICE-LEVEL-REPORTING-MIB', etsysSrvcLvlAggrMeasureHistoryMetric=etsysSrvcLvlAggrMeasureHistoryMetric, etsysSrvcLvlHistoryMeasureIndex=etsysSrvcLvlHistoryMeasureIndex, etsysSrvcLvlNetMeasureName=etsysSrvcLvlNetMeasureName, TimeUnit=TimeUnit, etsysSrvcLvlAggrMeasureStatus=etsysSrvcLvlAggrMeasureStatus, etsysSrvcLvlAggrMeasureMetrics=etsysSrvcLvlAggrMeasureMetrics, etsysSrvcLvlAggrMeasureDuration=etsysSrvcLvlAggrMeasureDuration, etsysServiceLevelReportingMIB=etsysServiceLevelReportingMIB, etsysSrvcLvlNetMeasureIndex=etsysSrvcLvlNetMeasureIndex, etsysSrvcLvlReportingGroups=etsysSrvcLvlReportingGroups, etsysSrvcLvlNetMeasureDuration=etsysSrvcLvlNetMeasureDuration, etsysSrvcLvlHistoryEntry=etsysSrvcLvlHistoryEntry, etsysSrvcLvlAggrMeasureIndex=etsysSrvcLvlAggrMeasureIndex, etsysSrvcLvlOwnersTable=etsysSrvcLvlOwnersTable, etsysSrvcLvlNetMeasureDurationUnit=etsysSrvcLvlNetMeasureDurationUnit, EtsysSrvcLvlOwnerString=EtsysSrvcLvlOwnerString, etsysSrvcLvlNetMeasureSrcTypeP=etsysSrvcLvlNetMeasureSrcTypeP, etsysSrvcLvlAggrMeasureBeginTime=etsysSrvcLvlAggrMeasureBeginTime, etsysSrvcLvlSystemClockResolution=etsysSrvcLvlSystemClockResolution, etsysSrvcLvlHistory=etsysSrvcLvlHistory, etsysSrvcLvlConfigObjects=etsysSrvcLvlConfigObjects, etsysSrvcLvlHistoryMetricIndex=etsysSrvcLvlHistoryMetricIndex, PYSNMP_MODULE_ID=etsysServiceLevelReportingMIB, TypePaddress=TypePaddress, etsysSrvcLvlNetMeasureHistorySize=etsysSrvcLvlNetMeasureHistorySize, etsysSrvcLvlReportingConformance=etsysSrvcLvlReportingConformance, etsysSrvcLvlNetMeasureFailureMgmtMode=etsysSrvcLvlNetMeasureFailureMgmtMode, etsysSrvcLvlAggrMeasureMap=etsysSrvcLvlAggrMeasureMap, etsysSrvcLvlNetMeasureMetrics=etsysSrvcLvlNetMeasureMetrics, etsysSrvcLvlNetMeasureOwner=etsysSrvcLvlNetMeasureOwner, etsysSrvcLvlAggrMeasureHistorySize=etsysSrvcLvlAggrMeasureHistorySize, etsysSrvcLvlNetMeasureDevtnOrBurstSize=etsysSrvcLvlNetMeasureDevtnOrBurstSize, etsysSrvcLvlNetMeasureEntry=etsysSrvcLvlNetMeasureEntry, etsysSrvcLvlNetMeasureTxPacketRate=etsysSrvcLvlNetMeasureTxPacketRate, etsysSrvcLvlAggrMeasureOwner=etsysSrvcLvlAggrMeasureOwner, etsysSrvcLvlHistoryTimestamp=etsysSrvcLvlHistoryTimestamp, etsysSrvcLvlOwnersEmail=etsysSrvcLvlOwnersEmail, etsysSrvcLvlAggrMeasureTable=etsysSrvcLvlAggrMeasureTable, etsysSrvcLvlOwnersGroup=etsysSrvcLvlOwnersGroup, etsysSrvcLvlOwnersSMS=etsysSrvcLvlOwnersSMS, etsysSrvcLvlNetMeasureTable=etsysSrvcLvlNetMeasureTable, EtsysSrvcLvlStandardMetrics=EtsysSrvcLvlStandardMetrics, etsysSrvcLvlMetricIndex=etsysSrvcLvlMetricIndex, etsysSrvcLvlOwnersStatus=etsysSrvcLvlOwnersStatus, etsysSrvcLvlHistorySequence=etsysSrvcLvlHistorySequence, etsysSrvcLvlHistoryGroup=etsysSrvcLvlHistoryGroup, etsysSrvcLvlAggrMeasureAggrPeriod=etsysSrvcLvlAggrMeasureAggrPeriod, etsysSrvcLvlNetMeasureTxPacketRateUnit=etsysSrvcLvlNetMeasureTxPacketRateUnit, etsysSrvcLvlOwnersOwner=etsysSrvcLvlOwnersOwner, etsysSrvcLvlAggrMeasureEntry=etsysSrvcLvlAggrMeasureEntry, etsysSrvcLvlNetMeasureL3PacketSize=etsysSrvcLvlNetMeasureL3PacketSize, etsysSrvcLvlNetMeasureSrc=etsysSrvcLvlNetMeasureSrc, etsysSrvcLvlHistoryIndex=etsysSrvcLvlHistoryIndex, etsysSrvcLvlReportingCompliance=etsysSrvcLvlReportingCompliance, etsysSrvcLvlMetricTable=etsysSrvcLvlMetricTable, etsysSrvcLvlOwnersIpAddressType=etsysSrvcLvlOwnersIpAddressType, etsysSrvcLvlOwnersGrantedMetrics=etsysSrvcLvlOwnersGrantedMetrics, etsysSrvcLvlMeasure=etsysSrvcLvlMeasure, etsysSrvcLvlNetMeasureMap=etsysSrvcLvlNetMeasureMap, etsysSrvcLvlNetMeasureMedOrIntBurstSize=etsysSrvcLvlNetMeasureMedOrIntBurstSize, etsysSrvcLvlAggrMeasureResultsMgmt=etsysSrvcLvlAggrMeasureResultsMgmt, etsysSrvcLvlAggrMeasureAggrPeriodUnit=etsysSrvcLvlAggrMeasureAggrPeriodUnit, etsysSrvcLvlOwnersEntry=etsysSrvcLvlOwnersEntry, etsysSrvcLvlHistoryValue=etsysSrvcLvlHistoryValue, etsysSrvcLvlAggrMeasureHistoryOwnerIndex=etsysSrvcLvlAggrMeasureHistoryOwnerIndex, etsysSrvcLvlNetMeasureDataPattern=etsysSrvcLvlNetMeasureDataPattern, etsysSrvcLvlNetMeasureTxMode=etsysSrvcLvlNetMeasureTxMode, etsysSrvcLvlMetricType=etsysSrvcLvlMetricType, etsysSrvcLvlReportingCompliances=etsysSrvcLvlReportingCompliances, etsysSrvcLvlOwnersQuota=etsysSrvcLvlOwnersQuota, etsysSrvcLvlAggrMeasureName=etsysSrvcLvlAggrMeasureName, etsysSrvcLvlMetricCapabilities=etsysSrvcLvlMetricCapabilities, etsysSrvcLvlNetMeasureLossTimeout=etsysSrvcLvlNetMeasureLossTimeout, GMTTimeStamp=GMTTimeStamp, etsysSrvcLvlMetricEntry=etsysSrvcLvlMetricEntry, etsysSrvcLvlOwnersIpAddress=etsysSrvcLvlOwnersIpAddress, etsysSrvcLvlOwners=etsysSrvcLvlOwners, etsysSrvcLvlMeasureGroup=etsysSrvcLvlMeasureGroup, etsysSrvcLvlAggrMeasureDurationUnit=etsysSrvcLvlAggrMeasureDurationUnit, etsysSrvcLvlMetricUnit=etsysSrvcLvlMetricUnit, etsysSrvcLvlNetMeasureSingletons=etsysSrvcLvlNetMeasureSingletons, etsysSrvcLvlNetMeasureDstTypeP=etsysSrvcLvlNetMeasureDstTypeP, etsysSrvcLvlHistoryMeasureOwner=etsysSrvcLvlHistoryMeasureOwner, etsysSrvcLvlSystemGroup=etsysSrvcLvlSystemGroup, etsysSrvcLvlSystem=etsysSrvcLvlSystem, etsysSrvcLvlHistoryTable=etsysSrvcLvlHistoryTable, etsysSrvcLvlNetMeasureBeginTime=etsysSrvcLvlNetMeasureBeginTime, etsysSrvcLvlSystemTime=etsysSrvcLvlSystemTime, etsysSrvcLvlOwnersIndex=etsysSrvcLvlOwnersIndex, etsysSrvcLvlMetricDescription=etsysSrvcLvlMetricDescription, etsysSrvcLvlNetMeasureOperState=etsysSrvcLvlNetMeasureOperState, etsysSrvcLvlAggrMeasureHistoryOwner=etsysSrvcLvlAggrMeasureHistoryOwner, etsysSrvcLvlNetMeasureResultsMgmt=etsysSrvcLvlNetMeasureResultsMgmt, etsysSrvcLvlAggrMeasureAdminState=etsysSrvcLvlAggrMeasureAdminState, TypeP=TypeP, etsysSrvcLvlAggrMeasureStorageType=etsysSrvcLvlAggrMeasureStorageType, etsysSrvcLvlNetMeasureDst=etsysSrvcLvlNetMeasureDst) |
#
# @lc app=leetcode id=4 lang=python3
#
# [4] Median of Two Sorted Arrays
#
# https://leetcode.com/problems/median-of-two-sorted-arrays/description/
#
# algorithms
# Hard (30.86%)
# Likes: 9316
# Dislikes: 1441
# Total Accepted: 872.2K
# Total Submissions: 2.8M
# Testcase Example: '[1,3]\n[2]'
#
# Given two sorted arrays nums1 and nums2 of size m and n respectively, return
# the median of the two sorted arrays.
#
#
# Example 1:
#
#
# Input: nums1 = [1,3], nums2 = [2]
# Output: 2.00000
# Explanation: merged array = [1,2,3] and median is 2.
#
#
# Example 2:
#
#
# Input: nums1 = [1,2], nums2 = [3,4]
# Output: 2.50000
# Explanation: merged array = [1,2,3,4] and median is (2 + 3) / 2 = 2.5.
#
#
# Example 3:
#
#
# Input: nums1 = [0,0], nums2 = [0,0]
# Output: 0.00000
#
#
# Example 4:
#
#
# Input: nums1 = [], nums2 = [1]
# Output: 1.00000
#
#
# Example 5:
#
#
# Input: nums1 = [2], nums2 = []
# Output: 2.00000
#
#
#
# Constraints:
#
#
# nums1.length == m
# nums2.length == n
# 0 <= m <= 1000
# 0 <= n <= 1000
# 1 <= m + n <= 2000
# -10^6 <= nums1[i], nums2[i] <= 10^6
#
#
#
# Follow up: The overall run time complexity should be O(log (m+n)).
#
# @lc code=start
class Solution_QuickSelect:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
nums = nums1[:] + nums2[:]
length = len(nums)
if length % 2 == 0:
return (self._quick_select(nums, 0, length - 1, length // 2 + 1) + self._quick_select(nums, 0, length - 1, (length - 1) // 2 + 1)) / 2
else:
return self._quick_select(nums, 0, length - 1, length // 2 + 1)
def _quick_select(self, nums, start, end, k):
left, right = start, end
pivot = nums[(left + right) // 2]
while left <= right:
while left <= right and nums[left] > pivot:
left += 1
while left <= right and nums[right] < pivot:
right -= 1
if left <= right:
nums[left], nums[right] = nums[right], nums[left]
left += 1
right -= 1
if start + k - 1 <= right:
return self._quick_select(nums, start, right, k)
if start + k - 1 >= left:
return self._quick_select(nums, left, end, k - (left - start))
return nums[right + 1]
class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
if len(nums1) > len(nums2):
return self.findMedianSortedArrays(nums2, nums1)
l1, l2 = len(nums1), len(nums2)
left, right = 0, l1
while left <= right:
position_x = (left + right) // 2
position_y = (l1 + l2 + 1) // 2 - position_x
max_left_x = nums1[position_x - 1] if position_x != 0 else float('-inf')
max_left_y = nums2[position_y - 1] if position_y != 0 else float('-inf')
min_right_x = nums1[position_x] if position_x < l1 else float('inf')
min_right_y = nums2[position_y] if position_y < l2 else float('inf')
if (max_left_x <= min_right_y and max_left_y <= min_right_x):
# we found the partition
if (l1 + l2) % 2 == 0:
return (max(max_left_x, max_left_y) + min(min_right_x, min_right_y)) / 2
else:
return max(max_left_x, max_left_y)
elif max_left_x > min_right_y:
# we should move left
right = position_x - 1
else:
left = position_x + 1
return 0
# @lc code=end
| class Solution_Quickselect:
def find_median_sorted_arrays(self, nums1: List[int], nums2: List[int]) -> float:
nums = nums1[:] + nums2[:]
length = len(nums)
if length % 2 == 0:
return (self._quick_select(nums, 0, length - 1, length // 2 + 1) + self._quick_select(nums, 0, length - 1, (length - 1) // 2 + 1)) / 2
else:
return self._quick_select(nums, 0, length - 1, length // 2 + 1)
def _quick_select(self, nums, start, end, k):
(left, right) = (start, end)
pivot = nums[(left + right) // 2]
while left <= right:
while left <= right and nums[left] > pivot:
left += 1
while left <= right and nums[right] < pivot:
right -= 1
if left <= right:
(nums[left], nums[right]) = (nums[right], nums[left])
left += 1
right -= 1
if start + k - 1 <= right:
return self._quick_select(nums, start, right, k)
if start + k - 1 >= left:
return self._quick_select(nums, left, end, k - (left - start))
return nums[right + 1]
class Solution:
def find_median_sorted_arrays(self, nums1: List[int], nums2: List[int]) -> float:
if len(nums1) > len(nums2):
return self.findMedianSortedArrays(nums2, nums1)
(l1, l2) = (len(nums1), len(nums2))
(left, right) = (0, l1)
while left <= right:
position_x = (left + right) // 2
position_y = (l1 + l2 + 1) // 2 - position_x
max_left_x = nums1[position_x - 1] if position_x != 0 else float('-inf')
max_left_y = nums2[position_y - 1] if position_y != 0 else float('-inf')
min_right_x = nums1[position_x] if position_x < l1 else float('inf')
min_right_y = nums2[position_y] if position_y < l2 else float('inf')
if max_left_x <= min_right_y and max_left_y <= min_right_x:
if (l1 + l2) % 2 == 0:
return (max(max_left_x, max_left_y) + min(min_right_x, min_right_y)) / 2
else:
return max(max_left_x, max_left_y)
elif max_left_x > min_right_y:
right = position_x - 1
else:
left = position_x + 1
return 0 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def recoverFromPreorder(self, S: str) -> TreeNode:
def dfs(parent, s, lev):
print(parent.val, s, lev)
if not s: return
i = lev
l = 0
while i < len(s) and s[i].isdigit():
l = l * 10 + int(s[i])
i += 1
parent.left = TreeNode(l)
j = lev
f = '-' * lev
for ind in range(i, len(s)):
if s[ind:].startswith(f) and not s[ind:].startswith(f + '-') and s[ind -1] != '-':
rr = ind
j = ind + lev
r = 0
while j < len(s) and s[j].isdigit():
r = r * 10 + int(s[j])
j += 1
parent.right = TreeNode(r)
dfs(parent.left, s[i:rr], lev + 1)
dfs(parent.right, s[j:], lev + 1)
return
dfs(parent.left, s[i:], lev + 1)
i = num = 0
while i < len(S) and S[i].isdigit():
num = num * 10 + int(S[i])
i += 1
root = TreeNode(num)
dfs(root, S[i:], 1)
return root
| class Solution:
def recover_from_preorder(self, S: str) -> TreeNode:
def dfs(parent, s, lev):
print(parent.val, s, lev)
if not s:
return
i = lev
l = 0
while i < len(s) and s[i].isdigit():
l = l * 10 + int(s[i])
i += 1
parent.left = tree_node(l)
j = lev
f = '-' * lev
for ind in range(i, len(s)):
if s[ind:].startswith(f) and (not s[ind:].startswith(f + '-')) and (s[ind - 1] != '-'):
rr = ind
j = ind + lev
r = 0
while j < len(s) and s[j].isdigit():
r = r * 10 + int(s[j])
j += 1
parent.right = tree_node(r)
dfs(parent.left, s[i:rr], lev + 1)
dfs(parent.right, s[j:], lev + 1)
return
dfs(parent.left, s[i:], lev + 1)
i = num = 0
while i < len(S) and S[i].isdigit():
num = num * 10 + int(S[i])
i += 1
root = tree_node(num)
dfs(root, S[i:], 1)
return root |
# Enter your code here. Read input from STDIN. Print output to STDOUT
n=int(input())
country_name=set(input() for i in range(n))
print(len(country_name))
| n = int(input())
country_name = set((input() for i in range(n)))
print(len(country_name)) |
PIPELINE = {
#'PIPELINE_ENABLED': True,
'STYLESHEETS': {
'global': {
'source_filenames': (
'foundation-sites/dist/foundation.min.css',
'pikaday/css/pikaday.css',
'jt.timepicker/jquery.timepicker.css',
'foundation-icon-fonts/foundation-icons.css',
'routes/css/routes.css',
),
'output_filename': 'css/global.css',
'extra_context': {
'media': 'screen,projection',
},
},
},
'JAVASCRIPT': {
'global': {
'source_filenames': (
'jquery/dist/jquery.min.js',
'common/js/csrf.js',
'foundation-sites/dist/foundation.min.js',
'pikaday/pikaday.js',
'pikaday/plugins/pikaday.jquery.js',
'jt.timepicker/jquery.timepicker.min.js',
'moment/min/moment.min.js',
'moment-timezone/builds/moment-timezone-with-data.min.js',
'Chart.js/dist/Chart.min.js',
'vue/dist/vue.min.js',
'routes/js/routes.js',
),
'output_filename': 'js/global.js',
}
}
}
| pipeline = {'STYLESHEETS': {'global': {'source_filenames': ('foundation-sites/dist/foundation.min.css', 'pikaday/css/pikaday.css', 'jt.timepicker/jquery.timepicker.css', 'foundation-icon-fonts/foundation-icons.css', 'routes/css/routes.css'), 'output_filename': 'css/global.css', 'extra_context': {'media': 'screen,projection'}}}, 'JAVASCRIPT': {'global': {'source_filenames': ('jquery/dist/jquery.min.js', 'common/js/csrf.js', 'foundation-sites/dist/foundation.min.js', 'pikaday/pikaday.js', 'pikaday/plugins/pikaday.jquery.js', 'jt.timepicker/jquery.timepicker.min.js', 'moment/min/moment.min.js', 'moment-timezone/builds/moment-timezone-with-data.min.js', 'Chart.js/dist/Chart.min.js', 'vue/dist/vue.min.js', 'routes/js/routes.js'), 'output_filename': 'js/global.js'}}} |
TITLE = "Jump game"
WIDTH = 480
HEIGHT = 600
FPS = 30
WHITE = (255, 255, 255)
BLACK = (0,0,0)
RED = (240, 55, 66) | title = 'Jump game'
width = 480
height = 600
fps = 30
white = (255, 255, 255)
black = (0, 0, 0)
red = (240, 55, 66) |
class Tool:
def __init__(self, name, make):
self.name = name
self.make = make
| class Tool:
def __init__(self, name, make):
self.name = name
self.make = make |
colors = {
"bg0": " #fbf1c7",
"bg1": " #ebdbb2",
"bg2": " #d5c4a1",
"bg3": " #bdae93",
"bg4": " #a89984",
"gry": " #928374",
"fg4": " #7c6f64",
"fg3": " #665c54",
"fg2": " #504945",
"fg1": " #3c3836",
"fg0": " #282828",
"red": " #cc241d",
"red2": " #9d0006",
"orange": " #d65d0e",
"orange2": " #af3a03",
"yellow": " #d79921",
"yellow2": " #b57614",
"green": " #98971a",
"green2": " #79740e",
"aqua": " #689d6a",
"aqua2": " #427b58",
"blue": " #458588",
"blue2": " #076678",
"purple": " #b16286",
"purple2": " #8f3f71",
}
html_theme = "furo"
html_theme_options = {
"light_css_variables": {
"font-stack": "Fira Sans, sans-serif",
"font-stack--monospace": "Fira Code, monospace",
"color-brand-primary": colors["purple2"],
"color-brand-content": colors["blue2"],
},
"dark_css_variables": {
"color-brand-primary": colors["purple"],
"color-brand-content": colors["blue"],
"color-background-primary": colors["fg1"],
"color-background-secondary": colors["fg0"],
"color-foreground-primary": colors["bg0"],
"color-foreground-secondary": colors["bg1"],
"color-highlighted-background": colors["yellow"],
"color-highlight-on-target": colors["fg2"],
},
}
panels_css_variables = {
"tabs-color-label-active": colors["purple2"],
"tabs-color-label-inactive": colors["purple"],
"tabs-color-overline": colors['purple'],
"tabs-color-underline": colors["purple2"],
"tabs-size-label": "1rem",
}
highlight_language = "python3"
pygments_style = "gruvbox-light"
pygments_dark_style = "gruvbox-dark"
| colors = {'bg0': ' #fbf1c7', 'bg1': ' #ebdbb2', 'bg2': ' #d5c4a1', 'bg3': ' #bdae93', 'bg4': ' #a89984', 'gry': ' #928374', 'fg4': ' #7c6f64', 'fg3': ' #665c54', 'fg2': ' #504945', 'fg1': ' #3c3836', 'fg0': ' #282828', 'red': ' #cc241d', 'red2': ' #9d0006', 'orange': ' #d65d0e', 'orange2': ' #af3a03', 'yellow': ' #d79921', 'yellow2': ' #b57614', 'green': ' #98971a', 'green2': ' #79740e', 'aqua': ' #689d6a', 'aqua2': ' #427b58', 'blue': ' #458588', 'blue2': ' #076678', 'purple': ' #b16286', 'purple2': ' #8f3f71'}
html_theme = 'furo'
html_theme_options = {'light_css_variables': {'font-stack': 'Fira Sans, sans-serif', 'font-stack--monospace': 'Fira Code, monospace', 'color-brand-primary': colors['purple2'], 'color-brand-content': colors['blue2']}, 'dark_css_variables': {'color-brand-primary': colors['purple'], 'color-brand-content': colors['blue'], 'color-background-primary': colors['fg1'], 'color-background-secondary': colors['fg0'], 'color-foreground-primary': colors['bg0'], 'color-foreground-secondary': colors['bg1'], 'color-highlighted-background': colors['yellow'], 'color-highlight-on-target': colors['fg2']}}
panels_css_variables = {'tabs-color-label-active': colors['purple2'], 'tabs-color-label-inactive': colors['purple'], 'tabs-color-overline': colors['purple'], 'tabs-color-underline': colors['purple2'], 'tabs-size-label': '1rem'}
highlight_language = 'python3'
pygments_style = 'gruvbox-light'
pygments_dark_style = 'gruvbox-dark' |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
result = ListNode(0)
result_tail = result
carry = 0
while l1 or l2 or carry:
val1 = (l1.val if l1 else 0)
val2 = (l2.val if l2 else 0)
carry, out = divmod(val1+val2 + carry, 10)
result_tail.next = ListNode(out)
result_tail = result_tail.next
l1 = (l1.next if l1 else None)
l2 = (l2.next if l2 else None)
return result.next
| class Solution:
def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode:
result = list_node(0)
result_tail = result
carry = 0
while l1 or l2 or carry:
val1 = l1.val if l1 else 0
val2 = l2.val if l2 else 0
(carry, out) = divmod(val1 + val2 + carry, 10)
result_tail.next = list_node(out)
result_tail = result_tail.next
l1 = l1.next if l1 else None
l2 = l2.next if l2 else None
return result.next |
budget = float(input())
season = str(input())
region = str()
final_budget = 0
accommodation = str()
if budget <= 100:
region = "Bulgaria"
if season == "summer":
accommodation = "Camp"
final_budget = budget * 0.7
else:
accommodation = "Hotel"
final_budget = budget * 0.30
elif 100 < budget <= 1000:
region = "Balkans"
if season == "summer":
accommodation = "Camp"
final_budget = budget * 0.6
else:
accommodation = "Hotel"
final_budget = budget * 0.20
else:
region = "Europe"
accommodation = "Hotel"
if season == "summer":
final_budget = budget * 0.1
else:
final_budget = budget * 0.1
print(f"Somewhere in {region}")
print(f"{accommodation} - {budget - final_budget:.2f}")
| budget = float(input())
season = str(input())
region = str()
final_budget = 0
accommodation = str()
if budget <= 100:
region = 'Bulgaria'
if season == 'summer':
accommodation = 'Camp'
final_budget = budget * 0.7
else:
accommodation = 'Hotel'
final_budget = budget * 0.3
elif 100 < budget <= 1000:
region = 'Balkans'
if season == 'summer':
accommodation = 'Camp'
final_budget = budget * 0.6
else:
accommodation = 'Hotel'
final_budget = budget * 0.2
else:
region = 'Europe'
accommodation = 'Hotel'
if season == 'summer':
final_budget = budget * 0.1
else:
final_budget = budget * 0.1
print(f'Somewhere in {region}')
print(f'{accommodation} - {budget - final_budget:.2f}') |
class RequestConnectionError(Exception):
pass
class ReferralError(Exception):
pass
class DataRegistryCaseUpdateError(Exception):
pass
| class Requestconnectionerror(Exception):
pass
class Referralerror(Exception):
pass
class Dataregistrycaseupdateerror(Exception):
pass |
class ATTR:
CAND_CSV = "cand_csv"
CANDIDATE = "candidate"
COLOR = "color"
CONFIRMED = "confirmed"
CSV_ENDING = ".csv"
EMAIL = "Email"
FIRST_NAME = "First Name"
LAST_NAME = "Last Name"
NEXT = "next"
NUM_BITBYTES = "num_bitbytes"
NUM_CONFIRMED = "num_confirmed"
NUM_PENDING = "num_pending"
NUM_REJECTED = "num_rejected"
POST = "POST"
STATUS = "status"
TITLE = "title"
UNCONFIRMED = "unconfirmed"
UTF8 = "utf-8"
UTF8SIG = "utf-8-sig"
DOMAINS = [
"@berkeley.edu",
"@hkn.eecs.berkeley.edu",
]
class CandidateDTO:
def __init__(self, candidate_attributes: dict):
self.email = candidate_attributes.get(ATTR.EMAIL, None)
self.first_name = candidate_attributes.get(ATTR.FIRST_NAME, None)
self.last_name = candidate_attributes.get(ATTR.LAST_NAME, None)
self.username = self.email
if self.email is not None:
for d in DOMAINS:
if self.email.endswith(d):
self.username = self.email.replace(d, "")
break
self.validate()
def validate(self):
assert self.email, "Candidate email must not be empty"
assert any(
self.email.endswith(d) for d in DOMAINS
), "Candidate email must be an @berkeley.edu or @hkn.eecs.berkeley.edu email"
assert self.first_name, "Candidate first name must not be empty"
assert self.last_name, "Candidate last name must not be empty"
assert self.username, "Candidate username must not be empty"
DEFAULT_RANDOM_PASSWORD_LENGTH = 20
# Default hard-coded event types for candidate semester
# NOTE: these strings are also hard-coded in candidate/index.html
class EVENT_NAMES:
MANDATORY = "Mandatory"
BITBYTE = "bitbyte"
HANGOUT = "officer_hangout"
CHALLENGE = "officer_challenge"
EITHER = "either"
INTERACTIVITIES = "interactivities"
REQUIREMENT_TITLES_TEMPLATE = "{} ({} required, {} remaining)"
| class Attr:
cand_csv = 'cand_csv'
candidate = 'candidate'
color = 'color'
confirmed = 'confirmed'
csv_ending = '.csv'
email = 'Email'
first_name = 'First Name'
last_name = 'Last Name'
next = 'next'
num_bitbytes = 'num_bitbytes'
num_confirmed = 'num_confirmed'
num_pending = 'num_pending'
num_rejected = 'num_rejected'
post = 'POST'
status = 'status'
title = 'title'
unconfirmed = 'unconfirmed'
utf8 = 'utf-8'
utf8_sig = 'utf-8-sig'
domains = ['@berkeley.edu', '@hkn.eecs.berkeley.edu']
class Candidatedto:
def __init__(self, candidate_attributes: dict):
self.email = candidate_attributes.get(ATTR.EMAIL, None)
self.first_name = candidate_attributes.get(ATTR.FIRST_NAME, None)
self.last_name = candidate_attributes.get(ATTR.LAST_NAME, None)
self.username = self.email
if self.email is not None:
for d in DOMAINS:
if self.email.endswith(d):
self.username = self.email.replace(d, '')
break
self.validate()
def validate(self):
assert self.email, 'Candidate email must not be empty'
assert any((self.email.endswith(d) for d in DOMAINS)), 'Candidate email must be an @berkeley.edu or @hkn.eecs.berkeley.edu email'
assert self.first_name, 'Candidate first name must not be empty'
assert self.last_name, 'Candidate last name must not be empty'
assert self.username, 'Candidate username must not be empty'
default_random_password_length = 20
class Event_Names:
mandatory = 'Mandatory'
bitbyte = 'bitbyte'
hangout = 'officer_hangout'
challenge = 'officer_challenge'
either = 'either'
interactivities = 'interactivities'
requirement_titles_template = '{} ({} required, {} remaining)' |
class PartOfSpeech:
NOUN = 'noun'
VERB = 'verb'
ADJECTIVE = 'adjective'
ADVERB = 'adverb'
pos2con = {
'n': [
'NN', 'NNS', 'NNP', 'NNPS', # from WordNet
'NP' # from PPDB
],
'v': [
'VB', 'VBD', 'VBG', 'VBN', 'VBZ', # from WordNet
'VBP' # from PPDB
],
'a': ['JJ', 'JJR', 'JJS', 'IN'],
's': ['JJ', 'JJR', 'JJS', 'IN'], # Adjective Satellite
'r': ['RB', 'RBR', 'RBS'], # Adverb
}
con2pos = {}
poses = []
for key, values in pos2con.items():
poses.extend(values)
for value in values:
if value not in con2pos:
con2pos[value] = []
con2pos[value].append(key)
@staticmethod
def pos2constituent(pos):
if pos in PartOfSpeech.pos2con:
return PartOfSpeech.pos2con[pos]
return []
@staticmethod
def constituent2pos(con):
if con in PartOfSpeech.con2pos:
return PartOfSpeech.con2pos[con]
return []
@staticmethod
def get_pos():
return PartOfSpeech.poses
| class Partofspeech:
noun = 'noun'
verb = 'verb'
adjective = 'adjective'
adverb = 'adverb'
pos2con = {'n': ['NN', 'NNS', 'NNP', 'NNPS', 'NP'], 'v': ['VB', 'VBD', 'VBG', 'VBN', 'VBZ', 'VBP'], 'a': ['JJ', 'JJR', 'JJS', 'IN'], 's': ['JJ', 'JJR', 'JJS', 'IN'], 'r': ['RB', 'RBR', 'RBS']}
con2pos = {}
poses = []
for (key, values) in pos2con.items():
poses.extend(values)
for value in values:
if value not in con2pos:
con2pos[value] = []
con2pos[value].append(key)
@staticmethod
def pos2constituent(pos):
if pos in PartOfSpeech.pos2con:
return PartOfSpeech.pos2con[pos]
return []
@staticmethod
def constituent2pos(con):
if con in PartOfSpeech.con2pos:
return PartOfSpeech.con2pos[con]
return []
@staticmethod
def get_pos():
return PartOfSpeech.poses |
my_first_name = str(input("My first name is "))
neighbor_first_name = str(input("My neighbor's first name is "))
my_coding = int(input("How many months have I been coding? "))
neighbor_coding = int(input("How many months has my neighbor been coding? "))
print("I am " + my_first_name + " and my neighbor is " + neighbor_first_name)
print(str(my_first_name))
print(str(neighbor_first_name))
print(str(my_coding))
print(str(neighbor_coding)) | my_first_name = str(input('My first name is '))
neighbor_first_name = str(input("My neighbor's first name is "))
my_coding = int(input('How many months have I been coding? '))
neighbor_coding = int(input('How many months has my neighbor been coding? '))
print('I am ' + my_first_name + ' and my neighbor is ' + neighbor_first_name)
print(str(my_first_name))
print(str(neighbor_first_name))
print(str(my_coding))
print(str(neighbor_coding)) |
data_nascimento = 9
mes_nascimento = 10
ano_nascimento = 1985
print(data_nascimento, mes_nascimento, ano_nascimento, sep="/", end=".\n")
contador = 1
while(contador <= 10):
print(contador)
contador = contador + 2
if(contador == 5):
contador = contador + 2
| data_nascimento = 9
mes_nascimento = 10
ano_nascimento = 1985
print(data_nascimento, mes_nascimento, ano_nascimento, sep='/', end='.\n')
contador = 1
while contador <= 10:
print(contador)
contador = contador + 2
if contador == 5:
contador = contador + 2 |
BASE_URL = 'https://caseinfo.arcourts.gov/cconnect/PROD/public/'
### Search Results ###
PERSON_SUFFIX = 'ck_public_qry_cpty.cp_personcase_srch_details?backto=P&'
JUDGEMENT_SUFFIX = 'ck_public_qry_judg.cp_judgment_srch_rslt?'
CASE_SUFFIX = 'ck_public_qry_doct.cp_dktrpt_docket_report?backto=D&'
DATE_SUFFIX = 'ck_public_qry_doct.cp_dktrpt_new_case_report?backto=C&'
DOCKET_SUFFIX = 'ck_public_qry_doct.cp_dktrpt_new_case_report?backto=F&'
SEARCH_TYPE_CONVERTER = {
'name': PERSON_SUFFIX,
'judgement': JUDGEMENT_SUFFIX,
'case': CASE_SUFFIX,
'date': DATE_SUFFIX,
'docket': DOCKET_SUFFIX
}
### Details for Known ID's ###
CASE_ID = 'ck_public_qry_doct.cp_dktrpt_docket_report?case_id='
### Case Page Navigation ###
HEADINGS = [
'Report Selection Criteria',
'Case Description',
'Case Event Schedule',
'Case Parties',
'Violations',
'Sentence',
'Milestone Tracks',
'Docket Entries'
]
CASE_DETAIL_HANDLER = {
'Report Selection Criteria': '_parse_report_or_desc',
'Case Description': '_parse_report_or_desc',
'Case Event Schedule': '_parse_events',
'Case Parties': '_parse_parties_or_docket',
'Violations': '_parse_violations',
'Sentence': '_parse_sentence',
'Milestone Tracks': '_skip_parse',
'Docket Entries': '_parse_parties_or_docket'
}
NON_TABLE_DATA = [
'Violations',
'Sentence',
'Milestone Tracks'
]
UNAVAILABLE_STATEMENTS = {
'Case Event Schedule': 'No case events were found.',
'Sentence': 'No Sentence Info Found.',
'Milestone Tracks': 'No Milestone Tracks found.'
}
### New Web Layout ###
CASE_ID_SEARCH = 'https://caseinfonew.arcourts.gov/pls/apexpcc/f?p=313:15:206076974987427::NO:::' | base_url = 'https://caseinfo.arcourts.gov/cconnect/PROD/public/'
person_suffix = 'ck_public_qry_cpty.cp_personcase_srch_details?backto=P&'
judgement_suffix = 'ck_public_qry_judg.cp_judgment_srch_rslt?'
case_suffix = 'ck_public_qry_doct.cp_dktrpt_docket_report?backto=D&'
date_suffix = 'ck_public_qry_doct.cp_dktrpt_new_case_report?backto=C&'
docket_suffix = 'ck_public_qry_doct.cp_dktrpt_new_case_report?backto=F&'
search_type_converter = {'name': PERSON_SUFFIX, 'judgement': JUDGEMENT_SUFFIX, 'case': CASE_SUFFIX, 'date': DATE_SUFFIX, 'docket': DOCKET_SUFFIX}
case_id = 'ck_public_qry_doct.cp_dktrpt_docket_report?case_id='
headings = ['Report Selection Criteria', 'Case Description', 'Case Event Schedule', 'Case Parties', 'Violations', 'Sentence', 'Milestone Tracks', 'Docket Entries']
case_detail_handler = {'Report Selection Criteria': '_parse_report_or_desc', 'Case Description': '_parse_report_or_desc', 'Case Event Schedule': '_parse_events', 'Case Parties': '_parse_parties_or_docket', 'Violations': '_parse_violations', 'Sentence': '_parse_sentence', 'Milestone Tracks': '_skip_parse', 'Docket Entries': '_parse_parties_or_docket'}
non_table_data = ['Violations', 'Sentence', 'Milestone Tracks']
unavailable_statements = {'Case Event Schedule': 'No case events were found.', 'Sentence': 'No Sentence Info Found.', 'Milestone Tracks': 'No Milestone Tracks found.'}
case_id_search = 'https://caseinfonew.arcourts.gov/pls/apexpcc/f?p=313:15:206076974987427::NO:::' |
value = 2 ** 1000
value_string = str(value)
value_sum = 0
for _ in value_string:
value_sum += int(_)
print(value_sum) | value = 2 ** 1000
value_string = str(value)
value_sum = 0
for _ in value_string:
value_sum += int(_)
print(value_sum) |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftplusminusnonassocadvdisadvadv dice disadv div minus newline number plus space star tabcommand : roll_list\n | mod_list\n |\n roll_list : roll\n | roll roll_list\n roll : number dice mod_list\n | number dice\n | dice mod_list\n | dice\n | number\n | number mod_list\n mod_list : mod\n | mod mod_list\n mod : plus number\n | minus number\n | star number\n | div number\n | adv\n | disadv\n '
_lr_action_items = {'$end':([0,1,2,3,4,5,6,7,12,13,14,15,16,17,18,19,20,21,22,23,],[-3,0,-1,-2,-4,-12,-10,-9,-18,-19,-5,-13,-7,-11,-8,-14,-15,-16,-17,-6,]),'number':([0,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23,],[6,6,-12,-10,-9,19,20,21,22,-18,-19,-13,-7,-11,-8,-14,-15,-16,-17,-6,]),'dice':([0,4,5,6,7,12,13,15,16,17,18,19,20,21,22,23,],[7,7,-12,16,-9,-18,-19,-13,-7,-11,-8,-14,-15,-16,-17,-6,]),'plus':([0,5,6,7,12,13,16,19,20,21,22,],[8,8,8,8,-18,-19,8,-14,-15,-16,-17,]),'minus':([0,5,6,7,12,13,16,19,20,21,22,],[9,9,9,9,-18,-19,9,-14,-15,-16,-17,]),'star':([0,5,6,7,12,13,16,19,20,21,22,],[10,10,10,10,-18,-19,10,-14,-15,-16,-17,]),'div':([0,5,6,7,12,13,16,19,20,21,22,],[11,11,11,11,-18,-19,11,-14,-15,-16,-17,]),'adv':([0,5,6,7,12,13,16,19,20,21,22,],[12,12,12,12,-18,-19,12,-14,-15,-16,-17,]),'disadv':([0,5,6,7,12,13,16,19,20,21,22,],[13,13,13,13,-18,-19,13,-14,-15,-16,-17,]),}
_lr_action = {}
for _k, _v in _lr_action_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_action: _lr_action[_x] = {}
_lr_action[_x][_k] = _y
del _lr_action_items
_lr_goto_items = {'command':([0,],[1,]),'roll_list':([0,4,],[2,14,]),'mod_list':([0,5,6,7,16,],[3,15,17,18,23,]),'roll':([0,4,],[4,4,]),'mod':([0,5,6,7,16,],[5,5,5,5,5,]),}
_lr_goto = {}
for _k, _v in _lr_goto_items.items():
for _x, _y in zip(_v[0], _v[1]):
if not _x in _lr_goto: _lr_goto[_x] = {}
_lr_goto[_x][_k] = _y
del _lr_goto_items
_lr_productions = [
("S' -> command","S'",1,None,None,None),
('command -> roll_list','command',1,'p_command','parser.py',28),
('command -> mod_list','command',1,'p_command','parser.py',29),
('command -> <empty>','command',0,'p_command','parser.py',30),
('roll_list -> roll','roll_list',1,'p_roll_list','parser.py',41),
('roll_list -> roll roll_list','roll_list',2,'p_roll_list','parser.py',42),
('roll -> number dice mod_list','roll',3,'p_roll','parser.py',50),
('roll -> number dice','roll',2,'p_roll','parser.py',51),
('roll -> dice mod_list','roll',2,'p_roll','parser.py',52),
('roll -> dice','roll',1,'p_roll','parser.py',53),
('roll -> number','roll',1,'p_roll','parser.py',54),
('roll -> number mod_list','roll',2,'p_roll','parser.py',55),
('mod_list -> mod','mod_list',1,'p_mod_list','parser.py',71),
('mod_list -> mod mod_list','mod_list',2,'p_mod_list','parser.py',72),
('mod -> plus number','mod',2,'p_mod','parser.py',80),
('mod -> minus number','mod',2,'p_mod','parser.py',81),
('mod -> star number','mod',2,'p_mod','parser.py',82),
('mod -> div number','mod',2,'p_mod','parser.py',83),
('mod -> adv','mod',1,'p_mod','parser.py',84),
('mod -> disadv','mod',1,'p_mod','parser.py',85),
]
| _tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftplusminusnonassocadvdisadvadv dice disadv div minus newline number plus space star tabcommand : roll_list\n | mod_list\n |\n roll_list : roll\n | roll roll_list\n roll : number dice mod_list\n | number dice\n | dice mod_list\n | dice\n | number\n | number mod_list\n mod_list : mod\n | mod mod_list\n mod : plus number\n | minus number\n | star number\n | div number\n | adv\n | disadv\n '
_lr_action_items = {'$end': ([0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], [-3, 0, -1, -2, -4, -12, -10, -9, -18, -19, -5, -13, -7, -11, -8, -14, -15, -16, -17, -6]), 'number': ([0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23], [6, 6, -12, -10, -9, 19, 20, 21, 22, -18, -19, -13, -7, -11, -8, -14, -15, -16, -17, -6]), 'dice': ([0, 4, 5, 6, 7, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23], [7, 7, -12, 16, -9, -18, -19, -13, -7, -11, -8, -14, -15, -16, -17, -6]), 'plus': ([0, 5, 6, 7, 12, 13, 16, 19, 20, 21, 22], [8, 8, 8, 8, -18, -19, 8, -14, -15, -16, -17]), 'minus': ([0, 5, 6, 7, 12, 13, 16, 19, 20, 21, 22], [9, 9, 9, 9, -18, -19, 9, -14, -15, -16, -17]), 'star': ([0, 5, 6, 7, 12, 13, 16, 19, 20, 21, 22], [10, 10, 10, 10, -18, -19, 10, -14, -15, -16, -17]), 'div': ([0, 5, 6, 7, 12, 13, 16, 19, 20, 21, 22], [11, 11, 11, 11, -18, -19, 11, -14, -15, -16, -17]), 'adv': ([0, 5, 6, 7, 12, 13, 16, 19, 20, 21, 22], [12, 12, 12, 12, -18, -19, 12, -14, -15, -16, -17]), 'disadv': ([0, 5, 6, 7, 12, 13, 16, 19, 20, 21, 22], [13, 13, 13, 13, -18, -19, 13, -14, -15, -16, -17])}
_lr_action = {}
for (_k, _v) in _lr_action_items.items():
for (_x, _y) in zip(_v[0], _v[1]):
if not _x in _lr_action:
_lr_action[_x] = {}
_lr_action[_x][_k] = _y
del _lr_action_items
_lr_goto_items = {'command': ([0], [1]), 'roll_list': ([0, 4], [2, 14]), 'mod_list': ([0, 5, 6, 7, 16], [3, 15, 17, 18, 23]), 'roll': ([0, 4], [4, 4]), 'mod': ([0, 5, 6, 7, 16], [5, 5, 5, 5, 5])}
_lr_goto = {}
for (_k, _v) in _lr_goto_items.items():
for (_x, _y) in zip(_v[0], _v[1]):
if not _x in _lr_goto:
_lr_goto[_x] = {}
_lr_goto[_x][_k] = _y
del _lr_goto_items
_lr_productions = [("S' -> command", "S'", 1, None, None, None), ('command -> roll_list', 'command', 1, 'p_command', 'parser.py', 28), ('command -> mod_list', 'command', 1, 'p_command', 'parser.py', 29), ('command -> <empty>', 'command', 0, 'p_command', 'parser.py', 30), ('roll_list -> roll', 'roll_list', 1, 'p_roll_list', 'parser.py', 41), ('roll_list -> roll roll_list', 'roll_list', 2, 'p_roll_list', 'parser.py', 42), ('roll -> number dice mod_list', 'roll', 3, 'p_roll', 'parser.py', 50), ('roll -> number dice', 'roll', 2, 'p_roll', 'parser.py', 51), ('roll -> dice mod_list', 'roll', 2, 'p_roll', 'parser.py', 52), ('roll -> dice', 'roll', 1, 'p_roll', 'parser.py', 53), ('roll -> number', 'roll', 1, 'p_roll', 'parser.py', 54), ('roll -> number mod_list', 'roll', 2, 'p_roll', 'parser.py', 55), ('mod_list -> mod', 'mod_list', 1, 'p_mod_list', 'parser.py', 71), ('mod_list -> mod mod_list', 'mod_list', 2, 'p_mod_list', 'parser.py', 72), ('mod -> plus number', 'mod', 2, 'p_mod', 'parser.py', 80), ('mod -> minus number', 'mod', 2, 'p_mod', 'parser.py', 81), ('mod -> star number', 'mod', 2, 'p_mod', 'parser.py', 82), ('mod -> div number', 'mod', 2, 'p_mod', 'parser.py', 83), ('mod -> adv', 'mod', 1, 'p_mod', 'parser.py', 84), ('mod -> disadv', 'mod', 1, 'p_mod', 'parser.py', 85)] |
output = 'Char\tisdigit\tisdecimal\tisnumeric'
html_output = '''<table border="1">
<thead>
<tr>
<th>Char</th>
<th>isdigit</th>
<th>isdecimal</th>
<th>isnumeric</th>
</tr>
</thead>
<tbody>'''
for i in range(1, 1114111):
if chr(i).isdigit() or chr(i).isdecimal() or chr(i).isnumeric():
output += f'\n{chr(i)}\t{chr(i).isdigit()}'
output += f'\t{chr(i).isdecimal()}\t{chr(i).isnumeric()}'
if not (chr(i).isdigit() and chr(i).isdecimal() and chr(i).isnumeric()):
# one is False
color = 'red'
else:
color = 'black'
html_output += f'''<tr style="color:{color}">
<td>{chr(i)}</td>
<td>{chr(i).isdigit()}</td>
<td>{chr(i).isdecimal()}</td>
<td>{chr(i).isnumeric()}</td>
</tr>'''
html_output += '</tbody></table>'
with open('numbers.txt', 'w', encoding="utf-8") as f:
f.write(output)
print('Look in the strings/Demos directory for a new file.')
with open('numbers.html', 'w', encoding="utf-8") as f:
f.write(html_output)
print('''Look in the strings/Demos directory for new \
numbers.txt and numbers.html files.''') | output = 'Char\tisdigit\tisdecimal\tisnumeric'
html_output = '<table border="1">\n<thead>\n <tr>\n <th>Char</th>\n <th>isdigit</th>\n <th>isdecimal</th>\n <th>isnumeric</th>\n </tr>\n</thead>\n<tbody>'
for i in range(1, 1114111):
if chr(i).isdigit() or chr(i).isdecimal() or chr(i).isnumeric():
output += f'\n{chr(i)}\t{chr(i).isdigit()}'
output += f'\t{chr(i).isdecimal()}\t{chr(i).isnumeric()}'
if not (chr(i).isdigit() and chr(i).isdecimal() and chr(i).isnumeric()):
color = 'red'
else:
color = 'black'
html_output += f'<tr style="color:{color}">\n <td>{chr(i)}</td> \n <td>{chr(i).isdigit()}</td> \n <td>{chr(i).isdecimal()}</td> \n <td>{chr(i).isnumeric()}</td> \n</tr>'
html_output += '</tbody></table>'
with open('numbers.txt', 'w', encoding='utf-8') as f:
f.write(output)
print('Look in the strings/Demos directory for a new file.')
with open('numbers.html', 'w', encoding='utf-8') as f:
f.write(html_output)
print('Look in the strings/Demos directory for new numbers.txt and numbers.html files.') |
# question can be found at leetcode.com/problems/sqrtx/
# The original implementation does a Binary search
class Solution:
def mySqrt(self, x: int) -> int:
if x == 0 or x == 1:
return x
i, result = 1, 1
while result <= x:
i += 1
result = pow(i, 2)
return i - 1
# or literally return x ** 0.5 :lel:
| class Solution:
def my_sqrt(self, x: int) -> int:
if x == 0 or x == 1:
return x
(i, result) = (1, 1)
while result <= x:
i += 1
result = pow(i, 2)
return i - 1 |
# indices for weight, magnitude, and phase lists
M, P, W = 0, 1, 2
# Set max for model weighting. Minimum is 1.0
MAX_MODEL_WEIGHT = 100.0
# Rich text control for red font
RICH_TEXT_RED = "<FONT COLOR='red'>"
# Color definitions
# (see http://www.w3schools.com/tags/ref_colorpicker.asp )
M_COLOR = "#6f93ff" # magnitude data
P_COLOR = "#ffcc00" # phase data
DM_COLOR = "#3366ff" # drawn magnitude
DP_COLOR = "#b38f00" # drawn phase
DW_COLOR = "#33cc33" # drawn weight
MM_COLOR = "000000" # modeled magnitude lines
MP_COLOR = "000000" # modeled phase lines
# Line styles for modeled data
MM_STYLE = "-"
MP_STYLE = "--"
# Boolean for whether to allow negative param results
ALLOW_NEG = True
# File name for parameter save/restore
PARAM_FILE = "params.csv"
# Path and file name for preferred text editor for editing model scripts
# TODO: make this usable from os.startfile() -- not successful so far
EDITOR = "notepad++.exe"
EDIT_PATH = "C:\\Program Files\\Notepad++\\"
# List of fitting methods available to lmfit
# (Dogleg and Newton CG are not included since they require a Jacobian
# to be supplied)
METHODS = [
("Levenberg-Marquardt", "leastsq"),
("Nelder-Mead", "nelder"),
("L-BFGS-B", "lbfgsb"),
("Powell", "powell"),
("Conjugate Gradient", "cg"),
("COBYLA", "cobyla"),
("Truncated Newton", "tnc"),
("Sequential Linear Squares", "slsqp"),
("Differential Evolution", "differential_evolution")
]
# Define one or the other:
LIMITS = "lmfit"
# LIMITS = "zfit" | (m, p, w) = (0, 1, 2)
max_model_weight = 100.0
rich_text_red = "<FONT COLOR='red'>"
m_color = '#6f93ff'
p_color = '#ffcc00'
dm_color = '#3366ff'
dp_color = '#b38f00'
dw_color = '#33cc33'
mm_color = '000000'
mp_color = '000000'
mm_style = '-'
mp_style = '--'
allow_neg = True
param_file = 'params.csv'
editor = 'notepad++.exe'
edit_path = 'C:\\Program Files\\Notepad++\\'
methods = [('Levenberg-Marquardt', 'leastsq'), ('Nelder-Mead', 'nelder'), ('L-BFGS-B', 'lbfgsb'), ('Powell', 'powell'), ('Conjugate Gradient', 'cg'), ('COBYLA', 'cobyla'), ('Truncated Newton', 'tnc'), ('Sequential Linear Squares', 'slsqp'), ('Differential Evolution', 'differential_evolution')]
limits = 'lmfit' |
# Lost Memories Found [Hayato] (57172)
recoveredMemory = 7081
mouriMotonari = 9130008
sm.setSpeakerID(mouriMotonari)
sm.sendNext("I've been watching you fight for Maple World, Hayato. "
"Your dedication is impressive.")
sm.sendSay("I, Mouri Motonari, hope that you will call me an ally. "
"The two of us have a great future together.")
sm.sendSay("Continue your quest, and I shall ensure we go down in history.")
sm.startQuest(parentID)
sm.completeQuest(parentID)
sm.startQuest(recoveredMemory)
sm.setQRValue(recoveredMemory, "1", False) | recovered_memory = 7081
mouri_motonari = 9130008
sm.setSpeakerID(mouriMotonari)
sm.sendNext("I've been watching you fight for Maple World, Hayato. Your dedication is impressive.")
sm.sendSay('I, Mouri Motonari, hope that you will call me an ally. The two of us have a great future together.')
sm.sendSay('Continue your quest, and I shall ensure we go down in history.')
sm.startQuest(parentID)
sm.completeQuest(parentID)
sm.startQuest(recoveredMemory)
sm.setQRValue(recoveredMemory, '1', False) |
def enc():
code=input('Write what you want to encrypt: ')
new_code_1=''
for i in range(0,len(code)-1,1):
new_code_1=new_code_1+code[i+1]
new_code_1=new_code_1+code[i]
print(new_code_1)
def dec():
code=input('Write what you want to deccrypt: ')
new_code=''
if len(code)>1:
new_code=new_code+code[1]
new_code=new_code+code[0]
for i in range(2,len(code)-1,2):
new_code=new_code+code[i]
else:
print(code)
print(new_code)
def main():
print('Helo, this is task 1. Its goal to encrypt or decrypt your letter')
choice=input('What do you want to do? ')
if choice=='encrypt':
enc()
elif choice=='decrypt':
dec()
else:
print('Error')
if __name__=='__main__':
main()
| def enc():
code = input('Write what you want to encrypt: ')
new_code_1 = ''
for i in range(0, len(code) - 1, 1):
new_code_1 = new_code_1 + code[i + 1]
new_code_1 = new_code_1 + code[i]
print(new_code_1)
def dec():
code = input('Write what you want to deccrypt: ')
new_code = ''
if len(code) > 1:
new_code = new_code + code[1]
new_code = new_code + code[0]
for i in range(2, len(code) - 1, 2):
new_code = new_code + code[i]
else:
print(code)
print(new_code)
def main():
print('Helo, this is task 1. Its goal to encrypt or decrypt your letter')
choice = input('What do you want to do? ')
if choice == 'encrypt':
enc()
elif choice == 'decrypt':
dec()
else:
print('Error')
if __name__ == '__main__':
main() |
class Node:
def __init__(self, key):
self.data = key
self.left = None
self.right = None
def getNodeCount(root : Node) -> int:
if root is None:
return 0
count = 0
count += 1
count += (getNodeCount(root.left) + getNodeCount(root.right))
return count
if __name__ == '__main__':
root = Node(2)
root.left = Node(7)
root.right = Node(5)
root.left.right = Node(6)
root.left.right.left = Node(1)
root.left.right.right = Node(11)
root.right.right = Node(9)
root.right.right.left = Node(4)
print(f"node count: {getNodeCount(root)}")
| class Node:
def __init__(self, key):
self.data = key
self.left = None
self.right = None
def get_node_count(root: Node) -> int:
if root is None:
return 0
count = 0
count += 1
count += get_node_count(root.left) + get_node_count(root.right)
return count
if __name__ == '__main__':
root = node(2)
root.left = node(7)
root.right = node(5)
root.left.right = node(6)
root.left.right.left = node(1)
root.left.right.right = node(11)
root.right.right = node(9)
root.right.right.left = node(4)
print(f'node count: {get_node_count(root)}') |
# import torch
# import torch.nn as nn
# import numpy as np
class NetworkFit(object):
def __init__(self, model, optimizer, soft_criterion):
self.model = model
self.optimizer = optimizer
self.soft_criterion = soft_criterion
def train(self, inputs, labels):
self.optimizer.zero_grad()
self.model.train()
outputs = self.model(inputs)
soft_loss = self.soft_criterion(outputs, labels)
loss = soft_loss
loss.backward()
self.optimizer.step()
def test(self, inputs, labels):
self.model.eval()
outputs = self.model(inputs)
soft_loss = self.soft_criterion(outputs, labels)
loss = soft_loss
_, predicted = outputs.max(1)
correct = (predicted == labels).sum().item()
return [loss.item()], [correct]
def get_model(self):
return self.model
| class Networkfit(object):
def __init__(self, model, optimizer, soft_criterion):
self.model = model
self.optimizer = optimizer
self.soft_criterion = soft_criterion
def train(self, inputs, labels):
self.optimizer.zero_grad()
self.model.train()
outputs = self.model(inputs)
soft_loss = self.soft_criterion(outputs, labels)
loss = soft_loss
loss.backward()
self.optimizer.step()
def test(self, inputs, labels):
self.model.eval()
outputs = self.model(inputs)
soft_loss = self.soft_criterion(outputs, labels)
loss = soft_loss
(_, predicted) = outputs.max(1)
correct = (predicted == labels).sum().item()
return ([loss.item()], [correct])
def get_model(self):
return self.model |
#!/usr/bin/python3
def no_c(my_string):
newStr = ""
for i in range(len(my_string)):
if my_string[i] != "c" and my_string[i] != "C":
newStr += my_string[i]
return (newStr)
| def no_c(my_string):
new_str = ''
for i in range(len(my_string)):
if my_string[i] != 'c' and my_string[i] != 'C':
new_str += my_string[i]
return newStr |
height = int(input())
for i in range(1, height + 1):
for j in range(1, height + 1):
if(i == 1 or i == height or j == 1 or j == height):
print(1,end=" ")
else:
print(0,end=" ")
print()
# Sample Input :- 5
# Output :-
# 1 1 1 1 1
# 1 0 0 0 1
# 1 0 0 0 1
# 1 0 0 0 1
# 1 1 1 1 1
| height = int(input())
for i in range(1, height + 1):
for j in range(1, height + 1):
if i == 1 or i == height or j == 1 or (j == height):
print(1, end=' ')
else:
print(0, end=' ')
print() |
def _find_patterns(content, pos, patterns):
max = len(content)
for i in range(pos, max):
for p in enumerate(patterns):
if content.startswith(p[1], i):
return struct(
pos = i,
pattern = p[0]
)
return None
_find_ending_escapes = {
'(': ')',
'"': '"',
"'": "'",
'{': '}',
}
def _find_ending(content, pos, endch, escapes = _find_ending_escapes):
max = len(content)
ending_search_stack = [ endch ]
for i in range(pos, max):
ch = content[i]
if ch == ending_search_stack[0]:
ending_search_stack.pop(0)
if not ending_search_stack:
return i
continue
for start, end in escapes.items():
if ch == start:
ending_search_stack.insert(0, end)
break
return None
_whitespace_chars = [ ' ', '\t', '\n' ]
def _is_whitespace(content, pos, end_pos, ws = _whitespace_chars):
for i in range(pos, end_pos):
if not content[i] in ws:
return False
return True
parse = struct(
find_patterns = _find_patterns,
find_ending = _find_ending,
is_whitespace = _is_whitespace,
) | def _find_patterns(content, pos, patterns):
max = len(content)
for i in range(pos, max):
for p in enumerate(patterns):
if content.startswith(p[1], i):
return struct(pos=i, pattern=p[0])
return None
_find_ending_escapes = {'(': ')', '"': '"', "'": "'", '{': '}'}
def _find_ending(content, pos, endch, escapes=_find_ending_escapes):
max = len(content)
ending_search_stack = [endch]
for i in range(pos, max):
ch = content[i]
if ch == ending_search_stack[0]:
ending_search_stack.pop(0)
if not ending_search_stack:
return i
continue
for (start, end) in escapes.items():
if ch == start:
ending_search_stack.insert(0, end)
break
return None
_whitespace_chars = [' ', '\t', '\n']
def _is_whitespace(content, pos, end_pos, ws=_whitespace_chars):
for i in range(pos, end_pos):
if not content[i] in ws:
return False
return True
parse = struct(find_patterns=_find_patterns, find_ending=_find_ending, is_whitespace=_is_whitespace) |
def num_of_likes(names):
if len(names) == 0:
return 'no one likes this'
elif len(names) == 1:
return names[0] + ' likes this'
elif len(names) == 2:
return names[0] + ' and ' + names[1] + ' like this'
elif len(names) == 3:
return names[0] + ', ' + names[1] + ' and ' + names[2] + ' like this'
else:
return names[0] + ', ' + names[1] + ' and '+ str(len(names)-2) + ' others like this' | def num_of_likes(names):
if len(names) == 0:
return 'no one likes this'
elif len(names) == 1:
return names[0] + ' likes this'
elif len(names) == 2:
return names[0] + ' and ' + names[1] + ' like this'
elif len(names) == 3:
return names[0] + ', ' + names[1] + ' and ' + names[2] + ' like this'
else:
return names[0] + ', ' + names[1] + ' and ' + str(len(names) - 2) + ' others like this' |
def is_none_us_symbol(symbol: str) -> bool:
return symbol.endswith(".HK") or symbol.endswith(".SZ") or symbol.endswith(".SH")
def is_us_symbol(symbol: str) -> bool:
return not is_none_us_symbol(symbol)
| def is_none_us_symbol(symbol: str) -> bool:
return symbol.endswith('.HK') or symbol.endswith('.SZ') or symbol.endswith('.SH')
def is_us_symbol(symbol: str) -> bool:
return not is_none_us_symbol(symbol) |
# table definition
table = {
'table_name' : 'adm_functions',
'module_id' : 'adm',
'short_descr' : 'Functions',
'long_descr' : 'Functional breakdwon of the organisation',
'sub_types' : None,
'sub_trans' : None,
'sequence' : ['seq', ['parent_id'], None],
'tree_params' : [None, ['function_id', 'descr', 'parent_id', 'seq'],
['function_type', [['root', 'Root']], None]],
'roll_params' : None,
'indexes' : None,
'ledger_col' : None,
'defn_company' : None,
'data_company' : None,
'read_only' : False,
}
# column definitions
cols = []
cols.append ({
'col_name' : 'row_id',
'data_type' : 'AUTO',
'short_descr': 'Row id',
'long_descr' : 'Row id',
'col_head' : 'Row',
'key_field' : 'Y',
'data_source': 'gen',
'condition' : None,
'allow_null' : False,
'allow_amend': False,
'max_len' : 0,
'db_scale' : 0,
'scale_ptr' : None,
'dflt_val' : None,
'dflt_rule' : None,
'col_checks' : None,
'fkey' : None,
'choices' : None,
})
cols.append ({
'col_name' : 'created_id',
'data_type' : 'INT',
'short_descr': 'Created id',
'long_descr' : 'Created row id',
'col_head' : 'Created',
'key_field' : 'N',
'data_source': 'gen',
'condition' : None,
'allow_null' : False,
'allow_amend': False,
'max_len' : 0,
'db_scale' : 0,
'scale_ptr' : None,
'dflt_val' : '0',
'dflt_rule' : None,
'col_checks' : None,
'fkey' : None,
'choices' : None,
})
cols.append ({
'col_name' : 'deleted_id',
'data_type' : 'INT',
'short_descr': 'Deleted id',
'long_descr' : 'Deleted row id',
'col_head' : 'Deleted',
'key_field' : 'N',
'data_source': 'gen',
'condition' : None,
'allow_null' : False,
'allow_amend': False,
'max_len' : 0,
'db_scale' : 0,
'scale_ptr' : None,
'dflt_val' : '0',
'dflt_rule' : None,
'col_checks' : None,
'fkey' : None,
'choices' : None,
})
cols.append ({
'col_name' : 'function_id',
'data_type' : 'TEXT',
'short_descr': 'Function id',
'long_descr' : 'Function id',
'col_head' : 'Fcn',
'key_field' : 'A',
'data_source': 'input',
'condition' : None,
'allow_null' : False,
'allow_amend': False,
'max_len' : 15,
'db_scale' : 0,
'scale_ptr' : None,
'dflt_val' : None,
'dflt_rule' : None,
'col_checks' : None,
'fkey' : None,
'choices' : None,
})
cols.append ({
'col_name' : 'descr',
'data_type' : 'TEXT',
'short_descr': 'Description',
'long_descr' : 'Function description',
'col_head' : 'Description',
'key_field' : 'N',
'data_source': 'input',
'condition' : None,
'allow_null' : False,
'allow_amend': True,
'max_len' : 30,
'db_scale' : 0,
'scale_ptr' : None,
'dflt_val' : None,
'dflt_rule' : None,
'col_checks' : None,
'fkey' : None,
'choices' : None,
})
cols.append ({
'col_name' : 'function_type',
'data_type' : 'TEXT',
'short_descr': 'Type of function code',
'long_descr' : (
"Type of function code.\n"
"If fixed levels are defined for this table (see tree_params),\n"
" user must specify a 'type column', and define a 'type code' for each level.\n"
"This is the type column where the type codes are stored.\n"
"At run-time, tree_params is inspected, and if fixed levels are detected,\n"
" 'choices' for this column is populated with valid codes which is then\n"
" used for validation."
),
'col_head' : 'Type',
'key_field' : 'N',
'data_source': 'input',
'condition' : None,
'allow_null' : False,
'allow_amend': False,
'max_len' : 10,
'db_scale' : 0,
'scale_ptr' : None,
'dflt_val' : None,
'dflt_rule' : None,
'col_checks' : None,
'fkey' : None,
'choices' : None,
})
cols.append ({
'col_name' : 'parent_id',
'data_type' : 'INT',
'short_descr': 'Parent id',
'long_descr' : 'Parent id',
'col_head' : 'Parent',
'key_field' : 'N',
'data_source': 'input',
'condition' : None,
'allow_null' : True,
'allow_amend': True,
'max_len' : 0,
'db_scale' : 0,
'scale_ptr' : None,
'dflt_val' : None,
'dflt_rule' : None,
'col_checks' : None,
'fkey' : ['adm_functions', 'row_id', 'parent', 'function_id', False, None],
'choices' : None,
})
cols.append ({
'col_name' : 'seq',
'data_type' : 'INT',
'short_descr': 'Sequence',
'long_descr' : 'Sequence',
'col_head' : 'Seq',
'key_field' : 'N',
'data_source': 'seq',
'condition' : None,
'allow_null' : False,
'allow_amend': True,
'max_len' : 0,
'db_scale' : 0,
'scale_ptr' : None,
'dflt_val' : None,
'dflt_rule' : None,
'col_checks' : None,
'fkey' : None,
'choices' : None,
})
# virtual column definitions
virt = []
virt.append ({
'col_name' : 'children',
'data_type' : 'INT',
'short_descr': 'Children',
'long_descr' : 'Number of children',
'col_head' : '',
'sql' : "SELECT count(*) FROM {company}.adm_functions b "
"WHERE b.parent_id = a.row_id AND b.deleted_id = 0",
})
virt.append ({
'col_name' : 'is_leaf',
'data_type' : 'BOOL',
'short_descr': 'Is leaf node?',
'long_descr' : 'Is this node a leaf node? Over-ridden at run-time in db.objects if levels added.',
'col_head' : '',
'sql' : '$True',
})
# cursor definitions
cursors = []
cursors.append({
'cursor_name': 'functions',
'title': 'Maintain functions',
'columns': [
['function_id', 100, False, False],
['descr', 260, True, True],
],
'filter': [['WHERE', '', 'function_type', '!=', "'root'", '']],
'sequence': [['function_id', False]],
})
# actions
actions = []
actions.append([
'after_commit', '<pyfunc name="db.cache.param_updated"/>'
])
| table = {'table_name': 'adm_functions', 'module_id': 'adm', 'short_descr': 'Functions', 'long_descr': 'Functional breakdwon of the organisation', 'sub_types': None, 'sub_trans': None, 'sequence': ['seq', ['parent_id'], None], 'tree_params': [None, ['function_id', 'descr', 'parent_id', 'seq'], ['function_type', [['root', 'Root']], None]], 'roll_params': None, 'indexes': None, 'ledger_col': None, 'defn_company': None, 'data_company': None, 'read_only': False}
cols = []
cols.append({'col_name': 'row_id', 'data_type': 'AUTO', 'short_descr': 'Row id', 'long_descr': 'Row id', 'col_head': 'Row', 'key_field': 'Y', 'data_source': 'gen', 'condition': None, 'allow_null': False, 'allow_amend': False, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None})
cols.append({'col_name': 'created_id', 'data_type': 'INT', 'short_descr': 'Created id', 'long_descr': 'Created row id', 'col_head': 'Created', 'key_field': 'N', 'data_source': 'gen', 'condition': None, 'allow_null': False, 'allow_amend': False, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': '0', 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None})
cols.append({'col_name': 'deleted_id', 'data_type': 'INT', 'short_descr': 'Deleted id', 'long_descr': 'Deleted row id', 'col_head': 'Deleted', 'key_field': 'N', 'data_source': 'gen', 'condition': None, 'allow_null': False, 'allow_amend': False, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': '0', 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None})
cols.append({'col_name': 'function_id', 'data_type': 'TEXT', 'short_descr': 'Function id', 'long_descr': 'Function id', 'col_head': 'Fcn', 'key_field': 'A', 'data_source': 'input', 'condition': None, 'allow_null': False, 'allow_amend': False, 'max_len': 15, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None})
cols.append({'col_name': 'descr', 'data_type': 'TEXT', 'short_descr': 'Description', 'long_descr': 'Function description', 'col_head': 'Description', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': False, 'allow_amend': True, 'max_len': 30, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None})
cols.append({'col_name': 'function_type', 'data_type': 'TEXT', 'short_descr': 'Type of function code', 'long_descr': "Type of function code.\nIf fixed levels are defined for this table (see tree_params),\n user must specify a 'type column', and define a 'type code' for each level.\nThis is the type column where the type codes are stored.\nAt run-time, tree_params is inspected, and if fixed levels are detected,\n 'choices' for this column is populated with valid codes which is then\n used for validation.", 'col_head': 'Type', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': False, 'allow_amend': False, 'max_len': 10, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None})
cols.append({'col_name': 'parent_id', 'data_type': 'INT', 'short_descr': 'Parent id', 'long_descr': 'Parent id', 'col_head': 'Parent', 'key_field': 'N', 'data_source': 'input', 'condition': None, 'allow_null': True, 'allow_amend': True, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': ['adm_functions', 'row_id', 'parent', 'function_id', False, None], 'choices': None})
cols.append({'col_name': 'seq', 'data_type': 'INT', 'short_descr': 'Sequence', 'long_descr': 'Sequence', 'col_head': 'Seq', 'key_field': 'N', 'data_source': 'seq', 'condition': None, 'allow_null': False, 'allow_amend': True, 'max_len': 0, 'db_scale': 0, 'scale_ptr': None, 'dflt_val': None, 'dflt_rule': None, 'col_checks': None, 'fkey': None, 'choices': None})
virt = []
virt.append({'col_name': 'children', 'data_type': 'INT', 'short_descr': 'Children', 'long_descr': 'Number of children', 'col_head': '', 'sql': 'SELECT count(*) FROM {company}.adm_functions b WHERE b.parent_id = a.row_id AND b.deleted_id = 0'})
virt.append({'col_name': 'is_leaf', 'data_type': 'BOOL', 'short_descr': 'Is leaf node?', 'long_descr': 'Is this node a leaf node? Over-ridden at run-time in db.objects if levels added.', 'col_head': '', 'sql': '$True'})
cursors = []
cursors.append({'cursor_name': 'functions', 'title': 'Maintain functions', 'columns': [['function_id', 100, False, False], ['descr', 260, True, True]], 'filter': [['WHERE', '', 'function_type', '!=', "'root'", '']], 'sequence': [['function_id', False]]})
actions = []
actions.append(['after_commit', '<pyfunc name="db.cache.param_updated"/>']) |
# Commutable Islands
#
# There are n islands and there are many bridges connecting them. Each bridge has
# some cost attached to it.
#
# We need to find bridges with minimal cost such that all islands are connected.
#
# It is guaranteed that input data will contain at least one possible scenario in which
# all islands are connected with each other.
#
# Example :
# Input
#
# Number of islands ( n ) = 4
# 1 2 1
# 2 3 4
# 1 4 3
# 4 3 2
# 1 3 10
#
# In this example, we have number of islands(n) = 4 . Each row then represents a bridge
# configuration. In each row first two numbers represent the islands number which are connected
# by this bridge and the third integer is the cost associated with this bridge.
#
# In the above example, we can select bridges 1(connecting islands 1 and 2 with cost 1),
# 3(connecting islands 1 and 4 with cost 3), 4(connecting islands 4 and 3 with cost 2). Thus we
# will have all islands connected with the minimum possible cost(1+3+2 = 6).
# In any other case, cost incurred will be more.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class Solution:
class Edges(list):
def __lt__(self, other):
for i in [2, 0, 1]:
if self[i] == other[i]:
continue
return self[i] < other[i]
class DisjoinSet:
def __init__(self, i):
self.parent = i
self.lvl = 0
def __repr__(self):
return "{}<{}>".format(self.parent, self.lvl)
@staticmethod
def findSet(x, S):
if S[x].parent == x:
return x
S[x].parent = Solution.findSet(S[x].parent, S)
return S[x].parent
@staticmethod
def unionSet(a, b, S):
set_a = Solution.findSet(a, S)
set_b = Solution.findSet(b, S)
if S[set_a].lvl < S[set_b].lvl:
S[set_a].parent = set_b
elif S[set_a].lvl > S[set_b].lvl:
S[set_b].parent = set_a
else:
S[set_b].parent = set_a
S[set_a].lvl += 1
# @param A : integer
# @param B : list of list of integers
# @return an integer
def solve(self, A, B):
B.sort(key=Solution.Edges)
S = [None] + [Solution.DisjoinSet(i + 1) for i in range(A)]
components, weigth = A - 1, 0
for edge in B:
if components == 0:
break
start = Solution.findSet(edge[0], S)
end = Solution.findSet(edge[1], S)
if start == end:
continue
Solution.unionSet(start, end, S)
components -= 1
weigth += edge[2]
return weigth | class Solution:
class Edges(list):
def __lt__(self, other):
for i in [2, 0, 1]:
if self[i] == other[i]:
continue
return self[i] < other[i]
class Disjoinset:
def __init__(self, i):
self.parent = i
self.lvl = 0
def __repr__(self):
return '{}<{}>'.format(self.parent, self.lvl)
@staticmethod
def find_set(x, S):
if S[x].parent == x:
return x
S[x].parent = Solution.findSet(S[x].parent, S)
return S[x].parent
@staticmethod
def union_set(a, b, S):
set_a = Solution.findSet(a, S)
set_b = Solution.findSet(b, S)
if S[set_a].lvl < S[set_b].lvl:
S[set_a].parent = set_b
elif S[set_a].lvl > S[set_b].lvl:
S[set_b].parent = set_a
else:
S[set_b].parent = set_a
S[set_a].lvl += 1
def solve(self, A, B):
B.sort(key=Solution.Edges)
s = [None] + [Solution.DisjoinSet(i + 1) for i in range(A)]
(components, weigth) = (A - 1, 0)
for edge in B:
if components == 0:
break
start = Solution.findSet(edge[0], S)
end = Solution.findSet(edge[1], S)
if start == end:
continue
Solution.unionSet(start, end, S)
components -= 1
weigth += edge[2]
return weigth |
x=[2,25,34,56,72,34,54]
val=int(input("Enter the value you want to get searched : "))
for i in x:
if i==val:
print(x.index(i))
break
elif x.index(i)==(len(x)-1) and i!=val:
print("The Val u want to search is not there in the list")
| x = [2, 25, 34, 56, 72, 34, 54]
val = int(input('Enter the value you want to get searched : '))
for i in x:
if i == val:
print(x.index(i))
break
elif x.index(i) == len(x) - 1 and i != val:
print('The Val u want to search is not there in the list') |
# subsequence: a sequence that can be derived from another sequence by deleting one or more elements,
# without changing the order
# unlike substrings, subsequences are not required to occupy consecutive positions within the parent sequence
# so ACE is a valid subsequence of ABCDE
# find the length of the longest common subsequence that is common to two given strings
# naive recursive implementation:
# compare the characters at index 0
# if they are the same, add one to the length of the LCS, then compare the characters at index 1
# otherwise, the LCS is composed of characters from either s1[:] and s2[1:], or s1[1:] and s2[:]
# so find out which of those has the longest
def longest_common_subsequence(s1, s2, i1=0, i2=0):
# if at end of either string, no further additions to subsequence possible
if i1 >= len(s1) or i2 >= len(s2):
return 0
if s1[i1] == s2[i2]:
return 1 + longest_common_subsequence(s1, s2, i1 + 1, i2 + 1)
branch_1 = longest_common_subsequence(s1, s2, i1, i2 + 1)
branch_2 = longest_common_subsequence(s1, s2, i1 + 1, i2)
return max(branch_1, branch_2)
s1 = "elephant"
s2 = "eretpat"
print(longest_common_subsequence(s1, s2))
| def longest_common_subsequence(s1, s2, i1=0, i2=0):
if i1 >= len(s1) or i2 >= len(s2):
return 0
if s1[i1] == s2[i2]:
return 1 + longest_common_subsequence(s1, s2, i1 + 1, i2 + 1)
branch_1 = longest_common_subsequence(s1, s2, i1, i2 + 1)
branch_2 = longest_common_subsequence(s1, s2, i1 + 1, i2)
return max(branch_1, branch_2)
s1 = 'elephant'
s2 = 'eretpat'
print(longest_common_subsequence(s1, s2)) |
# Input: arr[] = {1, 20, 2, 10}
# Output: 72
def single_rotation(arr,l):
temp=arr[0]
for i in range(l-1):
arr[i]=arr[i+1]
arr[l-1]=temp
def sum_calculate(arr,l):
sum=0
for i in range(l):
sum=sum+arr[i]*(i)
return sum
def max_finder(arr,l):
max=arr[0]
for i in range(l):
if max<arr[i]:
max=arr[i]
maximum=max
for i in range(l):
if max == arr[i]:
temp=i
index=temp+1
for j in range(index):
single_rotation(arr,len(arr))
arr=[10, 1, 2, 3, 4, 5, 6, 7, 8, 9]
max_finder(arr,len(arr))
result=sum_calculate(arr,len(arr))
print("Max sum is: "+ str(result))
#optimized approach
# '''Python program to find maximum value of Sum(i*arr[i])'''
# # returns max possible value of Sum(i*arr[i])
# def maxSum(arr):
# # stores sum of arr[i]
# arrSum = 0
# # stores sum of i*arr[i]
# currVal = 0
# n = len(arr)
# for i in range(0, n):
# arrSum = arrSum + arr[i]
# currVal = currVal + (i*arr[i])
# # initialize result
# maxVal = currVal
# # try all rotations one by one and find the maximum
# # rotation sum
# for j in range(1, n):
# currVal = currVal + arrSum-n*arr[n-j]
# if currVal > maxVal:
# maxVal = currVal
# # return result
# return maxVal
# # test maxsum(arr) function
# arr = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]
# print("Max sum is: ", maxSum(arr))
| def single_rotation(arr, l):
temp = arr[0]
for i in range(l - 1):
arr[i] = arr[i + 1]
arr[l - 1] = temp
def sum_calculate(arr, l):
sum = 0
for i in range(l):
sum = sum + arr[i] * i
return sum
def max_finder(arr, l):
max = arr[0]
for i in range(l):
if max < arr[i]:
max = arr[i]
maximum = max
for i in range(l):
if max == arr[i]:
temp = i
index = temp + 1
for j in range(index):
single_rotation(arr, len(arr))
arr = [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]
max_finder(arr, len(arr))
result = sum_calculate(arr, len(arr))
print('Max sum is: ' + str(result)) |
# program checks if the string is palindrome or not.
def function(string):
if(string == string[:: - 1]):
print("This is a Palindrome String")
else:
print("This is Not a Palindrome String")
string = input("Please enter your own String : ")
function(string)
| def function(string):
if string == string[::-1]:
print('This is a Palindrome String')
else:
print('This is Not a Palindrome String')
string = input('Please enter your own String : ')
function(string) |
_base_ = './deit-small_pt-4xb256_in1k.py'
# model settings
model = dict(
backbone=dict(type='DistilledVisionTransformer', arch='deit-base'),
head=dict(type='DeiTClsHead', in_channels=768),
)
# data settings
data = dict(samples_per_gpu=64, workers_per_gpu=5)
| _base_ = './deit-small_pt-4xb256_in1k.py'
model = dict(backbone=dict(type='DistilledVisionTransformer', arch='deit-base'), head=dict(type='DeiTClsHead', in_channels=768))
data = dict(samples_per_gpu=64, workers_per_gpu=5) |
class Solution:
def findRestaurant(self, list1: List[str], list2: List[str]) -> List[str]:
h = {v: i for i, v in enumerate(list1)}
result = []
m = inf
for i, v in enumerate(list2):
if v in h:
r = h[v] + i
if r < m:
m = r
result = [v]
elif r == m:
result.append(v)
return result
| class Solution:
def find_restaurant(self, list1: List[str], list2: List[str]) -> List[str]:
h = {v: i for (i, v) in enumerate(list1)}
result = []
m = inf
for (i, v) in enumerate(list2):
if v in h:
r = h[v] + i
if r < m:
m = r
result = [v]
elif r == m:
result.append(v)
return result |
#
# This helps us not have to pass so many things (caches, resolvers,
# transcoders...) around by letting us set class properties on the IIIFRequest
# at startup. Here's a basic example of how this pattern works:
#
# >>> class MyMeta(type): # Note we subclass type, not object
# ... _something = None
# ... def _get_something(self):
# ... return self._something
# ... def _set_something(self, value):
# ... self._something = value
# ... something = property(_get_something, _set_something)
# ...
# >>> class MyFoo(metaclass=MyMeta):
# ... pass
# >>> print(MyFoo.something)
# None
# >>> MyFoo.something = 'bar'
# >>> MyFoo.something
# 'bar'
#
class MetaRequest(type):
_compliance = None
_info_cache = None
_extractors = None
_app_configs = None
_transcoders = None
_resolvers = None
def _get_compliance(self):
return self._compliance
def _set_compliance(self, compliance):
self._compliance = compliance
compliance = property(_get_compliance, _set_compliance)
def _get_info_cache(self):
return self._info_cache
def _set_info_cache(self, info_cache):
self._info_cache = info_cache
info_cache = property(_get_info_cache, _set_info_cache)
def _get_extractors(self):
return self._extractors
def _set_extractors(self, extractors):
self._extractors = extractors
extractors = property(_get_extractors, _set_extractors)
def _get_app_configs(self):
return self._app_configs
def _set_app_configs(self, app_configs):
self._app_configs = app_configs
app_configs = property(_get_app_configs, _set_app_configs)
def _get_transcoders(self):
return self._transcoders
def _set_transcoders(self, transcoders):
self._transcoders = transcoders
transcoders = property(_get_transcoders, _set_transcoders)
def _get_resolvers(self):
return self._resolvers
def _set_resolvers(self, resolvers):
self._resolvers = resolvers
resolvers = property(_get_resolvers, _set_resolvers)
| class Metarequest(type):
_compliance = None
_info_cache = None
_extractors = None
_app_configs = None
_transcoders = None
_resolvers = None
def _get_compliance(self):
return self._compliance
def _set_compliance(self, compliance):
self._compliance = compliance
compliance = property(_get_compliance, _set_compliance)
def _get_info_cache(self):
return self._info_cache
def _set_info_cache(self, info_cache):
self._info_cache = info_cache
info_cache = property(_get_info_cache, _set_info_cache)
def _get_extractors(self):
return self._extractors
def _set_extractors(self, extractors):
self._extractors = extractors
extractors = property(_get_extractors, _set_extractors)
def _get_app_configs(self):
return self._app_configs
def _set_app_configs(self, app_configs):
self._app_configs = app_configs
app_configs = property(_get_app_configs, _set_app_configs)
def _get_transcoders(self):
return self._transcoders
def _set_transcoders(self, transcoders):
self._transcoders = transcoders
transcoders = property(_get_transcoders, _set_transcoders)
def _get_resolvers(self):
return self._resolvers
def _set_resolvers(self, resolvers):
self._resolvers = resolvers
resolvers = property(_get_resolvers, _set_resolvers) |
def anderson_iteration(X, U, V, labels, p, logger):
def multi_update_V(V, U, X):
delta_V = 100
while delta_V > 1e-1:
new_V = update_V(V, U, X, epsilon)
delta_V = l21_norm(new_V - V)
V = new_V
return V
V_len = V.flatten().shape[0]
mAA = 0
V_old = V
U_old = U
iterations = t = 0
mmax = p.mmax or 4
AAstart = p.AAstart or 0
droptol = p.droptol or 1e10
gamma = p.gamma
epsilon = p.epsilon
max_iteration = p.max_iterations or 300
fold = gold = None
g = np.ndarray(shape=(V_len, 0))
Q = np.ndarray(shape=(V_len, 1))
R = np.ndarray(shape=(1, 1))
old_E = np.Infinity
VAUt = None
while True:
U_new = solve_U(X, V_old, gamma, epsilon)
delta_U, is_converged = U_converged(U_new, U_old)
new_E = E(U_new, V_old, X, gamma, epsilon)
if is_converged:
return U_new, V_old, t, metric(U_new, labels)
if t > max_iteration:
return U_new, V_old, t, metric(U_new, labels)
if new_E >= old_E:
mAA = 0
iterations = 0
V_old = VAUt
g = np.ndarray(shape=(V_len, 0))
Q = np.ndarray(shape=(V_len, 1))
R = np.ndarray(shape=(1, 1))
U_new = solve_U(X, V_old, gamma, epsilon)
old_E = E(U_new, V_old, X, gamma, epsilon)
# AA Start
# VAUt = gcur = update_V(V_old, U_new, X, epsilon)
VAUt = gcur = multi_update_V(V_old, U_new, X)
fcur = gcur - V_old
if iterations > AAstart:
delta_f = (fcur - fold).reshape((V_len, 1))
delta_g = (gcur - gold).reshape((V_len, 1))
if mAA < mmax:
g = np.hstack((g, delta_g))
else:
g = np.hstack((g[:, 1:mAA], delta_g))
mAA += 1
fold, gold = fcur, gcur
if mAA == 0:
V_new = gcur
else:
if mAA == 1:
delta_f_norm = l21_norm(delta_f)
Q[:, 0] = delta_f.flatten() / delta_f_norm
R[0, 0] = delta_f_norm
else:
if mAA > mmax:
Q, R = qr_delete(Q, R, 1)
mAA -= 1
R = np.resize(R, (mAA, mAA))
Q = np.resize(Q, (V_len, mAA))
for i in range(0, mAA - 1):
R[i, mAA - 1] = Q[:, i].T @ delta_f
delta_f = delta_f - (R[i, mAA - 1] * Q[:, i]).reshape((V_len, 1))
delta_f_norm = l21_norm(delta_f)
Q[:, mAA - 1] = delta_f.flatten() / delta_f_norm
R[mAA - 1, mAA - 1] = delta_f_norm
while np.linalg.cond(R) > droptol and mAA > 1:
Q, R = qr_delete(Q, R, 1)
mAA -= 1
Gamma = scipy.linalg.solve(R, Q.T @ fcur.reshape(V_len, 1))
V_new = gcur - (g @ Gamma).reshape(V.shape)
delta_V, _ = U_converged(V_new, V_old)
V_old = V_new
U_old = U_new
old_E = new_E
logger.log_middle(E(U_new, V_new, X, gamma, epsilon), metric(U_new, labels))
t += 1
iterations += 1
| def anderson_iteration(X, U, V, labels, p, logger):
def multi_update_v(V, U, X):
delta_v = 100
while delta_V > 0.1:
new_v = update_v(V, U, X, epsilon)
delta_v = l21_norm(new_V - V)
v = new_V
return V
v_len = V.flatten().shape[0]
m_aa = 0
v_old = V
u_old = U
iterations = t = 0
mmax = p.mmax or 4
a_astart = p.AAstart or 0
droptol = p.droptol or 10000000000.0
gamma = p.gamma
epsilon = p.epsilon
max_iteration = p.max_iterations or 300
fold = gold = None
g = np.ndarray(shape=(V_len, 0))
q = np.ndarray(shape=(V_len, 1))
r = np.ndarray(shape=(1, 1))
old_e = np.Infinity
va_ut = None
while True:
u_new = solve_u(X, V_old, gamma, epsilon)
(delta_u, is_converged) = u_converged(U_new, U_old)
new_e = e(U_new, V_old, X, gamma, epsilon)
if is_converged:
return (U_new, V_old, t, metric(U_new, labels))
if t > max_iteration:
return (U_new, V_old, t, metric(U_new, labels))
if new_E >= old_E:
m_aa = 0
iterations = 0
v_old = VAUt
g = np.ndarray(shape=(V_len, 0))
q = np.ndarray(shape=(V_len, 1))
r = np.ndarray(shape=(1, 1))
u_new = solve_u(X, V_old, gamma, epsilon)
old_e = e(U_new, V_old, X, gamma, epsilon)
va_ut = gcur = multi_update_v(V_old, U_new, X)
fcur = gcur - V_old
if iterations > AAstart:
delta_f = (fcur - fold).reshape((V_len, 1))
delta_g = (gcur - gold).reshape((V_len, 1))
if mAA < mmax:
g = np.hstack((g, delta_g))
else:
g = np.hstack((g[:, 1:mAA], delta_g))
m_aa += 1
(fold, gold) = (fcur, gcur)
if mAA == 0:
v_new = gcur
else:
if mAA == 1:
delta_f_norm = l21_norm(delta_f)
Q[:, 0] = delta_f.flatten() / delta_f_norm
R[0, 0] = delta_f_norm
else:
if mAA > mmax:
(q, r) = qr_delete(Q, R, 1)
m_aa -= 1
r = np.resize(R, (mAA, mAA))
q = np.resize(Q, (V_len, mAA))
for i in range(0, mAA - 1):
R[i, mAA - 1] = Q[:, i].T @ delta_f
delta_f = delta_f - (R[i, mAA - 1] * Q[:, i]).reshape((V_len, 1))
delta_f_norm = l21_norm(delta_f)
Q[:, mAA - 1] = delta_f.flatten() / delta_f_norm
R[mAA - 1, mAA - 1] = delta_f_norm
while np.linalg.cond(R) > droptol and mAA > 1:
(q, r) = qr_delete(Q, R, 1)
m_aa -= 1
gamma = scipy.linalg.solve(R, Q.T @ fcur.reshape(V_len, 1))
v_new = gcur - (g @ Gamma).reshape(V.shape)
(delta_v, _) = u_converged(V_new, V_old)
v_old = V_new
u_old = U_new
old_e = new_E
logger.log_middle(e(U_new, V_new, X, gamma, epsilon), metric(U_new, labels))
t += 1
iterations += 1 |
def move(cc, order, value):
if order == "N":
cc[1] += value
if order == "S":
cc[1] -= value
if order == "E":
cc[0] += value
if order == "W":
cc[0] -= value
return cc
def stage1(inp):
direct = ["S", "W", "N", "E"]
facing = "E"
current_coord = [0, 0]
for order in inp:
value = int(order[1:])
if order[0] in ["S", "W", "N", "E"]:
current_coord = move(current_coord, order[0], value)
if order[0] == "R":
facing = direct[(direct.index(facing) + int(value / 90)) % 4]
if order[0] == "L":
nd = direct.index(facing) - int(value / 90)
if nd < 0:
nd = 4 - abs(nd)
facing = direct[nd]
if order[0] == "F":
current_coord = move(current_coord, facing, value)
return abs(current_coord[0]) + abs(current_coord[1])
def stage2(inp):
current_w_coord = [10, 1]
current_s_coord = [0, 0]
for order in inp:
value = int(order[1:])
if order[0] in ["S", "W", "N", "E"]:
current_w_coord = move(current_w_coord, order[0], value)
if order[0] == "R":
for _ in range(0, int(value / 90)):
cc = current_w_coord[1]
current_w_coord[1] = -current_w_coord[0]
current_w_coord[0] = cc
if order[0] == "L":
for _ in range(0, int(value / 90)):
cc = current_w_coord[1]
current_w_coord[1] = current_w_coord[0]
current_w_coord[0] = -cc
if order[0] == "F":
if current_w_coord[0] > 0:
current_s_coord = move(current_s_coord, "E", value * current_w_coord[0])
else:
current_s_coord = move(
current_s_coord, "W", value * abs(current_w_coord[0])
)
if current_w_coord[1] > 0:
current_s_coord = move(current_s_coord, "N", value * current_w_coord[1])
else:
current_s_coord = move(
current_s_coord, "S", value * abs(current_w_coord[1])
)
return abs(current_s_coord[0]) + abs(current_s_coord[1])
def solve(inp):
s1, s2 = (0, 0)
s1 = stage1(inp)
s2 = stage2(inp)
return s1, s2
| def move(cc, order, value):
if order == 'N':
cc[1] += value
if order == 'S':
cc[1] -= value
if order == 'E':
cc[0] += value
if order == 'W':
cc[0] -= value
return cc
def stage1(inp):
direct = ['S', 'W', 'N', 'E']
facing = 'E'
current_coord = [0, 0]
for order in inp:
value = int(order[1:])
if order[0] in ['S', 'W', 'N', 'E']:
current_coord = move(current_coord, order[0], value)
if order[0] == 'R':
facing = direct[(direct.index(facing) + int(value / 90)) % 4]
if order[0] == 'L':
nd = direct.index(facing) - int(value / 90)
if nd < 0:
nd = 4 - abs(nd)
facing = direct[nd]
if order[0] == 'F':
current_coord = move(current_coord, facing, value)
return abs(current_coord[0]) + abs(current_coord[1])
def stage2(inp):
current_w_coord = [10, 1]
current_s_coord = [0, 0]
for order in inp:
value = int(order[1:])
if order[0] in ['S', 'W', 'N', 'E']:
current_w_coord = move(current_w_coord, order[0], value)
if order[0] == 'R':
for _ in range(0, int(value / 90)):
cc = current_w_coord[1]
current_w_coord[1] = -current_w_coord[0]
current_w_coord[0] = cc
if order[0] == 'L':
for _ in range(0, int(value / 90)):
cc = current_w_coord[1]
current_w_coord[1] = current_w_coord[0]
current_w_coord[0] = -cc
if order[0] == 'F':
if current_w_coord[0] > 0:
current_s_coord = move(current_s_coord, 'E', value * current_w_coord[0])
else:
current_s_coord = move(current_s_coord, 'W', value * abs(current_w_coord[0]))
if current_w_coord[1] > 0:
current_s_coord = move(current_s_coord, 'N', value * current_w_coord[1])
else:
current_s_coord = move(current_s_coord, 'S', value * abs(current_w_coord[1]))
return abs(current_s_coord[0]) + abs(current_s_coord[1])
def solve(inp):
(s1, s2) = (0, 0)
s1 = stage1(inp)
s2 = stage2(inp)
return (s1, s2) |
A = int(input('Enter the value of A: '))
B = int(input('Enter the value of B: '))
#A = int(A)
#B = int(B)
C = A
A = B
B = C
print('Value of A', A, 'Value of B', B)
| a = int(input('Enter the value of A: '))
b = int(input('Enter the value of B: '))
c = A
a = B
b = C
print('Value of A', A, 'Value of B', B) |
# Input:
# 1
# 8
# 1 2 2 4 5 6 7 8
#
# Output:
# 2 1 4 2 6 5 8 7
def pairWiseSwap(head):
if head == None or head.next == None:
return head
prev = None
cur = head
count = 2
while count > 0 and cur != None:
temp = cur.next
cur.next = prev
prev = cur
cur = temp
count -= 1
head.next = pairWiseSwap(cur)
return prev
| def pair_wise_swap(head):
if head == None or head.next == None:
return head
prev = None
cur = head
count = 2
while count > 0 and cur != None:
temp = cur.next
cur.next = prev
prev = cur
cur = temp
count -= 1
head.next = pair_wise_swap(cur)
return prev |
a = 5 > 3
b = 5 > 4
c = 5 > 5
d = 5 > 6
e = 5 > 7
| a = 5 > 3
b = 5 > 4
c = 5 > 5
d = 5 > 6
e = 5 > 7 |
names = []
startingletter = ""
# Open file and getting all names from it
with open("./Input/Names/invited_names.txt") as file:
for line in file:
names.append(line.strip())
# Getting the text from the starting letter
with open("./Input/Letters/starting_letter.txt") as file:
startingletter = file.read()
# Looping through the list of names and writing the final version of the letter for each person
for name in names:
with open(f"./Output/ReadyToSend/letter_for_{name}", "w") as readytosend:
readytosend.write(startingletter.replace("[name]", name))
| names = []
startingletter = ''
with open('./Input/Names/invited_names.txt') as file:
for line in file:
names.append(line.strip())
with open('./Input/Letters/starting_letter.txt') as file:
startingletter = file.read()
for name in names:
with open(f'./Output/ReadyToSend/letter_for_{name}', 'w') as readytosend:
readytosend.write(startingletter.replace('[name]', name)) |
def Counting_Sort(A, k=-1):
if(k==-1): k=max(A)
C = [0 for x in range(k+1)]
for x in A: C[x]+=1
for x in range(1, k+1):C[x]+=C[x-1]
B = [0 for x in range(len(A))]
for i in range(len(A)-1, -1, -1):
x = A[i]
B[C[x]-1] = x
C[x]-=1
return B
A = [13,20,18,20,12,15,7]
print(Counting_Sort(A))
| def counting__sort(A, k=-1):
if k == -1:
k = max(A)
c = [0 for x in range(k + 1)]
for x in A:
C[x] += 1
for x in range(1, k + 1):
C[x] += C[x - 1]
b = [0 for x in range(len(A))]
for i in range(len(A) - 1, -1, -1):
x = A[i]
B[C[x] - 1] = x
C[x] -= 1
return B
a = [13, 20, 18, 20, 12, 15, 7]
print(counting__sort(A)) |
class Solution:
def minWindow(self, s: str, t: str) -> str:
target, window = defaultdict(int), defaultdict(int)
left, right, match = 0, 0, 0
d = float("inf")
for c in t:
target[c] += 1
while right < len(s):
c = s[right]
if c in target:
window[c] += 1
if window[c] == target[c]:
match += 1
right += 1
while (match == len(target)):
if right - left < d:
ans = s[left:right]
d = right - left
c = s[left]
left += 1
if c in target:
if window[c] == target[c]:
match -= 1
window[c] -= 1
return "" if d == float("inf") else ans
| class Solution:
def min_window(self, s: str, t: str) -> str:
(target, window) = (defaultdict(int), defaultdict(int))
(left, right, match) = (0, 0, 0)
d = float('inf')
for c in t:
target[c] += 1
while right < len(s):
c = s[right]
if c in target:
window[c] += 1
if window[c] == target[c]:
match += 1
right += 1
while match == len(target):
if right - left < d:
ans = s[left:right]
d = right - left
c = s[left]
left += 1
if c in target:
if window[c] == target[c]:
match -= 1
window[c] -= 1
return '' if d == float('inf') else ans |
# From: http://wiki.python.org/moin/SimplePrograms, with permission from the author, Steve Howell
BOARD_SIZE = 8
def under_attack(col, queens):
return col in queens or \
any(abs(col - x) == len(queens)-i for i,x in enumerate(queens))
def solve(n):
solutions = [[]]
for row in range(n):
solutions = [solution+[i+1]
for solution in solutions
for i in range(BOARD_SIZE)
if not under_attack(i+1, solution)]
return solutions
for answer in solve(BOARD_SIZE): print(list(enumerate(answer, start=1)))
| board_size = 8
def under_attack(col, queens):
return col in queens or any((abs(col - x) == len(queens) - i for (i, x) in enumerate(queens)))
def solve(n):
solutions = [[]]
for row in range(n):
solutions = [solution + [i + 1] for solution in solutions for i in range(BOARD_SIZE) if not under_attack(i + 1, solution)]
return solutions
for answer in solve(BOARD_SIZE):
print(list(enumerate(answer, start=1))) |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
INITIAL_DATA_TO_COMPLETE = [
'valid_0',
'valid_1',
'valid_10',
'valid_100',
'valid_101',
'valid_102',
'valid_103',
'valid_105',
'valid_106',
'valid_107',
'valid_108',
'valid_109',
'valid_11',
'valid_110',
'valid_111',
'valid_112',
'valid_115',
'valid_116',
'valid_117',
'valid_119',
'valid_12',
'valid_120',
'valid_121',
'valid_122',
'valid_123',
'valid_124',
'valid_125',
'valid_13',
'valid_130',
'valid_131',
'valid_133',
'valid_136',
'valid_138',
'valid_139',
'valid_14',
'valid_140',
'valid_141',
'valid_143',
'valid_144',
'valid_145',
'valid_146',
'valid_147',
'valid_148',
'valid_15',
'valid_152',
'valid_153',
'valid_154',
'valid_155',
'valid_156',
'valid_158',
'valid_160',
'valid_162',
'valid_163',
'valid_166',
'valid_169',
'valid_17',
'valid_171',
'valid_172',
'valid_174',
'valid_175',
'valid_176',
'valid_177',
'valid_178',
'valid_18',
'valid_181',
'valid_182',
'valid_184',
'valid_187',
'valid_19',
'valid_190',
'valid_191',
'valid_192',
'valid_193',
'valid_194',
'valid_196',
'valid_2',
'valid_20',
'valid_202',
'valid_203',
'valid_205',
'valid_206',
'valid_207',
'valid_208',
'valid_212',
'valid_214',
'valid_215',
'valid_216',
'valid_217',
'valid_219',
'valid_223',
'valid_225',
'valid_227',
'valid_228',
'valid_23',
'valid_230',
'valid_231',
'valid_232',
'valid_233',
'valid_234',
'valid_236',
]
COMMON_CONFIG = {
'task': 'msc:SessionBaseMsc',
'num_examples': -1,
'label_speaker_id': 'their',
'session_id': 4,
'datatype': 'valid',
}
MODEL_OPT = {
'BST90M': {
'previous_persona_type': 'none',
'num_previous_sessions_msg': 10,
'include_time_gap': False,
}
}
UI_OPT = {'BST90M': {'previous_persona_type': 'both', 'include_time_gap': False}}
| initial_data_to_complete = ['valid_0', 'valid_1', 'valid_10', 'valid_100', 'valid_101', 'valid_102', 'valid_103', 'valid_105', 'valid_106', 'valid_107', 'valid_108', 'valid_109', 'valid_11', 'valid_110', 'valid_111', 'valid_112', 'valid_115', 'valid_116', 'valid_117', 'valid_119', 'valid_12', 'valid_120', 'valid_121', 'valid_122', 'valid_123', 'valid_124', 'valid_125', 'valid_13', 'valid_130', 'valid_131', 'valid_133', 'valid_136', 'valid_138', 'valid_139', 'valid_14', 'valid_140', 'valid_141', 'valid_143', 'valid_144', 'valid_145', 'valid_146', 'valid_147', 'valid_148', 'valid_15', 'valid_152', 'valid_153', 'valid_154', 'valid_155', 'valid_156', 'valid_158', 'valid_160', 'valid_162', 'valid_163', 'valid_166', 'valid_169', 'valid_17', 'valid_171', 'valid_172', 'valid_174', 'valid_175', 'valid_176', 'valid_177', 'valid_178', 'valid_18', 'valid_181', 'valid_182', 'valid_184', 'valid_187', 'valid_19', 'valid_190', 'valid_191', 'valid_192', 'valid_193', 'valid_194', 'valid_196', 'valid_2', 'valid_20', 'valid_202', 'valid_203', 'valid_205', 'valid_206', 'valid_207', 'valid_208', 'valid_212', 'valid_214', 'valid_215', 'valid_216', 'valid_217', 'valid_219', 'valid_223', 'valid_225', 'valid_227', 'valid_228', 'valid_23', 'valid_230', 'valid_231', 'valid_232', 'valid_233', 'valid_234', 'valid_236']
common_config = {'task': 'msc:SessionBaseMsc', 'num_examples': -1, 'label_speaker_id': 'their', 'session_id': 4, 'datatype': 'valid'}
model_opt = {'BST90M': {'previous_persona_type': 'none', 'num_previous_sessions_msg': 10, 'include_time_gap': False}}
ui_opt = {'BST90M': {'previous_persona_type': 'both', 'include_time_gap': False}} |
def inicio():
print ("--PRINCIPAL--")
print("1. AGREGAR")
print("2. ELIMINAR")
print("3. VER")
opc = input ("------> ")
return opc
| def inicio():
print('--PRINCIPAL--')
print('1. AGREGAR')
print('2. ELIMINAR')
print('3. VER')
opc = input('------> ')
return opc |
n, m = map(int, input().strip().split())
matrix = [list(map(int, input().strip().split())) for _ in range(n)]
k = int(input().strip())
for lst in sorted(matrix, key=lambda l: l[k]):
print(*lst)
| (n, m) = map(int, input().strip().split())
matrix = [list(map(int, input().strip().split())) for _ in range(n)]
k = int(input().strip())
for lst in sorted(matrix, key=lambda l: l[k]):
print(*lst) |
Nsweeps = 100
size = 32
for beta in [0.1, 0.8, 1.6]:
g = Grid(size, beta)
m = g.do_sweeps(0, Nsweeps)
grid = g.cells
mag = g.magnetisation(grid)
e_plus = np.zeros((size, size))
e_minus = np.zeros((size, size))
for i in np.arange(size):
for j in np.arange(size):
e_plus[i,j], e_minus[i,j] = g.energy(i, j, beta, grid)
if not os.path.exists(filename):
filename = 'test_data_beta_%0.1f_2.pickle'%beta
f = open(filename, 'wb')
pickle.dump((grid, mag, e_plus, e_minus, beta), f)
f.close()
if not os.path.exists(filename):
filename = 'test_data_beta_%0.1f_grid_only_2.pickle'%beta
f = open(filename, 'wb')
pickle.dump((grid, beta), f)
f.close() | nsweeps = 100
size = 32
for beta in [0.1, 0.8, 1.6]:
g = grid(size, beta)
m = g.do_sweeps(0, Nsweeps)
grid = g.cells
mag = g.magnetisation(grid)
e_plus = np.zeros((size, size))
e_minus = np.zeros((size, size))
for i in np.arange(size):
for j in np.arange(size):
(e_plus[i, j], e_minus[i, j]) = g.energy(i, j, beta, grid)
if not os.path.exists(filename):
filename = 'test_data_beta_%0.1f_2.pickle' % beta
f = open(filename, 'wb')
pickle.dump((grid, mag, e_plus, e_minus, beta), f)
f.close()
if not os.path.exists(filename):
filename = 'test_data_beta_%0.1f_grid_only_2.pickle' % beta
f = open(filename, 'wb')
pickle.dump((grid, beta), f)
f.close() |
load("@rules_maven_third_party//:import_external.bzl", import_external = "import_external")
def dependencies():
import_external(
name = "org_apache_maven_resolver_maven_resolver_api",
artifact = "org.apache.maven.resolver:maven-resolver-api:1.4.0",
artifact_sha256 = "85aac254240e8bf387d737acf5fcd18f07163ae55a0223b107c7e2af1dfdc6e6",
srcjar_sha256 = "be7f42679a5485fbe30c475afa05c12dd9a2beb83bbcebbb3d2e79eb8aeff9c4",
)
import_external(
name = "org_apache_maven_resolver_maven_resolver_connector_basic",
artifact = "org.apache.maven.resolver:maven-resolver-connector-basic:1.4.0",
artifact_sha256 = "4283db771d9265136615637bd22d02929cfd548c8d351f76ecb88a3006b5faf7",
srcjar_sha256 = "556163b53b1f98df263adf1d26b269cd45316a827f169e0ede514ca5fca0c5d1",
deps = [
"@org_apache_maven_resolver_maven_resolver_api",
"@org_apache_maven_resolver_maven_resolver_spi",
"@org_apache_maven_resolver_maven_resolver_util",
"@org_slf4j_slf4j_api",
],
)
import_external(
name = "org_apache_maven_resolver_maven_resolver_impl",
artifact = "org.apache.maven.resolver:maven-resolver-impl:1.4.0",
artifact_sha256 = "004662079feeed66251480ad76fedbcabff96ee53db29c59f6aa564647c5bfe6",
srcjar_sha256 = "b544f134261f813b1a44ffcc97590236d3d6e2519722d55dea395a96fef18206",
deps = [
"@org_apache_maven_resolver_maven_resolver_api",
"@org_apache_maven_resolver_maven_resolver_spi",
"@org_apache_maven_resolver_maven_resolver_util",
"@org_slf4j_slf4j_api",
],
)
import_external(
name = "org_apache_maven_resolver_maven_resolver_spi",
artifact = "org.apache.maven.resolver:maven-resolver-spi:1.4.0",
artifact_sha256 = "8a2985eb28135eae4c40db446081b1533c1813c251bb370756777697e0b7114e",
srcjar_sha256 = "89099a02006b6ce46096d89f021675bf000e96300bcdc0ff439a86d6e322c761",
deps = [
"@org_apache_maven_resolver_maven_resolver_api",
],
)
import_external(
name = "org_apache_maven_resolver_maven_resolver_transport_file",
artifact = "org.apache.maven.resolver:maven-resolver-transport-file:1.4.0",
artifact_sha256 = "94eb9bcc073ac1591002b26a4cf558324b12d8f76b6d5628151d7f87733436f6",
srcjar_sha256 = "17abd750063fa74cbf754e803ba27ca0216b0bebc8e45e1872cd9ed5a1e5e719",
deps = [
"@org_apache_maven_resolver_maven_resolver_api",
"@org_apache_maven_resolver_maven_resolver_spi",
"@org_slf4j_slf4j_api",
],
)
import_external(
name = "org_apache_maven_resolver_maven_resolver_transport_http",
artifact = "org.apache.maven.resolver:maven-resolver-transport-http:1.4.0",
artifact_sha256 = "8dddd83ec6244bde5ef63ae679a0ce5d7e8fc566369d7391c8814206e2a7114f",
srcjar_sha256 = "5af0150a1ab714b164763d1daca4b8fdd1ab6dd445ec3c57e7ec916ccbdf7e4e",
deps = [
"@org_apache_httpcomponents_httpclient",
"@org_apache_httpcomponents_httpcore",
"@org_apache_maven_resolver_maven_resolver_api",
"@org_apache_maven_resolver_maven_resolver_spi",
"@org_apache_maven_resolver_maven_resolver_util",
"@org_slf4j_jcl_over_slf4j",
"@org_slf4j_slf4j_api",
],
)
import_external(
name = "org_apache_maven_resolver_maven_resolver_util",
artifact = "org.apache.maven.resolver:maven-resolver-util:1.4.0",
artifact_sha256 = "e83b6c2de4b8b8d99d3c226f5e447f70df808834824336c360aa615fc4d7beac",
srcjar_sha256 = "74dd3696e2df175db39b944079f7b49941e39e57f98e469f942635a2ba1cae57",
deps = [
"@org_apache_maven_resolver_maven_resolver_api",
],
)
| load('@rules_maven_third_party//:import_external.bzl', import_external='import_external')
def dependencies():
import_external(name='org_apache_maven_resolver_maven_resolver_api', artifact='org.apache.maven.resolver:maven-resolver-api:1.4.0', artifact_sha256='85aac254240e8bf387d737acf5fcd18f07163ae55a0223b107c7e2af1dfdc6e6', srcjar_sha256='be7f42679a5485fbe30c475afa05c12dd9a2beb83bbcebbb3d2e79eb8aeff9c4')
import_external(name='org_apache_maven_resolver_maven_resolver_connector_basic', artifact='org.apache.maven.resolver:maven-resolver-connector-basic:1.4.0', artifact_sha256='4283db771d9265136615637bd22d02929cfd548c8d351f76ecb88a3006b5faf7', srcjar_sha256='556163b53b1f98df263adf1d26b269cd45316a827f169e0ede514ca5fca0c5d1', deps=['@org_apache_maven_resolver_maven_resolver_api', '@org_apache_maven_resolver_maven_resolver_spi', '@org_apache_maven_resolver_maven_resolver_util', '@org_slf4j_slf4j_api'])
import_external(name='org_apache_maven_resolver_maven_resolver_impl', artifact='org.apache.maven.resolver:maven-resolver-impl:1.4.0', artifact_sha256='004662079feeed66251480ad76fedbcabff96ee53db29c59f6aa564647c5bfe6', srcjar_sha256='b544f134261f813b1a44ffcc97590236d3d6e2519722d55dea395a96fef18206', deps=['@org_apache_maven_resolver_maven_resolver_api', '@org_apache_maven_resolver_maven_resolver_spi', '@org_apache_maven_resolver_maven_resolver_util', '@org_slf4j_slf4j_api'])
import_external(name='org_apache_maven_resolver_maven_resolver_spi', artifact='org.apache.maven.resolver:maven-resolver-spi:1.4.0', artifact_sha256='8a2985eb28135eae4c40db446081b1533c1813c251bb370756777697e0b7114e', srcjar_sha256='89099a02006b6ce46096d89f021675bf000e96300bcdc0ff439a86d6e322c761', deps=['@org_apache_maven_resolver_maven_resolver_api'])
import_external(name='org_apache_maven_resolver_maven_resolver_transport_file', artifact='org.apache.maven.resolver:maven-resolver-transport-file:1.4.0', artifact_sha256='94eb9bcc073ac1591002b26a4cf558324b12d8f76b6d5628151d7f87733436f6', srcjar_sha256='17abd750063fa74cbf754e803ba27ca0216b0bebc8e45e1872cd9ed5a1e5e719', deps=['@org_apache_maven_resolver_maven_resolver_api', '@org_apache_maven_resolver_maven_resolver_spi', '@org_slf4j_slf4j_api'])
import_external(name='org_apache_maven_resolver_maven_resolver_transport_http', artifact='org.apache.maven.resolver:maven-resolver-transport-http:1.4.0', artifact_sha256='8dddd83ec6244bde5ef63ae679a0ce5d7e8fc566369d7391c8814206e2a7114f', srcjar_sha256='5af0150a1ab714b164763d1daca4b8fdd1ab6dd445ec3c57e7ec916ccbdf7e4e', deps=['@org_apache_httpcomponents_httpclient', '@org_apache_httpcomponents_httpcore', '@org_apache_maven_resolver_maven_resolver_api', '@org_apache_maven_resolver_maven_resolver_spi', '@org_apache_maven_resolver_maven_resolver_util', '@org_slf4j_jcl_over_slf4j', '@org_slf4j_slf4j_api'])
import_external(name='org_apache_maven_resolver_maven_resolver_util', artifact='org.apache.maven.resolver:maven-resolver-util:1.4.0', artifact_sha256='e83b6c2de4b8b8d99d3c226f5e447f70df808834824336c360aa615fc4d7beac', srcjar_sha256='74dd3696e2df175db39b944079f7b49941e39e57f98e469f942635a2ba1cae57', deps=['@org_apache_maven_resolver_maven_resolver_api']) |
# Generic uwsgi_param headers
CONTENT_LENGTH = 'CONTENT_LENGTH'
CONTENT_TYPE = 'CONTENT_TYPE'
DOCUMENT_ROOT = 'DOCUMENT_ROOT'
QUERY_STRING = 'QUERY_STRING'
PATH_INFO = 'PATH_INFO'
REMOTE_ADDR = 'REMOTE_ADDR'
REMOTE_PORT = 'REMOTE_PORT'
REQUEST_METHOD = 'REQUEST_METHOD'
REQUEST_URI = 'REQUEST_URI'
SERVER_ADDR = 'SERVER_ADDR'
SERVER_NAME = 'SERVER_NAME'
SERVER_PORT = 'SERVER_PORT'
SERVER_PROTOCOL = 'SERVER_PROTOCOL'
# SSL uwsgi_param headers
CLIENT_SSL_CERT = 'CLIENT_SSL_CERT'
| content_length = 'CONTENT_LENGTH'
content_type = 'CONTENT_TYPE'
document_root = 'DOCUMENT_ROOT'
query_string = 'QUERY_STRING'
path_info = 'PATH_INFO'
remote_addr = 'REMOTE_ADDR'
remote_port = 'REMOTE_PORT'
request_method = 'REQUEST_METHOD'
request_uri = 'REQUEST_URI'
server_addr = 'SERVER_ADDR'
server_name = 'SERVER_NAME'
server_port = 'SERVER_PORT'
server_protocol = 'SERVER_PROTOCOL'
client_ssl_cert = 'CLIENT_SSL_CERT' |
file1 = ""
file2 = ""
with open('Hello.txt') as f:
file1 = f.read()
with open('Hi.txt') as f:
file2 = f.read()
file1 += "\n"
file1 += file2
with open('file3.txt', 'w') as f:
f.write(file1) | file1 = ''
file2 = ''
with open('Hello.txt') as f:
file1 = f.read()
with open('Hi.txt') as f:
file2 = f.read()
file1 += '\n'
file1 += file2
with open('file3.txt', 'w') as f:
f.write(file1) |
ix.enable_command_history()
ix.api.SdkHelpers.enable_disable_items_selected(ix.application, False)
ix.disable_command_history() | ix.enable_command_history()
ix.api.SdkHelpers.enable_disable_items_selected(ix.application, False)
ix.disable_command_history() |
#!/usr/bin/env python
######################################
# Installation module for King Phisher
######################################
# AUTHOR OF MODULE NAME
AUTHOR="Spencer McIntyre (@zeroSteiner)"
# DESCRIPTION OF THE MODULE
DESCRIPTION="This module will install/update the King Phisher phishing campaign toolkit"
# INSTALL TYPE GIT, SVN, FILE DOWNLOAD
# OPTIONS = GIT, SVN, FILE
INSTALL_TYPE="GIT"
# LOCATION OF THE FILE OR GIT/SVN REPOSITORY
REPOSITORY_LOCATION="https://github.com/securestate/king-phisher/"
# WHERE DO YOU WANT TO INSTALL IT
INSTALL_LOCATION="king-phisher"
# DEPENDS FOR DEBIAN INSTALLS
DEBIAN="git"
# DEPENDS FOR FEDORA INSTALLS
FEDORA="git"
# COMMANDS TO RUN AFTER
AFTER_COMMANDS="cd {INSTALL_LOCATION},yes | tools/install.sh"
| author = 'Spencer McIntyre (@zeroSteiner)'
description = 'This module will install/update the King Phisher phishing campaign toolkit'
install_type = 'GIT'
repository_location = 'https://github.com/securestate/king-phisher/'
install_location = 'king-phisher'
debian = 'git'
fedora = 'git'
after_commands = 'cd {INSTALL_LOCATION},yes | tools/install.sh' |
num = int(input())
for i in range(1, num+1):
s = ''
for j in range(1, i):
s += str(j)
for j in range(i, 0, -1):
s += str(j)
print(s) | num = int(input())
for i in range(1, num + 1):
s = ''
for j in range(1, i):
s += str(j)
for j in range(i, 0, -1):
s += str(j)
print(s) |
def replace_spaces_dashes(line):
return "-".join(line.split())
def last_five_lowercase(line):
return line[-5:].lower()
def backwards_skipped(line):
return line[::-2]
if __name__ == '__main__':
line = input("Enter a string: ")
print(replace_spaces_dashes(line))
print(last_five_lowercase(line))
print(backwards_skipped(line))
| def replace_spaces_dashes(line):
return '-'.join(line.split())
def last_five_lowercase(line):
return line[-5:].lower()
def backwards_skipped(line):
return line[::-2]
if __name__ == '__main__':
line = input('Enter a string: ')
print(replace_spaces_dashes(line))
print(last_five_lowercase(line))
print(backwards_skipped(line)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.