content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
data1 = {
'board': {
'snakes': [
{'body': [
{'x': 5, 'y': 5},
{'x': 5, 'y': 6},
{'x': 4, 'y': 6},
{'x': 3, 'y': 6},
{'x': 3, 'y': 5},
{'x': 3, 'y': 4},
{'x': 4, 'y': 4},
{'x': 5, 'y': 4},
{'x': 6, 'y': 4},
{'x': 7, 'y': 4}
],
'health': 100,
'id': 'testsnake',
'length': 10,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 10,
'width': 10,
'food': [
{'x': 2, 'y': 2},
]
},
'you': {
'body': [
{'x': 5, 'y': 5},
{'x': 5, 'y': 6},
{'x': 4, 'y': 6},
{'x': 3, 'y': 6},
{'x': 3, 'y': 5},
{'x': 3, 'y': 4},
{'x': 4, 'y': 6},
{'x': 5, 'y': 6},
{'x': 6, 'y': 6},
{'x': 7, 'y': 6}
],
'health': 100,
'id': 'testsnake',
'length': 10,
'name': 'testsnake',
'object': 'snake'
}
}
data2 = {
'board': {
'snakes': [
{'body': [
{'x': 5, 'y': 5},
{'x': 5, 'y': 6},
{'x': 5, 'y': 7},
{'x': 4, 'y': 7},
{'x': 3, 'y': 7},
{'x': 2, 'y': 7},
{'x': 2, 'y': 6},
{'x': 2, 'y': 5},
{'x': 2, 'y': 4},
{'x': 3, 'y': 4},
{'x': 4, 'y': 4},
{'x': 5, 'y': 4},
{'x': 6, 'y': 4},
{'x': 7, 'y': 4}
],
'health': 100,
'id': 'testsnake',
'length': 14,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 10,
'width': 10,
'food': [
{'x': 2, 'y': 2},
]
},
'you': {
'body': [
{'x': 5, 'y': 5},
{'x': 5, 'y': 6},
{'x': 5, 'y': 7},
{'x': 4, 'y': 7},
{'x': 3, 'y': 7},
{'x': 2, 'y': 7},
{'x': 2, 'y': 6},
{'x': 2, 'y': 5},
{'x': 2, 'y': 4},
{'x': 3, 'y': 4},
{'x': 4, 'y': 4},
{'x': 5, 'y': 4},
{'x': 6, 'y': 4},
{'x': 7, 'y': 4}
],
'health': 100,
'id': 'testsnake',
'length': 14,
'name': 'testsnake',
'object': 'snake'
}
}
data3 = {
'board': {
'snakes': [
{'body': [
{'x': 0, 'y': 1},
{'x': 1, 'y': 1}
],
'health': 100,
'id': 'testsnake',
'length': 2,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 10,
'width': 10,
'food': [
{'x': 5, 'y': 5},
]
},
'you': {
'body': [
{'x': 0, 'y': 1},
{'x': 1, 'y': 1}
],
'health': 100,
'id': 'testsnake',
'length': 2,
'name': 'testsnake',
'object': 'snake'
}
}
data4 = {
'board': {
'snakes': [
{'body': [
{'x': 2, 'y': 0},
{'x': 1, 'y': 0},
{'x': 0, 'y': 0},
{'x': 0, 'y': 1}
],
'health': 100,
'id': 'testsnake',
'length': 4,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 10,
'width': 10,
'food': [
{'x': 1, 'y': 1},
]
},
'you': {
'body': [
{'x': 2, 'y': 0},
{'x': 1, 'y': 0},
{'x': 0, 'y': 0},
{'x': 0, 'y': 1}
],
'health': 100,
'id': 'testsnake',
'length': 4,
'name': 'testsnake',
'object': 'snake'
}
}
data5 = {
'board': {
'snakes': [
{'body': [
{'x': 3, 'y': 0},
{'x': 3, 'y': 0},
{'x': 3, 'y': 0}
],
'health': 100,
'id': 'testsnake',
'length': 3,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 10,
'width': 10,
'food': [
{'x': 1, 'y': 1},
]
},
'you': {
'body': [
{'x': 3, 'y': 0},
{'x': 3, 'y': 0},
{'x': 3, 'y': 0}
],
'health': 100,
'id': 'testsnake',
'length': 3,
'name': 'testsnake',
'object': 'snake'
}
}
data52 = {
'board': {
'snakes': [
{'body': [
{'x': 0, 'y': 3},
{'x': 0, 'y': 3},
{'x': 0, 'y': 3}
],
'health': 100,
'id': 'testsnake',
'length': 3,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 10,
'width': 10,
'food': [
{'x': 1, 'y': 1},
]
},
'you': {
'body': [
{'x': 0, 'y': 3},
{'x': 0, 'y': 3},
{'x': 0, 'y': 3}
],
'health': 100,
'id': 'testsnake',
'length': 3,
'name': 'testsnake',
'object': 'snake'
}
}
data53 = {
'board': {
'snakes': [
{'body': [
{'x': 3, 'y': 9},
{'x': 3, 'y': 9},
{'x': 3, 'y': 9}
],
'health': 100,
'id': 'testsnake',
'length': 3,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 10,
'width': 10,
'food': [
{'x': 1, 'y': 1},
]
},
'you': {
'body': [
{'x': 3, 'y': 9},
{'x': 3, 'y': 9},
{'x': 3, 'y': 9}
],
'health': 100,
'id': 'testsnake',
'length': 3,
'name': 'testsnake',
'object': 'snake'
}
}
data54 = {
'board': {
'snakes': [
{'body': [
{'x': 9, 'y': 3},
{'x': 9, 'y': 3},
{'x': 9, 'y': 3}
],
'health': 100,
'id': 'testsnake',
'length': 3,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 10,
'width': 10,
'food': [
{'x': 1, 'y': 1},
]
},
'you': {
'body': [
{'x': 9, 'y': 3},
{'x': 9, 'y': 3},
{'x': 9, 'y': 3}
],
'health': 100,
'id': 'testsnake',
'length': 3,
'name': 'testsnake',
'object': 'snake'
}
}
data6 = {
'board': {
'snakes': [
{'body': [
{'x': 0, 'y': 7},
{'x': 0, 'y': 8},
{'x': 1, 'y': 8},
{'x': 1, 'y': 7},
{'x': 1, 'y': 6},
{'x': 1, 'y': 5},
{'x': 1, 'y': 4}
],
'health': 100,
'id': 'testsnake',
'length': 7,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 10,
'width': 10,
'food': [
{'x': 5, 'y': 8},
]
},
'you': {
'body': [
{'x': 0, 'y': 7},
{'x': 0, 'y': 8},
{'x': 1, 'y': 8},
{'x': 1, 'y': 7},
{'x': 1, 'y': 6},
{'x': 1, 'y': 5},
{'x': 1, 'y': 4}
],
'health': 100,
'id': 'testsnake',
'length': 7,
'name': 'testsnake',
'object': 'snake'
}
}
data7 = {
'board': {
'snakes': [
{'body': [
{'x': 4, 'y': 2},
{'x': 4, 'y': 1},
{'x': 5, 'y': 1},
{'x': 5, 'y': 2},
{'x': 5, 'y': 3},
{'x': 5, 'y': 4},
{'x': 5, 'y': 5},
{'x': 4, 'y': 5},
{'x': 3, 'y': 5},
{'x': 3, 'y': 4},
{'x': 3, 'y': 3},
{'x': 2, 'y': 3},
{'x': 1, 'y': 3}
],
'health': 100,
'id': 'testsnake',
'length': 13,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 10,
'width': 10,
'food': [
{'x': 5, 'y': 8},
]
},
'you': {
'body': [
{'x': 4, 'y': 2},
{'x': 4, 'y': 1},
{'x': 5, 'y': 1},
{'x': 5, 'y': 2},
{'x': 5, 'y': 3},
{'x': 5, 'y': 4},
{'x': 5, 'y': 5},
{'x': 4, 'y': 5},
{'x': 3, 'y': 5},
{'x': 3, 'y': 4},
{'x': 3, 'y': 3},
{'x': 2, 'y': 3},
{'x': 1, 'y': 3}
],
'health': 100,
'id': 'testsnake',
'length': 13,
'name': 'testsnake',
'object': 'snake'
}
}
data8 = {
'board': {
'snakes': [
{'body': [
{'x': 8, 'y': 29},
{'x': 8, 'y': 28},
{'x': 7, 'y': 28},
{'x': 6, 'y': 27},
{'x': 6, 'y': 26},
{'x': 6, 'y': 25},
{'x': 6, 'y': 24},
{'x': 6, 'y': 23},
{'x': 6, 'y': 22},
{'x': 6, 'y': 21},
{'x': 6, 'y': 20},
{'x': 6, 'y': 19},
{'x': 6, 'y': 18},
{'x': 6, 'y': 17},
{'x': 6, 'y': 16},
{'x': 6, 'y': 15},
{'x': 6, 'y': 14},
{'x': 6, 'y': 13},
{'x': 6, 'y': 12},
{'x': 6, 'y': 11},
{'x': 6, 'y': 10},
{'x': 6, 'y': 9},
{'x': 6, 'y': 8},
{'x': 6, 'y': 7},
{'x': 6, 'y': 6},
{'x': 6, 'y': 5},
{'x': 6, 'y': 4},
{'x': 6, 'y': 3},
{'x': 6, 'y': 2},
{'x': 6, 'y': 1},
{'x': 7, 'y': 1},
{'x': 8, 'y': 1},
{'x': 9, 'y': 1},
{'x': 9, 'y': 2}
],
'health': 100,
'id': 'testsnake',
'length': 34,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 30,
'width': 30,
'food': [
{'x': 5, 'y': 8},
]
},
'you': {
'body': [
{'x': 8, 'y': 29},
{'x': 8, 'y': 28},
{'x': 7, 'y': 28},
{'x': 6, 'y': 27},
{'x': 6, 'y': 26},
{'x': 6, 'y': 25},
{'x': 6, 'y': 24},
{'x': 6, 'y': 23},
{'x': 6, 'y': 22},
{'x': 6, 'y': 21},
{'x': 6, 'y': 20},
{'x': 6, 'y': 19},
{'x': 6, 'y': 18},
{'x': 6, 'y': 17},
{'x': 6, 'y': 16},
{'x': 6, 'y': 15},
{'x': 6, 'y': 14},
{'x': 6, 'y': 13},
{'x': 6, 'y': 12},
{'x': 6, 'y': 11},
{'x': 6, 'y': 10},
{'x': 6, 'y': 9},
{'x': 6, 'y': 8},
{'x': 6, 'y': 7},
{'x': 6, 'y': 6},
{'x': 6, 'y': 5},
{'x': 6, 'y': 4},
{'x': 6, 'y': 3},
{'x': 6, 'y': 2},
{'x': 6, 'y': 1},
{'x': 7, 'y': 1},
{'x': 8, 'y': 1},
{'x': 9, 'y': 1},
{'x': 9, 'y': 2}
],
'health': 100,
'id': 'testsnake',
'length': 34,
'name': 'testsnake',
'object': 'snake'
}
}
data9 = {
'board': {
'snakes': [
{'body': [
{'x': 4, 'y': 2},
{'x': 4, 'y': 3},
{'x': 4, 'y': 4},
{'x': 3, 'y': 4},
{'x': 2, 'y': 4},
{'x': 1, 'y': 4},
{'x': 1, 'y': 3},
{'x': 1, 'y': 2},
{'x': 1, 'y': 1},
{'x': 2, 'y': 1},
{'x': 3, 'y': 1},
{'x': 3, 'y': 0},
{'x': 2, 'y': 0}
],
'health': 100,
'id': 'testsnake',
'length': 13,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 10,
'width': 10,
'food': [
{'x': 2, 'y': 6},
]
},
'you': {
'body': [
{'x': 4, 'y': 2},
{'x': 4, 'y': 3},
{'x': 4, 'y': 4},
{'x': 3, 'y': 4},
{'x': 2, 'y': 4},
{'x': 1, 'y': 4},
{'x': 1, 'y': 3},
{'x': 1, 'y': 2},
{'x': 1, 'y': 1},
{'x': 2, 'y': 1},
{'x': 3, 'y': 1},
{'x': 3, 'y': 0},
{'x': 2, 'y': 0}
],
'health': 100,
'id': 'testsnake',
'length': 13,
'name': 'testsnake',
'object': 'snake'
}
}
data_dead_end_with_tail = {
'board': {
'snakes': [
{'body': [
{'x': 6, 'y': 0},
{'x': 6, 'y': 1},
{'x': 6, 'y': 2},
{'x': 6, 'y': 3},
{'x': 5, 'y': 3},
{'x': 4, 'y': 3},
{'x': 4, 'y': 4},
{'x': 4, 'y': 5},
{'x': 3, 'y': 5},
{'x': 2, 'y': 5},
{'x': 1, 'y': 5},
{'x': 1, 'y': 4},
{'x': 1, 'y': 3},
{'x': 0, 'y': 3},
{'x': 0, 'y': 4},
{'x': 0, 'y': 5},
{'x': 0, 'y': 6},
{'x': 1, 'y': 6},
{'x': 2, 'y': 6},
{'x': 3, 'y': 6},
{'x': 4, 'y': 6},
{'x': 5, 'y': 6},
{'x': 6, 'y': 6},
{'x': 7, 'y': 6},
{'x': 7, 'y': 5},
{'x': 7, 'y': 4},
{'x': 7, 'y': 3},
{'x': 7, 'y': 2},
{'x': 7, 'y': 1},
{'x': 8, 'y': 1},
{'x': 8, 'y': 2},
{'x': 9, 'y': 2},
{'x': 10, 'y': 2},
{'x': 10, 'y': 1},
{'x': 10, 'y': 0},
{'x': 11, 'y': 0}
],
'health': 100,
'id': 'testsnake',
'length': 36,
'name': 'testsnake',
'object': 'snake'
}
],
'height': 12,
'width': 12,
'food': [
{'x': 8, 'y': 8},
]
},
'you': {
'body': [
{'x': 6, 'y': 0},
{'x': 6, 'y': 1},
{'x': 6, 'y': 2},
{'x': 6, 'y': 3},
{'x': 5, 'y': 3},
{'x': 4, 'y': 3},
{'x': 4, 'y': 4},
{'x': 4, 'y': 5},
{'x': 3, 'y': 5},
{'x': 2, 'y': 5},
{'x': 1, 'y': 5},
{'x': 1, 'y': 4},
{'x': 1, 'y': 3},
{'x': 0, 'y': 3},
{'x': 0, 'y': 4},
{'x': 0, 'y': 5},
{'x': 0, 'y': 6},
{'x': 1, 'y': 6},
{'x': 2, 'y': 6},
{'x': 3, 'y': 6},
{'x': 4, 'y': 6},
{'x': 5, 'y': 6},
{'x': 6, 'y': 6},
{'x': 7, 'y': 6},
{'x': 7, 'y': 5},
{'x': 7, 'y': 4},
{'x': 7, 'y': 3},
{'x': 7, 'y': 2},
{'x': 7, 'y': 1},
{'x': 8, 'y': 1},
{'x': 8, 'y': 2},
{'x': 9, 'y': 2},
{'x': 10, 'y': 2},
{'x': 10, 'y': 1},
{'x': 10, 'y': 0},
{'x': 11, 'y': 0}
],
'health': 100,
'id': 'testsnake',
'length': 36,
'name': 'testsnake',
'object': 'snake'
}
} | data1 = {'board': {'snakes': [{'body': [{'x': 5, 'y': 5}, {'x': 5, 'y': 6}, {'x': 4, 'y': 6}, {'x': 3, 'y': 6}, {'x': 3, 'y': 5}, {'x': 3, 'y': 4}, {'x': 4, 'y': 4}, {'x': 5, 'y': 4}, {'x': 6, 'y': 4}, {'x': 7, 'y': 4}], 'health': 100, 'id': 'testsnake', 'length': 10, 'name': 'testsnake', 'object': 'snake'}], 'height': 10, 'width': 10, 'food': [{'x': 2, 'y': 2}]}, 'you': {'body': [{'x': 5, 'y': 5}, {'x': 5, 'y': 6}, {'x': 4, 'y': 6}, {'x': 3, 'y': 6}, {'x': 3, 'y': 5}, {'x': 3, 'y': 4}, {'x': 4, 'y': 6}, {'x': 5, 'y': 6}, {'x': 6, 'y': 6}, {'x': 7, 'y': 6}], 'health': 100, 'id': 'testsnake', 'length': 10, 'name': 'testsnake', 'object': 'snake'}}
data2 = {'board': {'snakes': [{'body': [{'x': 5, 'y': 5}, {'x': 5, 'y': 6}, {'x': 5, 'y': 7}, {'x': 4, 'y': 7}, {'x': 3, 'y': 7}, {'x': 2, 'y': 7}, {'x': 2, 'y': 6}, {'x': 2, 'y': 5}, {'x': 2, 'y': 4}, {'x': 3, 'y': 4}, {'x': 4, 'y': 4}, {'x': 5, 'y': 4}, {'x': 6, 'y': 4}, {'x': 7, 'y': 4}], 'health': 100, 'id': 'testsnake', 'length': 14, 'name': 'testsnake', 'object': 'snake'}], 'height': 10, 'width': 10, 'food': [{'x': 2, 'y': 2}]}, 'you': {'body': [{'x': 5, 'y': 5}, {'x': 5, 'y': 6}, {'x': 5, 'y': 7}, {'x': 4, 'y': 7}, {'x': 3, 'y': 7}, {'x': 2, 'y': 7}, {'x': 2, 'y': 6}, {'x': 2, 'y': 5}, {'x': 2, 'y': 4}, {'x': 3, 'y': 4}, {'x': 4, 'y': 4}, {'x': 5, 'y': 4}, {'x': 6, 'y': 4}, {'x': 7, 'y': 4}], 'health': 100, 'id': 'testsnake', 'length': 14, 'name': 'testsnake', 'object': 'snake'}}
data3 = {'board': {'snakes': [{'body': [{'x': 0, 'y': 1}, {'x': 1, 'y': 1}], 'health': 100, 'id': 'testsnake', 'length': 2, 'name': 'testsnake', 'object': 'snake'}], 'height': 10, 'width': 10, 'food': [{'x': 5, 'y': 5}]}, 'you': {'body': [{'x': 0, 'y': 1}, {'x': 1, 'y': 1}], 'health': 100, 'id': 'testsnake', 'length': 2, 'name': 'testsnake', 'object': 'snake'}}
data4 = {'board': {'snakes': [{'body': [{'x': 2, 'y': 0}, {'x': 1, 'y': 0}, {'x': 0, 'y': 0}, {'x': 0, 'y': 1}], 'health': 100, 'id': 'testsnake', 'length': 4, 'name': 'testsnake', 'object': 'snake'}], 'height': 10, 'width': 10, 'food': [{'x': 1, 'y': 1}]}, 'you': {'body': [{'x': 2, 'y': 0}, {'x': 1, 'y': 0}, {'x': 0, 'y': 0}, {'x': 0, 'y': 1}], 'health': 100, 'id': 'testsnake', 'length': 4, 'name': 'testsnake', 'object': 'snake'}}
data5 = {'board': {'snakes': [{'body': [{'x': 3, 'y': 0}, {'x': 3, 'y': 0}, {'x': 3, 'y': 0}], 'health': 100, 'id': 'testsnake', 'length': 3, 'name': 'testsnake', 'object': 'snake'}], 'height': 10, 'width': 10, 'food': [{'x': 1, 'y': 1}]}, 'you': {'body': [{'x': 3, 'y': 0}, {'x': 3, 'y': 0}, {'x': 3, 'y': 0}], 'health': 100, 'id': 'testsnake', 'length': 3, 'name': 'testsnake', 'object': 'snake'}}
data52 = {'board': {'snakes': [{'body': [{'x': 0, 'y': 3}, {'x': 0, 'y': 3}, {'x': 0, 'y': 3}], 'health': 100, 'id': 'testsnake', 'length': 3, 'name': 'testsnake', 'object': 'snake'}], 'height': 10, 'width': 10, 'food': [{'x': 1, 'y': 1}]}, 'you': {'body': [{'x': 0, 'y': 3}, {'x': 0, 'y': 3}, {'x': 0, 'y': 3}], 'health': 100, 'id': 'testsnake', 'length': 3, 'name': 'testsnake', 'object': 'snake'}}
data53 = {'board': {'snakes': [{'body': [{'x': 3, 'y': 9}, {'x': 3, 'y': 9}, {'x': 3, 'y': 9}], 'health': 100, 'id': 'testsnake', 'length': 3, 'name': 'testsnake', 'object': 'snake'}], 'height': 10, 'width': 10, 'food': [{'x': 1, 'y': 1}]}, 'you': {'body': [{'x': 3, 'y': 9}, {'x': 3, 'y': 9}, {'x': 3, 'y': 9}], 'health': 100, 'id': 'testsnake', 'length': 3, 'name': 'testsnake', 'object': 'snake'}}
data54 = {'board': {'snakes': [{'body': [{'x': 9, 'y': 3}, {'x': 9, 'y': 3}, {'x': 9, 'y': 3}], 'health': 100, 'id': 'testsnake', 'length': 3, 'name': 'testsnake', 'object': 'snake'}], 'height': 10, 'width': 10, 'food': [{'x': 1, 'y': 1}]}, 'you': {'body': [{'x': 9, 'y': 3}, {'x': 9, 'y': 3}, {'x': 9, 'y': 3}], 'health': 100, 'id': 'testsnake', 'length': 3, 'name': 'testsnake', 'object': 'snake'}}
data6 = {'board': {'snakes': [{'body': [{'x': 0, 'y': 7}, {'x': 0, 'y': 8}, {'x': 1, 'y': 8}, {'x': 1, 'y': 7}, {'x': 1, 'y': 6}, {'x': 1, 'y': 5}, {'x': 1, 'y': 4}], 'health': 100, 'id': 'testsnake', 'length': 7, 'name': 'testsnake', 'object': 'snake'}], 'height': 10, 'width': 10, 'food': [{'x': 5, 'y': 8}]}, 'you': {'body': [{'x': 0, 'y': 7}, {'x': 0, 'y': 8}, {'x': 1, 'y': 8}, {'x': 1, 'y': 7}, {'x': 1, 'y': 6}, {'x': 1, 'y': 5}, {'x': 1, 'y': 4}], 'health': 100, 'id': 'testsnake', 'length': 7, 'name': 'testsnake', 'object': 'snake'}}
data7 = {'board': {'snakes': [{'body': [{'x': 4, 'y': 2}, {'x': 4, 'y': 1}, {'x': 5, 'y': 1}, {'x': 5, 'y': 2}, {'x': 5, 'y': 3}, {'x': 5, 'y': 4}, {'x': 5, 'y': 5}, {'x': 4, 'y': 5}, {'x': 3, 'y': 5}, {'x': 3, 'y': 4}, {'x': 3, 'y': 3}, {'x': 2, 'y': 3}, {'x': 1, 'y': 3}], 'health': 100, 'id': 'testsnake', 'length': 13, 'name': 'testsnake', 'object': 'snake'}], 'height': 10, 'width': 10, 'food': [{'x': 5, 'y': 8}]}, 'you': {'body': [{'x': 4, 'y': 2}, {'x': 4, 'y': 1}, {'x': 5, 'y': 1}, {'x': 5, 'y': 2}, {'x': 5, 'y': 3}, {'x': 5, 'y': 4}, {'x': 5, 'y': 5}, {'x': 4, 'y': 5}, {'x': 3, 'y': 5}, {'x': 3, 'y': 4}, {'x': 3, 'y': 3}, {'x': 2, 'y': 3}, {'x': 1, 'y': 3}], 'health': 100, 'id': 'testsnake', 'length': 13, 'name': 'testsnake', 'object': 'snake'}}
data8 = {'board': {'snakes': [{'body': [{'x': 8, 'y': 29}, {'x': 8, 'y': 28}, {'x': 7, 'y': 28}, {'x': 6, 'y': 27}, {'x': 6, 'y': 26}, {'x': 6, 'y': 25}, {'x': 6, 'y': 24}, {'x': 6, 'y': 23}, {'x': 6, 'y': 22}, {'x': 6, 'y': 21}, {'x': 6, 'y': 20}, {'x': 6, 'y': 19}, {'x': 6, 'y': 18}, {'x': 6, 'y': 17}, {'x': 6, 'y': 16}, {'x': 6, 'y': 15}, {'x': 6, 'y': 14}, {'x': 6, 'y': 13}, {'x': 6, 'y': 12}, {'x': 6, 'y': 11}, {'x': 6, 'y': 10}, {'x': 6, 'y': 9}, {'x': 6, 'y': 8}, {'x': 6, 'y': 7}, {'x': 6, 'y': 6}, {'x': 6, 'y': 5}, {'x': 6, 'y': 4}, {'x': 6, 'y': 3}, {'x': 6, 'y': 2}, {'x': 6, 'y': 1}, {'x': 7, 'y': 1}, {'x': 8, 'y': 1}, {'x': 9, 'y': 1}, {'x': 9, 'y': 2}], 'health': 100, 'id': 'testsnake', 'length': 34, 'name': 'testsnake', 'object': 'snake'}], 'height': 30, 'width': 30, 'food': [{'x': 5, 'y': 8}]}, 'you': {'body': [{'x': 8, 'y': 29}, {'x': 8, 'y': 28}, {'x': 7, 'y': 28}, {'x': 6, 'y': 27}, {'x': 6, 'y': 26}, {'x': 6, 'y': 25}, {'x': 6, 'y': 24}, {'x': 6, 'y': 23}, {'x': 6, 'y': 22}, {'x': 6, 'y': 21}, {'x': 6, 'y': 20}, {'x': 6, 'y': 19}, {'x': 6, 'y': 18}, {'x': 6, 'y': 17}, {'x': 6, 'y': 16}, {'x': 6, 'y': 15}, {'x': 6, 'y': 14}, {'x': 6, 'y': 13}, {'x': 6, 'y': 12}, {'x': 6, 'y': 11}, {'x': 6, 'y': 10}, {'x': 6, 'y': 9}, {'x': 6, 'y': 8}, {'x': 6, 'y': 7}, {'x': 6, 'y': 6}, {'x': 6, 'y': 5}, {'x': 6, 'y': 4}, {'x': 6, 'y': 3}, {'x': 6, 'y': 2}, {'x': 6, 'y': 1}, {'x': 7, 'y': 1}, {'x': 8, 'y': 1}, {'x': 9, 'y': 1}, {'x': 9, 'y': 2}], 'health': 100, 'id': 'testsnake', 'length': 34, 'name': 'testsnake', 'object': 'snake'}}
data9 = {'board': {'snakes': [{'body': [{'x': 4, 'y': 2}, {'x': 4, 'y': 3}, {'x': 4, 'y': 4}, {'x': 3, 'y': 4}, {'x': 2, 'y': 4}, {'x': 1, 'y': 4}, {'x': 1, 'y': 3}, {'x': 1, 'y': 2}, {'x': 1, 'y': 1}, {'x': 2, 'y': 1}, {'x': 3, 'y': 1}, {'x': 3, 'y': 0}, {'x': 2, 'y': 0}], 'health': 100, 'id': 'testsnake', 'length': 13, 'name': 'testsnake', 'object': 'snake'}], 'height': 10, 'width': 10, 'food': [{'x': 2, 'y': 6}]}, 'you': {'body': [{'x': 4, 'y': 2}, {'x': 4, 'y': 3}, {'x': 4, 'y': 4}, {'x': 3, 'y': 4}, {'x': 2, 'y': 4}, {'x': 1, 'y': 4}, {'x': 1, 'y': 3}, {'x': 1, 'y': 2}, {'x': 1, 'y': 1}, {'x': 2, 'y': 1}, {'x': 3, 'y': 1}, {'x': 3, 'y': 0}, {'x': 2, 'y': 0}], 'health': 100, 'id': 'testsnake', 'length': 13, 'name': 'testsnake', 'object': 'snake'}}
data_dead_end_with_tail = {'board': {'snakes': [{'body': [{'x': 6, 'y': 0}, {'x': 6, 'y': 1}, {'x': 6, 'y': 2}, {'x': 6, 'y': 3}, {'x': 5, 'y': 3}, {'x': 4, 'y': 3}, {'x': 4, 'y': 4}, {'x': 4, 'y': 5}, {'x': 3, 'y': 5}, {'x': 2, 'y': 5}, {'x': 1, 'y': 5}, {'x': 1, 'y': 4}, {'x': 1, 'y': 3}, {'x': 0, 'y': 3}, {'x': 0, 'y': 4}, {'x': 0, 'y': 5}, {'x': 0, 'y': 6}, {'x': 1, 'y': 6}, {'x': 2, 'y': 6}, {'x': 3, 'y': 6}, {'x': 4, 'y': 6}, {'x': 5, 'y': 6}, {'x': 6, 'y': 6}, {'x': 7, 'y': 6}, {'x': 7, 'y': 5}, {'x': 7, 'y': 4}, {'x': 7, 'y': 3}, {'x': 7, 'y': 2}, {'x': 7, 'y': 1}, {'x': 8, 'y': 1}, {'x': 8, 'y': 2}, {'x': 9, 'y': 2}, {'x': 10, 'y': 2}, {'x': 10, 'y': 1}, {'x': 10, 'y': 0}, {'x': 11, 'y': 0}], 'health': 100, 'id': 'testsnake', 'length': 36, 'name': 'testsnake', 'object': 'snake'}], 'height': 12, 'width': 12, 'food': [{'x': 8, 'y': 8}]}, 'you': {'body': [{'x': 6, 'y': 0}, {'x': 6, 'y': 1}, {'x': 6, 'y': 2}, {'x': 6, 'y': 3}, {'x': 5, 'y': 3}, {'x': 4, 'y': 3}, {'x': 4, 'y': 4}, {'x': 4, 'y': 5}, {'x': 3, 'y': 5}, {'x': 2, 'y': 5}, {'x': 1, 'y': 5}, {'x': 1, 'y': 4}, {'x': 1, 'y': 3}, {'x': 0, 'y': 3}, {'x': 0, 'y': 4}, {'x': 0, 'y': 5}, {'x': 0, 'y': 6}, {'x': 1, 'y': 6}, {'x': 2, 'y': 6}, {'x': 3, 'y': 6}, {'x': 4, 'y': 6}, {'x': 5, 'y': 6}, {'x': 6, 'y': 6}, {'x': 7, 'y': 6}, {'x': 7, 'y': 5}, {'x': 7, 'y': 4}, {'x': 7, 'y': 3}, {'x': 7, 'y': 2}, {'x': 7, 'y': 1}, {'x': 8, 'y': 1}, {'x': 8, 'y': 2}, {'x': 9, 'y': 2}, {'x': 10, 'y': 2}, {'x': 10, 'y': 1}, {'x': 10, 'y': 0}, {'x': 11, 'y': 0}], 'health': 100, 'id': 'testsnake', 'length': 36, 'name': 'testsnake', 'object': 'snake'}} |
# python 3.6
def camel2pothole(string):
rst = "".join(["_" + s.lower() if s == s.upper() or s.isdigit() else s for s in string])
return rst
print(camel2pothole("codingDojang"))
print(camel2pothole("numGoat30")) | def camel2pothole(string):
rst = ''.join(['_' + s.lower() if s == s.upper() or s.isdigit() else s for s in string])
return rst
print(camel2pothole('codingDojang'))
print(camel2pothole('numGoat30')) |
browsers = [
{
'id': 'chrome',
'name': 'Chrome'
},
{
'id': 'chromium',
'name': 'Chromium'
},
{
'id': 'firefox',
'name': 'Firefox'
},
{
'id': 'safari',
'name': 'Safari'
},
{
'id': 'msie',
'name': 'Internet Explorer'
},
{
'id': 'msedge',
'name': 'Microsoft Edge'
},
{
'id': 'opera',
'name': 'Opera'
},
{
'id': 'yandexbrowser',
'name': 'Yandex.Browser'
},
{
'id': 'ios',
'name': 'iOS'
},
{
'id': 'android',
'name': 'Android'
},
{
'id': 'samsungBrowser',
'name': 'Samsung Internet'
}
]
| browsers = [{'id': 'chrome', 'name': 'Chrome'}, {'id': 'chromium', 'name': 'Chromium'}, {'id': 'firefox', 'name': 'Firefox'}, {'id': 'safari', 'name': 'Safari'}, {'id': 'msie', 'name': 'Internet Explorer'}, {'id': 'msedge', 'name': 'Microsoft Edge'}, {'id': 'opera', 'name': 'Opera'}, {'id': 'yandexbrowser', 'name': 'Yandex.Browser'}, {'id': 'ios', 'name': 'iOS'}, {'id': 'android', 'name': 'Android'}, {'id': 'samsungBrowser', 'name': 'Samsung Internet'}] |
N, K, S = [int(n) for n in input().split()]
ans = []
for i in range(N-K):
ans.append(S+1 if S<10**9 else 1)
for j in range(K):
ans.append(S)
print(" ".join([str(n) for n in ans]))
| (n, k, s) = [int(n) for n in input().split()]
ans = []
for i in range(N - K):
ans.append(S + 1 if S < 10 ** 9 else 1)
for j in range(K):
ans.append(S)
print(' '.join([str(n) for n in ans])) |
#Binary Tree Level Order BFS&DFS
class Solution(object):
def levelOrder(self, root):
if not root:
return []
result = []
queue = collections.deque()
queue.append(root)
#visited = set(root)
while queue:
level_size = len(queue)
current_level = []
for _ in range(level_size):
node = queue.popleft()
current_level.append(node.val)
if node.left and node:
queue.append(node.left)
if node.right.append(node.right):
queue.append(node.right)
result = append(current_level)
return result
#Binary Tree Level Order BFS&DFS
# class solution(object):
# def levelOrder(self, root):
# if not root:
# return []
# self.result = []
# self._dfs(root, 0)
# return self.result
# def _dfs(self, root, level):
# if not node:
# return
# if len(self.result) < level + 1:
# self.return.append([])
# self.result[level].append([])
# self._dfs(node.left, level+1)
# self._dfs(node.right, level+1) | class Solution(object):
def level_order(self, root):
if not root:
return []
result = []
queue = collections.deque()
queue.append(root)
while queue:
level_size = len(queue)
current_level = []
for _ in range(level_size):
node = queue.popleft()
current_level.append(node.val)
if node.left and node:
queue.append(node.left)
if node.right.append(node.right):
queue.append(node.right)
result = append(current_level)
return result |
# Python Learning Lessons
some_var = int(input("Give me a number, any number: "))
if some_var > 10:
print("The number is bigger than tenerooonie.")
elif some_var < 10:
print("The numbah is smaller than 10.")
elif some_var == 10:
("YO. The numbah is TEN!")
some_name = str(input("Hey, what's your name, kid: "))
print("Pleasure to meet ya, numbah, " + some_name)
| some_var = int(input('Give me a number, any number: '))
if some_var > 10:
print('The number is bigger than tenerooonie.')
elif some_var < 10:
print('The numbah is smaller than 10.')
elif some_var == 10:
'YO. The numbah is TEN!'
some_name = str(input("Hey, what's your name, kid: "))
print('Pleasure to meet ya, numbah, ' + some_name) |
class SubClass():
def __init__(self):
self.message = 'init - SubFile - mtulio.example.sub Class'
def returnMessage(self):
return self.message
def subMessageHelloWorld():
return 'init - SubFile - mtulio.example.sub Method'
| class Subclass:
def __init__(self):
self.message = 'init - SubFile - mtulio.example.sub Class'
def return_message(self):
return self.message
def sub_message_hello_world():
return 'init - SubFile - mtulio.example.sub Method' |
"""
Discussion:
To better appreciate what is happening here, you should go back to the previous
interactive demo. Set the w = 5 and I_ext = 0.5.
You will find that there are three fixed points of the system for these values of
w and I_ext. Now, choose the initial value in this demo and see in which direction
the system output moves. When r_init is in the vicinity of the leftmost fixed points
it moves towards the left most fixed point. When r_init is in the vicinity of the
rightmost fixed points it moves towards the rightmost fixed point.
"""; | """
Discussion:
To better appreciate what is happening here, you should go back to the previous
interactive demo. Set the w = 5 and I_ext = 0.5.
You will find that there are three fixed points of the system for these values of
w and I_ext. Now, choose the initial value in this demo and see in which direction
the system output moves. When r_init is in the vicinity of the leftmost fixed points
it moves towards the left most fixed point. When r_init is in the vicinity of the
rightmost fixed points it moves towards the rightmost fixed point.
""" |
# coding=utf-8
# *** WARNING: this file was generated by crd2pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
SNAKE_TO_CAMEL_CASE_TABLE = {
"api_version": "apiVersion",
"attacher_node_selector": "attacherNodeSelector",
"driver_registrar": "driverRegistrar",
"gui_host": "guiHost",
"gui_port": "guiPort",
"image_pull_secrets": "imagePullSecrets",
"inode_limit": "inodeLimit",
"k8s_node": "k8sNode",
"node_mapping": "nodeMapping",
"plugin_node_selector": "pluginNodeSelector",
"primary_fs": "primaryFs",
"primary_fset": "primaryFset",
"provisioner_node_selector": "provisionerNodeSelector",
"ready": "Ready",
"remote_cluster": "remoteCluster",
"rest_api": "restApi",
"scale_hostpath": "scaleHostpath",
"secret_counter": "secretCounter",
"secure_ssl_mode": "secureSslMode",
"spectrum_scale": "spectrumScale",
"spectrumscale_node": "spectrumscaleNode",
"toleration_seconds": "tolerationSeconds",
}
CAMEL_TO_SNAKE_CASE_TABLE = {
"apiVersion": "api_version",
"attacherNodeSelector": "attacher_node_selector",
"driverRegistrar": "driver_registrar",
"guiHost": "gui_host",
"guiPort": "gui_port",
"imagePullSecrets": "image_pull_secrets",
"inodeLimit": "inode_limit",
"k8sNode": "k8s_node",
"nodeMapping": "node_mapping",
"pluginNodeSelector": "plugin_node_selector",
"primaryFs": "primary_fs",
"primaryFset": "primary_fset",
"provisionerNodeSelector": "provisioner_node_selector",
"Ready": "ready",
"remoteCluster": "remote_cluster",
"restApi": "rest_api",
"scaleHostpath": "scale_hostpath",
"secretCounter": "secret_counter",
"secureSslMode": "secure_ssl_mode",
"spectrumScale": "spectrum_scale",
"spectrumscaleNode": "spectrumscale_node",
"tolerationSeconds": "toleration_seconds",
}
| snake_to_camel_case_table = {'api_version': 'apiVersion', 'attacher_node_selector': 'attacherNodeSelector', 'driver_registrar': 'driverRegistrar', 'gui_host': 'guiHost', 'gui_port': 'guiPort', 'image_pull_secrets': 'imagePullSecrets', 'inode_limit': 'inodeLimit', 'k8s_node': 'k8sNode', 'node_mapping': 'nodeMapping', 'plugin_node_selector': 'pluginNodeSelector', 'primary_fs': 'primaryFs', 'primary_fset': 'primaryFset', 'provisioner_node_selector': 'provisionerNodeSelector', 'ready': 'Ready', 'remote_cluster': 'remoteCluster', 'rest_api': 'restApi', 'scale_hostpath': 'scaleHostpath', 'secret_counter': 'secretCounter', 'secure_ssl_mode': 'secureSslMode', 'spectrum_scale': 'spectrumScale', 'spectrumscale_node': 'spectrumscaleNode', 'toleration_seconds': 'tolerationSeconds'}
camel_to_snake_case_table = {'apiVersion': 'api_version', 'attacherNodeSelector': 'attacher_node_selector', 'driverRegistrar': 'driver_registrar', 'guiHost': 'gui_host', 'guiPort': 'gui_port', 'imagePullSecrets': 'image_pull_secrets', 'inodeLimit': 'inode_limit', 'k8sNode': 'k8s_node', 'nodeMapping': 'node_mapping', 'pluginNodeSelector': 'plugin_node_selector', 'primaryFs': 'primary_fs', 'primaryFset': 'primary_fset', 'provisionerNodeSelector': 'provisioner_node_selector', 'Ready': 'ready', 'remoteCluster': 'remote_cluster', 'restApi': 'rest_api', 'scaleHostpath': 'scale_hostpath', 'secretCounter': 'secret_counter', 'secureSslMode': 'secure_ssl_mode', 'spectrumScale': 'spectrum_scale', 'spectrumscaleNode': 'spectrumscale_node', 'tolerationSeconds': 'toleration_seconds'} |
STATS = [
{
"num_node_expansions": NaN,
"plan_length": 35,
"search_time": 7.93,
"total_time": 7.93
},
{
"num_node_expansions": NaN,
"plan_length": 34,
"search_time": 9.72,
"total_time": 9.72
},
{
"num_node_expansions": NaN,
"plan_length": 40,
"search_time": 15.54,
"total_time": 15.54
},
{
"num_node_expansions": NaN,
"plan_length": 23,
"search_time": 1.99,
"total_time": 1.99
},
{
"num_node_expansions": NaN,
"plan_length": 24,
"search_time": 1.22,
"total_time": 1.22
},
{
"num_node_expansions": NaN,
"plan_length": 23,
"search_time": 2.58,
"total_time": 2.58
},
{
"num_node_expansions": NaN,
"plan_length": 19,
"search_time": 1.62,
"total_time": 1.62
},
{
"num_node_expansions": NaN,
"plan_length": 23,
"search_time": 1.43,
"total_time": 1.43
},
{
"num_node_expansions": NaN,
"plan_length": 20,
"search_time": 0.72,
"total_time": 0.72
},
{
"num_node_expansions": NaN,
"plan_length": 29,
"search_time": 0.84,
"total_time": 0.84
},
{
"num_node_expansions": NaN,
"plan_length": 28,
"search_time": 1.08,
"total_time": 1.08
},
{
"num_node_expansions": NaN,
"plan_length": 21,
"search_time": 0.71,
"total_time": 0.71
},
{
"num_node_expansions": NaN,
"plan_length": 26,
"search_time": 1.97,
"total_time": 1.97
},
{
"num_node_expansions": NaN,
"plan_length": 29,
"search_time": 2.29,
"total_time": 2.29
},
{
"num_node_expansions": NaN,
"plan_length": 29,
"search_time": 2.64,
"total_time": 2.64
},
{
"num_node_expansions": NaN,
"plan_length": 23,
"search_time": 1.73,
"total_time": 1.73
},
{
"num_node_expansions": NaN,
"plan_length": 20,
"search_time": 0.97,
"total_time": 0.97
},
{
"num_node_expansions": NaN,
"plan_length": 34,
"search_time": 3.95,
"total_time": 3.95
}
]
num_timeouts = 12
num_timeouts = 25
num_problems = 55
| stats = [{'num_node_expansions': NaN, 'plan_length': 35, 'search_time': 7.93, 'total_time': 7.93}, {'num_node_expansions': NaN, 'plan_length': 34, 'search_time': 9.72, 'total_time': 9.72}, {'num_node_expansions': NaN, 'plan_length': 40, 'search_time': 15.54, 'total_time': 15.54}, {'num_node_expansions': NaN, 'plan_length': 23, 'search_time': 1.99, 'total_time': 1.99}, {'num_node_expansions': NaN, 'plan_length': 24, 'search_time': 1.22, 'total_time': 1.22}, {'num_node_expansions': NaN, 'plan_length': 23, 'search_time': 2.58, 'total_time': 2.58}, {'num_node_expansions': NaN, 'plan_length': 19, 'search_time': 1.62, 'total_time': 1.62}, {'num_node_expansions': NaN, 'plan_length': 23, 'search_time': 1.43, 'total_time': 1.43}, {'num_node_expansions': NaN, 'plan_length': 20, 'search_time': 0.72, 'total_time': 0.72}, {'num_node_expansions': NaN, 'plan_length': 29, 'search_time': 0.84, 'total_time': 0.84}, {'num_node_expansions': NaN, 'plan_length': 28, 'search_time': 1.08, 'total_time': 1.08}, {'num_node_expansions': NaN, 'plan_length': 21, 'search_time': 0.71, 'total_time': 0.71}, {'num_node_expansions': NaN, 'plan_length': 26, 'search_time': 1.97, 'total_time': 1.97}, {'num_node_expansions': NaN, 'plan_length': 29, 'search_time': 2.29, 'total_time': 2.29}, {'num_node_expansions': NaN, 'plan_length': 29, 'search_time': 2.64, 'total_time': 2.64}, {'num_node_expansions': NaN, 'plan_length': 23, 'search_time': 1.73, 'total_time': 1.73}, {'num_node_expansions': NaN, 'plan_length': 20, 'search_time': 0.97, 'total_time': 0.97}, {'num_node_expansions': NaN, 'plan_length': 34, 'search_time': 3.95, 'total_time': 3.95}]
num_timeouts = 12
num_timeouts = 25
num_problems = 55 |
"""
Build a Triangle
"""
# Use a while loop to print a 5-level triangle of stars that looks like this:
"""
*
**
***
****
*****
"""
| """
Build a Triangle
"""
'\n*\n**\n***\n****\n*****\n' |
def a():
pass
# This is commented
# out
| def a():
pass |
"""
Main entrypoint
---------------
Just-in-time injections awaitable from asyncio coroutines
Author: Chris Lee
Email: chrisklee93@gmail.com
"""
def main():
pass
if __name__ == "__main__":
main()
| """
Main entrypoint
---------------
Just-in-time injections awaitable from asyncio coroutines
Author: Chris Lee
Email: chrisklee93@gmail.com
"""
def main():
pass
if __name__ == '__main__':
main() |
def makeArrayConsecutive2(statues):
'''Ratiorg got statues of different sizes as a present from CodeMaster
for his birthday, each statue having an non-negative integer size.
Since he likes to make things perfect, he wants to arrange them from
smallest to largest so that each statue will be bigger than the previous
one exactly by 1. He may need some additional statues to be able to
accomplish that. Help him figure out the minimum number of additional
statues needed.
'''
minValue = min(statues)
maxvalue = max(statues)
return maxvalue - minValue - len(statues) + 1
print(makeArrayConsecutive2([6, 2, 3, 8])) | def make_array_consecutive2(statues):
"""Ratiorg got statues of different sizes as a present from CodeMaster
for his birthday, each statue having an non-negative integer size.
Since he likes to make things perfect, he wants to arrange them from
smallest to largest so that each statue will be bigger than the previous
one exactly by 1. He may need some additional statues to be able to
accomplish that. Help him figure out the minimum number of additional
statues needed.
"""
min_value = min(statues)
maxvalue = max(statues)
return maxvalue - minValue - len(statues) + 1
print(make_array_consecutive2([6, 2, 3, 8])) |
def is_list(v):
return isinstance(v, list)
def is_list_of_type(v, t):
return is_list(v) and all(isinstance(e, t) for e in v)
def flatten_indices(indices):
# indices could be nested nested list, we convert them to nested list
# if indices is not a list, then there is something wrong
if not is_list(indices): raise ValueError('indices is not a list')
# if indices is a list of integer, then we are done
if is_list_of_type(indices, int): return indices
# if indices is a list of list
flat_indices = []
for inds in indices:
if is_list_of_type(inds, int): flat_indices.append(inds)
else: flat_indices.extend(flatten_indices(inds))
return flat_indices
def flatten_scores(scores):
# scores could be nested list, we convert them to list of floats
if isinstance(scores, float): return scores
# instead of using deepflatten, i will write my own flatten function
# because i am not sure how deepflatten iterates (depth-first or breadth-first)
flat_scores = []
for score in scores:
if isinstance(score, float): flat_scores.append(score)
else: flat_scores.extend(flatten_scores(score))
return flat_scores
| def is_list(v):
return isinstance(v, list)
def is_list_of_type(v, t):
return is_list(v) and all((isinstance(e, t) for e in v))
def flatten_indices(indices):
if not is_list(indices):
raise value_error('indices is not a list')
if is_list_of_type(indices, int):
return indices
flat_indices = []
for inds in indices:
if is_list_of_type(inds, int):
flat_indices.append(inds)
else:
flat_indices.extend(flatten_indices(inds))
return flat_indices
def flatten_scores(scores):
if isinstance(scores, float):
return scores
flat_scores = []
for score in scores:
if isinstance(score, float):
flat_scores.append(score)
else:
flat_scores.extend(flatten_scores(score))
return flat_scores |
s1 = "HELLO BEGINNERS"
print(s1.casefold()) # -- CF1
s2 = "Hello Beginners"
print(s2.casefold()) # -- CF2
if s1.casefold() == s2.casefold(): # -- CF3
print("Both the strings are same after conversion")
else:
print("Both the strings are different after conversion ")
| s1 = 'HELLO BEGINNERS'
print(s1.casefold())
s2 = 'Hello Beginners'
print(s2.casefold())
if s1.casefold() == s2.casefold():
print('Both the strings are same after conversion')
else:
print('Both the strings are different after conversion ') |
n = list(map(int, input("[>] Enter numbers: ").split()))
n.sort()
for i in range(3):
for j in range(3):
print(f"{n[i]} + {n[j]} = {n[i] + n[j]}", end="\t")
print()
| n = list(map(int, input('[>] Enter numbers: ').split()))
n.sort()
for i in range(3):
for j in range(3):
print(f'{n[i]} + {n[j]} = {n[i] + n[j]}', end='\t')
print() |
class Solution:
def sortColors(self, nums: List[int]) -> None:
# If 2, put it at the tail
# if 0, put it at the head and move idx to next
# If 1, move idx to next
idx = 0
for _ in range(len(nums)):
if nums[idx] == 2:
nums.append(nums.pop(idx))
continue
elif nums[idx] == 0:
nums.insert(0, nums.pop(idx))
idx += 1 | class Solution:
def sort_colors(self, nums: List[int]) -> None:
idx = 0
for _ in range(len(nums)):
if nums[idx] == 2:
nums.append(nums.pop(idx))
continue
elif nums[idx] == 0:
nums.insert(0, nums.pop(idx))
idx += 1 |
{
'targets': [
{
'conditions': [
[ 'OS != "linux"', {
'target_name': 'procps_only_supported_on_linux',
} ],
[ 'OS == "linux"', {
'target_name': 'procps',
'sources': [
'src/procps.cc'
, 'src/proc.cc'
, 'src/diskstat.cc'
, 'src/partitionstat.cc'
, 'src/slabcache.cc'
, 'deps/procps/proc/alloc.c'
, 'deps/procps/proc/devname.c'
, 'deps/procps/proc/escape.c'
, 'deps/procps/proc/ksym.c'
, 'deps/procps/proc/pwcache.c'
, 'deps/procps/proc/readproc.c'
, 'deps/procps/proc/sig.c'
, 'deps/procps/proc/slab.c'
, 'deps/procps/proc/sysinfo.c'
, 'deps/procps/proc/version.c'
, 'deps/procps/proc/whattime.c'
],
'include_dirs': [
'./deps/procps/include/'
, './deps/procps/'
, '<!(node -e "require(\'nan\')")'
],
# VERSION numbers are picked up by procps (see procps/proc/version.c)
# TODO: Why does the C++ compiler pick up the C flags and complain about them ???
'cflags': [
'-DPACKAGE_NAME=\"procps\"'
, '-DPACKAGE_VERSION=\"3.3.9\"'
, '-DBUILD_WITH_WHINE=1'
],
'cflags!' : [ '-fno-exceptions', '-fno-tree-vrp', '-fno-tree-sink' ],
'cflags_c' : [ '--std=gnu99', '-Wno-string-plus-int', '-Wno-sign-compare' ],
'cflags_cc' : [ '-fexceptions', '-frtti' ],
} ],
]
}
]
}
| {'targets': [{'conditions': [['OS != "linux"', {'target_name': 'procps_only_supported_on_linux'}], ['OS == "linux"', {'target_name': 'procps', 'sources': ['src/procps.cc', 'src/proc.cc', 'src/diskstat.cc', 'src/partitionstat.cc', 'src/slabcache.cc', 'deps/procps/proc/alloc.c', 'deps/procps/proc/devname.c', 'deps/procps/proc/escape.c', 'deps/procps/proc/ksym.c', 'deps/procps/proc/pwcache.c', 'deps/procps/proc/readproc.c', 'deps/procps/proc/sig.c', 'deps/procps/proc/slab.c', 'deps/procps/proc/sysinfo.c', 'deps/procps/proc/version.c', 'deps/procps/proc/whattime.c'], 'include_dirs': ['./deps/procps/include/', './deps/procps/', '<!(node -e "require(\'nan\')")'], 'cflags': ['-DPACKAGE_NAME="procps"', '-DPACKAGE_VERSION="3.3.9"', '-DBUILD_WITH_WHINE=1'], 'cflags!': ['-fno-exceptions', '-fno-tree-vrp', '-fno-tree-sink'], 'cflags_c': ['--std=gnu99', '-Wno-string-plus-int', '-Wno-sign-compare'], 'cflags_cc': ['-fexceptions', '-frtti']}]]}]} |
#!/usr/bin/env python3
def read_value():
"""Reads a single line as an integer."""
return int(input())
def read_row(width):
"""Reads one row of integers interpreted as booleans."""
row = [int(field) != 0 for field in input().split()]
if len(row) != width:
raise ValueError('wrong row width')
return row
def read_grid():
"""Reads a grid of integers interpreted as booleans."""
height = read_value()
width = read_value()
return [read_row(width) for _ in range(height)]
def height(grid):
"""Gets the height of the grid (stored in row-major order)."""
return len(grid)
def width(grid):
"""Gets the width of the grid (stored in row-major order)."""
try:
return len(grid[0])
except IndexError:
return 0
def can_go(grid, i, j):
"""Checks if (i, j) is on the grid and accessible."""
return 0 <= i < height(grid) and 0 <= j < width(grid) and grid[i][j]
def fill(grid, i, j):
"""Fills the (i, j) region of nonzeros in grid and returns its area."""
if not can_go(grid, i, j):
return 0
grid[i][j] = False
return 1 + sum(fill(grid, h, k) for h in range(i - 1, i + 2)
for k in range(j - 1, j + 2))
def run():
"""Reports the biggest component in a grid read from standard input."""
grid = read_grid()
print(max(fill(grid, i, j) for i in range(height(grid))
for j in range(width(grid))))
if __name__ == '__main__':
run()
| def read_value():
"""Reads a single line as an integer."""
return int(input())
def read_row(width):
"""Reads one row of integers interpreted as booleans."""
row = [int(field) != 0 for field in input().split()]
if len(row) != width:
raise value_error('wrong row width')
return row
def read_grid():
"""Reads a grid of integers interpreted as booleans."""
height = read_value()
width = read_value()
return [read_row(width) for _ in range(height)]
def height(grid):
"""Gets the height of the grid (stored in row-major order)."""
return len(grid)
def width(grid):
"""Gets the width of the grid (stored in row-major order)."""
try:
return len(grid[0])
except IndexError:
return 0
def can_go(grid, i, j):
"""Checks if (i, j) is on the grid and accessible."""
return 0 <= i < height(grid) and 0 <= j < width(grid) and grid[i][j]
def fill(grid, i, j):
"""Fills the (i, j) region of nonzeros in grid and returns its area."""
if not can_go(grid, i, j):
return 0
grid[i][j] = False
return 1 + sum((fill(grid, h, k) for h in range(i - 1, i + 2) for k in range(j - 1, j + 2)))
def run():
"""Reports the biggest component in a grid read from standard input."""
grid = read_grid()
print(max((fill(grid, i, j) for i in range(height(grid)) for j in range(width(grid)))))
if __name__ == '__main__':
run() |
ROMAN = 'IVXLCDM'
def get_list_from_number(number):
return [int(num) for num in str(number)]
def get_roman_from_base(base_indexes, magnitude):
roman = ""
for i in base_indexes:
roman += ROMAN[i + magnitude*2]
return roman
def convert_number_to_base_indexes(number):
# Convert a number to a list of indexes, ie, 3 = [0, 0, 0] = [I, I, I]
# This handles 5-9 by adding 1 to the index
# and handles the different digits needed by 4 and 9
base_indexes = ["", "0", "00", "000", "01", "1", "10", "100", "1000", "02"]
return [int(x) for x in base_indexes[number]]
def roman_numeral(number):
roman = ''
number_list = get_list_from_number(number)
roman = rec_roman(number_list)
return roman
def rec_roman(list_of_numbers):
largest_factor = len(list_of_numbers) - 1
if largest_factor < 0:
return ''
largest_num = list_of_numbers[0]
base_indexes = convert_number_to_base_indexes(largest_num)
current_roman = get_roman_from_base(base_indexes, largest_factor)
roman = current_roman + rec_roman(list_of_numbers[1:])
return roman
if __name__ == '__main__':
print(roman_numeral(345))
| roman = 'IVXLCDM'
def get_list_from_number(number):
return [int(num) for num in str(number)]
def get_roman_from_base(base_indexes, magnitude):
roman = ''
for i in base_indexes:
roman += ROMAN[i + magnitude * 2]
return roman
def convert_number_to_base_indexes(number):
base_indexes = ['', '0', '00', '000', '01', '1', '10', '100', '1000', '02']
return [int(x) for x in base_indexes[number]]
def roman_numeral(number):
roman = ''
number_list = get_list_from_number(number)
roman = rec_roman(number_list)
return roman
def rec_roman(list_of_numbers):
largest_factor = len(list_of_numbers) - 1
if largest_factor < 0:
return ''
largest_num = list_of_numbers[0]
base_indexes = convert_number_to_base_indexes(largest_num)
current_roman = get_roman_from_base(base_indexes, largest_factor)
roman = current_roman + rec_roman(list_of_numbers[1:])
return roman
if __name__ == '__main__':
print(roman_numeral(345)) |
# SPDX-FileCopyrightText: 2020 - Sebastian Ritter <bastie@users.noreply.github.com>
# SPDX-License-Identifier: Apache-2.0
'''
## *J*ust *a* *v*ampire *A*PI ##
As same as bloodhound let us reimplement the Java API.
This is similar to long time ago
[JavAPI](https://github.com/RealBastie/JavApi) project.
### The Idea ###
Too many good programming languages are looking for developers hype.
Maybe You believe to coding in all important languages. I want to
take a good or the best language for my problem. But why the have
different API interfaces?
Why it isn't enough only learn the syntax and a little bit semantic?
### The Java way ###
It think it is a good way to take a look into a new programming language
to reimplement something. Java was great - perhaps Java is great, maybe
not longer more. I don't no, but I learned Java before the year 2000. So
I know the old API good enough to reimplement.
Just like a vampire take the good base of Java, the API declaration and
**do the hard work: implement the code behind.**
### The reason ###
I like many programming languages or parts of these - Java, C#, Rust, COBOL,
PHP, Swift,...
But I like to create a solution for a problem more than using one single
programming language. And I believe we do not need more programmer, we need
the right programmer this time. I think with natural language processing
and the power of computer we can develop with description of problems in
natural language.
Python is a programming language with many natural language processing API.
So I take Python and Java is the (or with COBOL one of) backend programming
languages.
### API description ###
If a class and method is defined, take a look to Java API documentation.
### see also ###
* [GitHub](https://github.com/bastie/PythonVampire)
* [PyPI](https://pypi.org/project/VampireAPI/)
'''
| """
## *J*ust *a* *v*ampire *A*PI ##
As same as bloodhound let us reimplement the Java API.
This is similar to long time ago
[JavAPI](https://github.com/RealBastie/JavApi) project.
### The Idea ###
Too many good programming languages are looking for developers hype.
Maybe You believe to coding in all important languages. I want to
take a good or the best language for my problem. But why the have
different API interfaces?
Why it isn't enough only learn the syntax and a little bit semantic?
### The Java way ###
It think it is a good way to take a look into a new programming language
to reimplement something. Java was great - perhaps Java is great, maybe
not longer more. I don't no, but I learned Java before the year 2000. So
I know the old API good enough to reimplement.
Just like a vampire take the good base of Java, the API declaration and
**do the hard work: implement the code behind.**
### The reason ###
I like many programming languages or parts of these - Java, C#, Rust, COBOL,
PHP, Swift,...
But I like to create a solution for a problem more than using one single
programming language. And I believe we do not need more programmer, we need
the right programmer this time. I think with natural language processing
and the power of computer we can develop with description of problems in
natural language.
Python is a programming language with many natural language processing API.
So I take Python and Java is the (or with COBOL one of) backend programming
languages.
### API description ###
If a class and method is defined, take a look to Java API documentation.
### see also ###
* [GitHub](https://github.com/bastie/PythonVampire)
* [PyPI](https://pypi.org/project/VampireAPI/)
""" |
class Meal:
def __init__(self,id,name,photo_url,details,price):
self.id = id
self.name = name
self.photo_url = photo_url
self.details = details
self.price = price
meal_list = []
orders_list = []
class Customer:
def get_all(self):
return meal_list
def get_meal_by_id(self, id):
result = None
for meal in meal_list:
if meal.id == id:
result = meal
break
return result
def add_meal(self,id):
meal = self.get_meal_by_id(id)
orders_list.append(meal)
class Admin:
def add_new_meal(self,meal):
meal_list.append(meal)
return meal_list
def get_orders(self):
return orders_list
def get_by_id(self,id):
result = None
for meal in orders_list:
if meal.id == id:
result = meal
break
return result
def update(self,id,fields):
meal = self.get_by_id(id)
meal.name = fields['name']
meal.photo_url = fields['photo_url']
meal.details = fields['details']
meal.price = fields['price']
return meal
def delete(self,id):
meal = self.get_by_id(id)
meal_list.remove(meal)
return orders_list
meal1 = Meal(id=1,
name='Lasagna Roll',
photo_url='https://thestayathomechef.com/wp-content/uploads/2017/08/Most-Amazing-Lasagna-4-e1503516670834.jpg',
details='Homemade Lasagna',
price='$40')
meal2 = Meal(id=2,
name='pasta',
photo_url='https://food.fnr.sndimg.com/content/dam/images/food/fullset/2019/1/07/0/JE401_Giadas-Pasta-with-Creamy-White-Beans_s4x3.jpg.rend.hgtvcom.826.620.suffix/1546886427856.jpeg',
details='Pasta with Creamy White Beans Recipe',
price='$30')
A = Admin()
A.add_new_meal(meal1)
A.add_new_meal(meal2)
C = Customer()
print(C.get_all())
C.add_meal(1)
print(A.get_orders())
A.delete(1)
print(C.get_all())
fields = {
'name':'Lasagna Roll',
'photo_url':'https://thestayathomechef.com/wp-content/uploads/2017/08/Most-Amazing-Lasagna-4-e1503516670834.jpg',
'details':'Homemade Lasagna',
'price':'$40'
}
A.update(1,fields)
print(C.get_meal_by_id(1))
| class Meal:
def __init__(self, id, name, photo_url, details, price):
self.id = id
self.name = name
self.photo_url = photo_url
self.details = details
self.price = price
meal_list = []
orders_list = []
class Customer:
def get_all(self):
return meal_list
def get_meal_by_id(self, id):
result = None
for meal in meal_list:
if meal.id == id:
result = meal
break
return result
def add_meal(self, id):
meal = self.get_meal_by_id(id)
orders_list.append(meal)
class Admin:
def add_new_meal(self, meal):
meal_list.append(meal)
return meal_list
def get_orders(self):
return orders_list
def get_by_id(self, id):
result = None
for meal in orders_list:
if meal.id == id:
result = meal
break
return result
def update(self, id, fields):
meal = self.get_by_id(id)
meal.name = fields['name']
meal.photo_url = fields['photo_url']
meal.details = fields['details']
meal.price = fields['price']
return meal
def delete(self, id):
meal = self.get_by_id(id)
meal_list.remove(meal)
return orders_list
meal1 = meal(id=1, name='Lasagna Roll', photo_url='https://thestayathomechef.com/wp-content/uploads/2017/08/Most-Amazing-Lasagna-4-e1503516670834.jpg', details='Homemade Lasagna', price='$40')
meal2 = meal(id=2, name='pasta', photo_url='https://food.fnr.sndimg.com/content/dam/images/food/fullset/2019/1/07/0/JE401_Giadas-Pasta-with-Creamy-White-Beans_s4x3.jpg.rend.hgtvcom.826.620.suffix/1546886427856.jpeg', details='Pasta with Creamy White Beans Recipe', price='$30')
a = admin()
A.add_new_meal(meal1)
A.add_new_meal(meal2)
c = customer()
print(C.get_all())
C.add_meal(1)
print(A.get_orders())
A.delete(1)
print(C.get_all())
fields = {'name': 'Lasagna Roll', 'photo_url': 'https://thestayathomechef.com/wp-content/uploads/2017/08/Most-Amazing-Lasagna-4-e1503516670834.jpg', 'details': 'Homemade Lasagna', 'price': '$40'}
A.update(1, fields)
print(C.get_meal_by_id(1)) |
self.description = "Sysupgrade with a sync package having higher epoch"
sp = pmpkg("dummy", "1:1.0-1")
self.addpkg2db("sync", sp)
lp = pmpkg("dummy", "1.1-1")
self.addpkg2db("local", lp)
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=dummy|1:1.0-1")
| self.description = 'Sysupgrade with a sync package having higher epoch'
sp = pmpkg('dummy', '1:1.0-1')
self.addpkg2db('sync', sp)
lp = pmpkg('dummy', '1.1-1')
self.addpkg2db('local', lp)
self.args = '-Su'
self.addrule('PACMAN_RETCODE=0')
self.addrule('PKG_VERSION=dummy|1:1.0-1') |
attacks_listing = {}
listing_by_name = {}
def register(attack_type):
if attack_type.base_attack:
if attack_type.base_attack in attacks_listing:
raise Exception("Attack already registered for this base_object_type.")
elif attack_type.name in listing_by_name:
raise Exception("Attack already registered for this name.")
attacks_listing[attack_type.base_attack] = attack_type
listing_by_name[attack_type.name] = attack_type
return attack_type
def get_attack(base_attack):
attack = attacks_listing.get(base_attack, None)
if attack is None:
attack_type = type(base_attack)
if attack_type is type:
try:
return get_attack(base_attack.__bases__[0])
except IndexError:
return None
else:
return get_attack(attack_type)
return attack
def get_attack_by_name(name):
return listing_by_name.get(name)
| attacks_listing = {}
listing_by_name = {}
def register(attack_type):
if attack_type.base_attack:
if attack_type.base_attack in attacks_listing:
raise exception('Attack already registered for this base_object_type.')
elif attack_type.name in listing_by_name:
raise exception('Attack already registered for this name.')
attacks_listing[attack_type.base_attack] = attack_type
listing_by_name[attack_type.name] = attack_type
return attack_type
def get_attack(base_attack):
attack = attacks_listing.get(base_attack, None)
if attack is None:
attack_type = type(base_attack)
if attack_type is type:
try:
return get_attack(base_attack.__bases__[0])
except IndexError:
return None
else:
return get_attack(attack_type)
return attack
def get_attack_by_name(name):
return listing_by_name.get(name) |
# MIT License
#
# Copyright (c) 2019 Eduardo E. Betanzos Morales
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
class Module:
def __init__(self, name: str, exportsPackages=None, requiresModules=None):
self.__name = name
self.__exports_packages = exportsPackages
self.__requires_modules = requiresModules
@classmethod
def from_json(cls, data):
return cls(**data)
def get_name(self):
return self.__name
def get_exports_packages(self):
return self.__exports_packages
def get_requires_modules(self):
return self.__requires_modules
class Artifact:
def __init__(self, name=None, module=None):
self.__name = name
if isinstance(module, dict):
self.__module = Module.from_json(module)
else:
self.__module = module
@classmethod
def from_json(cls, data):
return cls(**data)
def get_name(self):
return self.__name
def get_module(self):
return self.__module
def __hash__(self):
return hash(self.__name)
def __eq__(self, other):
if not isinstance(other, type(self)):
return NotImplemented
return self.__name == other.__name | class Module:
def __init__(self, name: str, exportsPackages=None, requiresModules=None):
self.__name = name
self.__exports_packages = exportsPackages
self.__requires_modules = requiresModules
@classmethod
def from_json(cls, data):
return cls(**data)
def get_name(self):
return self.__name
def get_exports_packages(self):
return self.__exports_packages
def get_requires_modules(self):
return self.__requires_modules
class Artifact:
def __init__(self, name=None, module=None):
self.__name = name
if isinstance(module, dict):
self.__module = Module.from_json(module)
else:
self.__module = module
@classmethod
def from_json(cls, data):
return cls(**data)
def get_name(self):
return self.__name
def get_module(self):
return self.__module
def __hash__(self):
return hash(self.__name)
def __eq__(self, other):
if not isinstance(other, type(self)):
return NotImplemented
return self.__name == other.__name |
# Copyright 2014 PDFium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'bigint',
'type': 'static_library',
'sources': [
'bigint/BigInteger.hh',
'bigint/BigIntegerLibrary.hh',
'bigint/BigIntegerUtils.hh',
'bigint/BigUnsigned.hh',
'bigint/NumberlikeArray.hh',
'bigint/BigUnsignedInABase.hh',
'bigint/BigInteger.cc',
'bigint/BigIntegerUtils.cc',
'bigint/BigUnsigned.cc',
'bigint/BigUnsignedInABase.cc',
],
},
{
'target_name': 'freetype',
'type': 'static_library',
'defines': [
'FT2_BUILD_LIBRARY',
],
'include_dirs': [
'freetype/include',
],
'sources': [
'freetype/include/freetype.h',
'freetype/include/ft2build.h',
'freetype/include/ftmm.h',
'freetype/include/ftotval.h',
'freetype/include/ftoutln.h',
'freetype/include/tttables.h',
'freetype/include/internal/ftobjs.h',
'freetype/include/internal/ftstream.h',
'freetype/include/internal/tttypes.h',
'freetype/src/cff/cffobjs.h',
'freetype/src/cff/cfftypes.h',
'freetype/src/cff/cff.c',
'freetype/src/base/ftbase.c',
'freetype/src/base/ftbitmap.c',
'freetype/src/base/ftglyph.c',
'freetype/src/base/ftinit.c',
'freetype/src/base/ftlcdfil.c',
'freetype/src/base/ftmm.c',
'freetype/src/base/ftsystem.c',
'freetype/src/psaux/psaux.c',
'freetype/src/pshinter/pshinter.c',
'freetype/src/psnames/psmodule.c',
'freetype/src/raster/raster.c',
'freetype/src/sfnt/sfnt.c',
'freetype/src/smooth/smooth.c',
'freetype/src/truetype/truetype.c',
'freetype/src/type1/type1.c',
'freetype/src/cid/type1cid.c',
],
},
{
'target_name': 'safemath',
'type': 'none',
'sources': [
'logging.h',
'macros.h',
'template_util.h',
'numerics/safe_conversions.h',
'numerics/safe_conversions_impl.h',
'numerics/safe_math.h',
'numerics/safe_math_impl.h',
],
},
],
}
| {'targets': [{'target_name': 'bigint', 'type': 'static_library', 'sources': ['bigint/BigInteger.hh', 'bigint/BigIntegerLibrary.hh', 'bigint/BigIntegerUtils.hh', 'bigint/BigUnsigned.hh', 'bigint/NumberlikeArray.hh', 'bigint/BigUnsignedInABase.hh', 'bigint/BigInteger.cc', 'bigint/BigIntegerUtils.cc', 'bigint/BigUnsigned.cc', 'bigint/BigUnsignedInABase.cc']}, {'target_name': 'freetype', 'type': 'static_library', 'defines': ['FT2_BUILD_LIBRARY'], 'include_dirs': ['freetype/include'], 'sources': ['freetype/include/freetype.h', 'freetype/include/ft2build.h', 'freetype/include/ftmm.h', 'freetype/include/ftotval.h', 'freetype/include/ftoutln.h', 'freetype/include/tttables.h', 'freetype/include/internal/ftobjs.h', 'freetype/include/internal/ftstream.h', 'freetype/include/internal/tttypes.h', 'freetype/src/cff/cffobjs.h', 'freetype/src/cff/cfftypes.h', 'freetype/src/cff/cff.c', 'freetype/src/base/ftbase.c', 'freetype/src/base/ftbitmap.c', 'freetype/src/base/ftglyph.c', 'freetype/src/base/ftinit.c', 'freetype/src/base/ftlcdfil.c', 'freetype/src/base/ftmm.c', 'freetype/src/base/ftsystem.c', 'freetype/src/psaux/psaux.c', 'freetype/src/pshinter/pshinter.c', 'freetype/src/psnames/psmodule.c', 'freetype/src/raster/raster.c', 'freetype/src/sfnt/sfnt.c', 'freetype/src/smooth/smooth.c', 'freetype/src/truetype/truetype.c', 'freetype/src/type1/type1.c', 'freetype/src/cid/type1cid.c']}, {'target_name': 'safemath', 'type': 'none', 'sources': ['logging.h', 'macros.h', 'template_util.h', 'numerics/safe_conversions.h', 'numerics/safe_conversions_impl.h', 'numerics/safe_math.h', 'numerics/safe_math_impl.h']}]} |
CERTIFICATION_SERVICES_TABLE_ID = 'cas'
INTERMEDIATE_CA_TAB_XPATH = '//a[@href="#intermediate_cas_tab"]'
INTERMEDIATE_CA_ADD_BTN_ID = 'intermediate_ca_add'
INTERMEDIATE_CA_CERT_UPLOAD_INPUT_ID = 'ca_cert_file'
INTERMEDIATE_CA_OCSP_TAB_XPATH = '//a[@href="#intermediate_ca_ocsp_responders_tab"]'
INTERMEDIATE_CA_OCSP_ADD_BTN_ID = 'intermediate_ca_ocsp_responder_add'
INTERMEDIATE_CA_BY_NAME_XPATH = '//table[@id="intermediate_cas"]//td[text()="{}"]'
INTERMEDIATE_CA_TR_BY_NAME_XPATH = '//table[@id="intermediate_cas"]//td[text()="{}"]/..'
INTERMEDIATE_CA_DELETE_BTN_ID = 'intermediate_ca_delete'
INTERMEDIATE_CA_TRS_CSS = '#intermediate_cas tbody tr'
INTERMEDIATE_CA_EDIT_BTN_ID = 'intermediate_ca_edit'
INTERMEDIATE_CA_SUBJECT_DN_ID = 'intermediate_ca_cert_subject_dn'
INTERMEDIATE_CA_ISSUER_DN_ID = 'intermediate_ca_cert_issuer_dn'
INTERMEDIATE_CA_VALID_FROM_ID = 'intermediate_ca_cert_valid_from'
INTERMEDIATE_CA_VALID_TO_ID = 'intermediate_ca_cert_valid_to'
DELETE_BTN_ID = 'ca_delete'
ADD_BTN_ID = 'ca_add'
DETAILS_BTN_ID = 'ca_details'
DATE_REGEX = '(\d{4}[-]?\d{1,2}[-]?\d{1,2})'
DATE_TIME_REGEX = '\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}'
CA_DETAILS_SUBJECT_DISTINGUISHED = 'top_ca_cert_subject_dn'
CA_DETAILS_ISSUER_DISTINGUISHED = 'top_ca_cert_issuer_dn'
CA_DETAILS_VALID_FROM = 'top_ca_cert_valid_from'
CA_DETAILS_VALID_TO = 'top_ca_cert_valid_to'
CA_DETAILS_VIEW_CERT = 'top_ca_cert_view'
CA_DETAILS_VIEW_CERT_SHA1 = 'cert_details_hash'
CA_DETAILS_VIEW_CERT_DUMP = 'cert_details_dump'
# Timestamp buttons
TSDELETE_BTN_ID = 'tsp_delete'
TSADD_BTN_ID = 'tsp_add'
TSEDIT_BTN_ID = 'tsp_details'
TS_SETTINGS_POPUP = '//div[@aria-describedby="tsp_url_and_cert_dialog"]'
TS_SETTINGS_POPUP_CANCEL_BTN_XPATH = TS_SETTINGS_POPUP + '//div[@class="ui-dialog-buttonset"]//button[span="Cancel"]'
IMPORT_TS_CERT_BTN_ID = 'tsp_cert_button'
SUBMIT_TS_CERT_BTN_ID = 'tsp_url_and_cert_submit'
TIMESTAMP_SERVICES_URL_ID = 'tsp_url'
IMPORT_CA_CERT_BTN_ID = 'ca_cert_button'
ADD_CA_AUTH_ONLY_CHECKBOX_XPATH = '//div[@id="ca_settings_dialog"]//input[@name="authentication_only"]'
EDIT_CA_AUTH_ONLY_CHECKBOX_XPATH = '//div[@id="ca_settings_tab"]//input[@name="authentication_only"]'
CA_SETTINGS_TAB_XPATH = '//li[@aria-controls="ca_settings_tab"]'
SUBMIT_CA_CERT_BTN_ID = 'ca_cert_submit'
# Timestamp view certificate
VIEW_CERTIFICATE = 'tsp_cert_view'
CERTIFICATE_PROFILE_INFO_AREA_CSS = '.cert_profile_info'
ADD_CERTIFICATE_PROFILE_INFO_AREA_XPATH = '//div[@id="ca_settings_dialog"]//input[@name="cert_profile_info"]'
EDIT_CERTIFICATE_PROFILE_INFO_AREA_XPATH = '//div[@id="ca_settings_tab"]//input[@name="cert_profile_info"]'
SUBMIT_CA_SETTINGS_BTN_ID = 'ca_settings_submit'
SAVE_CA_SETTINGS_BTN_ID = 'ca_settings_save'
OCSP_RESPONSE_TAB = '//li[@aria-controls="ocsp_responders_tab"]'
OCSP_RESPONDER_ADD_BTN_ID = 'ocsp_responder_add'
OCSP_RESPONDER_EDIT_BTN_ID = 'ocsp_responder_edit'
OCSP_RESPONDER_DELETE_BTN_ID = 'ocsp_responder_delete'
INTERMEDIATE_CA_TAB = '//li[@aria-controls="intermediate_cas_tab"]'
IMPORT_OCSP_CERT_BTN_ID = 'ocsp_responder_cert_button'
OCSP_RESPONDER_URL_AREA_ID = 'ocsp_responder_url'
SUBMIT_OCSP_CERT_AND_URL_BTN_ID = 'ocsp_responder_url_and_cert_submit'
OCSP_SETTINGS_POPUP = '//div[@aria-describedby="ocsp_responder_url_and_cert_dialog"]'
OCSP_SETTINGS_POPUP_OK_BTN_XPATH = OCSP_SETTINGS_POPUP + '//div[@class="ui-dialog-buttonset"]//button[span="OK"]'
OCSP_SETTINGS_POPUP_CANCEL_BTN_XPATH = OCSP_SETTINGS_POPUP + '//div[@class="ui-dialog-buttonset"]//button[span="Cancel"]'
LAST_ADDED_CERT_XPATH = '//table[@id="cas"]//tbody//tr[last()]'
def get_ca_by_td_text(text):
return '//table[contains(@id, "cas")]//tr//td[contains(text(), \"' + text + '\")]'
# timestamp id
def ts_get_ca_by_td_text(text):
return '//table[contains(@id, "tsps")]//tr//td[contains(text(), \"' + text + '\")]'
def get_ocsp_by_td_text(text):
return '//table[contains(@id, "ocsp_responders")]//tr//td[contains(text(), \"' + text + '\")]'
def get_ocsp_responders(self):
responders = self.by_xpath(
'(//table[contains(@id, "ocsp_responders")]//tr//td[1])[not(contains(@class,"dataTables_empty"))]',
multiple=True)
result = []
for responder in responders:
result.append(responder.text)
return result
| certification_services_table_id = 'cas'
intermediate_ca_tab_xpath = '//a[@href="#intermediate_cas_tab"]'
intermediate_ca_add_btn_id = 'intermediate_ca_add'
intermediate_ca_cert_upload_input_id = 'ca_cert_file'
intermediate_ca_ocsp_tab_xpath = '//a[@href="#intermediate_ca_ocsp_responders_tab"]'
intermediate_ca_ocsp_add_btn_id = 'intermediate_ca_ocsp_responder_add'
intermediate_ca_by_name_xpath = '//table[@id="intermediate_cas"]//td[text()="{}"]'
intermediate_ca_tr_by_name_xpath = '//table[@id="intermediate_cas"]//td[text()="{}"]/..'
intermediate_ca_delete_btn_id = 'intermediate_ca_delete'
intermediate_ca_trs_css = '#intermediate_cas tbody tr'
intermediate_ca_edit_btn_id = 'intermediate_ca_edit'
intermediate_ca_subject_dn_id = 'intermediate_ca_cert_subject_dn'
intermediate_ca_issuer_dn_id = 'intermediate_ca_cert_issuer_dn'
intermediate_ca_valid_from_id = 'intermediate_ca_cert_valid_from'
intermediate_ca_valid_to_id = 'intermediate_ca_cert_valid_to'
delete_btn_id = 'ca_delete'
add_btn_id = 'ca_add'
details_btn_id = 'ca_details'
date_regex = '(\\d{4}[-]?\\d{1,2}[-]?\\d{1,2})'
date_time_regex = '\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}'
ca_details_subject_distinguished = 'top_ca_cert_subject_dn'
ca_details_issuer_distinguished = 'top_ca_cert_issuer_dn'
ca_details_valid_from = 'top_ca_cert_valid_from'
ca_details_valid_to = 'top_ca_cert_valid_to'
ca_details_view_cert = 'top_ca_cert_view'
ca_details_view_cert_sha1 = 'cert_details_hash'
ca_details_view_cert_dump = 'cert_details_dump'
tsdelete_btn_id = 'tsp_delete'
tsadd_btn_id = 'tsp_add'
tsedit_btn_id = 'tsp_details'
ts_settings_popup = '//div[@aria-describedby="tsp_url_and_cert_dialog"]'
ts_settings_popup_cancel_btn_xpath = TS_SETTINGS_POPUP + '//div[@class="ui-dialog-buttonset"]//button[span="Cancel"]'
import_ts_cert_btn_id = 'tsp_cert_button'
submit_ts_cert_btn_id = 'tsp_url_and_cert_submit'
timestamp_services_url_id = 'tsp_url'
import_ca_cert_btn_id = 'ca_cert_button'
add_ca_auth_only_checkbox_xpath = '//div[@id="ca_settings_dialog"]//input[@name="authentication_only"]'
edit_ca_auth_only_checkbox_xpath = '//div[@id="ca_settings_tab"]//input[@name="authentication_only"]'
ca_settings_tab_xpath = '//li[@aria-controls="ca_settings_tab"]'
submit_ca_cert_btn_id = 'ca_cert_submit'
view_certificate = 'tsp_cert_view'
certificate_profile_info_area_css = '.cert_profile_info'
add_certificate_profile_info_area_xpath = '//div[@id="ca_settings_dialog"]//input[@name="cert_profile_info"]'
edit_certificate_profile_info_area_xpath = '//div[@id="ca_settings_tab"]//input[@name="cert_profile_info"]'
submit_ca_settings_btn_id = 'ca_settings_submit'
save_ca_settings_btn_id = 'ca_settings_save'
ocsp_response_tab = '//li[@aria-controls="ocsp_responders_tab"]'
ocsp_responder_add_btn_id = 'ocsp_responder_add'
ocsp_responder_edit_btn_id = 'ocsp_responder_edit'
ocsp_responder_delete_btn_id = 'ocsp_responder_delete'
intermediate_ca_tab = '//li[@aria-controls="intermediate_cas_tab"]'
import_ocsp_cert_btn_id = 'ocsp_responder_cert_button'
ocsp_responder_url_area_id = 'ocsp_responder_url'
submit_ocsp_cert_and_url_btn_id = 'ocsp_responder_url_and_cert_submit'
ocsp_settings_popup = '//div[@aria-describedby="ocsp_responder_url_and_cert_dialog"]'
ocsp_settings_popup_ok_btn_xpath = OCSP_SETTINGS_POPUP + '//div[@class="ui-dialog-buttonset"]//button[span="OK"]'
ocsp_settings_popup_cancel_btn_xpath = OCSP_SETTINGS_POPUP + '//div[@class="ui-dialog-buttonset"]//button[span="Cancel"]'
last_added_cert_xpath = '//table[@id="cas"]//tbody//tr[last()]'
def get_ca_by_td_text(text):
return '//table[contains(@id, "cas")]//tr//td[contains(text(), "' + text + '")]'
def ts_get_ca_by_td_text(text):
return '//table[contains(@id, "tsps")]//tr//td[contains(text(), "' + text + '")]'
def get_ocsp_by_td_text(text):
return '//table[contains(@id, "ocsp_responders")]//tr//td[contains(text(), "' + text + '")]'
def get_ocsp_responders(self):
responders = self.by_xpath('(//table[contains(@id, "ocsp_responders")]//tr//td[1])[not(contains(@class,"dataTables_empty"))]', multiple=True)
result = []
for responder in responders:
result.append(responder.text)
return result |
# coding=utf-8
"""
This package provides a custom session for TheTVDB.
"""
| """
This package provides a custom session for TheTVDB.
""" |
#!/usr/bin/env python3
def max_profit_with_k_transactions(prices, k):
pass
print(max_profit_with_k_transactions([5, 11, 3, 50, 60, 90], 2))
| def max_profit_with_k_transactions(prices, k):
pass
print(max_profit_with_k_transactions([5, 11, 3, 50, 60, 90], 2)) |
class Solution:
def findLUSlength(self, words):
def isSubsequence(s, t):
t = iter(t)
return all(c in t for c in s)
words.sort(key = lambda x:-len(x))
for i, word in enumerate(words):
if all(not isSubsequence(word, words[j]) for j in range(len(words)) if j != i):
return len(word)
return -1
| class Solution:
def find_lu_slength(self, words):
def is_subsequence(s, t):
t = iter(t)
return all((c in t for c in s))
words.sort(key=lambda x: -len(x))
for (i, word) in enumerate(words):
if all((not is_subsequence(word, words[j]) for j in range(len(words)) if j != i)):
return len(word)
return -1 |
class Query:
def __init__(self, the_query, filename=None):
self.data = None
self.the_query = the_query
def set_data(self, data):
self.data = data
def __repr__(self):
return self.the_query
class LocalMP3Query(Query):
def __init__(self, filename, url, author_name):
self.title = f"{filename} by {author_name}"
super().__init__(url)
def __repr__(self):
return self.title
class YoutubeQuery(Query):
def __init__(self, the_query):
super().__init__(the_query)
def __repr__(self):
return " ".join(self.the_query) if isinstance(self.the_query, tuple) or isinstance(self.the_query, list) else self.the_query
class SpotifyQuery(Query):
def __init__(self, the_query):
super().__init__(the_query)
class SoundcloudQuery(Query):
def __init__(self, the_query):
super().__init__(the_query) | class Query:
def __init__(self, the_query, filename=None):
self.data = None
self.the_query = the_query
def set_data(self, data):
self.data = data
def __repr__(self):
return self.the_query
class Localmp3Query(Query):
def __init__(self, filename, url, author_name):
self.title = f'{filename} by {author_name}'
super().__init__(url)
def __repr__(self):
return self.title
class Youtubequery(Query):
def __init__(self, the_query):
super().__init__(the_query)
def __repr__(self):
return ' '.join(self.the_query) if isinstance(self.the_query, tuple) or isinstance(self.the_query, list) else self.the_query
class Spotifyquery(Query):
def __init__(self, the_query):
super().__init__(the_query)
class Soundcloudquery(Query):
def __init__(self, the_query):
super().__init__(the_query) |
class Rect:
def __init__(self, id: int, x: int, y: int, w: int, h: int):
self.id = id
self.pos = (x,y)
self.size = (w,h)
def getX(self):
return self.pos[0]
def getY(self):
return self.pos[1]
def getEndX(self):
return self.getX() + self.getW()
def getEndY(self):
return self.getY() + self.getH()
def getW(self):
return self.size[0]
def getH(self):
return self.size[1]
def __repr__(self):
return "{}: {},{} | {},{}".format(self.id, self.getX(), self.getY(), self.getW(), self.getH())
def parse(line: str) -> Rect:
id = line[1:line.find('@') - 1]
x = line[line.find('@') + 2:line.find(',')]
y = line[line.find(',') + 1:line.find(':')]
w = line[line.find(':') + 2:line.find('x')]
h = line[line.find('x') + 1:len(line) - 1]
#print("{},{} | {},{}".format(x, y, w, h))
return Rect(id, int(x), int(y), int(w), int(h))
dict = {}
with open('input.txt', 'r') as f:
lines = f.readlines()
rects = list(map(parse, lines))
for r in rects:
for y in range (r.getX(), r.getEndX()):
for x in range (r.getY(), r.getEndY()):
k = (x, y)
if k in dict:
dict[k] = 2
else:
dict[k] = 1
sum = 0
for x in dict.values():
if x > 1:
sum += 1
print(sum) | class Rect:
def __init__(self, id: int, x: int, y: int, w: int, h: int):
self.id = id
self.pos = (x, y)
self.size = (w, h)
def get_x(self):
return self.pos[0]
def get_y(self):
return self.pos[1]
def get_end_x(self):
return self.getX() + self.getW()
def get_end_y(self):
return self.getY() + self.getH()
def get_w(self):
return self.size[0]
def get_h(self):
return self.size[1]
def __repr__(self):
return '{}: {},{} | {},{}'.format(self.id, self.getX(), self.getY(), self.getW(), self.getH())
def parse(line: str) -> Rect:
id = line[1:line.find('@') - 1]
x = line[line.find('@') + 2:line.find(',')]
y = line[line.find(',') + 1:line.find(':')]
w = line[line.find(':') + 2:line.find('x')]
h = line[line.find('x') + 1:len(line) - 1]
return rect(id, int(x), int(y), int(w), int(h))
dict = {}
with open('input.txt', 'r') as f:
lines = f.readlines()
rects = list(map(parse, lines))
for r in rects:
for y in range(r.getX(), r.getEndX()):
for x in range(r.getY(), r.getEndY()):
k = (x, y)
if k in dict:
dict[k] = 2
else:
dict[k] = 1
sum = 0
for x in dict.values():
if x > 1:
sum += 1
print(sum) |
# Databricks notebook source
# MAGIC %run /Shared/churn-model/utils
# COMMAND ----------
seed = 2022
target = 'Churn'
drop_columns = [target, 'CodigoCliente']
# Get the Train Dataset
dataset = get_dataset('/dbfs/Dataset/Customer')
# Preprocessing Features
dataset, numeric_columns = preprocessing(dataset)
# Split train and test
train_dataset, test_dataset = split_dataset(dataset, seed)
# Parameters we got from the best interaction
params = {'early_stopping_rounds': 50,
'learning_rate': 0.2260,
'max_depth': 64,
'maximize': False,
'min_child_weight': 19.22,
'num_boost_round': 1000,
'reg_alpha': 0.01,
'reg_lambda': 0.348,
'verbose_eval': False,
'seed': seed}
# Get X, y
X_train, X_test, y_train, y_test = get_X_y(train_dataset, test_dataset, target, numeric_columns, drop_columns)
# Train model and Load
model_uri = train_model(X_train, y_train, X_test, y_test)
model = load_model(model_uri)
# Persist in the DBFS
persist_model(model, '/dbfs/models/churn-prediction')
print('Model trained - TEST') | seed = 2022
target = 'Churn'
drop_columns = [target, 'CodigoCliente']
dataset = get_dataset('/dbfs/Dataset/Customer')
(dataset, numeric_columns) = preprocessing(dataset)
(train_dataset, test_dataset) = split_dataset(dataset, seed)
params = {'early_stopping_rounds': 50, 'learning_rate': 0.226, 'max_depth': 64, 'maximize': False, 'min_child_weight': 19.22, 'num_boost_round': 1000, 'reg_alpha': 0.01, 'reg_lambda': 0.348, 'verbose_eval': False, 'seed': seed}
(x_train, x_test, y_train, y_test) = get_x_y(train_dataset, test_dataset, target, numeric_columns, drop_columns)
model_uri = train_model(X_train, y_train, X_test, y_test)
model = load_model(model_uri)
persist_model(model, '/dbfs/models/churn-prediction')
print('Model trained - TEST') |
#
# @lc app=leetcode.cn id=747 lang=python3
#
# [747] min-cost-climbing-stairs
#
None
# @lc code=end | None |
"""
The difference between: "==" and "is" operators
This can be a bit confusing!!
Note that "==" operator distinguishes whether
two operands have the same value and that
"is" operator distinguishes whether two operands
refer to the same object!
"""
a = [1, 2, 3]
b = [1, 2, 3]
# we have two lists that have the same value!!
print(f'"a is b" is {a is b}')
print(f'"a == b" is {a == b}')
# seems like the same, but are different!
print(f'id of a is {id(a)}')
print(f'id of elements in list a: \n\
a[0] is {id(a[0])} \n\
a[1] is {id(a[1])} \n\
a[2] is {id(a[2])} ')
print(f'id of b is {id(b)}')
print(f'id of elements in list b: \n\
b[0] is {id(a[0])} \n\
b[1] is {id(a[1])} \n\
b[2] is {id(a[2])} ')
"""
The id(memory location) of the list are different while
the elements of the list are the same
"""
a = b
print('now a = b')
print(f'"a is b" is {a is b}')
print(f'"a == b" is {a == b}')
print(f'id of a is {id(a)}')
print(f'id of b is {id(b)}')
# b referes to a variable then everything becomes the same
a = 1
b = 1
print('now a = 1, b = 1')
print(f'"a is b" is {a is b}')
print(f'"a == b" is {a == b}')
# reminder for last class!
| """
The difference between: "==" and "is" operators
This can be a bit confusing!!
Note that "==" operator distinguishes whether
two operands have the same value and that
"is" operator distinguishes whether two operands
refer to the same object!
"""
a = [1, 2, 3]
b = [1, 2, 3]
print(f'"a is b" is {a is b}')
print(f'"a == b" is {a == b}')
print(f'id of a is {id(a)}')
print(f'id of elements in list a: \n\ta[0] is {id(a[0])} \n\ta[1] is {id(a[1])} \n\ta[2] is {id(a[2])} ')
print(f'id of b is {id(b)}')
print(f'id of elements in list b: \n\tb[0] is {id(a[0])} \n\tb[1] is {id(a[1])} \n\tb[2] is {id(a[2])} ')
'\nThe id(memory location) of the list are different while\nthe elements of the list are the same\n'
a = b
print('now a = b')
print(f'"a is b" is {a is b}')
print(f'"a == b" is {a == b}')
print(f'id of a is {id(a)}')
print(f'id of b is {id(b)}')
a = 1
b = 1
print('now a = 1, b = 1')
print(f'"a is b" is {a is b}')
print(f'"a == b" is {a == b}') |
"""Perform DOI activation task."""
class HSTaskRouter(object):
"""Perform DOI activation task."""
def route_for_task(self, task, args=None, kwargs=None):
"""Return exchange, exchange_type, and routing_key."""
if task == 'hs_core.tasks.check_doi_activation':
return {
'exchange': 'default',
'exchange_type': 'topic',
'routing_key': 'task.default',
}
return None
| """Perform DOI activation task."""
class Hstaskrouter(object):
"""Perform DOI activation task."""
def route_for_task(self, task, args=None, kwargs=None):
"""Return exchange, exchange_type, and routing_key."""
if task == 'hs_core.tasks.check_doi_activation':
return {'exchange': 'default', 'exchange_type': 'topic', 'routing_key': 'task.default'}
return None |
class Note:
def __init__(self, number=0, name='', alt_name='', frequency=0, velocity=1):
self.number = number
self.name = name
self.alt_name = alt_name
self.frequency = frequency
self.velocity = velocity
| class Note:
def __init__(self, number=0, name='', alt_name='', frequency=0, velocity=1):
self.number = number
self.name = name
self.alt_name = alt_name
self.frequency = frequency
self.velocity = velocity |
#!/usr/bin/env python
# Copyright (c) 2015 Nelson Tran
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# Mouse basic commands and arguments
MOUSE_CMD = 0xE0
MOUSE_CALIBRATE = 0xE1
MOUSE_PRESS = 0xE2
MOUSE_RELEASE = 0xE3
MOUSE_CLICK = 0xE4
MOUSE_FAST_CLICK = 0xE5
MOUSE_MOVE = 0xE6
MOUSE_BEZIER = 0xE7
# Mouse buttons
MOUSE_LEFT = 0xEA
MOUSE_RIGHT = 0xEB
MOUSE_MIDDLE = 0xEC
MOUSE_BUTTONS = [MOUSE_LEFT,
MOUSE_MIDDLE,
MOUSE_RIGHT]
# Keyboard commands and arguments
KEYBOARD_CMD = 0xF0
KEYBOARD_PRESS = 0xF1
KEYBOARD_RELEASE = 0xF2
KEYBOARD_RELEASE_ALL = 0xF3
KEYBOARD_PRINT = 0xF4
KEYBOARD_PRINTLN = 0xF5
KEYBOARD_WRITE = 0xF6
KEYBOARD_TYPE = 0xF7
# Arduino keyboard modifiers
# http://arduino.cc/en/Reference/KeyboardModifiers
LEFT_CTRL = 0x80
LEFT_SHIFT = 0x81
LEFT_ALT = 0x82
LEFT_GUI = 0x83
RIGHT_CTRL = 0x84
RIGHT_SHIFT = 0x85
RIGHT_ALT = 0x86
RIGHT_GUI = 0x87
UP_ARROW = 0xDA
DOWN_ARROW = 0xD9
LEFT_ARROW = 0xD8
RIGHT_ARROW = 0xD7
BACKSPACE = 0xB2
TAB = 0xB3
RETURN = 0xB0
ESC = 0xB1
INSERT = 0xD1
DELETE = 0xD4
PAGE_UP = 0xD3
PAGE_DOWN = 0xD6
HOME = 0xD2
END = 0xD5
CAPS_LOCK = 0xC1
F1 = 0xC2
F2 = 0xC3
F3 = 0xC4
F4 = 0xC5
F5 = 0xC6
F6 = 0xC7
F7 = 0xC8
F8 = 0xC9
F9 = 0xCA
F10 = 0xCB
F11 = 0xCC
F12 = 0xCD
# etc.
SCREEN_CALIBRATE = 0xFF
COMMAND_COMPLETE = 0xFE
| mouse_cmd = 224
mouse_calibrate = 225
mouse_press = 226
mouse_release = 227
mouse_click = 228
mouse_fast_click = 229
mouse_move = 230
mouse_bezier = 231
mouse_left = 234
mouse_right = 235
mouse_middle = 236
mouse_buttons = [MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT]
keyboard_cmd = 240
keyboard_press = 241
keyboard_release = 242
keyboard_release_all = 243
keyboard_print = 244
keyboard_println = 245
keyboard_write = 246
keyboard_type = 247
left_ctrl = 128
left_shift = 129
left_alt = 130
left_gui = 131
right_ctrl = 132
right_shift = 133
right_alt = 134
right_gui = 135
up_arrow = 218
down_arrow = 217
left_arrow = 216
right_arrow = 215
backspace = 178
tab = 179
return = 176
esc = 177
insert = 209
delete = 212
page_up = 211
page_down = 214
home = 210
end = 213
caps_lock = 193
f1 = 194
f2 = 195
f3 = 196
f4 = 197
f5 = 198
f6 = 199
f7 = 200
f8 = 201
f9 = 202
f10 = 203
f11 = 204
f12 = 205
screen_calibrate = 255
command_complete = 254 |
def minion_game(string):
# your code goes here
vowels = ['A', 'E', 'I', 'O', 'U']
kevin = 0
stuart = 0
for i in range(len(string)):
if s[i] in vowels:
kevin = kevin + (len(s)-i)
else:
stuart = stuart + (len(s)-i)
if stuart > kevin:
print('Stuart '+ str(stuart))
elif kevin > stuart:
print('Kevin ' + str(kevin))
else:
print('Draw')
if __name__ == '__main__':
s = input()
minion_game(s) | def minion_game(string):
vowels = ['A', 'E', 'I', 'O', 'U']
kevin = 0
stuart = 0
for i in range(len(string)):
if s[i] in vowels:
kevin = kevin + (len(s) - i)
else:
stuart = stuart + (len(s) - i)
if stuart > kevin:
print('Stuart ' + str(stuart))
elif kevin > stuart:
print('Kevin ' + str(kevin))
else:
print('Draw')
if __name__ == '__main__':
s = input()
minion_game(s) |
# https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list
N = int(input())
line_of_numbers = input().split(' ')
# Extract numbers from input line and add them to list
A = []
for i in range(N):
A.append(int(line_of_numbers[i]))
# Sort list and get largest value from it
A.sort()
max_number = A[-1]
# Remove all instances of the largest value from the list
while (A[-1] == max_number):
A.pop()
# Print the list's last element, which is now the 2nd largest value
print(A[-1])
| n = int(input())
line_of_numbers = input().split(' ')
a = []
for i in range(N):
A.append(int(line_of_numbers[i]))
A.sort()
max_number = A[-1]
while A[-1] == max_number:
A.pop()
print(A[-1]) |
# The kth Factor of n
'''
Given two positive integers n and k.
A factor of an integer n is defined as an integer i where n % i == 0.
Consider a list of all factors of n sorted in ascending order, return the kth factor in this list or return -1 if n has less than k factors.
Example 1:
Input: n = 12, k = 3
Output: 3
Explanation: Factors list is [1, 2, 3, 4, 6, 12], the 3rd factor is 3.
Example 2:
Input: n = 7, k = 2
Output: 7
Explanation: Factors list is [1, 7], the 2nd factor is 7.
Example 3:
Input: n = 4, k = 4
Output: -1
Explanation: Factors list is [1, 2, 4], there is only 3 factors. We should return -1.
Example 4:
Input: n = 1, k = 1
Output: 1
Explanation: Factors list is [1], the 1st factor is 1.
Example 5:
Input: n = 1000, k = 3
Output: 4
Explanation: Factors list is [1, 2, 4, 5, 8, 10, 20, 25, 40, 50, 100, 125, 200, 250, 500, 1000].
Constraints:
1 <= k <= n <= 1000
Hide Hint #1
The factors of n will be always in the range [1, n].
Hide Hint #2
Keep a list of all factors sorted. Loop i from 1 to n and add i if n % i == 0. Return the kth factor if it exist in this list.
'''
class Solution:
def kthFactor(self, n: int, k: int) -> int:
factors = []
for i in range(1,n//2+1):
if n%i == 0:
factors.append(i)
factors.append(n)
return factors[k-1] if len(factors)>=k else -1
| """
Given two positive integers n and k.
A factor of an integer n is defined as an integer i where n % i == 0.
Consider a list of all factors of n sorted in ascending order, return the kth factor in this list or return -1 if n has less than k factors.
Example 1:
Input: n = 12, k = 3
Output: 3
Explanation: Factors list is [1, 2, 3, 4, 6, 12], the 3rd factor is 3.
Example 2:
Input: n = 7, k = 2
Output: 7
Explanation: Factors list is [1, 7], the 2nd factor is 7.
Example 3:
Input: n = 4, k = 4
Output: -1
Explanation: Factors list is [1, 2, 4], there is only 3 factors. We should return -1.
Example 4:
Input: n = 1, k = 1
Output: 1
Explanation: Factors list is [1], the 1st factor is 1.
Example 5:
Input: n = 1000, k = 3
Output: 4
Explanation: Factors list is [1, 2, 4, 5, 8, 10, 20, 25, 40, 50, 100, 125, 200, 250, 500, 1000].
Constraints:
1 <= k <= n <= 1000
Hide Hint #1
The factors of n will be always in the range [1, n].
Hide Hint #2
Keep a list of all factors sorted. Loop i from 1 to n and add i if n % i == 0. Return the kth factor if it exist in this list.
"""
class Solution:
def kth_factor(self, n: int, k: int) -> int:
factors = []
for i in range(1, n // 2 + 1):
if n % i == 0:
factors.append(i)
factors.append(n)
return factors[k - 1] if len(factors) >= k else -1 |
LOGIN_REQUIRED = 'Es Necesario iniciar Sesion!'
USER_CREATED = 'Usuario Creado Exitosamente!'
LOGOUT = 'Cerraste Sesion!'
ERRO_USER_PASSWORD = 'Usuario o Contrasena Invalidos!'
LOGIN = 'Usuario Autenticado Exitosamente!'
TASK_CREATED = 'Tarea creada Exitosamente!'
TASK_UPDATED = 'Tarea Actualizada!'
TASK_DELETE = "Tarea Eliminada!" | login_required = 'Es Necesario iniciar Sesion!'
user_created = 'Usuario Creado Exitosamente!'
logout = 'Cerraste Sesion!'
erro_user_password = 'Usuario o Contrasena Invalidos!'
login = 'Usuario Autenticado Exitosamente!'
task_created = 'Tarea creada Exitosamente!'
task_updated = 'Tarea Actualizada!'
task_delete = 'Tarea Eliminada!' |
def left_join(d1, d2):
results = []
for key in d1:
if key in d2:
results.append([key, d1[key], d2[key]])
else:
results.append([key, d1[key], None])
return results | def left_join(d1, d2):
results = []
for key in d1:
if key in d2:
results.append([key, d1[key], d2[key]])
else:
results.append([key, d1[key], None])
return results |
listagem = ('APRENDER', 'PROGRAMAR',
'LINGUAGEM', 'PYTHON',
'CURSO', 'GRATIS',
'ESTUDAR', 'PRATICAR',
'TRABALHAR', 'MERCADO',
'PROGRAMADOR', 'FUTURO')
for pos in listagem:
print(f'\nNa palavra {pos} temos ', end=' ')
for letra in pos:
if letra.upper() in 'AEIOU':
print(letra, end=' ')
| listagem = ('APRENDER', 'PROGRAMAR', 'LINGUAGEM', 'PYTHON', 'CURSO', 'GRATIS', 'ESTUDAR', 'PRATICAR', 'TRABALHAR', 'MERCADO', 'PROGRAMADOR', 'FUTURO')
for pos in listagem:
print(f'\nNa palavra {pos} temos ', end=' ')
for letra in pos:
if letra.upper() in 'AEIOU':
print(letra, end=' ') |
# In Python, the names of classes follow the CapWords
# convention. Let's convert the input phrase accordingly by
# capitilizing all words and spelling them without underscores in-
# between.
# The input format:
# A word or phrase, with words separated by underscores, like
# function and variable names in Python.
# You might want to change the case of letters since they are not
# necessarily lowercased.
# The output format:
# The name written in the CapWords fashion.
# word.capitalize() if word.isalpha else
word = input()
print(word.title() if word.find("_") == -1 else word.title().replace("_", ''))
print(''.join([x.capitalize() for x in input().lower().split('_')])) | word = input()
print(word.title() if word.find('_') == -1 else word.title().replace('_', ''))
print(''.join([x.capitalize() for x in input().lower().split('_')])) |
pow_of_5th = {i:i**5 for i in range(10)}
def get_5th_pow_of(n):
return pow_of_5th[n]
def get_sum_of_5th_pow_of(n):
sum = 0
for digit in str(n):
sum += get_5th_pow_of(int(digit))
return sum
if __name__ == "__main__":
numb = set()
ceil = ((pow_of_5th[9]) * 9)+1 # Verify this ceil
for n in range(2, ceil):
if get_sum_of_5th_pow_of(n) == n:
numb.add(n)
print(sum(numb)) | pow_of_5th = {i: i ** 5 for i in range(10)}
def get_5th_pow_of(n):
return pow_of_5th[n]
def get_sum_of_5th_pow_of(n):
sum = 0
for digit in str(n):
sum += get_5th_pow_of(int(digit))
return sum
if __name__ == '__main__':
numb = set()
ceil = pow_of_5th[9] * 9 + 1
for n in range(2, ceil):
if get_sum_of_5th_pow_of(n) == n:
numb.add(n)
print(sum(numb)) |
CONSUMER_API_KEY = ""
CONSUMER_API_SECRET = ""
ACCESS_TOKEN = ""
ACCESS_KEY = ""
| consumer_api_key = ''
consumer_api_secret = ''
access_token = ''
access_key = '' |
def emergency_stop(driver):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def stop(driver, frame=30):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def print_all_devices(r):
print('---------------------------------------')
for i in range(r.getNumberOfDevices()):
print('~ Device:', r.getDeviceByIndex(i).getName(), ' ===> ', r.getDeviceByIndex(i))
print('---------------------------------------')
| def emergency_stop(driver):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def stop(driver, frame=30):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def print_all_devices(r):
print('---------------------------------------')
for i in range(r.getNumberOfDevices()):
print('~ Device:', r.getDeviceByIndex(i).getName(), ' ===> ', r.getDeviceByIndex(i))
print('---------------------------------------') |
file = open("input01.txt").read().splitlines()
file = [int(x) for x in file]
"""Part One"""
counter = 0
for i in range(1, len(file)):
if file[i] - file[i-1] > 0:
counter += 1
print(counter)
"""Part Two"""
temp = []
for i in range(len(file)-2):
temp.append(sum(file[i:i+3]))
counter = 0
for i in range(1, len(temp)):
if temp[i] - temp[i-1] > 0:
counter += 1
print(counter)
| file = open('input01.txt').read().splitlines()
file = [int(x) for x in file]
'Part One'
counter = 0
for i in range(1, len(file)):
if file[i] - file[i - 1] > 0:
counter += 1
print(counter)
'Part Two'
temp = []
for i in range(len(file) - 2):
temp.append(sum(file[i:i + 3]))
counter = 0
for i in range(1, len(temp)):
if temp[i] - temp[i - 1] > 0:
counter += 1
print(counter) |
"""Placeholder for MicroPython framebuf module"""
MONO_VLSB = 0
MONO_HLSB = 0
MONO_HMSB = 0
RGB565 = 0
GS4_HMSB = 0
class FrameBuffer():
def __init__(self, buffer, width, height, format, stride=None):
pass
| """Placeholder for MicroPython framebuf module"""
mono_vlsb = 0
mono_hlsb = 0
mono_hmsb = 0
rgb565 = 0
gs4_hmsb = 0
class Framebuffer:
def __init__(self, buffer, width, height, format, stride=None):
pass |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Script: solution.py
# @Author: Pradip Patil
# @Contact: @pradip__patil
# @Created: 2018-02-12 23:58:20
# @Last Modified By: Pradip Patil
# @Last Modified: 2018-02-13 00:15:16
# @Description: https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem
if __name__ == '__main__':
n = int(input())
# 1. create list fom space separated input
# 2. remove duplicates by creating set from list
# 3. sort the set and print second last element
print(sorted(set([int(i) for i in input().split()]))[-2])
| if __name__ == '__main__':
n = int(input())
print(sorted(set([int(i) for i in input().split()]))[-2]) |
class Base(object):
TYPE_ATTRIBUTES = ("_entity_type", "workflow_type")
@staticmethod
def _get_camelcase(attribute):
if attribute in Base.TYPE_ATTRIBUTES:
return "type"
tmp = attribute.split("_")
return tmp[0] + "".join([w.title() for w in tmp[1:]])
@staticmethod
def _get_serialized(attribute_value):
serializable = getattr(attribute_value, "serialize", None)
if serializable:
attribute_value = attribute_value.serialize()
return attribute_value
def _get_serialized_attribute(self, attribute_value):
if isinstance(attribute_value, list):
attribute_value = [self._get_serialized(a) for a in attribute_value]
else:
attribute_value = self._get_serialized(attribute_value)
return attribute_value
def serialize(self):
return {self._get_camelcase(k): self._get_serialized_attribute(v)
for k, v in self.__dict__.items()
if v is not None
}
class Entity(Base):
def __init__(self, value):
self.value = value
| class Base(object):
type_attributes = ('_entity_type', 'workflow_type')
@staticmethod
def _get_camelcase(attribute):
if attribute in Base.TYPE_ATTRIBUTES:
return 'type'
tmp = attribute.split('_')
return tmp[0] + ''.join([w.title() for w in tmp[1:]])
@staticmethod
def _get_serialized(attribute_value):
serializable = getattr(attribute_value, 'serialize', None)
if serializable:
attribute_value = attribute_value.serialize()
return attribute_value
def _get_serialized_attribute(self, attribute_value):
if isinstance(attribute_value, list):
attribute_value = [self._get_serialized(a) for a in attribute_value]
else:
attribute_value = self._get_serialized(attribute_value)
return attribute_value
def serialize(self):
return {self._get_camelcase(k): self._get_serialized_attribute(v) for (k, v) in self.__dict__.items() if v is not None}
class Entity(Base):
def __init__(self, value):
self.value = value |
n = int(input())
while n:
p = str(input())
print("gzuz")
n = n - 1
| n = int(input())
while n:
p = str(input())
print('gzuz')
n = n - 1 |
group_name = [
'DA',
'DG',
'DC',
'DT',
'DI'
]
| group_name = ['DA', 'DG', 'DC', 'DT', 'DI'] |
LESSONS = [
{
"Move cursor left": ["h"],
"Move cursor right": ["l"],
"Move cursor down": ["j"],
"Move cursor up": ["k"],
"Close file": [":q"],
"Close file, don't save changes": [":q!"],
"Save changes to file": [":w"],
"Save changes and close file": [":wq", ":x", "ZZ"],
"Delete character at cursor": ["x"],
"Insert at cursor": ["i"],
"Insert at beginning of line": ["I"],
"Append after cursor": ["a"],
"Append at end of line": ["A"],
"Exit insert mode": ["ESC"]
},
{
"Delete word": ["dw"],
"Delete to end of line": ["d$", "D"],
"Next word": ["w"],
"Go to end of text on current line": ["$"],
"Go to beginning of text on current line": ["^"],
"Go to beginning of current line": ["0"],
"Go two word forward": ["2w"],
"Go to end of third word ahead": ["3e"],
"Delete two words": ["d2w"],
"Delete entire line": ["dd"],
"Delete two lines": ["2dd"],
"Undo last change": ["u"],
"Undo changes on entire line": ["U"],
"Redo changes": ["CTRL_R"]
},
{
"Paste after cursor": ["p"],
"Paste before cursor": ["P"],
"Replace character under cursor": ["r"],
"Change word": ["cw"],
"Change to end of line": ["c$", "C"],
"Change two words": ["c2w"]
},
{
"Go to line 50": ["50G"],
"Go to last line in file": ["G"],
"Go to first line in file": ["gg"],
"Search for \"vim\"": ["/vim"],
"Go to next search result": ["n"],
"Go to previous search result": ["N"],
"Search backwards for \"editor\"": ["?editor"],
"Jump to previous location (jump back)": ["CTRL_O"],
"Jump to next location (jump foward)": ["CTRL_I"],
"Go to matching parentheses or brackets": ["%"],
"Replace bad with good in CURRENT LINE": [":%s/bad/good"],
"Replace hi with bye in entire file": [":%s/hi/bye/g"],
"Replace x with y in entire file, prompt for changes": ["%s/x/y/gc"]
},
{
"Run shell command ls": [":!ls"],
"Open visual mode": ["v"],
"Visual selected world": ["vw"],
"Visual select word, then delete word": ["vwd", "vwx"],
"Save current file as \"socket.js\"": [":w socket.js"],
"Read in file \"play.py\"": [":r play.py"]
},
{
"Open new line below": ["o"],
"Open new line above": ["O"],
"Go to end of word": ["e"],
"Go to end of next word": ["2e"],
"Enter replace mode": ["R"],
"Yank word": ["yw"],
"Visual select word, then yank": ["vwy"],
"Yank to end of current line": ["y$"],
"Change search settings to ignore case": ["set ignorecase", "set ic"],
"Change search settings to use case": ["set noignorecase", "set noic"]
},
{
"Open file \"~/.vimrc\"": [":e ~/.vimrc"],
"Get help for \"d\" command": [":help d"],
"Get help for \"y\" command": [":help y"]
}
]
| lessons = [{'Move cursor left': ['h'], 'Move cursor right': ['l'], 'Move cursor down': ['j'], 'Move cursor up': ['k'], 'Close file': [':q'], "Close file, don't save changes": [':q!'], 'Save changes to file': [':w'], 'Save changes and close file': [':wq', ':x', 'ZZ'], 'Delete character at cursor': ['x'], 'Insert at cursor': ['i'], 'Insert at beginning of line': ['I'], 'Append after cursor': ['a'], 'Append at end of line': ['A'], 'Exit insert mode': ['ESC']}, {'Delete word': ['dw'], 'Delete to end of line': ['d$', 'D'], 'Next word': ['w'], 'Go to end of text on current line': ['$'], 'Go to beginning of text on current line': ['^'], 'Go to beginning of current line': ['0'], 'Go two word forward': ['2w'], 'Go to end of third word ahead': ['3e'], 'Delete two words': ['d2w'], 'Delete entire line': ['dd'], 'Delete two lines': ['2dd'], 'Undo last change': ['u'], 'Undo changes on entire line': ['U'], 'Redo changes': ['CTRL_R']}, {'Paste after cursor': ['p'], 'Paste before cursor': ['P'], 'Replace character under cursor': ['r'], 'Change word': ['cw'], 'Change to end of line': ['c$', 'C'], 'Change two words': ['c2w']}, {'Go to line 50': ['50G'], 'Go to last line in file': ['G'], 'Go to first line in file': ['gg'], 'Search for "vim"': ['/vim'], 'Go to next search result': ['n'], 'Go to previous search result': ['N'], 'Search backwards for "editor"': ['?editor'], 'Jump to previous location (jump back)': ['CTRL_O'], 'Jump to next location (jump foward)': ['CTRL_I'], 'Go to matching parentheses or brackets': ['%'], 'Replace bad with good in CURRENT LINE': [':%s/bad/good'], 'Replace hi with bye in entire file': [':%s/hi/bye/g'], 'Replace x with y in entire file, prompt for changes': ['%s/x/y/gc']}, {'Run shell command ls': [':!ls'], 'Open visual mode': ['v'], 'Visual selected world': ['vw'], 'Visual select word, then delete word': ['vwd', 'vwx'], 'Save current file as "socket.js"': [':w socket.js'], 'Read in file "play.py"': [':r play.py']}, {'Open new line below': ['o'], 'Open new line above': ['O'], 'Go to end of word': ['e'], 'Go to end of next word': ['2e'], 'Enter replace mode': ['R'], 'Yank word': ['yw'], 'Visual select word, then yank': ['vwy'], 'Yank to end of current line': ['y$'], 'Change search settings to ignore case': ['set ignorecase', 'set ic'], 'Change search settings to use case': ['set noignorecase', 'set noic']}, {'Open file "~/.vimrc"': [':e ~/.vimrc'], 'Get help for "d" command': [':help d'], 'Get help for "y" command': [':help y']}] |
class Car:
"""
Car models a car w/ tires and an engine
"""
def __init__(self, engine, tires):
self.engine = engine
self.tires = tires
def description(self):
print(f"A car with a {self.engine} engine, and {self.tires} tires")
def wheel_circumference(self):
if len(self.tires) > 0:
return self.tires[0].circumference()
else:
return 0
| class Car:
"""
Car models a car w/ tires and an engine
"""
def __init__(self, engine, tires):
self.engine = engine
self.tires = tires
def description(self):
print(f'A car with a {self.engine} engine, and {self.tires} tires')
def wheel_circumference(self):
if len(self.tires) > 0:
return self.tires[0].circumference()
else:
return 0 |
def centuryFromYear(year):
if ((year > 0) and (year <= 2005)):
str_year = str(year) # converts integer input to string type with 'str()'
len_year = len(str_year) # finds length of new 'str_year'
century_arr = []
century = 0
# iterates through 'str_year'...
for digit in range(len_year):
# appends each digit from 'str_year' to century_arr
century_arr.append(str_year[digit])
if len_year == 1:
century += 1
if len_year == 2:
century += 1
if len_year == 3:
if ((century_arr[1] == '0') and (century_arr[2] == '0')):
century = int(century_arr[0])
else:
century = int(century_arr[0]) + 1
if len_year == 4:
if ((century_arr[2] == '0') and (century_arr[3] == '0')):
century = int(century_arr[0] + century_arr[1])
else:
century = int(century_arr[0] + century_arr[1]) + 1
return century
else:
return "This is not a valid year. Please try again."
print(centuryFromYear(1905)) # should print "20"
print(centuryFromYear(12)) # should print "1"
print(centuryFromYear(195)) # should print "2"
print(centuryFromYear(2005)) # should print "21"
print(centuryFromYear(2035)) # should print "This is not a valid year. Please try again."
print(centuryFromYear(1700)) # should print "17"
print(centuryFromYear(45)) # should print "1" | def century_from_year(year):
if year > 0 and year <= 2005:
str_year = str(year)
len_year = len(str_year)
century_arr = []
century = 0
for digit in range(len_year):
century_arr.append(str_year[digit])
if len_year == 1:
century += 1
if len_year == 2:
century += 1
if len_year == 3:
if century_arr[1] == '0' and century_arr[2] == '0':
century = int(century_arr[0])
else:
century = int(century_arr[0]) + 1
if len_year == 4:
if century_arr[2] == '0' and century_arr[3] == '0':
century = int(century_arr[0] + century_arr[1])
else:
century = int(century_arr[0] + century_arr[1]) + 1
return century
else:
return 'This is not a valid year. Please try again.'
print(century_from_year(1905))
print(century_from_year(12))
print(century_from_year(195))
print(century_from_year(2005))
print(century_from_year(2035))
print(century_from_year(1700))
print(century_from_year(45)) |
def get_roles(client: object) -> list:
"""Get information about the roles in Blackbaud.
Documentation:
https://docs.blackbaud.com/on-api-docs/api/constituents/role/get-listall
Args:
client (object): The ON API client object.
Returns:
List of dictionaries.
"""
url = '/role/ListAll'
return client.get(url)
| def get_roles(client: object) -> list:
"""Get information about the roles in Blackbaud.
Documentation:
https://docs.blackbaud.com/on-api-docs/api/constituents/role/get-listall
Args:
client (object): The ON API client object.
Returns:
List of dictionaries.
"""
url = '/role/ListAll'
return client.get(url) |
#
# PySNMP MIB module CISCO-DMN-DSG-SDI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DMN-DSG-SDI-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:37:52 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)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection")
ciscoDSGUtilities, = mibBuilder.importSymbols("CISCO-DMN-DSG-ROOT-MIB", "ciscoDSGUtilities")
NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
Counter64, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, MibIdentifier, Unsigned32, iso, Gauge32, Counter32, Bits, Integer32, ObjectIdentity, IpAddress, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "MibIdentifier", "Unsigned32", "iso", "Gauge32", "Counter32", "Bits", "Integer32", "ObjectIdentity", "IpAddress", "TimeTicks")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
ciscoDSGSDI = ModuleIdentity((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32))
ciscoDSGSDI.setRevisions(('2012-03-20 11:00', '2010-08-24 07:00',))
if mibBuilder.loadTexts: ciscoDSGSDI.setLastUpdated('201203201100Z')
if mibBuilder.loadTexts: ciscoDSGSDI.setOrganization('Cisco Systems, Inc.')
sdiTable = MibIdentifier((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2))
sdiInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1))
sdiVii = MibScalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sdiVii.setStatus('current')
vancGlobalStatusInterlaced = MibScalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancGlobalStatusInterlaced.setStatus('current')
vancGlobalStatusFrames = MibScalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancGlobalStatusFrames.setStatus('current')
vancGlobalStatusLines = MibScalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancGlobalStatusLines.setStatus('current')
vancGlobalStatusWords = MibScalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancGlobalStatusWords.setStatus('current')
vancGlobalStatusFirst = MibScalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancGlobalStatusFirst.setStatus('current')
vancGlobalStatusLast = MibScalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancGlobalStatusLast.setStatus('current')
vancGlobalStatusSwitch = MibScalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancGlobalStatusSwitch.setStatus('current')
vancGlobalStatusMultiLine = MibScalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancGlobalStatusMultiLine.setStatus('current')
vancCfgTable = MibTable((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 1), )
if mibBuilder.loadTexts: vancCfgTable.setStatus('current')
vancCfgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 1, 1), ).setIndexNames((0, "CISCO-DMN-DSG-SDI-MIB", "vancCfgSvcID"))
if mibBuilder.loadTexts: vancCfgEntry.setStatus('current')
vancCfgSvcID = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("eia708", 1), ("afd", 2), ("dpi", 3), ("smpte2031", 4), ("sdpOP47", 5), ("multiOP47", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancCfgSvcID.setStatus('current')
vancCfgEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vancCfgEnable.setStatus('current')
vancCfgOffset = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 18))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: vancCfgOffset.setStatus('current')
sdiAudioSlotTable = MibTable((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2), )
if mibBuilder.loadTexts: sdiAudioSlotTable.setStatus('current')
sdiAudioSlotEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2, 1), ).setIndexNames((0, "CISCO-DMN-DSG-SDI-MIB", "sdiAudioSlotGroup"), (0, "CISCO-DMN-DSG-SDI-MIB", "sdiAudioSlotPosition"))
if mibBuilder.loadTexts: sdiAudioSlotEntry.setStatus('current')
sdiAudioSlotGroup = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sdiAudioSlotGroup.setStatus('current')
sdiAudioSlotPosition = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sdiAudioSlotPosition.setStatus('current')
sdiAudioSlotAud = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sdiAudioSlotAud.setStatus('current')
sdiAudioSlotChan = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sdiAudioSlotChan.setStatus('current')
vancServiceStatusTable = MibTable((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3), )
if mibBuilder.loadTexts: vancServiceStatusTable.setStatus('current')
vancServiceStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1), ).setIndexNames((0, "CISCO-DMN-DSG-SDI-MIB", "vancServiceStatusServiceID"))
if mibBuilder.loadTexts: vancServiceStatusEntry.setStatus('current')
vancServiceStatusServiceID = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("eia708", 1), ("afd", 2), ("dpi", 3), ("smpte2031", 4), ("sdpOP47", 5), ("multiOP47", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancServiceStatusServiceID.setStatus('current')
vancServiceStatusActive = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancServiceStatusActive.setStatus('current')
vancServiceStatusADJLine = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancServiceStatusADJLine.setStatus('current')
vancServiceStatusACTLineF1 = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancServiceStatusACTLineF1.setStatus('current')
vancServiceStatusACTLineF2 = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancServiceStatusACTLineF2.setStatus('current')
vancServiceStatusLinesMAX = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancServiceStatusLinesMAX.setStatus('current')
vancServiceStatusDataAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancServiceStatusDataAvg.setStatus('current')
vancServiceStatusPacketsOKAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancServiceStatusPacketsOKAvg.setStatus('current')
vancServiceStatusPacketsDroppedAvg = MibTableColumn((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: vancServiceStatusPacketsDroppedAvg.setStatus('current')
mibBuilder.exportSymbols("CISCO-DMN-DSG-SDI-MIB", vancGlobalStatusMultiLine=vancGlobalStatusMultiLine, sdiTable=sdiTable, vancGlobalStatusSwitch=vancGlobalStatusSwitch, vancServiceStatusPacketsOKAvg=vancServiceStatusPacketsOKAvg, sdiAudioSlotGroup=sdiAudioSlotGroup, vancCfgOffset=vancCfgOffset, vancCfgTable=vancCfgTable, PYSNMP_MODULE_ID=ciscoDSGSDI, vancServiceStatusDataAvg=vancServiceStatusDataAvg, vancServiceStatusACTLineF2=vancServiceStatusACTLineF2, sdiAudioSlotEntry=sdiAudioSlotEntry, vancServiceStatusActive=vancServiceStatusActive, sdiInfo=sdiInfo, sdiAudioSlotTable=sdiAudioSlotTable, vancServiceStatusLinesMAX=vancServiceStatusLinesMAX, vancServiceStatusEntry=vancServiceStatusEntry, vancGlobalStatusWords=vancGlobalStatusWords, vancServiceStatusPacketsDroppedAvg=vancServiceStatusPacketsDroppedAvg, sdiAudioSlotChan=sdiAudioSlotChan, vancServiceStatusServiceID=vancServiceStatusServiceID, vancGlobalStatusFirst=vancGlobalStatusFirst, sdiAudioSlotAud=sdiAudioSlotAud, sdiVii=sdiVii, vancServiceStatusADJLine=vancServiceStatusADJLine, vancServiceStatusTable=vancServiceStatusTable, vancServiceStatusACTLineF1=vancServiceStatusACTLineF1, vancGlobalStatusLines=vancGlobalStatusLines, ciscoDSGSDI=ciscoDSGSDI, vancGlobalStatusInterlaced=vancGlobalStatusInterlaced, vancCfgSvcID=vancCfgSvcID, vancCfgEntry=vancCfgEntry, vancCfgEnable=vancCfgEnable, sdiAudioSlotPosition=sdiAudioSlotPosition, vancGlobalStatusLast=vancGlobalStatusLast, vancGlobalStatusFrames=vancGlobalStatusFrames)
| (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection')
(cisco_dsg_utilities,) = mibBuilder.importSymbols('CISCO-DMN-DSG-ROOT-MIB', 'ciscoDSGUtilities')
(notification_group, object_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ObjectGroup', 'ModuleCompliance')
(counter64, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, mib_identifier, unsigned32, iso, gauge32, counter32, bits, integer32, object_identity, ip_address, time_ticks) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'MibIdentifier', 'Unsigned32', 'iso', 'Gauge32', 'Counter32', 'Bits', 'Integer32', 'ObjectIdentity', 'IpAddress', 'TimeTicks')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
cisco_dsgsdi = module_identity((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32))
ciscoDSGSDI.setRevisions(('2012-03-20 11:00', '2010-08-24 07:00'))
if mibBuilder.loadTexts:
ciscoDSGSDI.setLastUpdated('201203201100Z')
if mibBuilder.loadTexts:
ciscoDSGSDI.setOrganization('Cisco Systems, Inc.')
sdi_table = mib_identifier((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2))
sdi_info = mib_identifier((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1))
sdi_vii = mib_scalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sdiVii.setStatus('current')
vanc_global_status_interlaced = mib_scalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancGlobalStatusInterlaced.setStatus('current')
vanc_global_status_frames = mib_scalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancGlobalStatusFrames.setStatus('current')
vanc_global_status_lines = mib_scalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancGlobalStatusLines.setStatus('current')
vanc_global_status_words = mib_scalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancGlobalStatusWords.setStatus('current')
vanc_global_status_first = mib_scalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancGlobalStatusFirst.setStatus('current')
vanc_global_status_last = mib_scalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancGlobalStatusLast.setStatus('current')
vanc_global_status_switch = mib_scalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancGlobalStatusSwitch.setStatus('current')
vanc_global_status_multi_line = mib_scalar((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancGlobalStatusMultiLine.setStatus('current')
vanc_cfg_table = mib_table((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 1))
if mibBuilder.loadTexts:
vancCfgTable.setStatus('current')
vanc_cfg_entry = mib_table_row((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 1, 1)).setIndexNames((0, 'CISCO-DMN-DSG-SDI-MIB', 'vancCfgSvcID'))
if mibBuilder.loadTexts:
vancCfgEntry.setStatus('current')
vanc_cfg_svc_id = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('eia708', 1), ('afd', 2), ('dpi', 3), ('smpte2031', 4), ('sdpOP47', 5), ('multiOP47', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancCfgSvcID.setStatus('current')
vanc_cfg_enable = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('no', 1), ('yes', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
vancCfgEnable.setStatus('current')
vanc_cfg_offset = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 18))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
vancCfgOffset.setStatus('current')
sdi_audio_slot_table = mib_table((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2))
if mibBuilder.loadTexts:
sdiAudioSlotTable.setStatus('current')
sdi_audio_slot_entry = mib_table_row((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2, 1)).setIndexNames((0, 'CISCO-DMN-DSG-SDI-MIB', 'sdiAudioSlotGroup'), (0, 'CISCO-DMN-DSG-SDI-MIB', 'sdiAudioSlotPosition'))
if mibBuilder.loadTexts:
sdiAudioSlotEntry.setStatus('current')
sdi_audio_slot_group = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 1))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sdiAudioSlotGroup.setStatus('current')
sdi_audio_slot_position = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 4))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sdiAudioSlotPosition.setStatus('current')
sdi_audio_slot_aud = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 2))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sdiAudioSlotAud.setStatus('current')
sdi_audio_slot_chan = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 2, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 2))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sdiAudioSlotChan.setStatus('current')
vanc_service_status_table = mib_table((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3))
if mibBuilder.loadTexts:
vancServiceStatusTable.setStatus('current')
vanc_service_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1)).setIndexNames((0, 'CISCO-DMN-DSG-SDI-MIB', 'vancServiceStatusServiceID'))
if mibBuilder.loadTexts:
vancServiceStatusEntry.setStatus('current')
vanc_service_status_service_id = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('eia708', 1), ('afd', 2), ('dpi', 3), ('smpte2031', 4), ('sdpOP47', 5), ('multiOP47', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancServiceStatusServiceID.setStatus('current')
vanc_service_status_active = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('no', 1), ('yes', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancServiceStatusActive.setStatus('current')
vanc_service_status_adj_line = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancServiceStatusADJLine.setStatus('current')
vanc_service_status_act_line_f1 = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancServiceStatusACTLineF1.setStatus('current')
vanc_service_status_act_line_f2 = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancServiceStatusACTLineF2.setStatus('current')
vanc_service_status_lines_max = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancServiceStatusLinesMAX.setStatus('current')
vanc_service_status_data_avg = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancServiceStatusDataAvg.setStatus('current')
vanc_service_status_packets_ok_avg = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancServiceStatusPacketsOKAvg.setStatus('current')
vanc_service_status_packets_dropped_avg = mib_table_column((1, 3, 6, 1, 4, 1, 1429, 2, 2, 5, 32, 2, 3, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
vancServiceStatusPacketsDroppedAvg.setStatus('current')
mibBuilder.exportSymbols('CISCO-DMN-DSG-SDI-MIB', vancGlobalStatusMultiLine=vancGlobalStatusMultiLine, sdiTable=sdiTable, vancGlobalStatusSwitch=vancGlobalStatusSwitch, vancServiceStatusPacketsOKAvg=vancServiceStatusPacketsOKAvg, sdiAudioSlotGroup=sdiAudioSlotGroup, vancCfgOffset=vancCfgOffset, vancCfgTable=vancCfgTable, PYSNMP_MODULE_ID=ciscoDSGSDI, vancServiceStatusDataAvg=vancServiceStatusDataAvg, vancServiceStatusACTLineF2=vancServiceStatusACTLineF2, sdiAudioSlotEntry=sdiAudioSlotEntry, vancServiceStatusActive=vancServiceStatusActive, sdiInfo=sdiInfo, sdiAudioSlotTable=sdiAudioSlotTable, vancServiceStatusLinesMAX=vancServiceStatusLinesMAX, vancServiceStatusEntry=vancServiceStatusEntry, vancGlobalStatusWords=vancGlobalStatusWords, vancServiceStatusPacketsDroppedAvg=vancServiceStatusPacketsDroppedAvg, sdiAudioSlotChan=sdiAudioSlotChan, vancServiceStatusServiceID=vancServiceStatusServiceID, vancGlobalStatusFirst=vancGlobalStatusFirst, sdiAudioSlotAud=sdiAudioSlotAud, sdiVii=sdiVii, vancServiceStatusADJLine=vancServiceStatusADJLine, vancServiceStatusTable=vancServiceStatusTable, vancServiceStatusACTLineF1=vancServiceStatusACTLineF1, vancGlobalStatusLines=vancGlobalStatusLines, ciscoDSGSDI=ciscoDSGSDI, vancGlobalStatusInterlaced=vancGlobalStatusInterlaced, vancCfgSvcID=vancCfgSvcID, vancCfgEntry=vancCfgEntry, vancCfgEnable=vancCfgEnable, sdiAudioSlotPosition=sdiAudioSlotPosition, vancGlobalStatusLast=vancGlobalStatusLast, vancGlobalStatusFrames=vancGlobalStatusFrames) |
#
# TrafficLight.py
# Taco --- SPH Innovation Challenge
#
# Created by Mat, Kon and Len on 2017-03-11.
# Copyright 2016 Researchnix. All rights reserved.
#
class TrafficLight:
# State is a 2D array with the values 0 and 1 associating red and green
# to the path from one incoming street to another outgoing street
state = {}
def __init__(self, incoming, outgoing):
for o in outgoing:
self.state[o.ID] = {}
for i in incoming:
self.state[o.ID][i.ID] = True
# For now every state is 1, so every car can go anywhere
def setState(self):
pass
# Dummy function, should actually decide if
# if a path on the intersection is clear
# depending on its current state
def pathAllowed(self, i, o):
return self.state[o][i]
# Another dummt functio
def update(self, time):
pass
| class Trafficlight:
state = {}
def __init__(self, incoming, outgoing):
for o in outgoing:
self.state[o.ID] = {}
for i in incoming:
self.state[o.ID][i.ID] = True
def set_state(self):
pass
def path_allowed(self, i, o):
return self.state[o][i]
def update(self, time):
pass |
mins = []
maxes = []
letters = []
passwords = []
with open("day2_input", "r") as f:
for line in f:
first, second = line.split(':')
first = first.split('-')
mins.append(int(first[0]))
maxes.append(int(first[1].split(' ')[0]))
letters.append(first[1].split(' ')[1])
passwords.append(second.lstrip(' ').rstrip('\n'))
def valid(min_l, max_l, letter, password):
count = password.count(letter)
return (min_l <= count) and (count <= max_l)
def valid2(index1, index2, letter, password):
# print(index1, index2, letter, password)
return ((password[index1-1] == letter) and (password[index2-1] != letter)) or ((password[index1-1] != letter) and (password[index2-1] == letter))
# part 1
# total = 0
# for (mn, mx, l, p) in zip(mins, maxes, letters, passwords):
# if valid(mn, mx, l, p):
# total += 1
# print(total)
# part 2
total = 0
for (mn, mx, l, p) in zip(mins, maxes, letters, passwords):
# print(valid2(mn, mx, l, p), mn, mx, l, p)
if valid2(mn, mx, l, p):
total += 1
print(total)
| mins = []
maxes = []
letters = []
passwords = []
with open('day2_input', 'r') as f:
for line in f:
(first, second) = line.split(':')
first = first.split('-')
mins.append(int(first[0]))
maxes.append(int(first[1].split(' ')[0]))
letters.append(first[1].split(' ')[1])
passwords.append(second.lstrip(' ').rstrip('\n'))
def valid(min_l, max_l, letter, password):
count = password.count(letter)
return min_l <= count and count <= max_l
def valid2(index1, index2, letter, password):
return password[index1 - 1] == letter and password[index2 - 1] != letter or (password[index1 - 1] != letter and password[index2 - 1] == letter)
total = 0
for (mn, mx, l, p) in zip(mins, maxes, letters, passwords):
if valid2(mn, mx, l, p):
total += 1
print(total) |
#
# PySNMP MIB module PDN-UPLINK-TAGGING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-UPLINK-TAGGING-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:39:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint")
pdn_common, = mibBuilder.importSymbols("PDN-HEADER-MIB", "pdn-common")
VlanId, = mibBuilder.importSymbols("Q-BRIDGE-MIB", "VlanId")
NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup")
Counter64, Integer32, NotificationType, Unsigned32, Counter32, IpAddress, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, TimeTicks, iso, ObjectIdentity, Gauge32, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Integer32", "NotificationType", "Unsigned32", "Counter32", "IpAddress", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "TimeTicks", "iso", "ObjectIdentity", "Gauge32", "ModuleIdentity")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
pdnUplinkTagging = ModuleIdentity((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37))
pdnUplinkTagging.setRevisions(('2003-03-12 00:00', '2002-05-15 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: pdnUplinkTagging.setRevisionsDescriptions(("Deprecated the origional objects, ultBaseVlanTag and ultIndex. Added new objects as follows: 1. pdnUltIndex - This new object is basically an Unsigned32 that excludes '0'. It idea is that different implementations will support different maximum values of the index. As such, the syntax for this object will cover any implementation and actual implementation specific maximum values should be documented in something like the implementation's SNMP Op Spec. 2. pdnGenUltBaseVlanTag - This object allows a any base VLAN Tag to be defined. 3. pdn48UltBaseVlanTag - This object defines a set of enumerations for base VLAN Tags for chassis/units that contain 48 ports. 4. pdn24UltBaseVlanTag - This object defines a set of enumerations for base VLAN Tags for chassis/units that contain 24 ports.", 'Initial Release.',))
if mibBuilder.loadTexts: pdnUplinkTagging.setLastUpdated('200303120000Z')
if mibBuilder.loadTexts: pdnUplinkTagging.setOrganization('Paradyne Networks MIB Working Group Other information about group editing the MIB')
if mibBuilder.loadTexts: pdnUplinkTagging.setContactInfo('Paradyne Networks, Inc. 8545 126th Avenue North Largo, FL 33733 www.paradyne.com General Comments to: mibwg_team@paradyne.com Editors Clay Sikes')
if mibBuilder.loadTexts: pdnUplinkTagging.setDescription("This MIB contains objects that are used to configure Uplink Tagging (ULT). Uplink Tagging is a term used to describe a feature that simplifies the setup and administration of networks where a service provider wants to use a unique VLAN per subscriber port. Ingress frames will get tagged with a VLAN and these tagged frame will be transmitted on the uplink port towards the WAN. In cases where the hardware implementation permits, multiple units can be interconnected together to form a 'Uplink Tagging Domain (ULT Domain)'. A ULT domain is defined as the set of interconnected Paradyne DSLAMs that share a common block of VLAN IDs. The maximum number of Paradyne DSLAMs that can be interconnected is implementation dependent. Generally, all DSLAMs in a ULT Domain will be configured with the same block of VLAN IDs. Each chassis/unit will be assigned a unique ULT Index within the ULT Domain. There are two parts of configuring Uplink Tagging: 1. Uplink Base VLAN Tag - This object specifies the beginning VLAN ID for a particular common block of VLAN IDs. This object will be defined as an enumeration whose values will depend on the number of port in a chassis/unit. 2. Uplink Tag Index - This object specifies the index within some block of VLAN IDs. Generally, this index can thought of a chassis/unit number as can be seen with the examples below.")
pdnUplinkTaggingObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 1))
pdnUplinkTaggingObjectsR2 = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 3))
pdnUltIndex = MibScalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 3, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: pdnUltIndex.setStatus('current')
if mibBuilder.loadTexts: pdnUltIndex.setDescription("This object represents VLAN tag index which is an index into a block of VLAN Tags the unit will use. Generally, this can be also thought of as the chassis/unit number in the case where multiple units are interconnected and form a ULT Domain described above. It is strongly encouraged that the upper limit for a particular implementation be clearly documented in the product's SNMP Op Spec.")
pdnGenUltBaseVlanTag = MibScalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 3, 2), VlanId().clone(16)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: pdnGenUltBaseVlanTag.setStatus('current')
if mibBuilder.loadTexts: pdnGenUltBaseVlanTag.setDescription("This object can be used to allow any Uplink Tagging Base Index to be entered when they don't like the 'canned' list defined in the objects below.")
pdn48UltBaseVlanTag = MibScalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 3, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("ultBase16", 1), ("ultBase512", 2), ("ultBase1024", 3), ("ultBase1536", 4), ("ultBase2048", 5), ("ultBase2560", 6), ("ultBase3072", 7), ("ultBase3584", 8))).clone('ultBase16')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: pdn48UltBaseVlanTag.setStatus('current')
if mibBuilder.loadTexts: pdn48UltBaseVlanTag.setDescription('This object represents Uplink Tagging base index which is the starting VLAN ID for a particular common block of VLAN IDs for chassis/units that contain 48 DSL subscriber ports.')
pdn24UltBaseVlanTag = MibScalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 3, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16))).clone(namedValues=NamedValues(("ultBase16", 1), ("ultBase256", 2), ("ultBase512", 3), ("ultBase768", 4), ("ultBase1024", 5), ("ultBase1280", 6), ("ultBase1536", 7), ("ultBase1792", 8), ("ultBase2048", 9), ("ultBase2304", 10), ("ultBase2560", 11), ("ultBase2816", 12), ("ultBase3072", 13), ("ultBase3328", 14), ("ultBase3584", 15), ("ultBase3840", 16))).clone('ultBase16')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: pdn24UltBaseVlanTag.setStatus('current')
if mibBuilder.loadTexts: pdn24UltBaseVlanTag.setDescription('This object represents Uplink Tagging base index which is the starting VLAN ID for a particular common block of VLAN IDs for chassis/units that contain 24 DSL subscriber ports.')
ultBaseVlanTag = MibScalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("ultBase16", 1), ("ultBase512", 2), ("ultBase1024", 3), ("ultBase1536", 4), ("ultBase2048", 5), ("ultBase2560", 6), ("ultBase3072", 7), ("ultBase3584", 8))).clone('ultBase16')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ultBaseVlanTag.setStatus('deprecated')
if mibBuilder.loadTexts: ultBaseVlanTag.setDescription('This object represents Uplink Tagging base index. This object has been deprecated. Please use an object defined in pdnUplinkTaggingObjectsR2.')
ultIndex = MibScalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 5)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ultIndex.setStatus('deprecated')
if mibBuilder.loadTexts: ultIndex.setDescription('This object represents VLAN tag index which represents an index into a block of VLAN Tags the unit will use. This object has been deprecated. Please use pdnUltIndex, which is more general below.')
pdnUplinkTaggingConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2))
pdnUplinkTaggingGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 1))
pdnUplinkTaggingCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 2))
pdnUplinkTaggingDeprecatedGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 3))
pdn48PortUpLinkTaggingGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 1, 1)).setObjects(("PDN-UPLINK-TAGGING-MIB", "pdnUltIndex"), ("PDN-UPLINK-TAGGING-MIB", "pdnGenUltBaseVlanTag"), ("PDN-UPLINK-TAGGING-MIB", "pdn48UltBaseVlanTag"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
pdn48PortUpLinkTaggingGroup = pdn48PortUpLinkTaggingGroup.setStatus('current')
if mibBuilder.loadTexts: pdn48PortUpLinkTaggingGroup.setDescription('Uplink Tagging Objects for 48-Port chassis/units.')
pdn24PortUpLinkTaggingGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 1, 2)).setObjects(("PDN-UPLINK-TAGGING-MIB", "pdnUltIndex"), ("PDN-UPLINK-TAGGING-MIB", "pdnGenUltBaseVlanTag"), ("PDN-UPLINK-TAGGING-MIB", "pdn24UltBaseVlanTag"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
pdn24PortUpLinkTaggingGroup = pdn24PortUpLinkTaggingGroup.setStatus('current')
if mibBuilder.loadTexts: pdn24PortUpLinkTaggingGroup.setDescription('Uplink Tagging Objects for 24-Port chassis/units.')
upLinkTaggingDeprecatedGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 3, 1)).setObjects(("PDN-UPLINK-TAGGING-MIB", "ultBaseVlanTag"), ("PDN-UPLINK-TAGGING-MIB", "ultIndex"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
upLinkTaggingDeprecatedGroup = upLinkTaggingDeprecatedGroup.setStatus('deprecated')
if mibBuilder.loadTexts: upLinkTaggingDeprecatedGroup.setDescription('Objects not to use.')
mibBuilder.exportSymbols("PDN-UPLINK-TAGGING-MIB", pdnUplinkTaggingObjectsR2=pdnUplinkTaggingObjectsR2, pdn24PortUpLinkTaggingGroup=pdn24PortUpLinkTaggingGroup, pdnGenUltBaseVlanTag=pdnGenUltBaseVlanTag, pdnUplinkTaggingCompliances=pdnUplinkTaggingCompliances, ultBaseVlanTag=ultBaseVlanTag, ultIndex=ultIndex, pdn48PortUpLinkTaggingGroup=pdn48PortUpLinkTaggingGroup, upLinkTaggingDeprecatedGroup=upLinkTaggingDeprecatedGroup, pdnUplinkTaggingConformance=pdnUplinkTaggingConformance, pdn48UltBaseVlanTag=pdn48UltBaseVlanTag, pdnUltIndex=pdnUltIndex, pdn24UltBaseVlanTag=pdn24UltBaseVlanTag, pdnUplinkTagging=pdnUplinkTagging, pdnUplinkTaggingObjects=pdnUplinkTaggingObjects, pdnUplinkTaggingDeprecatedGroup=pdnUplinkTaggingDeprecatedGroup, pdnUplinkTaggingGroups=pdnUplinkTaggingGroups, PYSNMP_MODULE_ID=pdnUplinkTagging)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ValueRangeConstraint', 'SingleValueConstraint')
(pdn_common,) = mibBuilder.importSymbols('PDN-HEADER-MIB', 'pdn-common')
(vlan_id,) = mibBuilder.importSymbols('Q-BRIDGE-MIB', 'VlanId')
(notification_group, module_compliance, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance', 'ObjectGroup')
(counter64, integer32, notification_type, unsigned32, counter32, ip_address, bits, mib_scalar, mib_table, mib_table_row, mib_table_column, mib_identifier, time_ticks, iso, object_identity, gauge32, module_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'Integer32', 'NotificationType', 'Unsigned32', 'Counter32', 'IpAddress', 'Bits', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'MibIdentifier', 'TimeTicks', 'iso', 'ObjectIdentity', 'Gauge32', 'ModuleIdentity')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
pdn_uplink_tagging = module_identity((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37))
pdnUplinkTagging.setRevisions(('2003-03-12 00:00', '2002-05-15 00:00'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
pdnUplinkTagging.setRevisionsDescriptions(("Deprecated the origional objects, ultBaseVlanTag and ultIndex. Added new objects as follows: 1. pdnUltIndex - This new object is basically an Unsigned32 that excludes '0'. It idea is that different implementations will support different maximum values of the index. As such, the syntax for this object will cover any implementation and actual implementation specific maximum values should be documented in something like the implementation's SNMP Op Spec. 2. pdnGenUltBaseVlanTag - This object allows a any base VLAN Tag to be defined. 3. pdn48UltBaseVlanTag - This object defines a set of enumerations for base VLAN Tags for chassis/units that contain 48 ports. 4. pdn24UltBaseVlanTag - This object defines a set of enumerations for base VLAN Tags for chassis/units that contain 24 ports.", 'Initial Release.'))
if mibBuilder.loadTexts:
pdnUplinkTagging.setLastUpdated('200303120000Z')
if mibBuilder.loadTexts:
pdnUplinkTagging.setOrganization('Paradyne Networks MIB Working Group Other information about group editing the MIB')
if mibBuilder.loadTexts:
pdnUplinkTagging.setContactInfo('Paradyne Networks, Inc. 8545 126th Avenue North Largo, FL 33733 www.paradyne.com General Comments to: mibwg_team@paradyne.com Editors Clay Sikes')
if mibBuilder.loadTexts:
pdnUplinkTagging.setDescription("This MIB contains objects that are used to configure Uplink Tagging (ULT). Uplink Tagging is a term used to describe a feature that simplifies the setup and administration of networks where a service provider wants to use a unique VLAN per subscriber port. Ingress frames will get tagged with a VLAN and these tagged frame will be transmitted on the uplink port towards the WAN. In cases where the hardware implementation permits, multiple units can be interconnected together to form a 'Uplink Tagging Domain (ULT Domain)'. A ULT domain is defined as the set of interconnected Paradyne DSLAMs that share a common block of VLAN IDs. The maximum number of Paradyne DSLAMs that can be interconnected is implementation dependent. Generally, all DSLAMs in a ULT Domain will be configured with the same block of VLAN IDs. Each chassis/unit will be assigned a unique ULT Index within the ULT Domain. There are two parts of configuring Uplink Tagging: 1. Uplink Base VLAN Tag - This object specifies the beginning VLAN ID for a particular common block of VLAN IDs. This object will be defined as an enumeration whose values will depend on the number of port in a chassis/unit. 2. Uplink Tag Index - This object specifies the index within some block of VLAN IDs. Generally, this index can thought of a chassis/unit number as can be seen with the examples below.")
pdn_uplink_tagging_objects = mib_identifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 1))
pdn_uplink_tagging_objects_r2 = mib_identifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 3))
pdn_ult_index = mib_scalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 3, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295)).clone(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
pdnUltIndex.setStatus('current')
if mibBuilder.loadTexts:
pdnUltIndex.setDescription("This object represents VLAN tag index which is an index into a block of VLAN Tags the unit will use. Generally, this can be also thought of as the chassis/unit number in the case where multiple units are interconnected and form a ULT Domain described above. It is strongly encouraged that the upper limit for a particular implementation be clearly documented in the product's SNMP Op Spec.")
pdn_gen_ult_base_vlan_tag = mib_scalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 3, 2), vlan_id().clone(16)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
pdnGenUltBaseVlanTag.setStatus('current')
if mibBuilder.loadTexts:
pdnGenUltBaseVlanTag.setDescription("This object can be used to allow any Uplink Tagging Base Index to be entered when they don't like the 'canned' list defined in the objects below.")
pdn48_ult_base_vlan_tag = mib_scalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 3, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('ultBase16', 1), ('ultBase512', 2), ('ultBase1024', 3), ('ultBase1536', 4), ('ultBase2048', 5), ('ultBase2560', 6), ('ultBase3072', 7), ('ultBase3584', 8))).clone('ultBase16')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
pdn48UltBaseVlanTag.setStatus('current')
if mibBuilder.loadTexts:
pdn48UltBaseVlanTag.setDescription('This object represents Uplink Tagging base index which is the starting VLAN ID for a particular common block of VLAN IDs for chassis/units that contain 48 DSL subscriber ports.')
pdn24_ult_base_vlan_tag = mib_scalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 3, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16))).clone(namedValues=named_values(('ultBase16', 1), ('ultBase256', 2), ('ultBase512', 3), ('ultBase768', 4), ('ultBase1024', 5), ('ultBase1280', 6), ('ultBase1536', 7), ('ultBase1792', 8), ('ultBase2048', 9), ('ultBase2304', 10), ('ultBase2560', 11), ('ultBase2816', 12), ('ultBase3072', 13), ('ultBase3328', 14), ('ultBase3584', 15), ('ultBase3840', 16))).clone('ultBase16')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
pdn24UltBaseVlanTag.setStatus('current')
if mibBuilder.loadTexts:
pdn24UltBaseVlanTag.setDescription('This object represents Uplink Tagging base index which is the starting VLAN ID for a particular common block of VLAN IDs for chassis/units that contain 24 DSL subscriber ports.')
ult_base_vlan_tag = mib_scalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('ultBase16', 1), ('ultBase512', 2), ('ultBase1024', 3), ('ultBase1536', 4), ('ultBase2048', 5), ('ultBase2560', 6), ('ultBase3072', 7), ('ultBase3584', 8))).clone('ultBase16')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ultBaseVlanTag.setStatus('deprecated')
if mibBuilder.loadTexts:
ultBaseVlanTag.setDescription('This object represents Uplink Tagging base index. This object has been deprecated. Please use an object defined in pdnUplinkTaggingObjectsR2.')
ult_index = mib_scalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 5)).clone(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ultIndex.setStatus('deprecated')
if mibBuilder.loadTexts:
ultIndex.setDescription('This object represents VLAN tag index which represents an index into a block of VLAN Tags the unit will use. This object has been deprecated. Please use pdnUltIndex, which is more general below.')
pdn_uplink_tagging_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2))
pdn_uplink_tagging_groups = mib_identifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 1))
pdn_uplink_tagging_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 2))
pdn_uplink_tagging_deprecated_group = mib_identifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 3))
pdn48_port_up_link_tagging_group = object_group((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 1, 1)).setObjects(('PDN-UPLINK-TAGGING-MIB', 'pdnUltIndex'), ('PDN-UPLINK-TAGGING-MIB', 'pdnGenUltBaseVlanTag'), ('PDN-UPLINK-TAGGING-MIB', 'pdn48UltBaseVlanTag'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
pdn48_port_up_link_tagging_group = pdn48PortUpLinkTaggingGroup.setStatus('current')
if mibBuilder.loadTexts:
pdn48PortUpLinkTaggingGroup.setDescription('Uplink Tagging Objects for 48-Port chassis/units.')
pdn24_port_up_link_tagging_group = object_group((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 1, 2)).setObjects(('PDN-UPLINK-TAGGING-MIB', 'pdnUltIndex'), ('PDN-UPLINK-TAGGING-MIB', 'pdnGenUltBaseVlanTag'), ('PDN-UPLINK-TAGGING-MIB', 'pdn24UltBaseVlanTag'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
pdn24_port_up_link_tagging_group = pdn24PortUpLinkTaggingGroup.setStatus('current')
if mibBuilder.loadTexts:
pdn24PortUpLinkTaggingGroup.setDescription('Uplink Tagging Objects for 24-Port chassis/units.')
up_link_tagging_deprecated_group = object_group((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 37, 2, 3, 1)).setObjects(('PDN-UPLINK-TAGGING-MIB', 'ultBaseVlanTag'), ('PDN-UPLINK-TAGGING-MIB', 'ultIndex'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
up_link_tagging_deprecated_group = upLinkTaggingDeprecatedGroup.setStatus('deprecated')
if mibBuilder.loadTexts:
upLinkTaggingDeprecatedGroup.setDescription('Objects not to use.')
mibBuilder.exportSymbols('PDN-UPLINK-TAGGING-MIB', pdnUplinkTaggingObjectsR2=pdnUplinkTaggingObjectsR2, pdn24PortUpLinkTaggingGroup=pdn24PortUpLinkTaggingGroup, pdnGenUltBaseVlanTag=pdnGenUltBaseVlanTag, pdnUplinkTaggingCompliances=pdnUplinkTaggingCompliances, ultBaseVlanTag=ultBaseVlanTag, ultIndex=ultIndex, pdn48PortUpLinkTaggingGroup=pdn48PortUpLinkTaggingGroup, upLinkTaggingDeprecatedGroup=upLinkTaggingDeprecatedGroup, pdnUplinkTaggingConformance=pdnUplinkTaggingConformance, pdn48UltBaseVlanTag=pdn48UltBaseVlanTag, pdnUltIndex=pdnUltIndex, pdn24UltBaseVlanTag=pdn24UltBaseVlanTag, pdnUplinkTagging=pdnUplinkTagging, pdnUplinkTaggingObjects=pdnUplinkTaggingObjects, pdnUplinkTaggingDeprecatedGroup=pdnUplinkTaggingDeprecatedGroup, pdnUplinkTaggingGroups=pdnUplinkTaggingGroups, PYSNMP_MODULE_ID=pdnUplinkTagging) |
class Chromosome:
def __init__(self, gene):
self.gene = gene
| class Chromosome:
def __init__(self, gene):
self.gene = gene |
"""
Runtime: 800 ms, faster than 31.40% of Python3 online submissions for Two Sum.
Memory Usage: 14.9 MB, less than 11.62% of Python3 online submissions for Two Sum.
https://leetcode.com/problems/two-sum
"""
def twoSum(nums, target):
# nums is a list of given numbers
# target is our goal
for i in range(len(nums)):
cn = nums[i]
lf = target - cn
if lf in nums:
if nums.index(lf) != i:
return [i, nums.index(lf)]
print(twoSum([3, 2, 4], 6))
| """
Runtime: 800 ms, faster than 31.40% of Python3 online submissions for Two Sum.
Memory Usage: 14.9 MB, less than 11.62% of Python3 online submissions for Two Sum.
https://leetcode.com/problems/two-sum
"""
def two_sum(nums, target):
for i in range(len(nums)):
cn = nums[i]
lf = target - cn
if lf in nums:
if nums.index(lf) != i:
return [i, nums.index(lf)]
print(two_sum([3, 2, 4], 6)) |
#
# PySNMP MIB module FDRY-RADIUS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FDRY-RADIUS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:59:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection")
fdryRadius, = mibBuilder.importSymbols("FOUNDRY-SN-ROOT-MIB", "fdryRadius")
InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
MibScalar, MibTable, MibTableRow, MibTableColumn, iso, ModuleIdentity, Integer32, TimeTicks, Unsigned32, Counter32, Counter64, NotificationType, MibIdentifier, Gauge32, Bits, ObjectIdentity, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "ModuleIdentity", "Integer32", "TimeTicks", "Unsigned32", "Counter32", "Counter64", "NotificationType", "MibIdentifier", "Gauge32", "Bits", "ObjectIdentity", "IpAddress")
TextualConvention, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "DisplayString")
fdryRadiusMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1))
fdryRadiusMIB.setRevisions(('2010-06-02 00:00', '2008-02-25 00:00',))
if mibBuilder.loadTexts: fdryRadiusMIB.setLastUpdated('201006020000Z')
if mibBuilder.loadTexts: fdryRadiusMIB.setOrganization('Brocade Communications Systems, Inc.')
class ServerUsage(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("default", 1), ("authenticationOnly", 2), ("authorizationOnly", 3), ("accountingOnly", 4))
fdryRadiusServer = MibIdentifier((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1))
fdryRadiusServerTable = MibTable((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1), )
if mibBuilder.loadTexts: fdryRadiusServerTable.setStatus('current')
fdryRadiusServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1), ).setIndexNames((0, "FDRY-RADIUS-MIB", "fdryRadiusServerIndex"))
if mibBuilder.loadTexts: fdryRadiusServerEntry.setStatus('current')
fdryRadiusServerIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 1), Unsigned32())
if mibBuilder.loadTexts: fdryRadiusServerIndex.setStatus('current')
fdryRadiusServerAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 2), InetAddressType().clone('ipv4')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: fdryRadiusServerAddrType.setStatus('current')
fdryRadiusServerAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 3), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: fdryRadiusServerAddr.setStatus('current')
fdryRadiusServerAuthPort = MibTableColumn((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 4), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: fdryRadiusServerAuthPort.setStatus('current')
fdryRadiusServerAcctPort = MibTableColumn((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 5), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: fdryRadiusServerAcctPort.setStatus('current')
fdryRadiusServerRowKey = MibTableColumn((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 6), DisplayString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: fdryRadiusServerRowKey.setStatus('current')
fdryRadiusServerUsage = MibTableColumn((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 7), ServerUsage().clone('default')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: fdryRadiusServerUsage.setStatus('current')
fdryRadiusServerRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 8), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: fdryRadiusServerRowStatus.setStatus('current')
mibBuilder.exportSymbols("FDRY-RADIUS-MIB", fdryRadiusServerTable=fdryRadiusServerTable, fdryRadiusServerAddr=fdryRadiusServerAddr, PYSNMP_MODULE_ID=fdryRadiusMIB, ServerUsage=ServerUsage, fdryRadiusServerAddrType=fdryRadiusServerAddrType, fdryRadiusMIB=fdryRadiusMIB, fdryRadiusServerEntry=fdryRadiusServerEntry, fdryRadiusServerIndex=fdryRadiusServerIndex, fdryRadiusServer=fdryRadiusServer, fdryRadiusServerUsage=fdryRadiusServerUsage, fdryRadiusServerAcctPort=fdryRadiusServerAcctPort, fdryRadiusServerAuthPort=fdryRadiusServerAuthPort, fdryRadiusServerRowStatus=fdryRadiusServerRowStatus, fdryRadiusServerRowKey=fdryRadiusServerRowKey)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection')
(fdry_radius,) = mibBuilder.importSymbols('FOUNDRY-SN-ROOT-MIB', 'fdryRadius')
(inet_address_type, inet_address) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressType', 'InetAddress')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(mib_scalar, mib_table, mib_table_row, mib_table_column, iso, module_identity, integer32, time_ticks, unsigned32, counter32, counter64, notification_type, mib_identifier, gauge32, bits, object_identity, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'ModuleIdentity', 'Integer32', 'TimeTicks', 'Unsigned32', 'Counter32', 'Counter64', 'NotificationType', 'MibIdentifier', 'Gauge32', 'Bits', 'ObjectIdentity', 'IpAddress')
(textual_convention, row_status, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'RowStatus', 'DisplayString')
fdry_radius_mib = module_identity((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1))
fdryRadiusMIB.setRevisions(('2010-06-02 00:00', '2008-02-25 00:00'))
if mibBuilder.loadTexts:
fdryRadiusMIB.setLastUpdated('201006020000Z')
if mibBuilder.loadTexts:
fdryRadiusMIB.setOrganization('Brocade Communications Systems, Inc.')
class Serverusage(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4))
named_values = named_values(('default', 1), ('authenticationOnly', 2), ('authorizationOnly', 3), ('accountingOnly', 4))
fdry_radius_server = mib_identifier((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1))
fdry_radius_server_table = mib_table((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1))
if mibBuilder.loadTexts:
fdryRadiusServerTable.setStatus('current')
fdry_radius_server_entry = mib_table_row((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1)).setIndexNames((0, 'FDRY-RADIUS-MIB', 'fdryRadiusServerIndex'))
if mibBuilder.loadTexts:
fdryRadiusServerEntry.setStatus('current')
fdry_radius_server_index = mib_table_column((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 1), unsigned32())
if mibBuilder.loadTexts:
fdryRadiusServerIndex.setStatus('current')
fdry_radius_server_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 2), inet_address_type().clone('ipv4')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
fdryRadiusServerAddrType.setStatus('current')
fdry_radius_server_addr = mib_table_column((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 3), inet_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
fdryRadiusServerAddr.setStatus('current')
fdry_radius_server_auth_port = mib_table_column((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 4), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
fdryRadiusServerAuthPort.setStatus('current')
fdry_radius_server_acct_port = mib_table_column((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 5), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
fdryRadiusServerAcctPort.setStatus('current')
fdry_radius_server_row_key = mib_table_column((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 6), display_string()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
fdryRadiusServerRowKey.setStatus('current')
fdry_radius_server_usage = mib_table_column((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 7), server_usage().clone('default')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
fdryRadiusServerUsage.setStatus('current')
fdry_radius_server_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 1991, 1, 1, 8, 1, 1, 1, 1, 8), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
fdryRadiusServerRowStatus.setStatus('current')
mibBuilder.exportSymbols('FDRY-RADIUS-MIB', fdryRadiusServerTable=fdryRadiusServerTable, fdryRadiusServerAddr=fdryRadiusServerAddr, PYSNMP_MODULE_ID=fdryRadiusMIB, ServerUsage=ServerUsage, fdryRadiusServerAddrType=fdryRadiusServerAddrType, fdryRadiusMIB=fdryRadiusMIB, fdryRadiusServerEntry=fdryRadiusServerEntry, fdryRadiusServerIndex=fdryRadiusServerIndex, fdryRadiusServer=fdryRadiusServer, fdryRadiusServerUsage=fdryRadiusServerUsage, fdryRadiusServerAcctPort=fdryRadiusServerAcctPort, fdryRadiusServerAuthPort=fdryRadiusServerAuthPort, fdryRadiusServerRowStatus=fdryRadiusServerRowStatus, fdryRadiusServerRowKey=fdryRadiusServerRowKey) |
input = """
% Enforce that <MUST_BE_TRUE,a> is in the queue before <TRUE,a>
:- x.
:- y.
x :- not a.
a :- not y.
% A rule with w and y in the head, such that they are not optimised away.
w v y v z.
% If <MUST_BE_TRUE,a> is in the queue before <TRUE,a>, the undefPosBody counter
% in this constraint should be decremented exactly once.
% If it is decremented twice, a bogus inconsistency is detected.
:- a, w.
"""
output = """
{a, z}
"""
| input = '\n% Enforce that <MUST_BE_TRUE,a> is in the queue before <TRUE,a>\n:- x.\n:- y.\n\nx :- not a.\na :- not y.\n\n% A rule with w and y in the head, such that they are not optimised away.\nw v y v z.\n\n% If <MUST_BE_TRUE,a> is in the queue before <TRUE,a>, the undefPosBody counter\n% in this constraint should be decremented exactly once.\n% If it is decremented twice, a bogus inconsistency is detected.\n:- a, w.\n\n'
output = '\n{a, z}\n' |
expected_output = {
"ap_name": {
"b25a-13-cap10": {
"ap_mac": "3c41.0fee.5094",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25b-12-cap01": {
"ap_mac": "3c41.0fee.5884",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25b-11-cap01": {
"ap_mac": "3c41.0fee.5d90",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-12-cap07": {
"ap_mac": "3c41.0fee.5de8",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-11-cap05": {
"ap_mac": "3c41.0fee.5df0",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-11-cap04": {
"ap_mac": "3c41.0fee.5e5c",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-12-cap08": {
"ap_mac": "3c41.0fee.5e74",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-11-cap01": {
"ap_mac": "3c41.0fee.5eac",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-11-cap08": {
"ap_mac": "3c41.0fee.5ef8",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-11-cap02": {
"ap_mac": "3c41.0fee.5f94",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-11-cap07": {
"ap_mac": "3c41.0fee.5fbc",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-12-cap02": {
"ap_mac": "2c57.4518.16ac",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25b-11-cap06": {
"ap_mac": "2c57.4518.2df0",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25b-11-cap08": {
"ap_mac": "2c57.4518.41b0",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25b-11-cap07": {
"ap_mac": "2c57.4518.432c",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-12-cap11": {
"ap_mac": "2c57.4518.4330",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25b-12-cap02": {
"ap_mac": "3c41.0fee.4394",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-13-cap09": {
"ap_mac": "2c57.4518.564c",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25b-12-cap03": {
"ap_mac": "2c57.4518.5b40",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
"b25a-12-cap10": {
"ap_mac": "2c57.4518.5b48",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "Static",
},
},
"number_of_aps": 20,
}
| expected_output = {'ap_name': {'b25a-13-cap10': {'ap_mac': '3c41.0fee.5094', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25b-12-cap01': {'ap_mac': '3c41.0fee.5884', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25b-11-cap01': {'ap_mac': '3c41.0fee.5d90', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-12-cap07': {'ap_mac': '3c41.0fee.5de8', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-11-cap05': {'ap_mac': '3c41.0fee.5df0', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-11-cap04': {'ap_mac': '3c41.0fee.5e5c', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-12-cap08': {'ap_mac': '3c41.0fee.5e74', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-11-cap01': {'ap_mac': '3c41.0fee.5eac', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-11-cap08': {'ap_mac': '3c41.0fee.5ef8', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-11-cap02': {'ap_mac': '3c41.0fee.5f94', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-11-cap07': {'ap_mac': '3c41.0fee.5fbc', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-12-cap02': {'ap_mac': '2c57.4518.16ac', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25b-11-cap06': {'ap_mac': '2c57.4518.2df0', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25b-11-cap08': {'ap_mac': '2c57.4518.41b0', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25b-11-cap07': {'ap_mac': '2c57.4518.432c', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-12-cap11': {'ap_mac': '2c57.4518.4330', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25b-12-cap02': {'ap_mac': '3c41.0fee.4394', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-13-cap09': {'ap_mac': '2c57.4518.564c', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25b-12-cap03': {'ap_mac': '2c57.4518.5b40', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25a-12-cap10': {'ap_mac': '2c57.4518.5b48', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}}, 'number_of_aps': 20} |
epoch = 100
train_result = "/home/yetaoyu/zc/Classification/patch_train_results"
train_dataset_dir = "/home/yetaoyu/zc/Classification/patch_data"
test_data_dir = "/home/yetaoyu/zc/Classification/patch_data"
test_result_dir = "/home/yetaoyu/zc/Classification/patch_test_results"
model_weight_path = "/home/yetaoyu/zc/Classification/patch_train_results" | epoch = 100
train_result = '/home/yetaoyu/zc/Classification/patch_train_results'
train_dataset_dir = '/home/yetaoyu/zc/Classification/patch_data'
test_data_dir = '/home/yetaoyu/zc/Classification/patch_data'
test_result_dir = '/home/yetaoyu/zc/Classification/patch_test_results'
model_weight_path = '/home/yetaoyu/zc/Classification/patch_train_results' |
bunsyou = "I am a"
gengo = "cat"
if len(gengo) > 3:
print(gengo)
elif bunsyou[-1] == gengo[1]:
print(bunsyou)
else:
print(bunsyou + " " + gengo)
| bunsyou = 'I am a'
gengo = 'cat'
if len(gengo) > 3:
print(gengo)
elif bunsyou[-1] == gengo[1]:
print(bunsyou)
else:
print(bunsyou + ' ' + gengo) |
# Space: O(n)
# Time: O(n!)
class Solution:
def permuteUnique(self, nums):
def backtracking(nums_list, temp_list, res, visited):
if len(nums_list) == len(temp_list):
res.append(temp_list[:])
for i, num in enumerate(nums_list):
if visited[i]: continue
if i > 0 and nums_list[i] == nums_list[i - 1] and not visited[i - 1]: continue
temp_list.append(num)
visited[i] = True
backtracking(nums_list, temp_list, res, visited)
temp_list.pop()
visited[i] = False
return res
nums.sort()
visited = [False for _ in range(len(nums))]
return backtracking(nums, [], [], visited)
| class Solution:
def permute_unique(self, nums):
def backtracking(nums_list, temp_list, res, visited):
if len(nums_list) == len(temp_list):
res.append(temp_list[:])
for (i, num) in enumerate(nums_list):
if visited[i]:
continue
if i > 0 and nums_list[i] == nums_list[i - 1] and (not visited[i - 1]):
continue
temp_list.append(num)
visited[i] = True
backtracking(nums_list, temp_list, res, visited)
temp_list.pop()
visited[i] = False
return res
nums.sort()
visited = [False for _ in range(len(nums))]
return backtracking(nums, [], [], visited) |
#
# PySNMP MIB module HH3C-NVGRE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-NVGRE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:16:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion")
hh3cCommon, = mibBuilder.importSymbols("HH3C-OID-MIB", "hh3cCommon")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ModuleIdentity, IpAddress, MibIdentifier, TimeTicks, Gauge32, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, NotificationType, Integer32, Unsigned32, iso, Bits, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "IpAddress", "MibIdentifier", "TimeTicks", "Gauge32", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "NotificationType", "Integer32", "Unsigned32", "iso", "Bits", "ObjectIdentity")
DisplayString, TextualConvention, MacAddress, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "MacAddress", "RowStatus")
hh3cNvgre = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 156))
hh3cNvgre.setRevisions(('2014-03-11 09:00',))
if mibBuilder.loadTexts: hh3cNvgre.setLastUpdated('201403110900Z')
if mibBuilder.loadTexts: hh3cNvgre.setOrganization('Hangzhou H3C Technologies Co., Ltd.')
hh3cNvgreObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1))
hh3cNvgreScalarGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 1))
hh3cNvgreNextNvgreID = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cNvgreNextNvgreID.setStatus('current')
hh3cNvgreConfigured = MibScalar((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cNvgreConfigured.setStatus('current')
hh3cNvgreTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2), )
if mibBuilder.loadTexts: hh3cNvgreTable.setStatus('current')
hh3cNvgreEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2, 1), ).setIndexNames((0, "HH3C-NVGRE-MIB", "hh3cNvgreID"))
if mibBuilder.loadTexts: hh3cNvgreEntry.setStatus('current')
hh3cNvgreID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2, 1, 1), Unsigned32())
if mibBuilder.loadTexts: hh3cNvgreID.setStatus('current')
hh3cNvgreVsiIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2, 1, 2), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cNvgreVsiIndex.setStatus('current')
hh3cNvgreRemoteMacCount = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cNvgreRemoteMacCount.setStatus('current')
hh3cNvgreRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2, 1, 4), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cNvgreRowStatus.setStatus('current')
hh3cNvgreTunnelTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3), )
if mibBuilder.loadTexts: hh3cNvgreTunnelTable.setStatus('current')
hh3cNvgreTunnelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3, 1), ).setIndexNames((0, "HH3C-NVGRE-MIB", "hh3cNvgreID"), (0, "HH3C-NVGRE-MIB", "hh3cNvgreTunnelID"))
if mibBuilder.loadTexts: hh3cNvgreTunnelEntry.setStatus('current')
hh3cNvgreTunnelID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3, 1, 1), Unsigned32())
if mibBuilder.loadTexts: hh3cNvgreTunnelID.setStatus('current')
hh3cNvgreTunnelRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3, 1, 2), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cNvgreTunnelRowStatus.setStatus('current')
hh3cNvgreTunnelOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cNvgreTunnelOctets.setStatus('current')
hh3cNvgreTunnelPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cNvgreTunnelPackets.setStatus('current')
hh3cNvgreTunnelBoundTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 4), )
if mibBuilder.loadTexts: hh3cNvgreTunnelBoundTable.setStatus('current')
hh3cNvgreTunnelBoundEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 4, 1), ).setIndexNames((0, "HH3C-NVGRE-MIB", "hh3cNvgreTunnelID"))
if mibBuilder.loadTexts: hh3cNvgreTunnelBoundEntry.setStatus('current')
hh3cNvgreTunnelBoundNvgreNum = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 4, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cNvgreTunnelBoundNvgreNum.setStatus('current')
hh3cNvgreMacTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 5), )
if mibBuilder.loadTexts: hh3cNvgreMacTable.setStatus('current')
hh3cNvgreMacEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 5, 1), ).setIndexNames((0, "HH3C-NVGRE-MIB", "hh3cNvgreVsiIndex"), (0, "HH3C-NVGRE-MIB", "hh3cNvgreMacAddr"))
if mibBuilder.loadTexts: hh3cNvgreMacEntry.setStatus('current')
hh3cNvgreMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 5, 1, 1), MacAddress())
if mibBuilder.loadTexts: hh3cNvgreMacAddr.setStatus('current')
hh3cNvgreMacTunnelID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 5, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cNvgreMacTunnelID.setStatus('current')
hh3cNvgreMacType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("selfLearned", 1), ("staticConfigured", 2), ("protocolLearned", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cNvgreMacType.setStatus('current')
hh3cNvgreStaticMacTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 6), )
if mibBuilder.loadTexts: hh3cNvgreStaticMacTable.setStatus('current')
hh3cNvgreStaticMacEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 6, 1), ).setIndexNames((0, "HH3C-NVGRE-MIB", "hh3cNvgreVsiIndex"), (0, "HH3C-NVGRE-MIB", "hh3cNvgreStaticMacAddr"))
if mibBuilder.loadTexts: hh3cNvgreStaticMacEntry.setStatus('current')
hh3cNvgreStaticMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 6, 1, 1), MacAddress())
if mibBuilder.loadTexts: hh3cNvgreStaticMacAddr.setStatus('current')
hh3cNvgreStaticMacTunnelID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 6, 1, 2), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cNvgreStaticMacTunnelID.setStatus('current')
hh3cNvgreStaticMacRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 6, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cNvgreStaticMacRowStatus.setStatus('current')
mibBuilder.exportSymbols("HH3C-NVGRE-MIB", hh3cNvgreScalarGroup=hh3cNvgreScalarGroup, hh3cNvgreTunnelBoundNvgreNum=hh3cNvgreTunnelBoundNvgreNum, hh3cNvgreConfigured=hh3cNvgreConfigured, hh3cNvgreTable=hh3cNvgreTable, hh3cNvgreMacTunnelID=hh3cNvgreMacTunnelID, hh3cNvgreRowStatus=hh3cNvgreRowStatus, hh3cNvgreTunnelBoundEntry=hh3cNvgreTunnelBoundEntry, hh3cNvgreObjects=hh3cNvgreObjects, hh3cNvgreTunnelEntry=hh3cNvgreTunnelEntry, hh3cNvgreStaticMacAddr=hh3cNvgreStaticMacAddr, hh3cNvgreStaticMacTunnelID=hh3cNvgreStaticMacTunnelID, hh3cNvgreTunnelTable=hh3cNvgreTunnelTable, hh3cNvgreNextNvgreID=hh3cNvgreNextNvgreID, PYSNMP_MODULE_ID=hh3cNvgre, hh3cNvgreTunnelID=hh3cNvgreTunnelID, hh3cNvgre=hh3cNvgre, hh3cNvgreRemoteMacCount=hh3cNvgreRemoteMacCount, hh3cNvgreTunnelOctets=hh3cNvgreTunnelOctets, hh3cNvgreMacEntry=hh3cNvgreMacEntry, hh3cNvgreID=hh3cNvgreID, hh3cNvgreTunnelPackets=hh3cNvgreTunnelPackets, hh3cNvgreVsiIndex=hh3cNvgreVsiIndex, hh3cNvgreMacType=hh3cNvgreMacType, hh3cNvgreTunnelBoundTable=hh3cNvgreTunnelBoundTable, hh3cNvgreMacTable=hh3cNvgreMacTable, hh3cNvgreStaticMacRowStatus=hh3cNvgreStaticMacRowStatus, hh3cNvgreTunnelRowStatus=hh3cNvgreTunnelRowStatus, hh3cNvgreStaticMacEntry=hh3cNvgreStaticMacEntry, hh3cNvgreMacAddr=hh3cNvgreMacAddr, hh3cNvgreEntry=hh3cNvgreEntry, hh3cNvgreStaticMacTable=hh3cNvgreStaticMacTable)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ConstraintsUnion')
(hh3c_common,) = mibBuilder.importSymbols('HH3C-OID-MIB', 'hh3cCommon')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(module_identity, ip_address, mib_identifier, time_ticks, gauge32, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, notification_type, integer32, unsigned32, iso, bits, object_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'IpAddress', 'MibIdentifier', 'TimeTicks', 'Gauge32', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'NotificationType', 'Integer32', 'Unsigned32', 'iso', 'Bits', 'ObjectIdentity')
(display_string, textual_convention, mac_address, row_status) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention', 'MacAddress', 'RowStatus')
hh3c_nvgre = module_identity((1, 3, 6, 1, 4, 1, 25506, 2, 156))
hh3cNvgre.setRevisions(('2014-03-11 09:00',))
if mibBuilder.loadTexts:
hh3cNvgre.setLastUpdated('201403110900Z')
if mibBuilder.loadTexts:
hh3cNvgre.setOrganization('Hangzhou H3C Technologies Co., Ltd.')
hh3c_nvgre_objects = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1))
hh3c_nvgre_scalar_group = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 1))
hh3c_nvgre_next_nvgre_id = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 1, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cNvgreNextNvgreID.setStatus('current')
hh3c_nvgre_configured = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 1, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cNvgreConfigured.setStatus('current')
hh3c_nvgre_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2))
if mibBuilder.loadTexts:
hh3cNvgreTable.setStatus('current')
hh3c_nvgre_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2, 1)).setIndexNames((0, 'HH3C-NVGRE-MIB', 'hh3cNvgreID'))
if mibBuilder.loadTexts:
hh3cNvgreEntry.setStatus('current')
hh3c_nvgre_id = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2, 1, 1), unsigned32())
if mibBuilder.loadTexts:
hh3cNvgreID.setStatus('current')
hh3c_nvgre_vsi_index = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2, 1, 2), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cNvgreVsiIndex.setStatus('current')
hh3c_nvgre_remote_mac_count = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2, 1, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cNvgreRemoteMacCount.setStatus('current')
hh3c_nvgre_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 2, 1, 4), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cNvgreRowStatus.setStatus('current')
hh3c_nvgre_tunnel_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3))
if mibBuilder.loadTexts:
hh3cNvgreTunnelTable.setStatus('current')
hh3c_nvgre_tunnel_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3, 1)).setIndexNames((0, 'HH3C-NVGRE-MIB', 'hh3cNvgreID'), (0, 'HH3C-NVGRE-MIB', 'hh3cNvgreTunnelID'))
if mibBuilder.loadTexts:
hh3cNvgreTunnelEntry.setStatus('current')
hh3c_nvgre_tunnel_id = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3, 1, 1), unsigned32())
if mibBuilder.loadTexts:
hh3cNvgreTunnelID.setStatus('current')
hh3c_nvgre_tunnel_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3, 1, 2), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cNvgreTunnelRowStatus.setStatus('current')
hh3c_nvgre_tunnel_octets = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3, 1, 3), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cNvgreTunnelOctets.setStatus('current')
hh3c_nvgre_tunnel_packets = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 3, 1, 4), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cNvgreTunnelPackets.setStatus('current')
hh3c_nvgre_tunnel_bound_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 4))
if mibBuilder.loadTexts:
hh3cNvgreTunnelBoundTable.setStatus('current')
hh3c_nvgre_tunnel_bound_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 4, 1)).setIndexNames((0, 'HH3C-NVGRE-MIB', 'hh3cNvgreTunnelID'))
if mibBuilder.loadTexts:
hh3cNvgreTunnelBoundEntry.setStatus('current')
hh3c_nvgre_tunnel_bound_nvgre_num = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 4, 1, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cNvgreTunnelBoundNvgreNum.setStatus('current')
hh3c_nvgre_mac_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 5))
if mibBuilder.loadTexts:
hh3cNvgreMacTable.setStatus('current')
hh3c_nvgre_mac_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 5, 1)).setIndexNames((0, 'HH3C-NVGRE-MIB', 'hh3cNvgreVsiIndex'), (0, 'HH3C-NVGRE-MIB', 'hh3cNvgreMacAddr'))
if mibBuilder.loadTexts:
hh3cNvgreMacEntry.setStatus('current')
hh3c_nvgre_mac_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 5, 1, 1), mac_address())
if mibBuilder.loadTexts:
hh3cNvgreMacAddr.setStatus('current')
hh3c_nvgre_mac_tunnel_id = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 5, 1, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cNvgreMacTunnelID.setStatus('current')
hh3c_nvgre_mac_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 5, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('selfLearned', 1), ('staticConfigured', 2), ('protocolLearned', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cNvgreMacType.setStatus('current')
hh3c_nvgre_static_mac_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 6))
if mibBuilder.loadTexts:
hh3cNvgreStaticMacTable.setStatus('current')
hh3c_nvgre_static_mac_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 6, 1)).setIndexNames((0, 'HH3C-NVGRE-MIB', 'hh3cNvgreVsiIndex'), (0, 'HH3C-NVGRE-MIB', 'hh3cNvgreStaticMacAddr'))
if mibBuilder.loadTexts:
hh3cNvgreStaticMacEntry.setStatus('current')
hh3c_nvgre_static_mac_addr = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 6, 1, 1), mac_address())
if mibBuilder.loadTexts:
hh3cNvgreStaticMacAddr.setStatus('current')
hh3c_nvgre_static_mac_tunnel_id = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 6, 1, 2), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cNvgreStaticMacTunnelID.setStatus('current')
hh3c_nvgre_static_mac_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 2, 156, 1, 6, 1, 3), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cNvgreStaticMacRowStatus.setStatus('current')
mibBuilder.exportSymbols('HH3C-NVGRE-MIB', hh3cNvgreScalarGroup=hh3cNvgreScalarGroup, hh3cNvgreTunnelBoundNvgreNum=hh3cNvgreTunnelBoundNvgreNum, hh3cNvgreConfigured=hh3cNvgreConfigured, hh3cNvgreTable=hh3cNvgreTable, hh3cNvgreMacTunnelID=hh3cNvgreMacTunnelID, hh3cNvgreRowStatus=hh3cNvgreRowStatus, hh3cNvgreTunnelBoundEntry=hh3cNvgreTunnelBoundEntry, hh3cNvgreObjects=hh3cNvgreObjects, hh3cNvgreTunnelEntry=hh3cNvgreTunnelEntry, hh3cNvgreStaticMacAddr=hh3cNvgreStaticMacAddr, hh3cNvgreStaticMacTunnelID=hh3cNvgreStaticMacTunnelID, hh3cNvgreTunnelTable=hh3cNvgreTunnelTable, hh3cNvgreNextNvgreID=hh3cNvgreNextNvgreID, PYSNMP_MODULE_ID=hh3cNvgre, hh3cNvgreTunnelID=hh3cNvgreTunnelID, hh3cNvgre=hh3cNvgre, hh3cNvgreRemoteMacCount=hh3cNvgreRemoteMacCount, hh3cNvgreTunnelOctets=hh3cNvgreTunnelOctets, hh3cNvgreMacEntry=hh3cNvgreMacEntry, hh3cNvgreID=hh3cNvgreID, hh3cNvgreTunnelPackets=hh3cNvgreTunnelPackets, hh3cNvgreVsiIndex=hh3cNvgreVsiIndex, hh3cNvgreMacType=hh3cNvgreMacType, hh3cNvgreTunnelBoundTable=hh3cNvgreTunnelBoundTable, hh3cNvgreMacTable=hh3cNvgreMacTable, hh3cNvgreStaticMacRowStatus=hh3cNvgreStaticMacRowStatus, hh3cNvgreTunnelRowStatus=hh3cNvgreTunnelRowStatus, hh3cNvgreStaticMacEntry=hh3cNvgreStaticMacEntry, hh3cNvgreMacAddr=hh3cNvgreMacAddr, hh3cNvgreEntry=hh3cNvgreEntry, hh3cNvgreStaticMacTable=hh3cNvgreStaticMacTable) |
def isPrime(n):
if n<=3 :
return True
for i in range(2, n):
if n%i==0:
return False
return True
a,b = map(int, input().split())
flag = True
if not isPrime(a) or not isPrime(b):
flag = False
print("NO")
else :
for i in range(a+1,b):
if isPrime(i):
flag = False
print("NO")
break
if flag:
print("YES")
| def is_prime(n):
if n <= 3:
return True
for i in range(2, n):
if n % i == 0:
return False
return True
(a, b) = map(int, input().split())
flag = True
if not is_prime(a) or not is_prime(b):
flag = False
print('NO')
else:
for i in range(a + 1, b):
if is_prime(i):
flag = False
print('NO')
break
if flag:
print('YES') |
def binary_search_recursive(array, element, start, end):
if start > end:
return -1
mid = (start + end) // 2
if element < array[mid]:
return binary_search_recursive(array, element, start, mid - 1)
else:
return binary_search_recursive(array, element, mid + 1, end)
element = 18
array = [1, 2, 5, 7, 13, 15, 16, 18, 24, 28, 29]
print("Searching for {}".format(element))
print("Index of {}: {}".format(element, binary_search_recursive(array, element, 0, len(array))))
def binary_search_iterative(array, element):
mid = 0
start = 0
end = len(array)
step = 0
while (start <= end):
print("Subarray in step {}: {}".format(step, str(array[start:end+1])))
step = step+1
mid = (start + end) // 2
if element == array[mid]:
return mid
if element < array[mid]:
end = mid - 1
else:
start = mid + 1
return -1
array = [1, 2, 5, 7, 13, 15, 16, 18, 24, 28, 29]
element = 18
print("Searching for {} in {}".format(element, array))
print("Index of {}: {}".format(element, binary_search_iterative(array, element))) | def binary_search_recursive(array, element, start, end):
if start > end:
return -1
mid = (start + end) // 2
if element < array[mid]:
return binary_search_recursive(array, element, start, mid - 1)
else:
return binary_search_recursive(array, element, mid + 1, end)
element = 18
array = [1, 2, 5, 7, 13, 15, 16, 18, 24, 28, 29]
print('Searching for {}'.format(element))
print('Index of {}: {}'.format(element, binary_search_recursive(array, element, 0, len(array))))
def binary_search_iterative(array, element):
mid = 0
start = 0
end = len(array)
step = 0
while start <= end:
print('Subarray in step {}: {}'.format(step, str(array[start:end + 1])))
step = step + 1
mid = (start + end) // 2
if element == array[mid]:
return mid
if element < array[mid]:
end = mid - 1
else:
start = mid + 1
return -1
array = [1, 2, 5, 7, 13, 15, 16, 18, 24, 28, 29]
element = 18
print('Searching for {} in {}'.format(element, array))
print('Index of {}: {}'.format(element, binary_search_iterative(array, element))) |
_base_ = './faster_rcnn_r50_fpn_1x_voc0712_cocofmt.py'
model = dict(
rpn_head=dict(loss_bbox=dict(type='MSELoss', loss_weight=1.0)),
roi_head=dict(
bbox_head=dict(
loss_bbox=dict(type='MSELoss', loss_weight=1.0))))
optimizer_config = dict(
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
work_dir = './work_dirs/voc/reg_loss/faster_rcnn/faster_rcnn_r50_fpn_l2_1x_voc0712_cocofmt'
| _base_ = './faster_rcnn_r50_fpn_1x_voc0712_cocofmt.py'
model = dict(rpn_head=dict(loss_bbox=dict(type='MSELoss', loss_weight=1.0)), roi_head=dict(bbox_head=dict(loss_bbox=dict(type='MSELoss', loss_weight=1.0))))
optimizer_config = dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
work_dir = './work_dirs/voc/reg_loss/faster_rcnn/faster_rcnn_r50_fpn_l2_1x_voc0712_cocofmt' |
no_of_labels=4
no_of_iterations = 10
graph = {
'a': {('b', 1), ('e', 4),('c',2)},
'b': {('a',1),('c', 3), ('d',3),('e',4)},
'c': {('a',2),('d',1),('b',3)},
'd': {('b',3),('e',1), ('c',1)},
'e': {('d',1),('a',4),('b',4)}
} | no_of_labels = 4
no_of_iterations = 10
graph = {'a': {('b', 1), ('e', 4), ('c', 2)}, 'b': {('a', 1), ('c', 3), ('d', 3), ('e', 4)}, 'c': {('a', 2), ('d', 1), ('b', 3)}, 'd': {('b', 3), ('e', 1), ('c', 1)}, 'e': {('d', 1), ('a', 4), ('b', 4)}} |
# Read one line of data
file = open('myfile.txt', 'r')
line_of_data = file.readline()
print(line_of_data, end='')
file.close()
| file = open('myfile.txt', 'r')
line_of_data = file.readline()
print(line_of_data, end='')
file.close() |
#
# PySNMP MIB module Nortel-Magellan-Passport-VnetEtsiQsigMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-VnetEtsiQsigMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:19:14 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")
ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion")
StorageType, Unsigned32, RowStatus, DisplayString = mibBuilder.importSymbols("Nortel-Magellan-Passport-StandardTextualConventionsMIB", "StorageType", "Unsigned32", "RowStatus", "DisplayString")
Link, NonReplicated = mibBuilder.importSymbols("Nortel-Magellan-Passport-TextualConventionsMIB", "Link", "NonReplicated")
passportMIBs, = mibBuilder.importSymbols("Nortel-Magellan-Passport-UsefulDefinitionsMIB", "passportMIBs")
sigChan, sigChanIndex = mibBuilder.importSymbols("Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChan", "sigChanIndex")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
ObjectIdentity, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, IpAddress, MibIdentifier, iso, TimeTicks, Counter64, Integer32, Counter32, Gauge32, Unsigned32, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "IpAddress", "MibIdentifier", "iso", "TimeTicks", "Counter64", "Integer32", "Counter32", "Gauge32", "Unsigned32", "ModuleIdentity")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
vnetEtsiQsigMIB = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110))
sigChanEQsig = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2))
sigChanEQsigRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1), )
if mibBuilder.loadTexts: sigChanEQsigRowStatusTable.setStatus('mandatory')
sigChanEQsigRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"))
if mibBuilder.loadTexts: sigChanEQsigRowStatusEntry.setStatus('mandatory')
sigChanEQsigRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1, 1, 1), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigRowStatus.setStatus('mandatory')
sigChanEQsigComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigComponentName.setStatus('mandatory')
sigChanEQsigStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1, 1, 4), StorageType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigStorageType.setStatus('mandatory')
sigChanEQsigIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1, 1, 10), NonReplicated())
if mibBuilder.loadTexts: sigChanEQsigIndex.setStatus('mandatory')
sigChanEQsigL2Table = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11), )
if mibBuilder.loadTexts: sigChanEQsigL2Table.setStatus('mandatory')
sigChanEQsigL2Entry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"))
if mibBuilder.loadTexts: sigChanEQsigL2Entry.setStatus('mandatory')
sigChanEQsigT23 = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 15)).clone(10)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigT23.setStatus('mandatory')
sigChanEQsigT200 = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 20)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigT200.setStatus('mandatory')
sigChanEQsigN200 = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 8)).clone(3)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigN200.setStatus('mandatory')
sigChanEQsigT203 = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(2, 40)).clone(10)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigT203.setStatus('mandatory')
sigChanEQsigCircuitSwitchedK = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 127)).clone(7)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigCircuitSwitchedK.setStatus('mandatory')
sigChanEQsigL3Table = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 12), )
if mibBuilder.loadTexts: sigChanEQsigL3Table.setStatus('mandatory')
sigChanEQsigL3Entry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 12, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"))
if mibBuilder.loadTexts: sigChanEQsigL3Entry.setStatus('mandatory')
sigChanEQsigT309 = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 12, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(15, 120)).clone(90)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigT309.setStatus('mandatory')
sigChanEQsigT310 = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 12, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(10, 120)).clone(30)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigT310.setStatus('mandatory')
sigChanEQsigProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13), )
if mibBuilder.loadTexts: sigChanEQsigProvTable.setStatus('mandatory')
sigChanEQsigProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"))
if mibBuilder.loadTexts: sigChanEQsigProvEntry.setStatus('mandatory')
sigChanEQsigSide = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("network", 1), ("user", 2))).clone('network')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigSide.setStatus('mandatory')
sigChanEQsigMaxNonCallConcurrent = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 30)).clone(30)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigMaxNonCallConcurrent.setStatus('mandatory')
sigChanEQsigOverlapSendingEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("enabled", 0), ("disabled", 1))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigOverlapSendingEnabled.setStatus('mandatory')
sigChanEQsigOverlapReceivingEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("enabled", 0), ("disabled", 1))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigOverlapReceivingEnabled.setStatus('mandatory')
sigChanEQsigStateTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 14), )
if mibBuilder.loadTexts: sigChanEQsigStateTable.setStatus('mandatory')
sigChanEQsigStateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 14, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"))
if mibBuilder.loadTexts: sigChanEQsigStateEntry.setStatus('mandatory')
sigChanEQsigAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 14, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("locked", 0), ("unlocked", 1), ("shuttingDown", 2))).clone('unlocked')).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigAdminState.setStatus('mandatory')
sigChanEQsigOperationalState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 14, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("disabled", 0), ("enabled", 1))).clone('disabled')).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigOperationalState.setStatus('mandatory')
sigChanEQsigUsageState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 14, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("idle", 0), ("active", 1), ("busy", 2))).clone('idle')).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigUsageState.setStatus('mandatory')
sigChanEQsigStatsTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15), )
if mibBuilder.loadTexts: sigChanEQsigStatsTable.setStatus('mandatory')
sigChanEQsigStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"))
if mibBuilder.loadTexts: sigChanEQsigStatsEntry.setStatus('mandatory')
sigChanEQsigTotalCallsToIf = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigTotalCallsToIf.setStatus('mandatory')
sigChanEQsigTotalCallsFromIf = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigTotalCallsFromIf.setStatus('mandatory')
sigChanEQsigNonCallAssocSessionsToIf = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigNonCallAssocSessionsToIf.setStatus('mandatory')
sigChanEQsigNonCallAssocSessionsFromIf = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigNonCallAssocSessionsFromIf.setStatus('mandatory')
sigChanEQsigOperTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16), )
if mibBuilder.loadTexts: sigChanEQsigOperTable.setStatus('mandatory')
sigChanEQsigOperEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"))
if mibBuilder.loadTexts: sigChanEQsigOperEntry.setStatus('mandatory')
sigChanEQsigActiveChannels = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigActiveChannels.setStatus('mandatory')
sigChanEQsigActiveVoiceChannels = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigActiveVoiceChannels.setStatus('mandatory')
sigChanEQsigActiveDataChannels = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigActiveDataChannels.setStatus('mandatory')
sigChanEQsigPeakActiveChannels = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigPeakActiveChannels.setStatus('mandatory')
sigChanEQsigPeakActiveVoiceChannels = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigPeakActiveVoiceChannels.setStatus('mandatory')
sigChanEQsigPeakActiveDataChannels = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigPeakActiveDataChannels.setStatus('mandatory')
sigChanEQsigDChanStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("outOfService", 0), ("establishing", 1), ("established", 2), ("enabling", 3), ("inService", 4), ("restarting", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigDChanStatus.setStatus('mandatory')
sigChanEQsigToolsTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 17), )
if mibBuilder.loadTexts: sigChanEQsigToolsTable.setStatus('mandatory')
sigChanEQsigToolsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 17, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"))
if mibBuilder.loadTexts: sigChanEQsigToolsEntry.setStatus('mandatory')
sigChanEQsigTracing = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 17, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigTracing.setStatus('mandatory')
sigChanEQsigEQsigSpecificProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 18), )
if mibBuilder.loadTexts: sigChanEQsigEQsigSpecificProvTable.setStatus('mandatory')
sigChanEQsigEQsigSpecificProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 18, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"))
if mibBuilder.loadTexts: sigChanEQsigEQsigSpecificProvEntry.setStatus('mandatory')
sigChanEQsigMsgSegmentation = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 18, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("enabled", 0), ("disabled", 1))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigMsgSegmentation.setStatus('mandatory')
sigChanEQsigE1ChannelNumbers = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 18, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("skip16", 1), ("contiguous", 2))).clone('skip16')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigE1ChannelNumbers.setStatus('mandatory')
sigChanEQsigEQsigSpecificOpTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 19), )
if mibBuilder.loadTexts: sigChanEQsigEQsigSpecificOpTable.setStatus('mandatory')
sigChanEQsigEQsigSpecificOpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 19, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"))
if mibBuilder.loadTexts: sigChanEQsigEQsigSpecificOpEntry.setStatus('mandatory')
sigChanEQsigSegmentationAccepted = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 19, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigSegmentationAccepted.setStatus('mandatory')
sigChanEQsigSegmentationFailed = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 19, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigSegmentationFailed.setStatus('mandatory')
sigChanEQsigFramer = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2))
sigChanEQsigFramerRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1), )
if mibBuilder.loadTexts: sigChanEQsigFramerRowStatusTable.setStatus('mandatory')
sigChanEQsigFramerRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigFramerIndex"))
if mibBuilder.loadTexts: sigChanEQsigFramerRowStatusEntry.setStatus('mandatory')
sigChanEQsigFramerRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1, 1, 1), RowStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerRowStatus.setStatus('mandatory')
sigChanEQsigFramerComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerComponentName.setStatus('mandatory')
sigChanEQsigFramerStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1, 1, 4), StorageType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerStorageType.setStatus('mandatory')
sigChanEQsigFramerIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1, 1, 10), NonReplicated())
if mibBuilder.loadTexts: sigChanEQsigFramerIndex.setStatus('mandatory')
sigChanEQsigFramerProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 10), )
if mibBuilder.loadTexts: sigChanEQsigFramerProvTable.setStatus('mandatory')
sigChanEQsigFramerProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 10, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigFramerIndex"))
if mibBuilder.loadTexts: sigChanEQsigFramerProvEntry.setStatus('mandatory')
sigChanEQsigFramerInterfaceName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 10, 1, 1), Link()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sigChanEQsigFramerInterfaceName.setStatus('mandatory')
sigChanEQsigFramerStateTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 12), )
if mibBuilder.loadTexts: sigChanEQsigFramerStateTable.setStatus('mandatory')
sigChanEQsigFramerStateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 12, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigFramerIndex"))
if mibBuilder.loadTexts: sigChanEQsigFramerStateEntry.setStatus('mandatory')
sigChanEQsigFramerAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 12, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("locked", 0), ("unlocked", 1), ("shuttingDown", 2))).clone('unlocked')).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerAdminState.setStatus('mandatory')
sigChanEQsigFramerOperationalState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 12, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("disabled", 0), ("enabled", 1))).clone('disabled')).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerOperationalState.setStatus('mandatory')
sigChanEQsigFramerUsageState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 12, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("idle", 0), ("active", 1), ("busy", 2))).clone('idle')).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerUsageState.setStatus('mandatory')
sigChanEQsigFramerStatsTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13), )
if mibBuilder.loadTexts: sigChanEQsigFramerStatsTable.setStatus('mandatory')
sigChanEQsigFramerStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-VoiceNetworkingMIB", "sigChanIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigIndex"), (0, "Nortel-Magellan-Passport-VnetEtsiQsigMIB", "sigChanEQsigFramerIndex"))
if mibBuilder.loadTexts: sigChanEQsigFramerStatsEntry.setStatus('mandatory')
sigChanEQsigFramerFrmToIf = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerFrmToIf.setStatus('mandatory')
sigChanEQsigFramerFrmFromIf = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerFrmFromIf.setStatus('mandatory')
sigChanEQsigFramerOctetFromIf = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerOctetFromIf.setStatus('mandatory')
sigChanEQsigFramerAborts = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerAborts.setStatus('mandatory')
sigChanEQsigFramerCrcErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerCrcErrors.setStatus('mandatory')
sigChanEQsigFramerLrcErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerLrcErrors.setStatus('mandatory')
sigChanEQsigFramerNonOctetErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerNonOctetErrors.setStatus('mandatory')
sigChanEQsigFramerOverruns = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerOverruns.setStatus('mandatory')
sigChanEQsigFramerUnderruns = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerUnderruns.setStatus('mandatory')
sigChanEQsigFramerLargeFrmErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 10), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sigChanEQsigFramerLargeFrmErrors.setStatus('mandatory')
vnetEtsiQsigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 1))
vnetEtsiQsigGroupBE = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 1, 5))
vnetEtsiQsigGroupBE01 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 1, 5, 2))
vnetEtsiQsigGroupBE01A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 1, 5, 2, 2))
vnetEtsiQsigCapabilities = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 3))
vnetEtsiQsigCapabilitiesBE = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 3, 5))
vnetEtsiQsigCapabilitiesBE01 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 3, 5, 2))
vnetEtsiQsigCapabilitiesBE01A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 3, 5, 2, 2))
mibBuilder.exportSymbols("Nortel-Magellan-Passport-VnetEtsiQsigMIB", sigChanEQsigSegmentationAccepted=sigChanEQsigSegmentationAccepted, sigChanEQsigFramerFrmToIf=sigChanEQsigFramerFrmToIf, sigChanEQsigOperEntry=sigChanEQsigOperEntry, sigChanEQsigFramerStorageType=sigChanEQsigFramerStorageType, sigChanEQsigStorageType=sigChanEQsigStorageType, vnetEtsiQsigGroupBE01A=vnetEtsiQsigGroupBE01A, sigChanEQsigFramerProvTable=sigChanEQsigFramerProvTable, sigChanEQsigTotalCallsFromIf=sigChanEQsigTotalCallsFromIf, sigChanEQsig=sigChanEQsig, sigChanEQsigFramerInterfaceName=sigChanEQsigFramerInterfaceName, sigChanEQsigTotalCallsToIf=sigChanEQsigTotalCallsToIf, sigChanEQsigFramerLargeFrmErrors=sigChanEQsigFramerLargeFrmErrors, sigChanEQsigToolsTable=sigChanEQsigToolsTable, sigChanEQsigCircuitSwitchedK=sigChanEQsigCircuitSwitchedK, sigChanEQsigEQsigSpecificOpTable=sigChanEQsigEQsigSpecificOpTable, sigChanEQsigProvEntry=sigChanEQsigProvEntry, sigChanEQsigEQsigSpecificProvTable=sigChanEQsigEQsigSpecificProvTable, sigChanEQsigFramerStatsEntry=sigChanEQsigFramerStatsEntry, sigChanEQsigOverlapReceivingEnabled=sigChanEQsigOverlapReceivingEnabled, sigChanEQsigIndex=sigChanEQsigIndex, sigChanEQsigL2Entry=sigChanEQsigL2Entry, sigChanEQsigOverlapSendingEnabled=sigChanEQsigOverlapSendingEnabled, sigChanEQsigProvTable=sigChanEQsigProvTable, sigChanEQsigSide=sigChanEQsigSide, sigChanEQsigFramerUsageState=sigChanEQsigFramerUsageState, sigChanEQsigFramerAborts=sigChanEQsigFramerAborts, sigChanEQsigNonCallAssocSessionsFromIf=sigChanEQsigNonCallAssocSessionsFromIf, sigChanEQsigL3Entry=sigChanEQsigL3Entry, sigChanEQsigFramerCrcErrors=sigChanEQsigFramerCrcErrors, sigChanEQsigFramerRowStatusTable=sigChanEQsigFramerRowStatusTable, sigChanEQsigL2Table=sigChanEQsigL2Table, sigChanEQsigFramer=sigChanEQsigFramer, sigChanEQsigEQsigSpecificProvEntry=sigChanEQsigEQsigSpecificProvEntry, sigChanEQsigPeakActiveDataChannels=sigChanEQsigPeakActiveDataChannels, sigChanEQsigFramerComponentName=sigChanEQsigFramerComponentName, vnetEtsiQsigCapabilitiesBE01=vnetEtsiQsigCapabilitiesBE01, sigChanEQsigFramerOctetFromIf=sigChanEQsigFramerOctetFromIf, sigChanEQsigDChanStatus=sigChanEQsigDChanStatus, sigChanEQsigFramerFrmFromIf=sigChanEQsigFramerFrmFromIf, sigChanEQsigTracing=sigChanEQsigTracing, sigChanEQsigToolsEntry=sigChanEQsigToolsEntry, vnetEtsiQsigGroupBE01=vnetEtsiQsigGroupBE01, sigChanEQsigT200=sigChanEQsigT200, sigChanEQsigOperationalState=sigChanEQsigOperationalState, sigChanEQsigRowStatusTable=sigChanEQsigRowStatusTable, sigChanEQsigActiveChannels=sigChanEQsigActiveChannels, vnetEtsiQsigGroupBE=vnetEtsiQsigGroupBE, sigChanEQsigN200=sigChanEQsigN200, sigChanEQsigMaxNonCallConcurrent=sigChanEQsigMaxNonCallConcurrent, sigChanEQsigT23=sigChanEQsigT23, sigChanEQsigEQsigSpecificOpEntry=sigChanEQsigEQsigSpecificOpEntry, sigChanEQsigT203=sigChanEQsigT203, sigChanEQsigL3Table=sigChanEQsigL3Table, sigChanEQsigT310=sigChanEQsigT310, sigChanEQsigStatsTable=sigChanEQsigStatsTable, sigChanEQsigRowStatusEntry=sigChanEQsigRowStatusEntry, vnetEtsiQsigCapabilities=vnetEtsiQsigCapabilities, sigChanEQsigOperTable=sigChanEQsigOperTable, sigChanEQsigActiveVoiceChannels=sigChanEQsigActiveVoiceChannels, sigChanEQsigPeakActiveChannels=sigChanEQsigPeakActiveChannels, sigChanEQsigT309=sigChanEQsigT309, sigChanEQsigFramerAdminState=sigChanEQsigFramerAdminState, sigChanEQsigFramerRowStatusEntry=sigChanEQsigFramerRowStatusEntry, sigChanEQsigFramerNonOctetErrors=sigChanEQsigFramerNonOctetErrors, sigChanEQsigAdminState=sigChanEQsigAdminState, vnetEtsiQsigGroup=vnetEtsiQsigGroup, vnetEtsiQsigCapabilitiesBE=vnetEtsiQsigCapabilitiesBE, sigChanEQsigFramerProvEntry=sigChanEQsigFramerProvEntry, sigChanEQsigFramerStateEntry=sigChanEQsigFramerStateEntry, sigChanEQsigComponentName=sigChanEQsigComponentName, sigChanEQsigFramerStatsTable=sigChanEQsigFramerStatsTable, sigChanEQsigFramerStateTable=sigChanEQsigFramerStateTable, sigChanEQsigActiveDataChannels=sigChanEQsigActiveDataChannels, sigChanEQsigUsageState=sigChanEQsigUsageState, sigChanEQsigFramerLrcErrors=sigChanEQsigFramerLrcErrors, sigChanEQsigFramerOperationalState=sigChanEQsigFramerOperationalState, sigChanEQsigMsgSegmentation=sigChanEQsigMsgSegmentation, sigChanEQsigRowStatus=sigChanEQsigRowStatus, sigChanEQsigNonCallAssocSessionsToIf=sigChanEQsigNonCallAssocSessionsToIf, sigChanEQsigFramerIndex=sigChanEQsigFramerIndex, sigChanEQsigPeakActiveVoiceChannels=sigChanEQsigPeakActiveVoiceChannels, sigChanEQsigFramerRowStatus=sigChanEQsigFramerRowStatus, sigChanEQsigStatsEntry=sigChanEQsigStatsEntry, sigChanEQsigFramerUnderruns=sigChanEQsigFramerUnderruns, sigChanEQsigSegmentationFailed=sigChanEQsigSegmentationFailed, sigChanEQsigStateTable=sigChanEQsigStateTable, sigChanEQsigFramerOverruns=sigChanEQsigFramerOverruns, vnetEtsiQsigMIB=vnetEtsiQsigMIB, sigChanEQsigStateEntry=sigChanEQsigStateEntry, vnetEtsiQsigCapabilitiesBE01A=vnetEtsiQsigCapabilitiesBE01A, sigChanEQsigE1ChannelNumbers=sigChanEQsigE1ChannelNumbers)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion')
(storage_type, unsigned32, row_status, display_string) = mibBuilder.importSymbols('Nortel-Magellan-Passport-StandardTextualConventionsMIB', 'StorageType', 'Unsigned32', 'RowStatus', 'DisplayString')
(link, non_replicated) = mibBuilder.importSymbols('Nortel-Magellan-Passport-TextualConventionsMIB', 'Link', 'NonReplicated')
(passport_mi_bs,) = mibBuilder.importSymbols('Nortel-Magellan-Passport-UsefulDefinitionsMIB', 'passportMIBs')
(sig_chan, sig_chan_index) = mibBuilder.importSymbols('Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChan', 'sigChanIndex')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(object_identity, bits, mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, ip_address, mib_identifier, iso, time_ticks, counter64, integer32, counter32, gauge32, unsigned32, module_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'ObjectIdentity', 'Bits', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'IpAddress', 'MibIdentifier', 'iso', 'TimeTicks', 'Counter64', 'Integer32', 'Counter32', 'Gauge32', 'Unsigned32', 'ModuleIdentity')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
vnet_etsi_qsig_mib = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110))
sig_chan_e_qsig = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2))
sig_chan_e_qsig_row_status_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1))
if mibBuilder.loadTexts:
sigChanEQsigRowStatusTable.setStatus('mandatory')
sig_chan_e_qsig_row_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'))
if mibBuilder.loadTexts:
sigChanEQsigRowStatusEntry.setStatus('mandatory')
sig_chan_e_qsig_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1, 1, 1), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigRowStatus.setStatus('mandatory')
sig_chan_e_qsig_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigComponentName.setStatus('mandatory')
sig_chan_e_qsig_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1, 1, 4), storage_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigStorageType.setStatus('mandatory')
sig_chan_e_qsig_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 1, 1, 10), non_replicated())
if mibBuilder.loadTexts:
sigChanEQsigIndex.setStatus('mandatory')
sig_chan_e_qsig_l2_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11))
if mibBuilder.loadTexts:
sigChanEQsigL2Table.setStatus('mandatory')
sig_chan_e_qsig_l2_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'))
if mibBuilder.loadTexts:
sigChanEQsigL2Entry.setStatus('mandatory')
sig_chan_e_qsig_t23 = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 15)).clone(10)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigT23.setStatus('mandatory')
sig_chan_e_qsig_t200 = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 20)).clone(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigT200.setStatus('mandatory')
sig_chan_e_qsig_n200 = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 8)).clone(3)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigN200.setStatus('mandatory')
sig_chan_e_qsig_t203 = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1, 4), unsigned32().subtype(subtypeSpec=value_range_constraint(2, 40)).clone(10)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigT203.setStatus('mandatory')
sig_chan_e_qsig_circuit_switched_k = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 11, 1, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 127)).clone(7)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigCircuitSwitchedK.setStatus('mandatory')
sig_chan_e_qsig_l3_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 12))
if mibBuilder.loadTexts:
sigChanEQsigL3Table.setStatus('mandatory')
sig_chan_e_qsig_l3_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 12, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'))
if mibBuilder.loadTexts:
sigChanEQsigL3Entry.setStatus('mandatory')
sig_chan_e_qsig_t309 = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 12, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(15, 120)).clone(90)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigT309.setStatus('mandatory')
sig_chan_e_qsig_t310 = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 12, 1, 4), unsigned32().subtype(subtypeSpec=value_range_constraint(10, 120)).clone(30)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigT310.setStatus('mandatory')
sig_chan_e_qsig_prov_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13))
if mibBuilder.loadTexts:
sigChanEQsigProvTable.setStatus('mandatory')
sig_chan_e_qsig_prov_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'))
if mibBuilder.loadTexts:
sigChanEQsigProvEntry.setStatus('mandatory')
sig_chan_e_qsig_side = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('network', 1), ('user', 2))).clone('network')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigSide.setStatus('mandatory')
sig_chan_e_qsig_max_non_call_concurrent = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 30)).clone(30)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigMaxNonCallConcurrent.setStatus('mandatory')
sig_chan_e_qsig_overlap_sending_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('enabled', 0), ('disabled', 1))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigOverlapSendingEnabled.setStatus('mandatory')
sig_chan_e_qsig_overlap_receiving_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 13, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('enabled', 0), ('disabled', 1))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigOverlapReceivingEnabled.setStatus('mandatory')
sig_chan_e_qsig_state_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 14))
if mibBuilder.loadTexts:
sigChanEQsigStateTable.setStatus('mandatory')
sig_chan_e_qsig_state_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 14, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'))
if mibBuilder.loadTexts:
sigChanEQsigStateEntry.setStatus('mandatory')
sig_chan_e_qsig_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 14, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('locked', 0), ('unlocked', 1), ('shuttingDown', 2))).clone('unlocked')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigAdminState.setStatus('mandatory')
sig_chan_e_qsig_operational_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 14, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('disabled', 0), ('enabled', 1))).clone('disabled')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigOperationalState.setStatus('mandatory')
sig_chan_e_qsig_usage_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 14, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('idle', 0), ('active', 1), ('busy', 2))).clone('idle')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigUsageState.setStatus('mandatory')
sig_chan_e_qsig_stats_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15))
if mibBuilder.loadTexts:
sigChanEQsigStatsTable.setStatus('mandatory')
sig_chan_e_qsig_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'))
if mibBuilder.loadTexts:
sigChanEQsigStatsEntry.setStatus('mandatory')
sig_chan_e_qsig_total_calls_to_if = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigTotalCallsToIf.setStatus('mandatory')
sig_chan_e_qsig_total_calls_from_if = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigTotalCallsFromIf.setStatus('mandatory')
sig_chan_e_qsig_non_call_assoc_sessions_to_if = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15, 1, 4), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigNonCallAssocSessionsToIf.setStatus('mandatory')
sig_chan_e_qsig_non_call_assoc_sessions_from_if = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 15, 1, 5), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigNonCallAssocSessionsFromIf.setStatus('mandatory')
sig_chan_e_qsig_oper_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16))
if mibBuilder.loadTexts:
sigChanEQsigOperTable.setStatus('mandatory')
sig_chan_e_qsig_oper_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'))
if mibBuilder.loadTexts:
sigChanEQsigOperEntry.setStatus('mandatory')
sig_chan_e_qsig_active_channels = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigActiveChannels.setStatus('mandatory')
sig_chan_e_qsig_active_voice_channels = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigActiveVoiceChannels.setStatus('mandatory')
sig_chan_e_qsig_active_data_channels = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigActiveDataChannels.setStatus('mandatory')
sig_chan_e_qsig_peak_active_channels = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 4), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigPeakActiveChannels.setStatus('mandatory')
sig_chan_e_qsig_peak_active_voice_channels = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 5), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigPeakActiveVoiceChannels.setStatus('mandatory')
sig_chan_e_qsig_peak_active_data_channels = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigPeakActiveDataChannels.setStatus('mandatory')
sig_chan_e_qsig_d_chan_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 16, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5))).clone(namedValues=named_values(('outOfService', 0), ('establishing', 1), ('established', 2), ('enabling', 3), ('inService', 4), ('restarting', 5)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigDChanStatus.setStatus('mandatory')
sig_chan_e_qsig_tools_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 17))
if mibBuilder.loadTexts:
sigChanEQsigToolsTable.setStatus('mandatory')
sig_chan_e_qsig_tools_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 17, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'))
if mibBuilder.loadTexts:
sigChanEQsigToolsEntry.setStatus('mandatory')
sig_chan_e_qsig_tracing = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 17, 1, 1), octet_string().subtype(subtypeSpec=value_size_constraint(1, 1)).setFixedLength(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigTracing.setStatus('mandatory')
sig_chan_e_qsig_e_qsig_specific_prov_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 18))
if mibBuilder.loadTexts:
sigChanEQsigEQsigSpecificProvTable.setStatus('mandatory')
sig_chan_e_qsig_e_qsig_specific_prov_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 18, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'))
if mibBuilder.loadTexts:
sigChanEQsigEQsigSpecificProvEntry.setStatus('mandatory')
sig_chan_e_qsig_msg_segmentation = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 18, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('enabled', 0), ('disabled', 1))).clone('disabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigMsgSegmentation.setStatus('mandatory')
sig_chan_e_qsig_e1_channel_numbers = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 18, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('skip16', 1), ('contiguous', 2))).clone('skip16')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigE1ChannelNumbers.setStatus('mandatory')
sig_chan_e_qsig_e_qsig_specific_op_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 19))
if mibBuilder.loadTexts:
sigChanEQsigEQsigSpecificOpTable.setStatus('mandatory')
sig_chan_e_qsig_e_qsig_specific_op_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 19, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'))
if mibBuilder.loadTexts:
sigChanEQsigEQsigSpecificOpEntry.setStatus('mandatory')
sig_chan_e_qsig_segmentation_accepted = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 19, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigSegmentationAccepted.setStatus('mandatory')
sig_chan_e_qsig_segmentation_failed = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 19, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigSegmentationFailed.setStatus('mandatory')
sig_chan_e_qsig_framer = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2))
sig_chan_e_qsig_framer_row_status_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1))
if mibBuilder.loadTexts:
sigChanEQsigFramerRowStatusTable.setStatus('mandatory')
sig_chan_e_qsig_framer_row_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigFramerIndex'))
if mibBuilder.loadTexts:
sigChanEQsigFramerRowStatusEntry.setStatus('mandatory')
sig_chan_e_qsig_framer_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1, 1, 1), row_status()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerRowStatus.setStatus('mandatory')
sig_chan_e_qsig_framer_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerComponentName.setStatus('mandatory')
sig_chan_e_qsig_framer_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1, 1, 4), storage_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerStorageType.setStatus('mandatory')
sig_chan_e_qsig_framer_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 1, 1, 10), non_replicated())
if mibBuilder.loadTexts:
sigChanEQsigFramerIndex.setStatus('mandatory')
sig_chan_e_qsig_framer_prov_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 10))
if mibBuilder.loadTexts:
sigChanEQsigFramerProvTable.setStatus('mandatory')
sig_chan_e_qsig_framer_prov_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 10, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigFramerIndex'))
if mibBuilder.loadTexts:
sigChanEQsigFramerProvEntry.setStatus('mandatory')
sig_chan_e_qsig_framer_interface_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 10, 1, 1), link()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sigChanEQsigFramerInterfaceName.setStatus('mandatory')
sig_chan_e_qsig_framer_state_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 12))
if mibBuilder.loadTexts:
sigChanEQsigFramerStateTable.setStatus('mandatory')
sig_chan_e_qsig_framer_state_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 12, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigFramerIndex'))
if mibBuilder.loadTexts:
sigChanEQsigFramerStateEntry.setStatus('mandatory')
sig_chan_e_qsig_framer_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 12, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('locked', 0), ('unlocked', 1), ('shuttingDown', 2))).clone('unlocked')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerAdminState.setStatus('mandatory')
sig_chan_e_qsig_framer_operational_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 12, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('disabled', 0), ('enabled', 1))).clone('disabled')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerOperationalState.setStatus('mandatory')
sig_chan_e_qsig_framer_usage_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 12, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('idle', 0), ('active', 1), ('busy', 2))).clone('idle')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerUsageState.setStatus('mandatory')
sig_chan_e_qsig_framer_stats_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13))
if mibBuilder.loadTexts:
sigChanEQsigFramerStatsTable.setStatus('mandatory')
sig_chan_e_qsig_framer_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-VoiceNetworkingMIB', 'sigChanIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigIndex'), (0, 'Nortel-Magellan-Passport-VnetEtsiQsigMIB', 'sigChanEQsigFramerIndex'))
if mibBuilder.loadTexts:
sigChanEQsigFramerStatsEntry.setStatus('mandatory')
sig_chan_e_qsig_framer_frm_to_if = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerFrmToIf.setStatus('mandatory')
sig_chan_e_qsig_framer_frm_from_if = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerFrmFromIf.setStatus('mandatory')
sig_chan_e_qsig_framer_octet_from_if = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerOctetFromIf.setStatus('mandatory')
sig_chan_e_qsig_framer_aborts = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 4), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerAborts.setStatus('mandatory')
sig_chan_e_qsig_framer_crc_errors = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 5), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerCrcErrors.setStatus('mandatory')
sig_chan_e_qsig_framer_lrc_errors = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 6), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerLrcErrors.setStatus('mandatory')
sig_chan_e_qsig_framer_non_octet_errors = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 7), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerNonOctetErrors.setStatus('mandatory')
sig_chan_e_qsig_framer_overruns = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 8), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerOverruns.setStatus('mandatory')
sig_chan_e_qsig_framer_underruns = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 9), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerUnderruns.setStatus('mandatory')
sig_chan_e_qsig_framer_large_frm_errors = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 115, 2, 2, 13, 1, 10), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sigChanEQsigFramerLargeFrmErrors.setStatus('mandatory')
vnet_etsi_qsig_group = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 1))
vnet_etsi_qsig_group_be = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 1, 5))
vnet_etsi_qsig_group_be01 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 1, 5, 2))
vnet_etsi_qsig_group_be01_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 1, 5, 2, 2))
vnet_etsi_qsig_capabilities = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 3))
vnet_etsi_qsig_capabilities_be = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 3, 5))
vnet_etsi_qsig_capabilities_be01 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 3, 5, 2))
vnet_etsi_qsig_capabilities_be01_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 110, 3, 5, 2, 2))
mibBuilder.exportSymbols('Nortel-Magellan-Passport-VnetEtsiQsigMIB', sigChanEQsigSegmentationAccepted=sigChanEQsigSegmentationAccepted, sigChanEQsigFramerFrmToIf=sigChanEQsigFramerFrmToIf, sigChanEQsigOperEntry=sigChanEQsigOperEntry, sigChanEQsigFramerStorageType=sigChanEQsigFramerStorageType, sigChanEQsigStorageType=sigChanEQsigStorageType, vnetEtsiQsigGroupBE01A=vnetEtsiQsigGroupBE01A, sigChanEQsigFramerProvTable=sigChanEQsigFramerProvTable, sigChanEQsigTotalCallsFromIf=sigChanEQsigTotalCallsFromIf, sigChanEQsig=sigChanEQsig, sigChanEQsigFramerInterfaceName=sigChanEQsigFramerInterfaceName, sigChanEQsigTotalCallsToIf=sigChanEQsigTotalCallsToIf, sigChanEQsigFramerLargeFrmErrors=sigChanEQsigFramerLargeFrmErrors, sigChanEQsigToolsTable=sigChanEQsigToolsTable, sigChanEQsigCircuitSwitchedK=sigChanEQsigCircuitSwitchedK, sigChanEQsigEQsigSpecificOpTable=sigChanEQsigEQsigSpecificOpTable, sigChanEQsigProvEntry=sigChanEQsigProvEntry, sigChanEQsigEQsigSpecificProvTable=sigChanEQsigEQsigSpecificProvTable, sigChanEQsigFramerStatsEntry=sigChanEQsigFramerStatsEntry, sigChanEQsigOverlapReceivingEnabled=sigChanEQsigOverlapReceivingEnabled, sigChanEQsigIndex=sigChanEQsigIndex, sigChanEQsigL2Entry=sigChanEQsigL2Entry, sigChanEQsigOverlapSendingEnabled=sigChanEQsigOverlapSendingEnabled, sigChanEQsigProvTable=sigChanEQsigProvTable, sigChanEQsigSide=sigChanEQsigSide, sigChanEQsigFramerUsageState=sigChanEQsigFramerUsageState, sigChanEQsigFramerAborts=sigChanEQsigFramerAborts, sigChanEQsigNonCallAssocSessionsFromIf=sigChanEQsigNonCallAssocSessionsFromIf, sigChanEQsigL3Entry=sigChanEQsigL3Entry, sigChanEQsigFramerCrcErrors=sigChanEQsigFramerCrcErrors, sigChanEQsigFramerRowStatusTable=sigChanEQsigFramerRowStatusTable, sigChanEQsigL2Table=sigChanEQsigL2Table, sigChanEQsigFramer=sigChanEQsigFramer, sigChanEQsigEQsigSpecificProvEntry=sigChanEQsigEQsigSpecificProvEntry, sigChanEQsigPeakActiveDataChannels=sigChanEQsigPeakActiveDataChannels, sigChanEQsigFramerComponentName=sigChanEQsigFramerComponentName, vnetEtsiQsigCapabilitiesBE01=vnetEtsiQsigCapabilitiesBE01, sigChanEQsigFramerOctetFromIf=sigChanEQsigFramerOctetFromIf, sigChanEQsigDChanStatus=sigChanEQsigDChanStatus, sigChanEQsigFramerFrmFromIf=sigChanEQsigFramerFrmFromIf, sigChanEQsigTracing=sigChanEQsigTracing, sigChanEQsigToolsEntry=sigChanEQsigToolsEntry, vnetEtsiQsigGroupBE01=vnetEtsiQsigGroupBE01, sigChanEQsigT200=sigChanEQsigT200, sigChanEQsigOperationalState=sigChanEQsigOperationalState, sigChanEQsigRowStatusTable=sigChanEQsigRowStatusTable, sigChanEQsigActiveChannels=sigChanEQsigActiveChannels, vnetEtsiQsigGroupBE=vnetEtsiQsigGroupBE, sigChanEQsigN200=sigChanEQsigN200, sigChanEQsigMaxNonCallConcurrent=sigChanEQsigMaxNonCallConcurrent, sigChanEQsigT23=sigChanEQsigT23, sigChanEQsigEQsigSpecificOpEntry=sigChanEQsigEQsigSpecificOpEntry, sigChanEQsigT203=sigChanEQsigT203, sigChanEQsigL3Table=sigChanEQsigL3Table, sigChanEQsigT310=sigChanEQsigT310, sigChanEQsigStatsTable=sigChanEQsigStatsTable, sigChanEQsigRowStatusEntry=sigChanEQsigRowStatusEntry, vnetEtsiQsigCapabilities=vnetEtsiQsigCapabilities, sigChanEQsigOperTable=sigChanEQsigOperTable, sigChanEQsigActiveVoiceChannels=sigChanEQsigActiveVoiceChannels, sigChanEQsigPeakActiveChannels=sigChanEQsigPeakActiveChannels, sigChanEQsigT309=sigChanEQsigT309, sigChanEQsigFramerAdminState=sigChanEQsigFramerAdminState, sigChanEQsigFramerRowStatusEntry=sigChanEQsigFramerRowStatusEntry, sigChanEQsigFramerNonOctetErrors=sigChanEQsigFramerNonOctetErrors, sigChanEQsigAdminState=sigChanEQsigAdminState, vnetEtsiQsigGroup=vnetEtsiQsigGroup, vnetEtsiQsigCapabilitiesBE=vnetEtsiQsigCapabilitiesBE, sigChanEQsigFramerProvEntry=sigChanEQsigFramerProvEntry, sigChanEQsigFramerStateEntry=sigChanEQsigFramerStateEntry, sigChanEQsigComponentName=sigChanEQsigComponentName, sigChanEQsigFramerStatsTable=sigChanEQsigFramerStatsTable, sigChanEQsigFramerStateTable=sigChanEQsigFramerStateTable, sigChanEQsigActiveDataChannels=sigChanEQsigActiveDataChannels, sigChanEQsigUsageState=sigChanEQsigUsageState, sigChanEQsigFramerLrcErrors=sigChanEQsigFramerLrcErrors, sigChanEQsigFramerOperationalState=sigChanEQsigFramerOperationalState, sigChanEQsigMsgSegmentation=sigChanEQsigMsgSegmentation, sigChanEQsigRowStatus=sigChanEQsigRowStatus, sigChanEQsigNonCallAssocSessionsToIf=sigChanEQsigNonCallAssocSessionsToIf, sigChanEQsigFramerIndex=sigChanEQsigFramerIndex, sigChanEQsigPeakActiveVoiceChannels=sigChanEQsigPeakActiveVoiceChannels, sigChanEQsigFramerRowStatus=sigChanEQsigFramerRowStatus, sigChanEQsigStatsEntry=sigChanEQsigStatsEntry, sigChanEQsigFramerUnderruns=sigChanEQsigFramerUnderruns, sigChanEQsigSegmentationFailed=sigChanEQsigSegmentationFailed, sigChanEQsigStateTable=sigChanEQsigStateTable, sigChanEQsigFramerOverruns=sigChanEQsigFramerOverruns, vnetEtsiQsigMIB=vnetEtsiQsigMIB, sigChanEQsigStateEntry=sigChanEQsigStateEntry, vnetEtsiQsigCapabilitiesBE01A=vnetEtsiQsigCapabilitiesBE01A, sigChanEQsigE1ChannelNumbers=sigChanEQsigE1ChannelNumbers) |
# -*- coding: utf-8 -*-
# (N.B : the site root is also related to the nginx conf!)
SITE_ROOT = "__YNH_APP_WEBPATH__"
DEBUG = False
TEMPLATE_DEBUG = False
| site_root = '__YNH_APP_WEBPATH__'
debug = False
template_debug = False |
#VERSION: 1.0
INFO = {"initwin":("init_window","Window initializer(only for Windows)")}
RLTS = {"cls":("iccode","os","json"),"funcs":("echo","get_args","edit_userconf"),"vars":("BLOCK","ECHO","OS")}
def init_window(cmd):
global ECHO
opts = get_args(cmd)
for i in opts:
if i in ("-h,--help"):
echo(1,"""Window initializer(only for Windows)
the configs of window color, title, etc. are in the basic user config.
to edit please use the command of \"edconf\"
for window color code please use \"color /help\" for help
Usage: chpwd
-h --help - display this page
Examples:
>initwin
""")
else:
echo(1,"[ERROR] unhandled option \"" + i + "\", try \"-h\" tag for help")
return
try:
configs = BLOCK.read("user/user.json")
coder = iccode(PWD)
configs = coder.decode(configs)
configs = configs.decode()
configs = json.loads(configs)
if PWD != configs["iccode_key"]:
raise Exception("user config file value didn't match")
else:
pass
except Exception as err:
echo(1,"[ERROR] Failed to read block config file: " + str(err) + ", file may be broken")
return
stat = "window_color" in configs and "window_title" in configs
if not stat:
echo(1,"windowinit configs not found, creating by default")
ECHO = False
edit_userconf("-e window_color -v 07")
edit_userconf("-e window_title -v ICLab")
ECHO = True
try:
configs = BLOCK.read("user/user.json")
coder = iccode(PWD)
configs = coder.decode(configs)
configs = configs.decode()
configs = json.loads(configs)
if PWD != configs["iccode_key"]:
raise Exception("user config file value didn't match")
else:
pass
except Exception as err:
echo(1,"[ERROR] Failed to read block config file: " + str(err) + ", file may be broken")
return
if OS == "win":
os.system("title " + configs["window_title"])
os.system("color " + configs["window_color"])
else:
pass
# [AUTORUN]
init_window("")
| info = {'initwin': ('init_window', 'Window initializer(only for Windows)')}
rlts = {'cls': ('iccode', 'os', 'json'), 'funcs': ('echo', 'get_args', 'edit_userconf'), 'vars': ('BLOCK', 'ECHO', 'OS')}
def init_window(cmd):
global ECHO
opts = get_args(cmd)
for i in opts:
if i in '-h,--help':
echo(1, 'Window initializer(only for Windows)\n\n the configs of window color, title, etc. are in the basic user config.\n to edit please use the command of "edconf"\n for window color code please use "color /help" for help\n\nUsage: chpwd\n -h --help - display this page\n\nExamples:\n >initwin\n')
else:
echo(1, '[ERROR] unhandled option "' + i + '", try "-h" tag for help')
return
try:
configs = BLOCK.read('user/user.json')
coder = iccode(PWD)
configs = coder.decode(configs)
configs = configs.decode()
configs = json.loads(configs)
if PWD != configs['iccode_key']:
raise exception("user config file value didn't match")
else:
pass
except Exception as err:
echo(1, '[ERROR] Failed to read block config file: ' + str(err) + ', file may be broken')
return
stat = 'window_color' in configs and 'window_title' in configs
if not stat:
echo(1, 'windowinit configs not found, creating by default')
echo = False
edit_userconf('-e window_color -v 07')
edit_userconf('-e window_title -v ICLab')
echo = True
try:
configs = BLOCK.read('user/user.json')
coder = iccode(PWD)
configs = coder.decode(configs)
configs = configs.decode()
configs = json.loads(configs)
if PWD != configs['iccode_key']:
raise exception("user config file value didn't match")
else:
pass
except Exception as err:
echo(1, '[ERROR] Failed to read block config file: ' + str(err) + ', file may be broken')
return
if OS == 'win':
os.system('title ' + configs['window_title'])
os.system('color ' + configs['window_color'])
else:
pass
init_window('') |
class TestarosaPyError(Exception):
...
class AnotherError(TestarosaPyError):
...
| class Testarosapyerror(Exception):
...
class Anothererror(TestarosaPyError):
... |
def upper_case_first_param(func):
def wrapper(text):
return func(text.upper())
return wrapper
@upper_case_first_param
def recibed_a_msg(name: str) -> str:
return f"{name}, you has received a message."
@upper_case_first_param
def uppercase(msg: str) -> str:
return msg
if __name__ == "__main__":
print(recibed_a_msg("Cesar"))
print(uppercase("hello world!"))
| def upper_case_first_param(func):
def wrapper(text):
return func(text.upper())
return wrapper
@upper_case_first_param
def recibed_a_msg(name: str) -> str:
return f'{name}, you has received a message.'
@upper_case_first_param
def uppercase(msg: str) -> str:
return msg
if __name__ == '__main__':
print(recibed_a_msg('Cesar'))
print(uppercase('hello world!')) |
"""
This file analyzes a game state and determines the next (group of) cells to mark grey or blue.
The output file for this will be "${GAMESTATE_FILENAME}_soln".
The data output will consist of:
1. An array of cells to mark as blue
2. An array of cells to mark as grey
3. An array of data structures to mark as completed
"""
| """
This file analyzes a game state and determines the next (group of) cells to mark grey or blue.
The output file for this will be "${GAMESTATE_FILENAME}_soln".
The data output will consist of:
1. An array of cells to mark as blue
2. An array of cells to mark as grey
3. An array of data structures to mark as completed
""" |
class FlagRegion:
def __init__(self, name, format, icon, mode):
self.name = name
self.format = format
self.icon = icon
self.mode = mode
| class Flagregion:
def __init__(self, name, format, icon, mode):
self.name = name
self.format = format
self.icon = icon
self.mode = mode |
class Status(object):
'''Object to represent row in status table
Attributes:
conn: database connection, usually sqlite3 connection object
name: name of pipeline job running
display_name: pretty formatted display name for pipeline
last_ran: UNIX timestamp (number) for last complete run
start_time: UNIX timestamp (number) for last complete run start
status: string representing status/errors with the pipeline
num_lines: if successful, number of lines processed
input_checksum: a checksum of the input's contents
'''
def __init__(
self, conn, name, display_name, last_ran, start_time,
status, frequency, num_lines, input_checksum
):
self.conn = conn
self.name = name
self.display_name = display_name
self.last_ran = last_ran
self.start_time = start_time
self.status = status
self.num_lines = num_lines
self.input_checksum = input_checksum
def update(self, **kwargs):
'''Update the Status object with passed kwargs and write the result
'''
for k, v in kwargs.items():
setattr(self, k, v)
self.write()
def write(self):
'''Insert or replace a status row
'''
cur = self.conn.cursor()
cur.execute(
'''
INSERT OR REPLACE INTO status (
name, display_name, last_ran, start_time,
input_checksum, status, num_lines
) VALUES (?, ?, ?, ?, ?, ?, ?)
''', (
self.name, self.display_name, self.last_ran,
self.start_time, self.input_checksum,
self.status, self.num_lines
)
)
self.conn.commit()
| class Status(object):
"""Object to represent row in status table
Attributes:
conn: database connection, usually sqlite3 connection object
name: name of pipeline job running
display_name: pretty formatted display name for pipeline
last_ran: UNIX timestamp (number) for last complete run
start_time: UNIX timestamp (number) for last complete run start
status: string representing status/errors with the pipeline
num_lines: if successful, number of lines processed
input_checksum: a checksum of the input's contents
"""
def __init__(self, conn, name, display_name, last_ran, start_time, status, frequency, num_lines, input_checksum):
self.conn = conn
self.name = name
self.display_name = display_name
self.last_ran = last_ran
self.start_time = start_time
self.status = status
self.num_lines = num_lines
self.input_checksum = input_checksum
def update(self, **kwargs):
"""Update the Status object with passed kwargs and write the result
"""
for (k, v) in kwargs.items():
setattr(self, k, v)
self.write()
def write(self):
"""Insert or replace a status row
"""
cur = self.conn.cursor()
cur.execute('\n INSERT OR REPLACE INTO status (\n name, display_name, last_ran, start_time,\n input_checksum, status, num_lines\n ) VALUES (?, ?, ?, ?, ?, ?, ?)\n ', (self.name, self.display_name, self.last_ran, self.start_time, self.input_checksum, self.status, self.num_lines))
self.conn.commit() |
"""
9. Palindrome Number
https://leetcode.com/problems/palindrome-number/description/
"""
class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
if x % 10 == x:
return True
before, after = x, 0
while before > 0:
after *= 10
after += (before % 10)
before //= 10
return after == x
# a = Solution()
# assert a.isPalindrome(1)
# assert a.isPalindrome(10) == False
# assert a.isPalindrome(11)
# assert a.isPalindrome(111)
# assert a.isPalindrome(121)
# assert a.isPalindrome(12321)
# assert a.isPalindrome(-12321) == False
| """
9. Palindrome Number
https://leetcode.com/problems/palindrome-number/description/
"""
class Solution:
def is_palindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
if x % 10 == x:
return True
(before, after) = (x, 0)
while before > 0:
after *= 10
after += before % 10
before //= 10
return after == x |
# clean = open("../data/fics_2017_HvC.pgn", "w+")
# with open("../data/fics_2017_HvC_raw.pgn") as raw:
# for i, line in enumerate(raw):
# if (i % 1000): print(i)
# if "\r\n" in line:
# clean.write(line.replace("\r\n", "\n"))
# else:
# clean.write("\n\n")
# clean.write("\n\n")
def writeEOF(src):
with open(src, "a") as f:
f.write("EOF\n")
writeEOF("../data/fics_2017_HvC.pgn")
writeEOF("../data/games.pgn")
| def write_eof(src):
with open(src, 'a') as f:
f.write('EOF\n')
write_eof('../data/fics_2017_HvC.pgn')
write_eof('../data/games.pgn') |
ABSATER = 'ABSATER'
ATTRIB = 'ATTRIB'
INVATR = 'INVATR'
OBJECT = 'OBJECT'
RDSET = 'RDSET'
RSET = 'RSET'
SET = 'SET'
ComponentRole = {
'000': ABSATER,
'001': ATTRIB,
'010': INVATR,
'011': OBJECT,
'100': 'reserved',
'101': RDSET,
'110': RSET,
'111': SET
}
"""
- An EFLR begins with a Set components. Type in Set is mandatory, name is optional.
- A Redundant Set is an identical copy of some Set written previously in the same Logical File, including the Set
Name and Type. If a Redundant Set is has a null Name, then the Set of which it is a copy must be the only Set in the
same Logical File of the same Type, excluding other Redundant Sets, preceding the given Redundant Set.
- A Replacement Set has the same Type and (non-null) Name, the same Template, and the same Objects (none added,
none deleted) in the same order as a Set written previously in the same Logical File. However, the Attributes of the
Replacement Set reflect all updates that may have been applied since the original Set was written. A Replacement
Set can be written anywhere in a Logical File following the original Set that it replaces. There may be any number
of Replacement Sets for a given original Set.
- Then Template follows Set. Template is just a collection of Attribute Components and/or Invariant Attribute
Components. This define the structures of the objects in this Set. All Components in the Template must have
distinct, non-null Labels.
- Object components follows the Template. Object name is manadatory,
- Attribute component.
- All Attributes in the same "column" of a Set must have the same Attribute Label, namely,
the one specified in the Template Attribute Component. Therefore, Attribute Components that follow Object Components
must not have Attribute Labels (because it is already defined in Template).
- The remaining Characteristics may be freely specified by an Object's Attribute Components. Any Characteristic
not present assumes the local default value as specified in the corresponding Attribute Component in the Template.
- Missing Attribute Components imply that local defaults should be used for the Characteristics of the
corresponding Attribute. Since Attribute order is important within a Set, only trailing Attribute Components can be
omitted.
- An Attribute is considered to be Absent for an Object when its Attribute Component is
replaced by an Absent Attribute Component. An Absent Attribute is one for which no
information is provided, not even default meaning.
"""
class Component(object):
"""
Represent Component in RP 66, super class for set, object, attribute
"""
def toJSON(self):
return self.__dict__
class Object(Component):
"""
Object. Each object only have two things: name and a list of attributes.
"""
def __init__(self):
self._name = None
self._attributes= []
@property
def name(self):
"""
:return:
:rtype: ObName
"""
return self._name
@property
def attributes(self):
return self._attributes
def __str__(self):
attrStr = "\n ".join(map(str, self.attributes))
return "Object[name:{} with attributes:\n{}]".format(self.name, attrStr)
class Attribute(Component):
"""
Represent Attribute in RP66.
"""
def __init__(self):
self._label = ''
self._count = 1
# default rep code is 19.
self._repCode = 19
self._units = ''
self._value = None
def clone(self, attr):
attr._label = self._label
attr._count = self._count
attr._repCode = self._repCode
attr._units = self._units
attr._value = self._value
return attr
def __str__(self):
return "Attribute[label:{} count:{} repCode:{} units:{} value:{}]".\
format(self._label, self._count, self._repCode, self._units, self._value)
@property
def value(self):
return self._value
@property
def label(self):
return self._label
@property
def count(self):
return self._count
@property
def repCode(self):
return self._repCode
@property
def units(self):
return self._units
class AbsentAttribute(Attribute):
"""
Represent Absent Attribute.
"""
def __init__(self, attr):
self._label = attr._label
self._count = attr._count
self._repCode = attr._repCode
self._units = attr._units
self._value = attr._value
class InvariantAttribute(Attribute):
"""
Represent Invariant attribute.
"""
pass
class Set(Component):
"""
Represent set. Set is central piece in EFLR, each set has a name, type and a template which defines attributes each
of objects should have, then a list of objects.
"""
def __init__(self):
self._type = None
self._name = None
self.template = None
self.objects = []
@property
def type(self):
return self._type
@property
def name(self):
return self._name
def __str__(self):
return 'Set[type:{} name:{} numOfObjects:{}]'.format(self._type, self._name, len(self.objects))
class RedundantSet(Set):
"""
Represent Redundant set.
"""
pass
class ReplacementSet(Set):
"""
Represent replacementset.
"""
pass
class Template(object):
"""
Template. Template only contains a list of attribute which should be included in each objects in the same set.
It is similar to database columns.
"""
def __init__(self):
self._attrList = []
@property
def attrList(self):
return self._attrList
def __str__(self):
attrListStr = '\n '.join(map(str, self._attrList))
return "Template with attributes [\n{}]".format(attrListStr)
def toJSON(self):
return dict(attributeList=self._attrList) | absater = 'ABSATER'
attrib = 'ATTRIB'
invatr = 'INVATR'
object = 'OBJECT'
rdset = 'RDSET'
rset = 'RSET'
set = 'SET'
component_role = {'000': ABSATER, '001': ATTRIB, '010': INVATR, '011': OBJECT, '100': 'reserved', '101': RDSET, '110': RSET, '111': SET}
'\n- An EFLR begins with a Set components. Type in Set is mandatory, name is optional. \n - A Redundant Set is an identical copy of some Set written previously in the same Logical File, including the Set \n Name and Type. If a Redundant Set is has a null Name, then the Set of which it is a copy must be the only Set in the\n same Logical File of the same Type, excluding other Redundant Sets, preceding the given Redundant Set.\n\n - A Replacement Set has the same Type and (non-null) Name, the same Template, and the same Objects (none added, \n none deleted) in the same order as a Set written previously in the same Logical File. However, the Attributes of the\n Replacement Set reflect all updates that may have been applied since the original Set was written. A Replacement \n Set can be written anywhere in a Logical File following the original Set that it replaces. There may be any number \n of Replacement Sets for a given original Set.\n\n\n \n- Then Template follows Set. Template is just a collection of Attribute Components and/or Invariant Attribute \n Components. This define the structures of the objects in this Set. All Components in the Template must have \n distinct, non-null Labels.\n \n- Object components follows the Template. Object name is manadatory,\n \n- Attribute component. \n - All Attributes in the same "column" of a Set must have the same Attribute Label, namely, \n the one specified in the Template Attribute Component. Therefore, Attribute Components that follow Object Components \n must not have Attribute Labels (because it is already defined in Template).\n \n - The remaining Characteristics may be freely specified by an Object\'s Attribute Components. Any Characteristic \n not present assumes the local default value as specified in the corresponding Attribute Component in the Template. \n \n - Missing Attribute Components imply that local defaults should be used for the Characteristics of the \n corresponding Attribute. Since Attribute order is important within a Set, only trailing Attribute Components can be \n omitted.\n \n - An Attribute is considered to be Absent for an Object when its Attribute Component is \n replaced by an Absent Attribute Component. An Absent Attribute is one for which no\n information is provided, not even default meaning.\n'
class Component(object):
"""
Represent Component in RP 66, super class for set, object, attribute
"""
def to_json(self):
return self.__dict__
class Object(Component):
"""
Object. Each object only have two things: name and a list of attributes.
"""
def __init__(self):
self._name = None
self._attributes = []
@property
def name(self):
"""
:return:
:rtype: ObName
"""
return self._name
@property
def attributes(self):
return self._attributes
def __str__(self):
attr_str = '\n '.join(map(str, self.attributes))
return 'Object[name:{} with attributes:\n{}]'.format(self.name, attrStr)
class Attribute(Component):
"""
Represent Attribute in RP66.
"""
def __init__(self):
self._label = ''
self._count = 1
self._repCode = 19
self._units = ''
self._value = None
def clone(self, attr):
attr._label = self._label
attr._count = self._count
attr._repCode = self._repCode
attr._units = self._units
attr._value = self._value
return attr
def __str__(self):
return 'Attribute[label:{} count:{} repCode:{} units:{} value:{}]'.format(self._label, self._count, self._repCode, self._units, self._value)
@property
def value(self):
return self._value
@property
def label(self):
return self._label
@property
def count(self):
return self._count
@property
def rep_code(self):
return self._repCode
@property
def units(self):
return self._units
class Absentattribute(Attribute):
"""
Represent Absent Attribute.
"""
def __init__(self, attr):
self._label = attr._label
self._count = attr._count
self._repCode = attr._repCode
self._units = attr._units
self._value = attr._value
class Invariantattribute(Attribute):
"""
Represent Invariant attribute.
"""
pass
class Set(Component):
"""
Represent set. Set is central piece in EFLR, each set has a name, type and a template which defines attributes each
of objects should have, then a list of objects.
"""
def __init__(self):
self._type = None
self._name = None
self.template = None
self.objects = []
@property
def type(self):
return self._type
@property
def name(self):
return self._name
def __str__(self):
return 'Set[type:{} name:{} numOfObjects:{}]'.format(self._type, self._name, len(self.objects))
class Redundantset(Set):
"""
Represent Redundant set.
"""
pass
class Replacementset(Set):
"""
Represent replacementset.
"""
pass
class Template(object):
"""
Template. Template only contains a list of attribute which should be included in each objects in the same set.
It is similar to database columns.
"""
def __init__(self):
self._attrList = []
@property
def attr_list(self):
return self._attrList
def __str__(self):
attr_list_str = '\n '.join(map(str, self._attrList))
return 'Template with attributes [\n{}]'.format(attrListStr)
def to_json(self):
return dict(attributeList=self._attrList) |
# Multiple Choice
# Return the answer to the multiple choice question in the handout.
# If you think option c is the correct answer,
# return 'c'
def question_1():
# [Image] The first hidden layer has 4 filters of kernel-width 2 and stride 2;
# the second layer has 3 filters of kernel-width 8 and stride 2; the third layer has 2 filters of kernel-width 6 and stride 2
return 'b'
def question_2():
# out_width = [(in_width_padded - kernel_dilated) // stride] + 1,
# where in_width_padded = in_width + 2 * padding, kernel_dilated = (kernel - 1) * (dilation - 1) + kernel
return 'd'
def question_3():
# [Image] ip = 100, kernel = 5, stride = 2. Op = ??
# Example Input: Batch size = 2, In channel = 3, In width = 100
# Example W: Out channel = 4, In channel = 3, Kernel width = 5
# Example Out: Batch size = 2, Out channel = 4, Out width = 48
return 'b'
def question_4():
#working of numpy.tensordot
#A = np.arange(30.).reshape(2,3,5)
#B = np.arange(24.).reshape(3,4,2)
#C = np.tensordot(A,B, axes = ([0,1],[2,0]))
return 'a' #random to test
def question_5():
#lol question
return 'a'
| def question_1():
return 'b'
def question_2():
return 'd'
def question_3():
return 'b'
def question_4():
return 'a'
def question_5():
return 'a' |
"""
entrada
cantidad invertida-->float-->c
tasa de intereses-->float-->t
salida
intereses-->float-->i
ganancia total-->float-->total
"""
c=float(input("Escriba la cantidad invertida:"))
t=float(input("Escriba la tasa de interes:"))
i=(c*t)/100
if (i>100.000):
print("Los intereses son:"+str(i))
total=c + t
print("el salario total es:"+str(total)) | """
entrada
cantidad invertida-->float-->c
tasa de intereses-->float-->t
salida
intereses-->float-->i
ganancia total-->float-->total
"""
c = float(input('Escriba la cantidad invertida:'))
t = float(input('Escriba la tasa de interes:'))
i = c * t / 100
if i > 100.0:
print('Los intereses son:' + str(i))
total = c + t
print('el salario total es:' + str(total)) |
class WorkflowNotFound(Exception):
pass
class WorkflowSyntaxError(Exception):
pass
| class Workflownotfound(Exception):
pass
class Workflowsyntaxerror(Exception):
pass |
# Copyright 2021 Tianmian Tech. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
class FederationWrapped(object):
"""
A wrapper, wraps _DSource as Table
"""
# noinspection PyProtectedMember
def __init__(self, session_id, dsource_cls, table_cls):
self.dsource_cls = dsource_cls
self.table_cls = table_cls
self.session_id = session_id
def unboxed(self, obj):
if hasattr(obj, "_fcs"):
return obj
elif isinstance(obj, self.table_cls):
return obj.dsource()
else:
return obj
def boxed(self, obj):
if isinstance(obj, self.dsource_cls):
return self.table_cls.from_dsource(dsource=obj, session_id=self.session_id)
else:
return obj
| class Federationwrapped(object):
"""
A wrapper, wraps _DSource as Table
"""
def __init__(self, session_id, dsource_cls, table_cls):
self.dsource_cls = dsource_cls
self.table_cls = table_cls
self.session_id = session_id
def unboxed(self, obj):
if hasattr(obj, '_fcs'):
return obj
elif isinstance(obj, self.table_cls):
return obj.dsource()
else:
return obj
def boxed(self, obj):
if isinstance(obj, self.dsource_cls):
return self.table_cls.from_dsource(dsource=obj, session_id=self.session_id)
else:
return obj |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# CDS-ILS is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.
"""CDS-ILS CDS Importer ignored fields."""
CDS_IGNORE_FIELDS = {
"003",
"005",
"020__q",
"020__c",
"020__b", # this field is used to match multipart items as volumes
"020__C",
"0248_a",
"0248_p",
"041__h", # 206 cds-dojson
"035__z",
"037__c", # arXiv subject category
"050__b",
"050_4b",
"082002",
"082042",
"0820_2",
"082__2", # INSPIRE keywords
"084__a", # INSPIRE keywords
"084__2",
"100__9",
"111__d",
"111__f",
"145__a",
"246__i",
"269__a", # preprint info
"269__b", # preprint info
"269__c", # preprint date
"270__m", # conference email
"300__b", # 206 cds-dojson
"340__a",
"440_3a", # 206 cds-dojson
"541__9",
"541__a",
"541__h",
"502__a", # thesis_info/defense_date
"502__b", # thesis_info/degree_type
"502__c", # thesis_info/institutions
"502__d", # thesis_info/date (publication)
"5208_a", # 206 cds-dojson
"520__9",
"536__a", # founding info, dropped
"536__c",
"536__f",
"536__r",
"540__b",
"540__f",
"595__z",
"595__9",
"596__a",
"597__a",
"650172",
"65017a",
"650272",
"65027a",
"690__c", # 206 cds-dojson
"694__9",
"694__a",
"695__2",
"695__a",
"700__9",
"710__5",
"773__r", # publication_info/parent_report_number
"773__w", # inspire cnum (duplicated field with 035__9)
"773__z", # publication_info/parent_isbn
"775__c", # related edition's year (it will be resolved)
"852__c",
"852__h",
"852__p",
"8564_8", # bibdoc id
"8564_s", # file identifier
"8564_x", # subformat identifier
"900__s", # 206 cds-dojson
"900__u", # 206 cds-dojson
"900__y", # 206 cds-dojson
"901__a", # record affiliation
"901__u",
"916__a",
"916__d",
"916__e",
"916__y",
"940__u",
"961__c",
"961__h",
"961__l",
"961__x",
"962__b",
"962__n", # books connected by conference
"963__a",
"964__a",
"970__a",
"970__d",
"980__c",
"981__a",
}
| """CDS-ILS CDS Importer ignored fields."""
cds_ignore_fields = {'003', '005', '020__q', '020__c', '020__b', '020__C', '0248_a', '0248_p', '041__h', '035__z', '037__c', '050__b', '050_4b', '082002', '082042', '0820_2', '082__2', '084__a', '084__2', '100__9', '111__d', '111__f', '145__a', '246__i', '269__a', '269__b', '269__c', '270__m', '300__b', '340__a', '440_3a', '541__9', '541__a', '541__h', '502__a', '502__b', '502__c', '502__d', '5208_a', '520__9', '536__a', '536__c', '536__f', '536__r', '540__b', '540__f', '595__z', '595__9', '596__a', '597__a', '650172', '65017a', '650272', '65027a', '690__c', '694__9', '694__a', '695__2', '695__a', '700__9', '710__5', '773__r', '773__w', '773__z', '775__c', '852__c', '852__h', '852__p', '8564_8', '8564_s', '8564_x', '900__s', '900__u', '900__y', '901__a', '901__u', '916__a', '916__d', '916__e', '916__y', '940__u', '961__c', '961__h', '961__l', '961__x', '962__b', '962__n', '963__a', '964__a', '970__a', '970__d', '980__c', '981__a'} |
#
# PySNMP MIB module ALVARION-BANDWIDTH-CONTROL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-BANDWIDTH-CONTROL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:21:58 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)
#
alvarionMgmtV2, = mibBuilder.importSymbols("ALVARION-SMI", "alvarionMgmtV2")
AlvarionPriorityQueue, = mibBuilder.importSymbols("ALVARION-TC", "AlvarionPriorityQueue")
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint")
ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup")
TimeTicks, ModuleIdentity, Unsigned32, Counter32, Integer32, Gauge32, ObjectIdentity, Counter64, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, Bits, MibIdentifier, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "ModuleIdentity", "Unsigned32", "Counter32", "Integer32", "Gauge32", "ObjectIdentity", "Counter64", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "Bits", "MibIdentifier", "IpAddress")
TruthValue, TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "TextualConvention", "DisplayString")
alvarionBandwidthControlMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14))
if mibBuilder.loadTexts: alvarionBandwidthControlMIB.setLastUpdated('200710310000Z')
if mibBuilder.loadTexts: alvarionBandwidthControlMIB.setOrganization('Alvarion Ltd.')
if mibBuilder.loadTexts: alvarionBandwidthControlMIB.setContactInfo('Alvarion Ltd. Postal: 21a HaBarzel St. P.O. Box 13139 Tel-Aviv 69710 Israel Phone: +972 3 645 6262')
if mibBuilder.loadTexts: alvarionBandwidthControlMIB.setDescription('Alvarion Bandwidth Control MIB.')
alvarionBandwidthControlMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1))
coBandwidthControlConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1))
coBandwidthControlEnable = MibScalar((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 1), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: coBandwidthControlEnable.setStatus('current')
if mibBuilder.loadTexts: coBandwidthControlEnable.setDescription('Indicates if bandwidth control is enabled or disabled on the Internet port.')
coBandwidthControlMaxTransmitRate = MibScalar((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: coBandwidthControlMaxTransmitRate.setStatus('current')
if mibBuilder.loadTexts: coBandwidthControlMaxTransmitRate.setDescription('Indicates the maximum rate at which data can be transmitted on the Internet port. If traffic exceeds this rate for short bursts, it is buffered. Long overages will result in data being dropped.')
coBandwidthControlMaxReceiveRate = MibScalar((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: coBandwidthControlMaxReceiveRate.setStatus('current')
if mibBuilder.loadTexts: coBandwidthControlMaxReceiveRate.setDescription('Indicates the maximum rate at which data can be received on the Internet port. If traffic exceeds this rate for short bursts it is buffered. Long overages will result in data being dropped.')
coBandwidthControlLevelTable = MibTable((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4), )
if mibBuilder.loadTexts: coBandwidthControlLevelTable.setStatus('current')
if mibBuilder.loadTexts: coBandwidthControlLevelTable.setDescription('A table defining the current bandwidth level settings that are active on the device.')
coBandwidthControlLevelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1), ).setIndexNames((0, "ALVARION-BANDWIDTH-CONTROL-MIB", "coBandwidthControlLevelIndex"))
if mibBuilder.loadTexts: coBandwidthControlLevelEntry.setStatus('current')
if mibBuilder.loadTexts: coBandwidthControlLevelEntry.setDescription('An entry in the coBandwidthControlLevelTable. coBandwidthControlLevelIndex - Uniquely access a definition for this particular bandwidth control level.')
coBandwidthControlLevelIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1, 1), AlvarionPriorityQueue())
if mibBuilder.loadTexts: coBandwidthControlLevelIndex.setStatus('current')
if mibBuilder.loadTexts: coBandwidthControlLevelIndex.setDescription('Specifies the level index. Each index defines a bandwidth level that traffic can be assigned to. Four indexes are defined (1 to 4) with the following meanings: 1-Low, 2-Normal, 3- High, 4-Very High.')
coBandwidthControlLevelMinTransmitRate = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: coBandwidthControlLevelMinTransmitRate.setStatus('current')
if mibBuilder.loadTexts: coBandwidthControlLevelMinTransmitRate.setDescription('Specify the minimum transmit rate for the level as a percentage of coBandwidthControlMaxTransmitRate. This is the minimum amount of bandwidth that will be assigned to a level as soon as outgoing traffic is present on the level.')
coBandwidthControlLevelMaxTransmitRate = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: coBandwidthControlLevelMaxTransmitRate.setStatus('current')
if mibBuilder.loadTexts: coBandwidthControlLevelMaxTransmitRate.setDescription('Specify the maximum transmit rate for the specified level as a percentage of coBandwidthControlMaxTransmitRate. This is the maximum amount of outgoing bandwidth that can be consumed by the level. Traffic in excess will be buffered for short bursts, and dropped for sustained overages')
coBandwidthControlLevelMinReceiveRate = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: coBandwidthControlLevelMinReceiveRate.setStatus('current')
if mibBuilder.loadTexts: coBandwidthControlLevelMinReceiveRate.setDescription('Specify the minimum receive rate for the specified level as a percentage of coBandwidthControlMaxReceiveRateRate. This is the minimum amount of bandwidth that will be assigned to a level as soon as incoming traffic is present on the level.')
coBandwidthControlLevelMaxReceiveRate = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: coBandwidthControlLevelMaxReceiveRate.setStatus('current')
if mibBuilder.loadTexts: coBandwidthControlLevelMaxReceiveRate.setDescription('Specify the maximum receive rate for the specified level as a percentage of coBandwidthControlMaxReceiveRateRate. This is the maximum amount of incoming bandwidth that can be consumed by the level. Traffic in excess will be buffered for short bursts, and dropped for sustained overages.')
alvarionBandwidthControlMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2))
alvarionBandwidthControlMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2, 1))
alvarionBandwidthControlMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2, 2))
alvarionBandwidthControlMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2, 1, 1)).setObjects(("ALVARION-BANDWIDTH-CONTROL-MIB", "alvarionBandwidthControlMIBGroup"), ("ALVARION-BANDWIDTH-CONTROL-MIB", "alvarionBandwidthControlLevelMIBGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
alvarionBandwidthControlMIBCompliance = alvarionBandwidthControlMIBCompliance.setStatus('current')
if mibBuilder.loadTexts: alvarionBandwidthControlMIBCompliance.setDescription('The compliance statement for the Bandwidth Control MIB.')
alvarionBandwidthControlMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2, 2, 1)).setObjects(("ALVARION-BANDWIDTH-CONTROL-MIB", "coBandwidthControlEnable"), ("ALVARION-BANDWIDTH-CONTROL-MIB", "coBandwidthControlMaxTransmitRate"), ("ALVARION-BANDWIDTH-CONTROL-MIB", "coBandwidthControlMaxReceiveRate"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
alvarionBandwidthControlMIBGroup = alvarionBandwidthControlMIBGroup.setStatus('current')
if mibBuilder.loadTexts: alvarionBandwidthControlMIBGroup.setDescription('A collection of objects for use with Bandwidth Controls.')
alvarionBandwidthControlLevelMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2, 2, 2)).setObjects(("ALVARION-BANDWIDTH-CONTROL-MIB", "coBandwidthControlLevelMinTransmitRate"), ("ALVARION-BANDWIDTH-CONTROL-MIB", "coBandwidthControlLevelMaxTransmitRate"), ("ALVARION-BANDWIDTH-CONTROL-MIB", "coBandwidthControlLevelMinReceiveRate"), ("ALVARION-BANDWIDTH-CONTROL-MIB", "coBandwidthControlLevelMaxReceiveRate"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
alvarionBandwidthControlLevelMIBGroup = alvarionBandwidthControlLevelMIBGroup.setStatus('current')
if mibBuilder.loadTexts: alvarionBandwidthControlLevelMIBGroup.setDescription('A collection of objects for use with Bandwidth Controls.')
mibBuilder.exportSymbols("ALVARION-BANDWIDTH-CONTROL-MIB", coBandwidthControlLevelMaxTransmitRate=coBandwidthControlLevelMaxTransmitRate, alvarionBandwidthControlMIBGroups=alvarionBandwidthControlMIBGroups, coBandwidthControlMaxReceiveRate=coBandwidthControlMaxReceiveRate, alvarionBandwidthControlMIBGroup=alvarionBandwidthControlMIBGroup, alvarionBandwidthControlMIBCompliance=alvarionBandwidthControlMIBCompliance, coBandwidthControlLevelMaxReceiveRate=coBandwidthControlLevelMaxReceiveRate, coBandwidthControlLevelMinTransmitRate=coBandwidthControlLevelMinTransmitRate, coBandwidthControlMaxTransmitRate=coBandwidthControlMaxTransmitRate, alvarionBandwidthControlMIBConformance=alvarionBandwidthControlMIBConformance, coBandwidthControlConfig=coBandwidthControlConfig, alvarionBandwidthControlMIB=alvarionBandwidthControlMIB, alvarionBandwidthControlMIBObjects=alvarionBandwidthControlMIBObjects, coBandwidthControlLevelMinReceiveRate=coBandwidthControlLevelMinReceiveRate, PYSNMP_MODULE_ID=alvarionBandwidthControlMIB, coBandwidthControlEnable=coBandwidthControlEnable, coBandwidthControlLevelTable=coBandwidthControlLevelTable, coBandwidthControlLevelEntry=coBandwidthControlLevelEntry, coBandwidthControlLevelIndex=coBandwidthControlLevelIndex, alvarionBandwidthControlLevelMIBGroup=alvarionBandwidthControlLevelMIBGroup, alvarionBandwidthControlMIBCompliances=alvarionBandwidthControlMIBCompliances)
| (alvarion_mgmt_v2,) = mibBuilder.importSymbols('ALVARION-SMI', 'alvarionMgmtV2')
(alvarion_priority_queue,) = mibBuilder.importSymbols('ALVARION-TC', 'AlvarionPriorityQueue')
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint', 'ValueSizeConstraint')
(object_group, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'ModuleCompliance', 'NotificationGroup')
(time_ticks, module_identity, unsigned32, counter32, integer32, gauge32, object_identity, counter64, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, bits, mib_identifier, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'ModuleIdentity', 'Unsigned32', 'Counter32', 'Integer32', 'Gauge32', 'ObjectIdentity', 'Counter64', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'Bits', 'MibIdentifier', 'IpAddress')
(truth_value, textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'TextualConvention', 'DisplayString')
alvarion_bandwidth_control_mib = module_identity((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14))
if mibBuilder.loadTexts:
alvarionBandwidthControlMIB.setLastUpdated('200710310000Z')
if mibBuilder.loadTexts:
alvarionBandwidthControlMIB.setOrganization('Alvarion Ltd.')
if mibBuilder.loadTexts:
alvarionBandwidthControlMIB.setContactInfo('Alvarion Ltd. Postal: 21a HaBarzel St. P.O. Box 13139 Tel-Aviv 69710 Israel Phone: +972 3 645 6262')
if mibBuilder.loadTexts:
alvarionBandwidthControlMIB.setDescription('Alvarion Bandwidth Control MIB.')
alvarion_bandwidth_control_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1))
co_bandwidth_control_config = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1))
co_bandwidth_control_enable = mib_scalar((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 1), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
coBandwidthControlEnable.setStatus('current')
if mibBuilder.loadTexts:
coBandwidthControlEnable.setDescription('Indicates if bandwidth control is enabled or disabled on the Internet port.')
co_bandwidth_control_max_transmit_rate = mib_scalar((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
coBandwidthControlMaxTransmitRate.setStatus('current')
if mibBuilder.loadTexts:
coBandwidthControlMaxTransmitRate.setDescription('Indicates the maximum rate at which data can be transmitted on the Internet port. If traffic exceeds this rate for short bursts, it is buffered. Long overages will result in data being dropped.')
co_bandwidth_control_max_receive_rate = mib_scalar((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
coBandwidthControlMaxReceiveRate.setStatus('current')
if mibBuilder.loadTexts:
coBandwidthControlMaxReceiveRate.setDescription('Indicates the maximum rate at which data can be received on the Internet port. If traffic exceeds this rate for short bursts it is buffered. Long overages will result in data being dropped.')
co_bandwidth_control_level_table = mib_table((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4))
if mibBuilder.loadTexts:
coBandwidthControlLevelTable.setStatus('current')
if mibBuilder.loadTexts:
coBandwidthControlLevelTable.setDescription('A table defining the current bandwidth level settings that are active on the device.')
co_bandwidth_control_level_entry = mib_table_row((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1)).setIndexNames((0, 'ALVARION-BANDWIDTH-CONTROL-MIB', 'coBandwidthControlLevelIndex'))
if mibBuilder.loadTexts:
coBandwidthControlLevelEntry.setStatus('current')
if mibBuilder.loadTexts:
coBandwidthControlLevelEntry.setDescription('An entry in the coBandwidthControlLevelTable. coBandwidthControlLevelIndex - Uniquely access a definition for this particular bandwidth control level.')
co_bandwidth_control_level_index = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1, 1), alvarion_priority_queue())
if mibBuilder.loadTexts:
coBandwidthControlLevelIndex.setStatus('current')
if mibBuilder.loadTexts:
coBandwidthControlLevelIndex.setDescription('Specifies the level index. Each index defines a bandwidth level that traffic can be assigned to. Four indexes are defined (1 to 4) with the following meanings: 1-Low, 2-Normal, 3- High, 4-Very High.')
co_bandwidth_control_level_min_transmit_rate = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 100))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
coBandwidthControlLevelMinTransmitRate.setStatus('current')
if mibBuilder.loadTexts:
coBandwidthControlLevelMinTransmitRate.setDescription('Specify the minimum transmit rate for the level as a percentage of coBandwidthControlMaxTransmitRate. This is the minimum amount of bandwidth that will be assigned to a level as soon as outgoing traffic is present on the level.')
co_bandwidth_control_level_max_transmit_rate = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 100))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
coBandwidthControlLevelMaxTransmitRate.setStatus('current')
if mibBuilder.loadTexts:
coBandwidthControlLevelMaxTransmitRate.setDescription('Specify the maximum transmit rate for the specified level as a percentage of coBandwidthControlMaxTransmitRate. This is the maximum amount of outgoing bandwidth that can be consumed by the level. Traffic in excess will be buffered for short bursts, and dropped for sustained overages')
co_bandwidth_control_level_min_receive_rate = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 100))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
coBandwidthControlLevelMinReceiveRate.setStatus('current')
if mibBuilder.loadTexts:
coBandwidthControlLevelMinReceiveRate.setDescription('Specify the minimum receive rate for the specified level as a percentage of coBandwidthControlMaxReceiveRateRate. This is the minimum amount of bandwidth that will be assigned to a level as soon as incoming traffic is present on the level.')
co_bandwidth_control_level_max_receive_rate = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 1, 1, 4, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 100))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
coBandwidthControlLevelMaxReceiveRate.setStatus('current')
if mibBuilder.loadTexts:
coBandwidthControlLevelMaxReceiveRate.setDescription('Specify the maximum receive rate for the specified level as a percentage of coBandwidthControlMaxReceiveRateRate. This is the maximum amount of incoming bandwidth that can be consumed by the level. Traffic in excess will be buffered for short bursts, and dropped for sustained overages.')
alvarion_bandwidth_control_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2))
alvarion_bandwidth_control_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2, 1))
alvarion_bandwidth_control_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2, 2))
alvarion_bandwidth_control_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2, 1, 1)).setObjects(('ALVARION-BANDWIDTH-CONTROL-MIB', 'alvarionBandwidthControlMIBGroup'), ('ALVARION-BANDWIDTH-CONTROL-MIB', 'alvarionBandwidthControlLevelMIBGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
alvarion_bandwidth_control_mib_compliance = alvarionBandwidthControlMIBCompliance.setStatus('current')
if mibBuilder.loadTexts:
alvarionBandwidthControlMIBCompliance.setDescription('The compliance statement for the Bandwidth Control MIB.')
alvarion_bandwidth_control_mib_group = object_group((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2, 2, 1)).setObjects(('ALVARION-BANDWIDTH-CONTROL-MIB', 'coBandwidthControlEnable'), ('ALVARION-BANDWIDTH-CONTROL-MIB', 'coBandwidthControlMaxTransmitRate'), ('ALVARION-BANDWIDTH-CONTROL-MIB', 'coBandwidthControlMaxReceiveRate'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
alvarion_bandwidth_control_mib_group = alvarionBandwidthControlMIBGroup.setStatus('current')
if mibBuilder.loadTexts:
alvarionBandwidthControlMIBGroup.setDescription('A collection of objects for use with Bandwidth Controls.')
alvarion_bandwidth_control_level_mib_group = object_group((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 14, 2, 2, 2)).setObjects(('ALVARION-BANDWIDTH-CONTROL-MIB', 'coBandwidthControlLevelMinTransmitRate'), ('ALVARION-BANDWIDTH-CONTROL-MIB', 'coBandwidthControlLevelMaxTransmitRate'), ('ALVARION-BANDWIDTH-CONTROL-MIB', 'coBandwidthControlLevelMinReceiveRate'), ('ALVARION-BANDWIDTH-CONTROL-MIB', 'coBandwidthControlLevelMaxReceiveRate'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
alvarion_bandwidth_control_level_mib_group = alvarionBandwidthControlLevelMIBGroup.setStatus('current')
if mibBuilder.loadTexts:
alvarionBandwidthControlLevelMIBGroup.setDescription('A collection of objects for use with Bandwidth Controls.')
mibBuilder.exportSymbols('ALVARION-BANDWIDTH-CONTROL-MIB', coBandwidthControlLevelMaxTransmitRate=coBandwidthControlLevelMaxTransmitRate, alvarionBandwidthControlMIBGroups=alvarionBandwidthControlMIBGroups, coBandwidthControlMaxReceiveRate=coBandwidthControlMaxReceiveRate, alvarionBandwidthControlMIBGroup=alvarionBandwidthControlMIBGroup, alvarionBandwidthControlMIBCompliance=alvarionBandwidthControlMIBCompliance, coBandwidthControlLevelMaxReceiveRate=coBandwidthControlLevelMaxReceiveRate, coBandwidthControlLevelMinTransmitRate=coBandwidthControlLevelMinTransmitRate, coBandwidthControlMaxTransmitRate=coBandwidthControlMaxTransmitRate, alvarionBandwidthControlMIBConformance=alvarionBandwidthControlMIBConformance, coBandwidthControlConfig=coBandwidthControlConfig, alvarionBandwidthControlMIB=alvarionBandwidthControlMIB, alvarionBandwidthControlMIBObjects=alvarionBandwidthControlMIBObjects, coBandwidthControlLevelMinReceiveRate=coBandwidthControlLevelMinReceiveRate, PYSNMP_MODULE_ID=alvarionBandwidthControlMIB, coBandwidthControlEnable=coBandwidthControlEnable, coBandwidthControlLevelTable=coBandwidthControlLevelTable, coBandwidthControlLevelEntry=coBandwidthControlLevelEntry, coBandwidthControlLevelIndex=coBandwidthControlLevelIndex, alvarionBandwidthControlLevelMIBGroup=alvarionBandwidthControlLevelMIBGroup, alvarionBandwidthControlMIBCompliances=alvarionBandwidthControlMIBCompliances) |
# Solution by PauloBA
def sum_of_minimums(numbers):
ans = 0
for i in numbers:
i.sort()
ans = ans + i[0]
return ans | def sum_of_minimums(numbers):
ans = 0
for i in numbers:
i.sort()
ans = ans + i[0]
return ans |
"""
[2017-08-11] Challenge #326 [Hard] Multifaceted alphabet blocks
https://www.reddit.com/r/dailyprogrammer/comments/6t0zua/20170811_challenge_326_hard_multifaceted_alphabet/
# Description
You are constructing a set of N alphabet blocks. The first block has 1 face. The second block has 2 faces, and so on up
to the Nth block, which has N faces. Each face contains a letter.
Given a word list, return a set of blocks that can spell every word on the word list, making N as small as possible. A
word can be spelled with the blocks if you can take some subset of the blocks, take one face from each block you chose,
put them in some order, and spell the word.
# Example input
zero
one
two
three
four
five
six
seven
# Example output
The smallest possible N in this case is N = 5:
e
eo
fhs
rvwx
intuz
This output represents five blocks. Block #1 has one face that contains `e`, block #2 has two faces, `e` and `o`, and
so on up to block #5, which has the faces `i`, `n`, `t`, `u`, and `z`.
For example, `four` can be formed by using blocks #3, #2, #5, and #4 in order. Note that `ten` could not be formed from
these blocks even though all the letters are there, because the only `t` and the only `n` both appear on block #5, and
you can only use at most one face from each block.
# Challenge input
[This list of 10,000 12-letter words](https://pastebin.com/trMz6nWQ).
I'll award +1 gold medal flair for the best (lowest number of blocks) solution to the challenge input after 7 days. I
will break ties by concatenating the blocks in order of number of faces (`eeofhsrvwxintuz` for the example), and take
the lexicographically first solution.
"""
def main():
pass
if __name__ == "__main__":
main()
| """
[2017-08-11] Challenge #326 [Hard] Multifaceted alphabet blocks
https://www.reddit.com/r/dailyprogrammer/comments/6t0zua/20170811_challenge_326_hard_multifaceted_alphabet/
# Description
You are constructing a set of N alphabet blocks. The first block has 1 face. The second block has 2 faces, and so on up
to the Nth block, which has N faces. Each face contains a letter.
Given a word list, return a set of blocks that can spell every word on the word list, making N as small as possible. A
word can be spelled with the blocks if you can take some subset of the blocks, take one face from each block you chose,
put them in some order, and spell the word.
# Example input
zero
one
two
three
four
five
six
seven
# Example output
The smallest possible N in this case is N = 5:
e
eo
fhs
rvwx
intuz
This output represents five blocks. Block #1 has one face that contains `e`, block #2 has two faces, `e` and `o`, and
so on up to block #5, which has the faces `i`, `n`, `t`, `u`, and `z`.
For example, `four` can be formed by using blocks #3, #2, #5, and #4 in order. Note that `ten` could not be formed from
these blocks even though all the letters are there, because the only `t` and the only `n` both appear on block #5, and
you can only use at most one face from each block.
# Challenge input
[This list of 10,000 12-letter words](https://pastebin.com/trMz6nWQ).
I'll award +1 gold medal flair for the best (lowest number of blocks) solution to the challenge input after 7 days. I
will break ties by concatenating the blocks in order of number of faces (`eeofhsrvwxintuz` for the example), and take
the lexicographically first solution.
"""
def main():
pass
if __name__ == '__main__':
main() |
s=str(input()) # Number n in binary format
s='0'+s # Trailing zero will make the code run for '11111' etc. without changes
first1=-1
seqend=-1
if s[-1]=='0':
'''
If s ends with '0', the next biggest number will be '1' followed by the
number of '0's + one extra '0' followed by the number of '1's. For ex:
if s = 111000
answer = 1000011
'''
for i in range(len(s)):
if s[len(s)-i-1]=='1':
if first1==-1:
first1=len(s)-i-1
else:
if first1!=-1:
seqend=len(s)-i-1+1
break
if seqend==0:
print('Next smallest:', s[1:seqend]+'1'+(len(s)-1-first1+1)*'0'+(first1-seqend)*'1')
next_smallest=int(s[1:seqend]+'1'+(len(s)-1-first1+1)*'0'+(first1-seqend)*'1',2)
else:
print('Next smallest:', s[1:seqend-1]+'1'+(len(s)-1-first1+1)*'0'+(first1-seqend)*'1')
next_smallest=int(s[1:seqend-1]+'1'+(len(s)-1-first1+1)*'0'+(first1-seqend)*'1',2)
else:
'''
If s ends with '1', find the first '0' from the right, swap it with
the bit just right of it.
if s = 111000111
answer = 111001011
'''
first1=len(s)-1
for i in range(len(s)):
if s[len(s)-i-1]=='0':
seqend=len(s)-i-1+1
break
print('Next smallest:', s[1:seqend-1]+'1'+'0'+(first1-seqend)*'1')
next_smallest=int(s[1:seqend-1]+'1'+'0'+(first1-seqend)*'1', 2)
'''
I am assuming we cannot add trailing zero to the end, otherwise
next largest doesn't make much sense since we can keep adding trailing
zeros and the number will get larger and larger.
If s in not all '1's, the next largest will be the one with all '1's to
the left (if s is already the number with all '1's to the left, just add
a trailing zero). If s is all '1's the next largest will be s+'0'
'''
s=s[1:] # Remove the trailing zero we added earlier
print('Next largest:',end=' ')
if '0' not in s:
print(s)
next_largest=int(s,2)
else:
ones=s.count('1')
if s.index('0')==ones: # s is already all '1's to the left
print(s)
next_largest=int(s,2)
else:
print('1'*ones+'0'*(len(s)-ones))
next_largest=int('1'*ones+'0'*(len(s)-ones),2)
# Testing next smallest code
i=int(s,2)+1
ones=s.count('1')
while True:
if bin(i).count('1')==ones:
if i==next_smallest:
print('Next smallest test passed')
break
else:
print('Next smallest test failed, found: ' + bin(next_smallest)[2:] + ' , needed: ' + bin(i)[2:])
break
i+=1
# Testing next largest code
i=int('1'*len(s),2)
while i>0:
if bin(i).count('1')==ones:
if i==next_largest:
print('Next largest test passed')
break
else:
print('Next largest test failed, found: ' + bin(next_largest)[2:] + ' , needed: ' + bin(i)[2:])
break
i-=1
| s = str(input())
s = '0' + s
first1 = -1
seqend = -1
if s[-1] == '0':
"\n If s ends with '0', the next biggest number will be '1' followed by the\n number of '0's + one extra '0' followed by the number of '1's. For ex:\n\n if s = 111000\n answer = 1000011\n "
for i in range(len(s)):
if s[len(s) - i - 1] == '1':
if first1 == -1:
first1 = len(s) - i - 1
elif first1 != -1:
seqend = len(s) - i - 1 + 1
break
if seqend == 0:
print('Next smallest:', s[1:seqend] + '1' + (len(s) - 1 - first1 + 1) * '0' + (first1 - seqend) * '1')
next_smallest = int(s[1:seqend] + '1' + (len(s) - 1 - first1 + 1) * '0' + (first1 - seqend) * '1', 2)
else:
print('Next smallest:', s[1:seqend - 1] + '1' + (len(s) - 1 - first1 + 1) * '0' + (first1 - seqend) * '1')
next_smallest = int(s[1:seqend - 1] + '1' + (len(s) - 1 - first1 + 1) * '0' + (first1 - seqend) * '1', 2)
else:
"\n If s ends with '1', find the first '0' from the right, swap it with\n the bit just right of it.\n\n if s = 111000111\n answer = 111001011\n "
first1 = len(s) - 1
for i in range(len(s)):
if s[len(s) - i - 1] == '0':
seqend = len(s) - i - 1 + 1
break
print('Next smallest:', s[1:seqend - 1] + '1' + '0' + (first1 - seqend) * '1')
next_smallest = int(s[1:seqend - 1] + '1' + '0' + (first1 - seqend) * '1', 2)
"\nI am assuming we cannot add trailing zero to the end, otherwise\nnext largest doesn't make much sense since we can keep adding trailing\nzeros and the number will get larger and larger.\n\nIf s in not all '1's, the next largest will be the one with all '1's to\nthe left (if s is already the number with all '1's to the left, just add\na trailing zero). If s is all '1's the next largest will be s+'0'\n"
s = s[1:]
print('Next largest:', end=' ')
if '0' not in s:
print(s)
next_largest = int(s, 2)
else:
ones = s.count('1')
if s.index('0') == ones:
print(s)
next_largest = int(s, 2)
else:
print('1' * ones + '0' * (len(s) - ones))
next_largest = int('1' * ones + '0' * (len(s) - ones), 2)
i = int(s, 2) + 1
ones = s.count('1')
while True:
if bin(i).count('1') == ones:
if i == next_smallest:
print('Next smallest test passed')
break
else:
print('Next smallest test failed, found: ' + bin(next_smallest)[2:] + ' , needed: ' + bin(i)[2:])
break
i += 1
i = int('1' * len(s), 2)
while i > 0:
if bin(i).count('1') == ones:
if i == next_largest:
print('Next largest test passed')
break
else:
print('Next largest test failed, found: ' + bin(next_largest)[2:] + ' , needed: ' + bin(i)[2:])
break
i -= 1 |
# The rand7() API is already defined for you.
# def rand7():
# @return a random integer in the range 1 to 7
# Don't know why the following solution doesn't work on 100000 calls case.
class Solution:
def rand10(self):
"""
:rtype: int
"""
a, b = rand7() - 1, rand7() - 1
num = a*7 + b
if num >= 40:
self.rand10()
return num % 10 + 1
# This works
class Solution:
def rand10(self):
"""
:rtype: int
"""
a= rand7()
b= rand7()
num = (a-1)*7 + b
if num >40:
return self.rand10()
return num % 10 + 1
class Solution:
def rand10(self):
"""
:rtype: int
"""
num = 40
while num >= 40:
num = (rand7() - 1)*7 + rand7() - 1
return num % 10 + 1 | class Solution:
def rand10(self):
"""
:rtype: int
"""
(a, b) = (rand7() - 1, rand7() - 1)
num = a * 7 + b
if num >= 40:
self.rand10()
return num % 10 + 1
class Solution:
def rand10(self):
"""
:rtype: int
"""
a = rand7()
b = rand7()
num = (a - 1) * 7 + b
if num > 40:
return self.rand10()
return num % 10 + 1
class Solution:
def rand10(self):
"""
:rtype: int
"""
num = 40
while num >= 40:
num = (rand7() - 1) * 7 + rand7() - 1
return num % 10 + 1 |
n = int(input())
case = 0
l = []
for i in range(n):
item = int(input())
l.append(item)
for i in l:
for j in range(1, i+1):
x = j
y = i - j
lx = [int(a) for a in str(x)]
ly = [int(b) for b in str(y)]
if((4 in lx) or (4 in ly)):
continue
else:
case += 1
print ('Case #'+str(case)+':', x, y)
break
| n = int(input())
case = 0
l = []
for i in range(n):
item = int(input())
l.append(item)
for i in l:
for j in range(1, i + 1):
x = j
y = i - j
lx = [int(a) for a in str(x)]
ly = [int(b) for b in str(y)]
if 4 in lx or 4 in ly:
continue
else:
case += 1
print('Case #' + str(case) + ':', x, y)
break |
# If Expression
# if expr:
if True:
print("it is true")
else:
print("it is false")
if False:
print("it is false")
print("print intented next line")
else:
print("it is not false")
if bool("python"):
print("it is python")
else:
print("it is not python")
h = 50
if h > 50:
print("h is not greater than 50")
else:
print("h is less than or equal to 50")
if h < 20:
print("h is less than 20")
else:
print("h is between 20 and 50")
#elif
if h > 50:
print("h is not greater than 50")
elif h < 20:
print("h is less than 20")
else:
print("h is between 20 and 50")
| if True:
print('it is true')
else:
print('it is false')
if False:
print('it is false')
print('print intented next line')
else:
print('it is not false')
if bool('python'):
print('it is python')
else:
print('it is not python')
h = 50
if h > 50:
print('h is not greater than 50')
else:
print('h is less than or equal to 50')
if h < 20:
print('h is less than 20')
else:
print('h is between 20 and 50')
if h > 50:
print('h is not greater than 50')
elif h < 20:
print('h is less than 20')
else:
print('h is between 20 and 50') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.