content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#-------------------------------------------------------------------------------- # SoCaTel - Backend data storage API endpoints docker container # These tokens are needed for database access. #-------------------------------------------------------------------------------- #=============================================================================== # SoCaTel Knowledge Base Deployment #=============================================================================== # The following are the pre-defined names of elasticsearch indices for the SoCaTel project which # host data shared with the front-end. elastic_user_index = "so_user" elastic_group_index = "so_group" elastic_organisation_index = "so_organisation" elastic_service_index = "so_service" elastic_host = "<insert_elastic_host>" # e.g. "127.0.0.1" elastic_port = "9200" # Default Elasticsearch port, change accordingly elastic_user = "<insert_elasticsearch_username>" elastic_passwd = "<insert_elasticsearch_password>" #=============================================================================== #=============================================================================== # Linked Pipes ETL Configuration #=============================================================================== # The following correspond to the URLs corresponding to the linked pipes executions, # which need to be setup beforehand. They are set to localhost, change according to deployment details path = "http://127.0.0.1:32800/resources/executions" user_pipeline = "http://127.0.0.1:32800/resources/pipelines/1578586195746" group_pipeline = "http://127.0.0.1:32800/resources/pipelines/1578586045942" organisation_pipeline = "http://127.0.0.1:32800/resources/pipelines/1575531753483" service_pipeline = "http://127.0.0.1:32800/resources/pipelines/1565080262463" #===============================================================================
elastic_user_index = 'so_user' elastic_group_index = 'so_group' elastic_organisation_index = 'so_organisation' elastic_service_index = 'so_service' elastic_host = '<insert_elastic_host>' elastic_port = '9200' elastic_user = '<insert_elasticsearch_username>' elastic_passwd = '<insert_elasticsearch_password>' path = 'http://127.0.0.1:32800/resources/executions' user_pipeline = 'http://127.0.0.1:32800/resources/pipelines/1578586195746' group_pipeline = 'http://127.0.0.1:32800/resources/pipelines/1578586045942' organisation_pipeline = 'http://127.0.0.1:32800/resources/pipelines/1575531753483' service_pipeline = 'http://127.0.0.1:32800/resources/pipelines/1565080262463'
x1 = 1 y1 = 0 x2 = 0 y2 = -2 m1 = (y2 / x1) x1 = 2 y1 = 2 x2 = 6 y2 = 10 m2 = (y2 - y1 / x2 - x1) diff = m1 - m2 print(f'Diff of 8 and 9: {diff:.2f}') # 10
x1 = 1 y1 = 0 x2 = 0 y2 = -2 m1 = y2 / x1 x1 = 2 y1 = 2 x2 = 6 y2 = 10 m2 = y2 - y1 / x2 - x1 diff = m1 - m2 print(f'Diff of 8 and 9: {diff:.2f}')
# https://www.codechef.com/problems/COPS for T in range(int(input())): M,x,y=map(int,input().split()) m,a = list(map(int,input().split())),list(range(1,101)) for i in m: for j in range(i-x*y,i+1+x*y): if(j in a): a.remove(j) print(len(a))
for t in range(int(input())): (m, x, y) = map(int, input().split()) (m, a) = (list(map(int, input().split())), list(range(1, 101))) for i in m: for j in range(i - x * y, i + 1 + x * y): if j in a: a.remove(j) print(len(a))
# # Hubblemon - Yet another general purpose system monitor # # Copyright 2015 NAVER Corp. # # 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 jquery: def __init__(self): self.scripts = [] def render(self): pass def autocomplete(self, id): ret = jquery_autocomplete(id) self.scripts.append(ret) return ret def button(self, id): ret = jquery_button(id) self.scripts.append(ret) return ret def selectable(self, id): ret = jquery_selectable(id) self.scripts.append(ret) return ret def radio(self, id): ret = jquery_radio(id) self.scripts.append(ret) return ret class jscript: def __init__(self, action): self.action = action def render(self): js_template = self.get_js_template() return js_template % (self.action) def get_js_template(self): js_template = ''' <script type="text/javascript"> $(function() { %s; }); </script> ''' return js_template class jqueryui: def __init__(self, id): self.id = id self.target = None def val(self, v = None): if v is None: return "$('#%s').val()" % (self.id) else: return "$('#%s').val(%s)" % (self.id, v) def val_str(self, v = None): if v is None: return "$('#%s').val()" % (self.id) else: return "$('#%s').val('%s')" % (self.id, v) def text(self, v = None): if v is None: return "$('#%s').text()" % (self.id) else: return "$('#%s').text(%s)" % (self.id, v) def text_str(self, v = None): if v is None: return "$('#%s').text()" % (self.id) else: return "$('#%s').text('%s')" % (self.id, v) class jquery_autocomplete(jqueryui): def set(self, source, action): self.source = source self.action = action def render(self): raw_data = self.source.__repr__() js_template = self.get_js_template() return js_template % (self.id, raw_data, self.action, self.id) def source(self, url): return "$('#%s').autocomplete('option', 'source', %s);" % (self.id, url) def get_js_template(self): js_template = ''' <script type="text/javascript"> $(function() { $('#%s').autocomplete({ source: %s, minLength: 0, select: function( event, ui ) { %s; return false; } }).focus(function(){ $(this).autocomplete('search', $(this).val())}); }); </script> <input type="text" id="%s"> ''' return js_template # TODO class jquery_selectable(jqueryui): def __init__(self, id): self.id = id self.select_list = [] def push_item(self, item): self.select_list.append(item) def render(self): select_list = '' for item in self.select_list: select_list += "<li class='ui-widget-content'>%s</li>\n" % item js_template = self.get_js_template() id = self.id return js_template % (id, id, id, id, id, select_list) def get_js_template(self): js_template = ''' <style> #%s .ui-selecting { background: #FECA40; } #%s .ui-selected { background: #F39814; color: white; } #%s { list-style-type: none; margin:0; padding:0; } .ui-widget-content { display:inline; margin: 0 0 0 0; padding: 0 0 0 0; border: 1; } </style> <script type="text/javascript"> $(function() { $('#%s').selectable(); }); </script> <ul id='%s'> %s </ul> ''' return js_template class jquery_button(jqueryui): def __init__(self, id): self.id = id self.action = '' def set_action(self, action): self.action = action def render(self): js_template = self.get_js_template() return js_template % (self.id, self.action, self.id, self.id) def get_js_template(self): js_template = ''' <script type="text/javascript"> $(function() { $('#%s').button().click( function() { %s; } ); }); </script> <button id='%s' float>%s</button> ''' return js_template class jquery_radio(jqueryui): def __init__(self, id): self.id = id self.action = '' self.button_list = [] def push_item(self, item): self.button_list.append(item) def set_action(self, action): self.action = action def render(self): button_list = '' for item in self.button_list: button_list += "<input type='radio' id='%s' name='radio'><label for='%s'>%s</label>" % (item, item, item) js_template = self.get_js_template() id = self.id return js_template % (id, id, self.action, id, button_list) def get_js_template(self): js_template = ''' <script type="text/javascript"> $(function() { $('#%s').buttonset(); $('#%s :radio').click(function() { %s; }); }); </script> <ul id='%s' style="display:inline"> %s </ul> ''' return js_template
class Jquery: def __init__(self): self.scripts = [] def render(self): pass def autocomplete(self, id): ret = jquery_autocomplete(id) self.scripts.append(ret) return ret def button(self, id): ret = jquery_button(id) self.scripts.append(ret) return ret def selectable(self, id): ret = jquery_selectable(id) self.scripts.append(ret) return ret def radio(self, id): ret = jquery_radio(id) self.scripts.append(ret) return ret class Jscript: def __init__(self, action): self.action = action def render(self): js_template = self.get_js_template() return js_template % self.action def get_js_template(self): js_template = '\n\t\t\t<script type="text/javascript">\n\t\t\t $(function() {\n\t\t\t\t%s;\n\t\t\t });\n\t\t\t</script>\n\t\t' return js_template class Jqueryui: def __init__(self, id): self.id = id self.target = None def val(self, v=None): if v is None: return "$('#%s').val()" % self.id else: return "$('#%s').val(%s)" % (self.id, v) def val_str(self, v=None): if v is None: return "$('#%s').val()" % self.id else: return "$('#%s').val('%s')" % (self.id, v) def text(self, v=None): if v is None: return "$('#%s').text()" % self.id else: return "$('#%s').text(%s)" % (self.id, v) def text_str(self, v=None): if v is None: return "$('#%s').text()" % self.id else: return "$('#%s').text('%s')" % (self.id, v) class Jquery_Autocomplete(jqueryui): def set(self, source, action): self.source = source self.action = action def render(self): raw_data = self.source.__repr__() js_template = self.get_js_template() return js_template % (self.id, raw_data, self.action, self.id) def source(self, url): return "$('#%s').autocomplete('option', 'source', %s);" % (self.id, url) def get_js_template(self): js_template = '\n\t\t\t<script type="text/javascript">\n\t\t\t $(function() {\n\t\t\t\t$(\'#%s\').autocomplete({\n\t\t\t\t source: %s,\n\t\t\t\t minLength: 0,\n\t\t\t\t select: function( event, ui ) {\n\t\t\t\t\t%s;\n\t\t\t\t\treturn false;\n\t\t\t\t }\n\t\t\t\t}).focus(function(){\n\t\t\t\t $(this).autocomplete(\'search\', $(this).val())});\n\t\t\t });\n\t\t\t</script>\n\n\t\t\t<input type="text" id="%s"> \n\t\t' return js_template class Jquery_Selectable(jqueryui): def __init__(self, id): self.id = id self.select_list = [] def push_item(self, item): self.select_list.append(item) def render(self): select_list = '' for item in self.select_list: select_list += "<li class='ui-widget-content'>%s</li>\n" % item js_template = self.get_js_template() id = self.id return js_template % (id, id, id, id, id, select_list) def get_js_template(self): js_template = '\n\t\t\t<style>\n\t\t\t#%s .ui-selecting { background: #FECA40; }\n\t\t\t#%s .ui-selected { background: #F39814; color: white; }\n\t\t\t#%s { list-style-type: none; margin:0; padding:0; }\n\t\t\t.ui-widget-content { display:inline; margin: 0 0 0 0; padding: 0 0 0 0; border: 1; }\n\t\t\t</style>\n\n\t\t\t<script type="text/javascript">\n\t\t\t $(function() {\n\t\t\t\t$(\'#%s\').selectable();\n\t\t\t });\n\t\t\t</script>\n\n\t\t\t<ul id=\'%s\'>\n\t\t\t\t%s\n\t\t\t</ul>\n\t\t' return js_template class Jquery_Button(jqueryui): def __init__(self, id): self.id = id self.action = '' def set_action(self, action): self.action = action def render(self): js_template = self.get_js_template() return js_template % (self.id, self.action, self.id, self.id) def get_js_template(self): js_template = '\n\t\t\t<script type="text/javascript">\n\t\t\t $(function() {\n\t\t\t\t$(\'#%s\').button().click(\n\t\t\t\t\tfunction() {\n\t\t\t\t\t\t%s;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t });\n\t\t\t</script>\n\n\t\t\t<button id=\'%s\' float>%s</button>\n\t\t' return js_template class Jquery_Radio(jqueryui): def __init__(self, id): self.id = id self.action = '' self.button_list = [] def push_item(self, item): self.button_list.append(item) def set_action(self, action): self.action = action def render(self): button_list = '' for item in self.button_list: button_list += "<input type='radio' id='%s' name='radio'><label for='%s'>%s</label>" % (item, item, item) js_template = self.get_js_template() id = self.id return js_template % (id, id, self.action, id, button_list) def get_js_template(self): js_template = '\n\t\t\t<script type="text/javascript">\n\t\t\t $(function() {\n\t\t\t\t$(\'#%s\').buttonset();\n\t\t\t\t$(\'#%s :radio\').click(function() {\n\t\t\t\t\t%s;\n\t\t\t\t});\n\t\t\t });\n\t\t\t</script>\n\n\t\t\t<ul id=\'%s\' style="display:inline">\n\t\t\t\t%s\n\t\t\t</ul>\n\t\t' return js_template
description = 'Verify the user cannot log in if password value is missing' pages = ['login'] def test(data): navigate(data.env.url) send_keys(login.username_input, 'admin') click(login.login_button) capture('Verify the correct error message is shown') verify_text_in_element(login.error_list, 'Password is required')
description = 'Verify the user cannot log in if password value is missing' pages = ['login'] def test(data): navigate(data.env.url) send_keys(login.username_input, 'admin') click(login.login_button) capture('Verify the correct error message is shown') verify_text_in_element(login.error_list, 'Password is required')
####################################################################### # Copyright (C) 2017 Shangtong Zhang([email protected]) # # Permission given to modify the code as long as you keep this # # declaration at the top # ####################################################################### class ConstantSchedule: def __init__(self, val): self.val = val def __call__(self, steps=1): return self.val class LinearSchedule: def __init__(self, start, end=None, steps=None): if end is None: end = start steps = 1 self.inc = (end - start) / float(steps) self.current = start self.end = end if end > start: self.bound = min else: self.bound = max def __call__(self, steps=1): val = self.current self.current = self.bound(self.current + self.inc * steps, self.end) return val
class Constantschedule: def __init__(self, val): self.val = val def __call__(self, steps=1): return self.val class Linearschedule: def __init__(self, start, end=None, steps=None): if end is None: end = start steps = 1 self.inc = (end - start) / float(steps) self.current = start self.end = end if end > start: self.bound = min else: self.bound = max def __call__(self, steps=1): val = self.current self.current = self.bound(self.current + self.inc * steps, self.end) return val
def forward(w,s,b,y): Yhat= w * s + b output = (Yhat-y)**2 return output, Yhat def derivative_W(x, output, Yhat, y): return ((2 * output) * (Yhat - y)) * x # w def derivative_B(b, output, Yhat, y): return ((2 * output) * (Yhat - y)) * b #bias def main(): w = 1.0 #weight x = 2.0 #sample b = 1.0 #bias y = 2.0*x #rule learning = 1e-1 epoch = 3 for i in range(epoch+1): output, Yhat = forward(w,x,b,y) print("-----------------------------------------------------------------------------") print("w:",w) print("\tw*b:",w*x) print("x:",x,"\t\tsum:", w*x+b) print("\tb:",b,"\t\t\tg1:",abs(Yhat-y),"\tg2:",abs(Yhat-y)**2,"\tloss:",output) print("\t\tY=2*x:", y) print("-----------------------------------------------------------------------------") if output == 0.0: break gw = derivative_W(x, output, Yhat, y) gb = derivative_B(b, output, Yhat, y) w -= learning * gw b -= learning * gb if __name__ == '__main__': main()
def forward(w, s, b, y): yhat = w * s + b output = (Yhat - y) ** 2 return (output, Yhat) def derivative_w(x, output, Yhat, y): return 2 * output * (Yhat - y) * x def derivative_b(b, output, Yhat, y): return 2 * output * (Yhat - y) * b def main(): w = 1.0 x = 2.0 b = 1.0 y = 2.0 * x learning = 0.1 epoch = 3 for i in range(epoch + 1): (output, yhat) = forward(w, x, b, y) print('-----------------------------------------------------------------------------') print('w:', w) print('\tw*b:', w * x) print('x:', x, '\t\tsum:', w * x + b) print('\tb:', b, '\t\t\tg1:', abs(Yhat - y), '\tg2:', abs(Yhat - y) ** 2, '\tloss:', output) print('\t\tY=2*x:', y) print('-----------------------------------------------------------------------------') if output == 0.0: break gw = derivative_w(x, output, Yhat, y) gb = derivative_b(b, output, Yhat, y) w -= learning * gw b -= learning * gb if __name__ == '__main__': main()
def banner(message, length, header='=', footer='*'): print() print(header * length) print((' ' * (length//2 - len(message)//2)), message) print(footer * length) def banner_v2(length, footer='-'): print(footer * length) print()
def banner(message, length, header='=', footer='*'): print() print(header * length) print(' ' * (length // 2 - len(message) // 2), message) print(footer * length) def banner_v2(length, footer='-'): print(footer * length) print()
# Soft-serve Damage Skin success = sm.addDamageSkin(2434951) if success: sm.chat("The Soft-serve Damage Skin has been added to your account's damage skin collection.")
success = sm.addDamageSkin(2434951) if success: sm.chat("The Soft-serve Damage Skin has been added to your account's damage skin collection.")
num1 = 100 num2 = 200 num3 = 300 num4 = 400 num5 = 500 mum6 = 600 num7 = 700 num8 = 800
num1 = 100 num2 = 200 num3 = 300 num4 = 400 num5 = 500 mum6 = 600 num7 = 700 num8 = 800
def required_model(name: object, kwargs: object) -> object: required_fields = kwargs['required_fields'] if 'required_fields' in kwargs else [] task_f = kwargs['required_task_fields'] if 'required_task_fields' in kwargs else [] proc_f = kwargs['required_proc_fields'] if 'required_proc_fields' in kwargs else [] display_name = kwargs['display_name'] if 'display_name' in kwargs else name def f(klass): return klass return f
def required_model(name: object, kwargs: object) -> object: required_fields = kwargs['required_fields'] if 'required_fields' in kwargs else [] task_f = kwargs['required_task_fields'] if 'required_task_fields' in kwargs else [] proc_f = kwargs['required_proc_fields'] if 'required_proc_fields' in kwargs else [] display_name = kwargs['display_name'] if 'display_name' in kwargs else name def f(klass): return klass return f
#!/usr/bin/env python # -*- coding: utf-8 -*- class Unit: def __init__(self, x, y, color, name): self.x = x self.y = y self.color = color self.name = name self.taken = False class OpUnit(Unit): def __init__(self, x, y, color, name): super().__init__(x, y, color, name) self.blue = 0.0
class Unit: def __init__(self, x, y, color, name): self.x = x self.y = y self.color = color self.name = name self.taken = False class Opunit(Unit): def __init__(self, x, y, color, name): super().__init__(x, y, color, name) self.blue = 0.0
#!/usr/bin/env python #coding: utf-8 class Node: def __init__(self, elem=None, next=None): self.elem = elem self.next = next if __name__ == "__main__": n1 = Node(1, None) n2 = Node(2, None) n1.next = n2
class Node: def __init__(self, elem=None, next=None): self.elem = elem self.next = next if __name__ == '__main__': n1 = node(1, None) n2 = node(2, None) n1.next = n2
def test_check_sanity(client): resp = client.get('/sanity') assert resp.status_code == 200 assert 'Sanity check passed.' == resp.data.decode() # 'list collections' tests def test_get_api_root(client): resp = client.get('/', content_type='application/json') assert resp.status_code == 200 resp_data = resp.get_json() assert 'keys_url' in resp_data assert len(resp_data) == 1 assert resp_data['keys_url'][-5:] == '/keys' def test_delete_api_root_not_allowed(client): resp = client.delete('/', content_type='application/json') assert resp.status_code == 405 # 'list keys' tests def test_get_empty_keys_list(client): resp = client.get('/keys', content_type='application/json') assert resp.status_code == 200 resp_data = resp.get_json() assert len(resp_data) == 0 def test_get_nonempty_keys_list(client, keys, add_to_keys): add_to_keys({'key': 'babboon', 'value': 'Larry'}) add_to_keys({'key': 'bees', 'value': ['Ann', 'Joe', 'Dee']}) resp = client.get('/keys', content_type='application/json') assert resp.status_code == 200 resp_data = resp.get_json() assert isinstance(resp_data, list) assert len(resp_data) == 2 for doc_idx in (0, 1): for k in ('key', 'http_url'): assert k in resp_data[doc_idx] if resp_data[doc_idx]['key'] == 'babboon': assert resp_data[doc_idx]['http_url'][-13:] == '/keys/babboon' else: assert resp_data[doc_idx]['http_url'][-10:] == '/keys/bees' def test_delete_on_keys_not_allowed(client): resp = client.delete('/keys', content_type='application/json') assert resp.status_code == 405 # 'get a key' tests def test_get_existing_key(client, keys, add_to_keys): add_to_keys({'key': 'babboon', 'value': 'Larry'}) add_to_keys({'key': 'bees', 'value': ['Ann', 'Joe', 'Dee']}) resp = client.get('/keys/bees', content_type='application/json') assert resp.status_code == 200 resp_data = resp.get_json() assert isinstance(resp_data, dict) for k in ('key', 'http_url', 'value'): assert k in resp_data assert resp_data['key'] == 'bees' assert resp_data['http_url'][-10:] == '/keys/bees' assert resp_data['value'] == ['Ann', 'Joe', 'Dee'] def test_get_nonexisting_key(client, keys): resp = client.get('/keys/bees', content_type='application/json') assert resp.status_code == 404 def test_post_on_a_key_not_allowed(client): resp = client.post('/keys/bees', content_type='application/json') assert resp.status_code == 405 # 'create a key' tests def test_create_new_key(client, keys): new_doc = {'key': 'oscillator', 'value': 'Colpitts'} resp = client.post( '/keys', json=new_doc, content_type='application/json' ) assert resp.status_code == 201 resp_data = resp.get_json() assert isinstance(resp_data, dict) for k in ('key', 'http_url', 'value'): assert k in resp_data assert resp_data['key'] == new_doc['key'] assert resp_data['value'] == new_doc['value'] assert resp_data['http_url'][-16:] == '/keys/oscillator' def test_create_duplicate_key(client, keys, add_to_keys): new_doc = {'key': 'oscillator', 'value': 'Colpitts'} add_to_keys(new_doc.copy()) resp = client.post( '/keys', json=new_doc, content_type='application/json' ) assert resp.status_code == 400 resp_data = resp.get_json() assert 'error' in resp_data assert resp_data['error'] == "Can't create duplicate key (oscillator)." def test_create_new_key_missing_key(client, keys): new_doc = {'value': 'Colpitts'} resp = client.post( '/keys', json=new_doc, content_type='application/json' ) assert resp.status_code == 400 resp_data = resp.get_json() assert 'error' in resp_data assert resp_data['error'] == 'Please provide the missing "key" parameter!' def test_create_new_key_missing_value(client, keys): new_doc = {'key': 'oscillator'} resp = client.post( '/keys', json=new_doc, content_type='application/json' ) assert resp.status_code == 400 resp_data = resp.get_json() assert 'error' in resp_data assert resp_data['error'] == 'Please provide the missing "value" ' \ 'parameter!' # 'update a key' tests def test_update_a_key_existing(client, keys, add_to_keys): add_to_keys({'key': 'oscillator', 'value': 'Colpitts'}) update_value = {'value': ['Pierce', 'Hartley']} resp = client.put( '/keys/oscillator', json=update_value, content_type='application/json' ) assert resp.status_code == 204 def test_update_a_key_nonexisting(client, keys, add_to_keys): add_to_keys({'key': 'oscillator', 'value': 'Colpitts'}) update_value = {'value': ['Pierce', 'Hartley']} resp = client.put( '/keys/gadget', json=update_value, content_type='application/json' ) assert resp.status_code == 400 resp_data = resp.get_json() assert 'error' in resp_data assert resp_data['error'] == 'Update failed.' # 'delete a key' tests def test_delete_a_key_existing(client, keys, add_to_keys): add_to_keys({'key': 'oscillator', 'value': 'Colpitts'}) resp = client.delete( '/keys/oscillator', content_type='application/json' ) assert resp.status_code == 204 def test_delete_a_key_nonexisting(client, keys): resp = client.delete( '/keys/oscillator', content_type='application/json' ) assert resp.status_code == 404
def test_check_sanity(client): resp = client.get('/sanity') assert resp.status_code == 200 assert 'Sanity check passed.' == resp.data.decode() def test_get_api_root(client): resp = client.get('/', content_type='application/json') assert resp.status_code == 200 resp_data = resp.get_json() assert 'keys_url' in resp_data assert len(resp_data) == 1 assert resp_data['keys_url'][-5:] == '/keys' def test_delete_api_root_not_allowed(client): resp = client.delete('/', content_type='application/json') assert resp.status_code == 405 def test_get_empty_keys_list(client): resp = client.get('/keys', content_type='application/json') assert resp.status_code == 200 resp_data = resp.get_json() assert len(resp_data) == 0 def test_get_nonempty_keys_list(client, keys, add_to_keys): add_to_keys({'key': 'babboon', 'value': 'Larry'}) add_to_keys({'key': 'bees', 'value': ['Ann', 'Joe', 'Dee']}) resp = client.get('/keys', content_type='application/json') assert resp.status_code == 200 resp_data = resp.get_json() assert isinstance(resp_data, list) assert len(resp_data) == 2 for doc_idx in (0, 1): for k in ('key', 'http_url'): assert k in resp_data[doc_idx] if resp_data[doc_idx]['key'] == 'babboon': assert resp_data[doc_idx]['http_url'][-13:] == '/keys/babboon' else: assert resp_data[doc_idx]['http_url'][-10:] == '/keys/bees' def test_delete_on_keys_not_allowed(client): resp = client.delete('/keys', content_type='application/json') assert resp.status_code == 405 def test_get_existing_key(client, keys, add_to_keys): add_to_keys({'key': 'babboon', 'value': 'Larry'}) add_to_keys({'key': 'bees', 'value': ['Ann', 'Joe', 'Dee']}) resp = client.get('/keys/bees', content_type='application/json') assert resp.status_code == 200 resp_data = resp.get_json() assert isinstance(resp_data, dict) for k in ('key', 'http_url', 'value'): assert k in resp_data assert resp_data['key'] == 'bees' assert resp_data['http_url'][-10:] == '/keys/bees' assert resp_data['value'] == ['Ann', 'Joe', 'Dee'] def test_get_nonexisting_key(client, keys): resp = client.get('/keys/bees', content_type='application/json') assert resp.status_code == 404 def test_post_on_a_key_not_allowed(client): resp = client.post('/keys/bees', content_type='application/json') assert resp.status_code == 405 def test_create_new_key(client, keys): new_doc = {'key': 'oscillator', 'value': 'Colpitts'} resp = client.post('/keys', json=new_doc, content_type='application/json') assert resp.status_code == 201 resp_data = resp.get_json() assert isinstance(resp_data, dict) for k in ('key', 'http_url', 'value'): assert k in resp_data assert resp_data['key'] == new_doc['key'] assert resp_data['value'] == new_doc['value'] assert resp_data['http_url'][-16:] == '/keys/oscillator' def test_create_duplicate_key(client, keys, add_to_keys): new_doc = {'key': 'oscillator', 'value': 'Colpitts'} add_to_keys(new_doc.copy()) resp = client.post('/keys', json=new_doc, content_type='application/json') assert resp.status_code == 400 resp_data = resp.get_json() assert 'error' in resp_data assert resp_data['error'] == "Can't create duplicate key (oscillator)." def test_create_new_key_missing_key(client, keys): new_doc = {'value': 'Colpitts'} resp = client.post('/keys', json=new_doc, content_type='application/json') assert resp.status_code == 400 resp_data = resp.get_json() assert 'error' in resp_data assert resp_data['error'] == 'Please provide the missing "key" parameter!' def test_create_new_key_missing_value(client, keys): new_doc = {'key': 'oscillator'} resp = client.post('/keys', json=new_doc, content_type='application/json') assert resp.status_code == 400 resp_data = resp.get_json() assert 'error' in resp_data assert resp_data['error'] == 'Please provide the missing "value" parameter!' def test_update_a_key_existing(client, keys, add_to_keys): add_to_keys({'key': 'oscillator', 'value': 'Colpitts'}) update_value = {'value': ['Pierce', 'Hartley']} resp = client.put('/keys/oscillator', json=update_value, content_type='application/json') assert resp.status_code == 204 def test_update_a_key_nonexisting(client, keys, add_to_keys): add_to_keys({'key': 'oscillator', 'value': 'Colpitts'}) update_value = {'value': ['Pierce', 'Hartley']} resp = client.put('/keys/gadget', json=update_value, content_type='application/json') assert resp.status_code == 400 resp_data = resp.get_json() assert 'error' in resp_data assert resp_data['error'] == 'Update failed.' def test_delete_a_key_existing(client, keys, add_to_keys): add_to_keys({'key': 'oscillator', 'value': 'Colpitts'}) resp = client.delete('/keys/oscillator', content_type='application/json') assert resp.status_code == 204 def test_delete_a_key_nonexisting(client, keys): resp = client.delete('/keys/oscillator', content_type='application/json') assert resp.status_code == 404
''' Single perceptron can replicate a NAND gate https://en.wikipedia.org/wiki/NAND_logic inputs | output 0 0 1 0 1 1 1 0 1 1 1 0 ''' def dot_product(vec1,vec2): if (len(vec1) != len(vec2)): print("input vector lengths are not equal") print(len(vec1)) print(len(vec2)) reslt=0 for indx in range(len(vec1)): reslt=reslt+vec1[indx]*vec2[indx] return reslt def perceptron(input_binary_vector,weight_vector,bias): reslt = dot_product(input_binary_vector,weight_vector) if ( reslt + bias <= 0 ): # aka reslt <= threshold output=0 else: # reslt > threshold, aka reslt + bias > 0 output=1 return output def nand(input_binary_vector): if (len(input_binary_vector) != 2): print("input vector length is not 2; this is an NAND gate!") return int(not (input_binary_vector[0] and input_binary_vector[1])) # weight. Higher value means more important w = [-2, -2] bias = 3 for indx in range(4): # input decision factors; value 0 or 1 if (indx == 0): x = [ 0, 0] elif (indx == 1): x = [ 1, 0] elif (indx == 2): x = [ 0, 1] elif (indx == 3): x = [ 1, 1] else: print("error in indx") print("input: "+str(x[0])+", "+str(x[1])) print("preceptron: "+str(perceptron(x,w,bias))) print("NAND: "+str(nand(x)))
""" Single perceptron can replicate a NAND gate https://en.wikipedia.org/wiki/NAND_logic inputs | output 0 0 1 0 1 1 1 0 1 1 1 0 """ def dot_product(vec1, vec2): if len(vec1) != len(vec2): print('input vector lengths are not equal') print(len(vec1)) print(len(vec2)) reslt = 0 for indx in range(len(vec1)): reslt = reslt + vec1[indx] * vec2[indx] return reslt def perceptron(input_binary_vector, weight_vector, bias): reslt = dot_product(input_binary_vector, weight_vector) if reslt + bias <= 0: output = 0 else: output = 1 return output def nand(input_binary_vector): if len(input_binary_vector) != 2: print('input vector length is not 2; this is an NAND gate!') return int(not (input_binary_vector[0] and input_binary_vector[1])) w = [-2, -2] bias = 3 for indx in range(4): if indx == 0: x = [0, 0] elif indx == 1: x = [1, 0] elif indx == 2: x = [0, 1] elif indx == 3: x = [1, 1] else: print('error in indx') print('input: ' + str(x[0]) + ', ' + str(x[1])) print('preceptron: ' + str(perceptron(x, w, bias))) print('NAND: ' + str(nand(x)))
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # write your code in Python 3.6 dictionary = {} for number in A: if dictionary.get(number) == None: dictionary[number] = 1 else: dictionary[number] += 1 for key in dictionary.keys(): if dictionary.get(key) % 2 == 1: return key
def solution(A): dictionary = {} for number in A: if dictionary.get(number) == None: dictionary[number] = 1 else: dictionary[number] += 1 for key in dictionary.keys(): if dictionary.get(key) % 2 == 1: return key
print(4+3); print("Hello"); print('Who are you'); print('This is Pradeep\'s python program'); print(r'C:\Users\N51254\Documents\NetBeansProjects'); print("Pradeep "*5);
print(4 + 3) print('Hello') print('Who are you') print("This is Pradeep's python program") print('C:\\Users\\N51254\\Documents\\NetBeansProjects') print('Pradeep ' * 5)
class Bank(): def __init__(self): pass def reduce(self, source, to): return source.reduce(to)
class Bank: def __init__(self): pass def reduce(self, source, to): return source.reduce(to)
SQLALCHEMY_DATABASE_URI = 'sqlite:///database.sqlite' SECRET_KEY = 'F12Zr47j\3yX R~X@H!jmM]Lwf/,?KT' SAVE_FOLDER = '../../../projects' SQLALCHEMY_TRACK_MODIFICATIONS = 'False' PORT = '3000' STATIC_FOLDER = '../../client/dist/static'
sqlalchemy_database_uri = 'sqlite:///database.sqlite' secret_key = 'F12Zr47j\x03yX R~X@H!jmM]Lwf/,?KT' save_folder = '../../../projects' sqlalchemy_track_modifications = 'False' port = '3000' static_folder = '../../client/dist/static'
discovery_node_rpc_url='https://ctz.solidwallet.io/api/v3' request_data = { "jsonrpc": "2.0", "id": 1234, "method": "icx_call", "params": { "to": "cx0000000000000000000000000000000000000000", "dataType": "call", "data": { "method": "getPReps", "params": { "startRanking": "0x1", "endRanking": "0xaaa" } } } }
discovery_node_rpc_url = 'https://ctz.solidwallet.io/api/v3' request_data = {'jsonrpc': '2.0', 'id': 1234, 'method': 'icx_call', 'params': {'to': 'cx0000000000000000000000000000000000000000', 'dataType': 'call', 'data': {'method': 'getPReps', 'params': {'startRanking': '0x1', 'endRanking': '0xaaa'}}}}
# jaylin hours = float(input("Enter hours worked: ")) rate = float(input("Enter hourly rate: ")) if (rate >= 15): pay=(hours* rate) print("Pay: $", pay) else: print("I'm sorry " + str(rate) + " is lower than the minimum wage!")
hours = float(input('Enter hours worked: ')) rate = float(input('Enter hourly rate: ')) if rate >= 15: pay = hours * rate print('Pay: $', pay) else: print("I'm sorry " + str(rate) + ' is lower than the minimum wage!')
# This is a namespace package. See also: # http://pythonhosted.org/distribute/setuptools.html#namespace-packages # http://osdir.com/ml/python.distutils.devel/2006-08/msg00029.html __import__('pkg_resources').declare_namespace(__name__)
__import__('pkg_resources').declare_namespace(__name__)
# put your python code here def event_time(hours, minutes, seconds): return (hours * 3600) + (minutes * 60) + seconds def time_difference(a, b): return abs(a - b) hours_1 = int(input()) minutes_1 = int(input()) seconds_1 = int(input()) hours_2 = int(input()) minutes_2 = int(input()) seconds_2 = int(input()) event_1 = event_time(hours_1, minutes_1, seconds_1) event_2 = event_time(hours_2, minutes_2, seconds_2) print(time_difference(event_1, event_2))
def event_time(hours, minutes, seconds): return hours * 3600 + minutes * 60 + seconds def time_difference(a, b): return abs(a - b) hours_1 = int(input()) minutes_1 = int(input()) seconds_1 = int(input()) hours_2 = int(input()) minutes_2 = int(input()) seconds_2 = int(input()) event_1 = event_time(hours_1, minutes_1, seconds_1) event_2 = event_time(hours_2, minutes_2, seconds_2) print(time_difference(event_1, event_2))
def get_config_cs2en(): config = {} # Settings which should be given at start time, but are not, for convenience config['the_task'] = 0 # Settings ---------------------------------------------------------------- config['allTagsSplit'] = 'allTagsSplit/' # can be 'allTagsSplit/', 'POSextra/' or '' config['identity_init'] = True config['early_stopping'] = False # this has no use for now config['use_attention'] = True # if we want attention output at test time; still no effect for training # Model related ----------------------------------------------------------- # Definition of the error function; right now only included in baseline_ets config['error_fct'] = 'categorical_cross_entropy' # Sequences longer than this will be discarded config['seq_len'] = 50 # Number of hidden units in encoder/decoder GRU config['enc_nhids'] = 100 # orig: 100 config['dec_nhids'] = 100 # orig: 100 # For the initialization of the parameters. config['rng_value'] = 11 # Dimension of the word embedding matrix in encoder/decoder config['enc_embed'] = 100 # orig: 300 config['dec_embed'] = 100 # orig: 300 # Where to save model, this corresponds to 'prefix' in groundhog config['saveto'] = 'model' # Optimization related ---------------------------------------------------- # Batch size config['batch_size'] = 20 # This many batches will be read ahead and sorted config['sort_k_batches'] = 12 # Optimization step rule config['step_rule'] = 'AdaDelta' # Gradient clipping threshold config['step_clipping'] = 1. # Std of weight initialization config['weight_scale'] = 0.01 # Regularization related -------------------------------------------------- # Weight noise flag for feed forward layers config['weight_noise_ff'] = False # Weight noise flag for recurrent layers config['weight_noise_rec'] = False # Dropout ratio, applied only after readout maxout config['dropout'] = 0.5 # Vocabulary/dataset/embeddings related ---------------------------------------------- # Corpus vocabulary pickle file config['corpus_data'] = '/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/Corpora/corpus_voc_' # Root directory for dataset datadir = '/mounts/Users/cisintern/huiming/SIGMORPHON/Code/src/baseline/' # Module name of the stream that will be used config['stream'] = 'stream' # Source and target vocabularies if config['the_task'] > 1: config['src_vocab'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '_src_voc_task' + str(config['the_task']) + '.pkl'] config['trg_vocab'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '_trg_voc_task' + str(config['the_task']) + '.pkl'] # introduce "german" or so here else: config['src_vocab'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '_src_voc.pkl'] config['trg_vocab'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '_trg_voc.pkl'] # introduce "german" or so here # Source and target datasets config['src_data'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '-task' + str(config['the_task']) + '-train_src'] config['trg_data'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '-task' + str(config['the_task']) + '-train_trg'] # Source and target vocabulary sizes, should include bos, eos, unk tokens # This will be read at runtime from a file. config['src_vocab_size'] = 159 config['trg_vocab_size'] = 61 # Special tokens and indexes config['unk_id'] = 1 config['bow_token'] = '<S>' config['eow_token'] = '</S>' config['unk_token'] = '<UNK>' # Validation set source file; this is the test file, because there is only a test set for two languages config['val_set'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '-task' + str(config['the_task']) + '-test_src'] # Validation set gold file config['val_set_grndtruth'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '-task' + str(config['the_task']) + '-test_trg'] # Print validation output to file config['output_val_set'] = False # Validation output file config['val_set_out'] = config['saveto'] + '/validation_out.txt' # Beam-size config['beam_size'] = 12 # Path to pretrained embeddings config['embeddings'] = ['/mounts/Users/cisintern/huiming/universal-mri/Code/_FINAL_ST_MODELS/t1_high/task2/Ens_1_model_', '_100_100'] # Timing/monitoring related ----------------------------------------------- # Maximum number of epochs config['finish_after'] = 100 # Reload model from files if exist config['reload'] = True # Save model after this many updates config['save_freq'] = 500 # Show samples from model after this many updates config['sampling_freq'] = 50 # Show this many samples at each sampling config['hook_samples'] = 2 # Start bleu validation after this many updates config['val_burn_in'] = 80000 config['lang'] = None return config
def get_config_cs2en(): config = {} config['the_task'] = 0 config['allTagsSplit'] = 'allTagsSplit/' config['identity_init'] = True config['early_stopping'] = False config['use_attention'] = True config['error_fct'] = 'categorical_cross_entropy' config['seq_len'] = 50 config['enc_nhids'] = 100 config['dec_nhids'] = 100 config['rng_value'] = 11 config['enc_embed'] = 100 config['dec_embed'] = 100 config['saveto'] = 'model' config['batch_size'] = 20 config['sort_k_batches'] = 12 config['step_rule'] = 'AdaDelta' config['step_clipping'] = 1.0 config['weight_scale'] = 0.01 config['weight_noise_ff'] = False config['weight_noise_rec'] = False config['dropout'] = 0.5 config['corpus_data'] = '/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/Corpora/corpus_voc_' datadir = '/mounts/Users/cisintern/huiming/SIGMORPHON/Code/src/baseline/' config['stream'] = 'stream' if config['the_task'] > 1: config['src_vocab'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '_src_voc_task' + str(config['the_task']) + '.pkl'] config['trg_vocab'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '_trg_voc_task' + str(config['the_task']) + '.pkl'] else: config['src_vocab'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '_src_voc.pkl'] config['trg_vocab'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '_trg_voc.pkl'] config['src_data'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '-task' + str(config['the_task']) + '-train_src'] config['trg_data'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '-task' + str(config['the_task']) + '-train_trg'] config['src_vocab_size'] = 159 config['trg_vocab_size'] = 61 config['unk_id'] = 1 config['bow_token'] = '<S>' config['eow_token'] = '</S>' config['unk_token'] = '<UNK>' config['val_set'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '-task' + str(config['the_task']) + '-test_src'] config['val_set_grndtruth'] = ['/mounts/Users/cisintern/huiming/SIGMORPHON/Code/data/forRnn/', '-task' + str(config['the_task']) + '-test_trg'] config['output_val_set'] = False config['val_set_out'] = config['saveto'] + '/validation_out.txt' config['beam_size'] = 12 config['embeddings'] = ['/mounts/Users/cisintern/huiming/universal-mri/Code/_FINAL_ST_MODELS/t1_high/task2/Ens_1_model_', '_100_100'] config['finish_after'] = 100 config['reload'] = True config['save_freq'] = 500 config['sampling_freq'] = 50 config['hook_samples'] = 2 config['val_burn_in'] = 80000 config['lang'] = None return config
ALLOWED_HOSTS = ['testserver'] EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:' } } CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'iosDevCourse' }, 'local': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'iosDevCourse' } }
allowed_hosts = ['testserver'] email_backend = 'django.core.mail.backends.console.EmailBackend' databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}} caches = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'iosDevCourse'}, 'local': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'iosDevCourse'}}
my_dictionary = { 'type': 'Fruits', 'name': 'Apple', 'color': 'Green', 'available': True, 'number': 25 } print(my_dictionary) print(my_dictionary['name']) # searching with wrong key print(my_dictionary['weight']) ############################################################### # printing keys and values for d in my_dictionary: print(d, my_dictionary[d]) # printing values direct for data in my_dictionary.values(): print(data) ############################################################### # modify a value my_dictionary['color'] = 'Red' print(my_dictionary) ############################################################### # inserting new item my_dictionary['weight'] = '5k' print(my_dictionary) ############################################################### # deleting an item del my_dictionary['weight'] print(my_dictionary) ###############################################################
my_dictionary = {'type': 'Fruits', 'name': 'Apple', 'color': 'Green', 'available': True, 'number': 25} print(my_dictionary) print(my_dictionary['name']) print(my_dictionary['weight']) for d in my_dictionary: print(d, my_dictionary[d]) for data in my_dictionary.values(): print(data) my_dictionary['color'] = 'Red' print(my_dictionary) my_dictionary['weight'] = '5k' print(my_dictionary) del my_dictionary['weight'] print(my_dictionary)
vTotal = 0 i = 0 vMenorValor = 0 cont = 1 vMenorValorItem = '' while True: vItem = str(input('Insira o nome do produto: ')) vValor = float(input('Valor do produto: R$')) vTotal = vTotal + vValor if vValor >= 1000: i = i + 1 if cont == 1: vMenorValor = vValor vMenorValorItem = vItem else: if vValor < vMenorValor: vMenorValor = vValor vMenorValorItem = vItem cont = cont + 1 vAns = ' ' while vAns not in 'YyNnSs': vAns = str(input('Deseja continuar [Y/N]? ')) if vAns in 'Nn': break print('-'*40) #print('{:-^40}'.format('Fim do Programa')) print('Fim do Programa'.center(40,'-')) print(f'Temos {i} produto(s) custando mais que R$1000.00') print(f'O produto mais barato foi o {vMenorValorItem} custando R${vMenorValor:.2f}')
v_total = 0 i = 0 v_menor_valor = 0 cont = 1 v_menor_valor_item = '' while True: v_item = str(input('Insira o nome do produto: ')) v_valor = float(input('Valor do produto: R$')) v_total = vTotal + vValor if vValor >= 1000: i = i + 1 if cont == 1: v_menor_valor = vValor v_menor_valor_item = vItem elif vValor < vMenorValor: v_menor_valor = vValor v_menor_valor_item = vItem cont = cont + 1 v_ans = ' ' while vAns not in 'YyNnSs': v_ans = str(input('Deseja continuar [Y/N]? ')) if vAns in 'Nn': break print('-' * 40) print('Fim do Programa'.center(40, '-')) print(f'Temos {i} produto(s) custando mais que R$1000.00') print(f'O produto mais barato foi o {vMenorValorItem} custando R${vMenorValor:.2f}')
# Tai Sakuma <[email protected]> ##__________________________________________________________________|| class Parallel(object): def __init__(self, progressMonitor, communicationChannel, workingarea=None): self.progressMonitor = progressMonitor self.communicationChannel = communicationChannel self.workingarea = workingarea def __repr__(self): name_value_pairs = ( ('progressMonitor', self.progressMonitor), ('communicationChannel', self.communicationChannel), ('workingarea', self.workingarea) ) return '{}({})'.format( self.__class__.__name__, ', '.join(['{}={!r}'.format(n, v) for n, v in name_value_pairs]), ) def begin(self): self.progressMonitor.begin() self.communicationChannel.begin() def terminate(self): self.communicationChannel.terminate() def end(self): self.progressMonitor.end() self.communicationChannel.end() ##__________________________________________________________________||
class Parallel(object): def __init__(self, progressMonitor, communicationChannel, workingarea=None): self.progressMonitor = progressMonitor self.communicationChannel = communicationChannel self.workingarea = workingarea def __repr__(self): name_value_pairs = (('progressMonitor', self.progressMonitor), ('communicationChannel', self.communicationChannel), ('workingarea', self.workingarea)) return '{}({})'.format(self.__class__.__name__, ', '.join(['{}={!r}'.format(n, v) for (n, v) in name_value_pairs])) def begin(self): self.progressMonitor.begin() self.communicationChannel.begin() def terminate(self): self.communicationChannel.terminate() def end(self): self.progressMonitor.end() self.communicationChannel.end()
# Algorithms > Warmup > Compare the Triplets # Compare the elements in two triplets. # # https://www.hackerrank.com/challenges/compare-the-triplets/problem # a = map(int, input().split()) b = map(int, input().split()) alice, bob = 0, 0 for i, j in zip(a, b): if i > j: alice += 1 elif i < j: bob += 1 print(alice, bob)
a = map(int, input().split()) b = map(int, input().split()) (alice, bob) = (0, 0) for (i, j) in zip(a, b): if i > j: alice += 1 elif i < j: bob += 1 print(alice, bob)
''' Normal Counting sort without any associated array to keep track of Time Complexity = O(n) Space Complexity = O(n + k) Auxilary Space = O(k) ''' def countingSort(a): b = [0]*(max(a) + 1) c = [] for i in range(len(a)): b[a[i]] += 1 for i in range(len(b)): if(b[i] != 0): for j in range(b[i]): c.append(i) return c
""" Normal Counting sort without any associated array to keep track of Time Complexity = O(n) Space Complexity = O(n + k) Auxilary Space = O(k) """ def counting_sort(a): b = [0] * (max(a) + 1) c = [] for i in range(len(a)): b[a[i]] += 1 for i in range(len(b)): if b[i] != 0: for j in range(b[i]): c.append(i) return c
n,m=map(int,input().split()) L = [list(map(int,input().split())) for i in range(m)] ans = 0 L.sort(key = lambda t:t[0],reverse = True) for i in L[:-1]: ans += max(0,n-i[0]) print(ans)
(n, m) = map(int, input().split()) l = [list(map(int, input().split())) for i in range(m)] ans = 0 L.sort(key=lambda t: t[0], reverse=True) for i in L[:-1]: ans += max(0, n - i[0]) print(ans)
N = int(input()) def factorial(N): if N == 0: return 1 return N * factorial(N-1) print(factorial(N))
n = int(input()) def factorial(N): if N == 0: return 1 return N * factorial(N - 1) print(factorial(N))
class AreWeUnitTesting(object): # no doc Value = False __all__ = []
class Areweunittesting(object): value = False __all__ = []
CJ_PATH = r'' COOKIES_PATH = r'' CHAN_ID = '' VID_ID = ''
cj_path = '' cookies_path = '' chan_id = '' vid_id = ''
class Rectangle: def __init__(self, length, breadth, unit_cost=0): self.length = length self.breadth = breadth self.unit_cost = unit_cost def get_area(self): return self.length * self.breadth def calculate_cost(self): area = self.get_area() return area * self.unit_cost # breadth = 120 units, length = 160 units, 1 sq unit cost = Rs 2000 r = Rectangle(160, 120, 2000) print("Area of Rectangle: %s sq units" % (r.get_area()))
class Rectangle: def __init__(self, length, breadth, unit_cost=0): self.length = length self.breadth = breadth self.unit_cost = unit_cost def get_area(self): return self.length * self.breadth def calculate_cost(self): area = self.get_area() return area * self.unit_cost r = rectangle(160, 120, 2000) print('Area of Rectangle: %s sq units' % r.get_area())
# URLs processed simultaneously class Batch(): def __init__(self): self._batch = 0 def set_batch(self, n_batch): try: self._batch = n_batch except BaseException: print("[ERROR] Can't set task batch number.") def get_batch(self): try: return self._batch except BaseException: print("[ERROR] Can't get task batch number.")
class Batch: def __init__(self): self._batch = 0 def set_batch(self, n_batch): try: self._batch = n_batch except BaseException: print("[ERROR] Can't set task batch number.") def get_batch(self): try: return self._batch except BaseException: print("[ERROR] Can't get task batch number.")
playerFilesWin = { "lib/avcodec-56.dll" : { "flag_deps" : True, "should_be_removed" : True }, "lib/avformat-56.dll" : { "flag_deps" : True, "should_be_removed" : True }, "lib/avutil-54.dll" : { "flag_deps" : True, "should_be_removed" : True }, "lib/swscale-3.dll" : { "flag_deps" : True, "should_be_removed" : True }, "lib/gen_files_list.py" : { "flag_deps" : True, "should_be_removed" : True }, "lib/crashrpt_lang.ini" : { "flag_deps" : True, "should_be_removed" : True }, "lib/CrashSender.exe" : { "flag_deps" : True, "should_be_removed" : True }, "lib/avcodec-57.dll" : { "flag_deps" : True, "should_be_removed" : True }, "lib/avformat-57.dll" : { "flag_deps" : True, "should_be_removed" : True }, "lib/avutil-55.dll" : { "flag_deps" : True, "should_be_removed" : True }, "lib/swscale-4.dll" : { "flag_deps" : True, "should_be_removed" : True }, "lib/avcodec-58.dll" : { "flag_deps" : True}, "lib/avformat-58.dll" : { "flag_deps" : True}, "lib/avutil-56.dll" : { "flag_deps" : True}, "lib/swscale-5.dll" : { "flag_deps" : True}, "lib/cef.pak" : { "flag_deps" : True }, "lib/cef_100_percent.pak" : { "flag_deps" : True }, "lib/cef_200_percent.pak" : { "flag_deps" : True }, "lib/cef_extensions.pak" : { "flag_deps" : True }, "lib/chrome_elf.dll" : { "flag_deps" : True }, "lib/d3dcompiler_43.dll" : { "flag_deps" : True }, "lib/d3dcompiler_47.dll" : { "flag_deps" : True }, "lib/devtools_resources.pak" : { "flag_deps" : True }, "lib/icudtl.dat" : { "flag_deps" : True }, "lib/libcef.dll" : { "flag_deps" : True }, "lib/libEGL.dll" : { "flag_deps" : True }, "lib/libGLESv2.dll" : { "flag_deps" : True }, "lib/libGLESv1_CM.dll" : { "flag_deps" : True }, "lib/angle_util.dll" : { "flag_deps" : True }, "lib/natives_blob.bin" : { "flag_deps" : True }, "lib/snapshot_blob.bin" : { "flag_deps" : True }, "lib/v8_context_snapshot.bin" : { "flag_deps" : True }, "lib/widevinecdmadapter.dll" : { "flag_deps" : True, "should_be_removed" : True}, "lib/images/sample_app.png" : { "flag_deps" : True, "should_be_removed" : True}, "lib/locales/am.pak" : { "flag_deps" : True }, "lib/locales/ar.pak" : { "flag_deps" : True }, "lib/locales/bg.pak" : { "flag_deps" : True }, "lib/locales/bn.pak" : { "flag_deps" : True }, "lib/locales/ca.pak" : { "flag_deps" : True }, "lib/locales/cs.pak" : { "flag_deps" : True }, "lib/locales/da.pak" : { "flag_deps" : True }, "lib/locales/de.pak" : { "flag_deps" : True }, "lib/locales/el.pak" : { "flag_deps" : True }, "lib/locales/en-GB.pak" : { "flag_deps" : True }, "lib/locales/en-US.pak" : { "flag_deps" : True }, "lib/locales/es-419.pak" : { "flag_deps" : True }, "lib/locales/es.pak" : { "flag_deps" : True }, "lib/locales/et.pak" : { "flag_deps" : True }, "lib/locales/fa.pak" : { "flag_deps" : True }, "lib/locales/fi.pak" : { "flag_deps" : True }, "lib/locales/fil.pak" : { "flag_deps" : True }, "lib/locales/fr.pak" : { "flag_deps" : True }, "lib/locales/gu.pak" : { "flag_deps" : True }, "lib/locales/he.pak" : { "flag_deps" : True }, "lib/locales/hi.pak" : { "flag_deps" : True }, "lib/locales/hr.pak" : { "flag_deps" : True }, "lib/locales/hu.pak" : { "flag_deps" : True }, "lib/locales/id.pak" : { "flag_deps" : True }, "lib/locales/it.pak" : { "flag_deps" : True }, "lib/locales/ja.pak" : { "flag_deps" : True }, "lib/locales/kn.pak" : { "flag_deps" : True }, "lib/locales/ko.pak" : { "flag_deps" : True }, "lib/locales/lt.pak" : { "flag_deps" : True }, "lib/locales/lv.pak" : { "flag_deps" : True }, "lib/locales/ml.pak" : { "flag_deps" : True }, "lib/locales/mr.pak" : { "flag_deps" : True }, "lib/locales/ms.pak" : { "flag_deps" : True }, "lib/locales/nb.pak" : { "flag_deps" : True }, "lib/locales/nl.pak" : { "flag_deps" : True }, "lib/locales/pl.pak" : { "flag_deps" : True }, "lib/locales/pt-BR.pak" : { "flag_deps" : True }, "lib/locales/pt-PT.pak" : { "flag_deps" : True }, "lib/locales/ro.pak" : { "flag_deps" : True }, "lib/locales/ru.pak" : { "flag_deps" : True }, "lib/locales/sk.pak" : { "flag_deps" : True }, "lib/locales/sl.pak" : { "flag_deps" : True }, "lib/locales/sr.pak" : { "flag_deps" : True }, "lib/locales/sv.pak" : { "flag_deps" : True }, "lib/locales/sw.pak" : { "flag_deps" : True }, "lib/locales/ta.pak" : { "flag_deps" : True }, "lib/locales/te.pak" : { "flag_deps" : True }, "lib/locales/th.pak" : { "flag_deps" : True }, "lib/locales/tr.pak" : { "flag_deps" : True }, "lib/locales/uk.pak" : { "flag_deps" : True }, "lib/locales/vi.pak" : { "flag_deps" : True }, "lib/locales/zh-CN.pak" : { "flag_deps" : True }, "lib/locales/zh-TW.pak" : { "flag_deps" : True }, # "lib/localhost.pack" : {}, "lib/u2ec.dll" : { "should_be_removed" : True }, "lib/collector.dll" : { "should_be_removed" : True }, "lib/logging.dll" : {}, "lib/rtspclient.dll" : { "should_be_removed" : True }, "lib/crash_reporter.cfg" : {}, "lib/benchmark.data" : { "should_be_removed" : True }, "lib/background.ts" : { "should_be_removed" : True }, "lib/benchmark_fullhd_hi.data" : {}, "lib/benchmark_fullhd_low.data" : { "should_be_removed" : True }, "lib/benchmark_hdready_hi.data" : {}, "lib/benchmark_hdready_low.data" : { "should_be_removed" : True }, "lib/config.ini" : { "may_be_modified" : True, "may_be_removed" : True }, "quickreset.exe" : { "should_be_removed" : True }, "lib/LiquidSkyHelper.exe" : { "should_be_removed" : True }, "lib/lang_en.ini" : { "should_be_removed" : True }, "lib/render-cef.dll" : { "should_be_removed" : True }, "lib/player-cef.dll" : { "should_be_removed" : True }, "lib/render-cuda.dll" : { "should_be_removed" : True }, "lib/render-ffmpeg.dll" : {}, "lib/render-ffmpeg-hw.dll" : { "should_be_removed" : True}, "lib/usb_driver.exe" : { "should_be_removed" : True }, #default liquidsky version "LiquidSkyClient.exe" : {}, "lib/LiquidSky.exe" : {}, "lib/usb_driver.msi" : { "should_be_removed" : True }, "lib/UsbHelper.exe" : { "should_be_removed" : True }, "lib/Vivien.exe" : { "should_be_removed" : True }, "VivienClient.exe" : { "should_be_removed" : True }, } #if you add any new file to verizon, please make sure that it is included to main list too playerFilesWinCast = { "lib/usb_driver.msi" : {}, "lib/UsbHelper.exe" : {}, "lib/Vivien.exe" : {}, "VivienClient.exe" : {}, "lib/LiquidSky.exe" : { "should_be_removed" : True }, "LiquidSkyClient.exe" : { "should_be_removed" : True }, "lib/localhost1.pack" : { "should_be_removed" : True }, "lib/localhost2.pack" : { "should_be_removed" : True }, "lib/localhost3.pack" : { "should_be_removed" : True }, "lib/localhost4.pack" : { "should_be_removed" : True }, } playerFilesMac = { "Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/am.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/ar.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/bg.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/bn.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/ca.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/cef_100_percent.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/cef_200_percent.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/cef_extensions.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/cs.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/da.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/de.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/devtools_resources.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/el.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/en.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/en_GB.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/es.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/es_419.lproj/locale.pak": { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/et.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/fa.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/fi.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/fil.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/fr.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/gu.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/he.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/hi.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/hr.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/hu.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/icudtl.dat" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/id.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/Info.plist" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/it.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/ja.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/kn.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/ko.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/lt.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/lv.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/ml.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/mr.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/ms.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/natives_blob.bin" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/nb.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/nl.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/pl.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/pt_BR.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/pt_PT.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/ro.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/ru.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/sk.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/sl.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/snapshot_blob.bin" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/sr.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/sv.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/sw.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/ta.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/te.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/th.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/tr.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/uk.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/vi.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/zh_CN.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/Chromium Embedded Framework.framework/Resources/zh_TW.lproj/locale.pak" : { "access_mode" : "644" }, "Frameworks/LiquidSky Helper.app/Contents/Info.plist" : { "access_mode" : "644" }, "Frameworks/LiquidSky Helper.app/Contents/MacOS/LiquidSky Helper" : { "access_mode" : "755" }, "Info.plist" : { "access_mode" : "644" }, "MacOS/libavcodec.dylib" : { "access_mode" : "644" }, "MacOS/libavformat.dylib" : { "access_mode" : "644" }, "MacOS/libavutil.dylib" : { "access_mode" : "644" }, "MacOS/libcollector.dylib" : { "access_mode" : "644", "should_be_removed" : True }, "MacOS/liblogging.dylib" : { "access_mode" : "644" }, "MacOS/libplayer-cef.dylib" : { "access_mode" : "644" }, "MacOS/librender-ffmpeg-hw.dylib" : { "access_mode" : "644" }, "MacOS/librender-ffmpeg.dylib" : { "access_mode" : "644" }, "MacOS/librtspclient.dylib" : { "access_mode" : "644" }, "MacOS/libswscale.dylib" : { "access_mode" : "644" }, "MacOS/LiquidSky" : { "access_mode" : "755", "should_be_removed" : True }, "MacOS/liquidsky-client" : { "access_mode" : "755" }, "Resources/background.ts" : { "access_mode" : "644", "should_be_removed" : True }, "Resources/benchmark_fullhd_hi.data" : { "access_mode" : "644", "should_be_removed" : True }, "Resources/benchmark_hdready_hi.data" : { "access_mode" : "644", "should_be_removed" : True }, "Resources/lang_en.ini" : { "access_mode" : "644" }, "Resources/liquidsky.icns" : { "access_mode" : "644" }, "Resources/localhost.pack" : { "access_mode" : "644" }, } streamerFilesWin = { "avcodec-57.dll" : { "should_be_removed" : True }, "avformat-57.dll" : { "should_be_removed" : True }, "avutil-55.dll" : { "should_be_removed" : True }, "swscale-4.dll" : { "should_be_removed" : True }, "avcodec-58.dll" : {}, "avformat-58.dll" : {}, "avutil-56.dll" : {}, "swscale-5.dll" : {}, "crashrpt_lang.ini" : {}, "CrashSender.exe" : {}, "osk-monitor.exe" : {}, "osk.exe" : {}, "sky.cfg" : { "may_be_modified" : True, "may_be_removed" : True }, "streamer-service.exe" : {}, "streamer-updater.exe" : { "should_be_removed" : True }, "update-executor.exe" : {}, "streamer.exe" : { "should_be_removed" : True }, "SkyBeam.exe" : {}, "storagetool.exe" : {}, "setuptool.exe" : {}, "vmhelper.dll" : {}, "logging.dll" : {}, "changelang.exe" : {}, "app-sender.exe" : {}, "process-monitor.exe" : {}, "webrtc-lib.dll" : {}, "lsfb.exe" : {}, } streamerFilesWinCast = { "usb-service.exe" : {}, } branchIniDisabled = { "lib/branch.ini" : { "should_be_removed" : True }, } branchIniEnabled = { "lib/branch.ini" : {}, } targets = { "player-win" : { "files" : playerFilesWin, "path" : ["buildproject", "player"], "brands" : { "cast" : playerFilesWinCast }, }, "player-mac" : { "files" : playerFilesMac, "path" : ["buildproject", "LiquidSky.app", "Contents"], "brands" : {}, }, "streamer-win" : { "files" : streamerFilesWin, "path" : ["buildproject", "streamer"], "brands" : { "cast" : streamerFilesWinCast }, }, }
player_files_win = {'lib/avcodec-56.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/avformat-56.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/avutil-54.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/swscale-3.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/gen_files_list.py': {'flag_deps': True, 'should_be_removed': True}, 'lib/crashrpt_lang.ini': {'flag_deps': True, 'should_be_removed': True}, 'lib/CrashSender.exe': {'flag_deps': True, 'should_be_removed': True}, 'lib/avcodec-57.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/avformat-57.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/avutil-55.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/swscale-4.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/avcodec-58.dll': {'flag_deps': True}, 'lib/avformat-58.dll': {'flag_deps': True}, 'lib/avutil-56.dll': {'flag_deps': True}, 'lib/swscale-5.dll': {'flag_deps': True}, 'lib/cef.pak': {'flag_deps': True}, 'lib/cef_100_percent.pak': {'flag_deps': True}, 'lib/cef_200_percent.pak': {'flag_deps': True}, 'lib/cef_extensions.pak': {'flag_deps': True}, 'lib/chrome_elf.dll': {'flag_deps': True}, 'lib/d3dcompiler_43.dll': {'flag_deps': True}, 'lib/d3dcompiler_47.dll': {'flag_deps': True}, 'lib/devtools_resources.pak': {'flag_deps': True}, 'lib/icudtl.dat': {'flag_deps': True}, 'lib/libcef.dll': {'flag_deps': True}, 'lib/libEGL.dll': {'flag_deps': True}, 'lib/libGLESv2.dll': {'flag_deps': True}, 'lib/libGLESv1_CM.dll': {'flag_deps': True}, 'lib/angle_util.dll': {'flag_deps': True}, 'lib/natives_blob.bin': {'flag_deps': True}, 'lib/snapshot_blob.bin': {'flag_deps': True}, 'lib/v8_context_snapshot.bin': {'flag_deps': True}, 'lib/widevinecdmadapter.dll': {'flag_deps': True, 'should_be_removed': True}, 'lib/images/sample_app.png': {'flag_deps': True, 'should_be_removed': True}, 'lib/locales/am.pak': {'flag_deps': True}, 'lib/locales/ar.pak': {'flag_deps': True}, 'lib/locales/bg.pak': {'flag_deps': True}, 'lib/locales/bn.pak': {'flag_deps': True}, 'lib/locales/ca.pak': {'flag_deps': True}, 'lib/locales/cs.pak': {'flag_deps': True}, 'lib/locales/da.pak': {'flag_deps': True}, 'lib/locales/de.pak': {'flag_deps': True}, 'lib/locales/el.pak': {'flag_deps': True}, 'lib/locales/en-GB.pak': {'flag_deps': True}, 'lib/locales/en-US.pak': {'flag_deps': True}, 'lib/locales/es-419.pak': {'flag_deps': True}, 'lib/locales/es.pak': {'flag_deps': True}, 'lib/locales/et.pak': {'flag_deps': True}, 'lib/locales/fa.pak': {'flag_deps': True}, 'lib/locales/fi.pak': {'flag_deps': True}, 'lib/locales/fil.pak': {'flag_deps': True}, 'lib/locales/fr.pak': {'flag_deps': True}, 'lib/locales/gu.pak': {'flag_deps': True}, 'lib/locales/he.pak': {'flag_deps': True}, 'lib/locales/hi.pak': {'flag_deps': True}, 'lib/locales/hr.pak': {'flag_deps': True}, 'lib/locales/hu.pak': {'flag_deps': True}, 'lib/locales/id.pak': {'flag_deps': True}, 'lib/locales/it.pak': {'flag_deps': True}, 'lib/locales/ja.pak': {'flag_deps': True}, 'lib/locales/kn.pak': {'flag_deps': True}, 'lib/locales/ko.pak': {'flag_deps': True}, 'lib/locales/lt.pak': {'flag_deps': True}, 'lib/locales/lv.pak': {'flag_deps': True}, 'lib/locales/ml.pak': {'flag_deps': True}, 'lib/locales/mr.pak': {'flag_deps': True}, 'lib/locales/ms.pak': {'flag_deps': True}, 'lib/locales/nb.pak': {'flag_deps': True}, 'lib/locales/nl.pak': {'flag_deps': True}, 'lib/locales/pl.pak': {'flag_deps': True}, 'lib/locales/pt-BR.pak': {'flag_deps': True}, 'lib/locales/pt-PT.pak': {'flag_deps': True}, 'lib/locales/ro.pak': {'flag_deps': True}, 'lib/locales/ru.pak': {'flag_deps': True}, 'lib/locales/sk.pak': {'flag_deps': True}, 'lib/locales/sl.pak': {'flag_deps': True}, 'lib/locales/sr.pak': {'flag_deps': True}, 'lib/locales/sv.pak': {'flag_deps': True}, 'lib/locales/sw.pak': {'flag_deps': True}, 'lib/locales/ta.pak': {'flag_deps': True}, 'lib/locales/te.pak': {'flag_deps': True}, 'lib/locales/th.pak': {'flag_deps': True}, 'lib/locales/tr.pak': {'flag_deps': True}, 'lib/locales/uk.pak': {'flag_deps': True}, 'lib/locales/vi.pak': {'flag_deps': True}, 'lib/locales/zh-CN.pak': {'flag_deps': True}, 'lib/locales/zh-TW.pak': {'flag_deps': True}, 'lib/u2ec.dll': {'should_be_removed': True}, 'lib/collector.dll': {'should_be_removed': True}, 'lib/logging.dll': {}, 'lib/rtspclient.dll': {'should_be_removed': True}, 'lib/crash_reporter.cfg': {}, 'lib/benchmark.data': {'should_be_removed': True}, 'lib/background.ts': {'should_be_removed': True}, 'lib/benchmark_fullhd_hi.data': {}, 'lib/benchmark_fullhd_low.data': {'should_be_removed': True}, 'lib/benchmark_hdready_hi.data': {}, 'lib/benchmark_hdready_low.data': {'should_be_removed': True}, 'lib/config.ini': {'may_be_modified': True, 'may_be_removed': True}, 'quickreset.exe': {'should_be_removed': True}, 'lib/LiquidSkyHelper.exe': {'should_be_removed': True}, 'lib/lang_en.ini': {'should_be_removed': True}, 'lib/render-cef.dll': {'should_be_removed': True}, 'lib/player-cef.dll': {'should_be_removed': True}, 'lib/render-cuda.dll': {'should_be_removed': True}, 'lib/render-ffmpeg.dll': {}, 'lib/render-ffmpeg-hw.dll': {'should_be_removed': True}, 'lib/usb_driver.exe': {'should_be_removed': True}, 'LiquidSkyClient.exe': {}, 'lib/LiquidSky.exe': {}, 'lib/usb_driver.msi': {'should_be_removed': True}, 'lib/UsbHelper.exe': {'should_be_removed': True}, 'lib/Vivien.exe': {'should_be_removed': True}, 'VivienClient.exe': {'should_be_removed': True}} player_files_win_cast = {'lib/usb_driver.msi': {}, 'lib/UsbHelper.exe': {}, 'lib/Vivien.exe': {}, 'VivienClient.exe': {}, 'lib/LiquidSky.exe': {'should_be_removed': True}, 'LiquidSkyClient.exe': {'should_be_removed': True}, 'lib/localhost1.pack': {'should_be_removed': True}, 'lib/localhost2.pack': {'should_be_removed': True}, 'lib/localhost3.pack': {'should_be_removed': True}, 'lib/localhost4.pack': {'should_be_removed': True}} player_files_mac = {'Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/am.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/ar.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/bg.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/bn.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/ca.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/cef_100_percent.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/cef_200_percent.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/cef_extensions.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/cs.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/da.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/de.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/devtools_resources.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/el.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/en.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/en_GB.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/es.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/es_419.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/et.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/fa.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/fi.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/fil.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/fr.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/gu.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/he.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/hi.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/hr.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/hu.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/icudtl.dat': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/id.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/Info.plist': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/it.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/ja.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/kn.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/ko.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/lt.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/lv.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/ml.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/mr.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/ms.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/natives_blob.bin': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/nb.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/nl.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/pl.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/pt_BR.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/pt_PT.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/ro.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/ru.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/sk.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/sl.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/snapshot_blob.bin': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/sr.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/sv.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/sw.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/ta.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/te.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/th.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/tr.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/uk.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/vi.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/zh_CN.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/Chromium Embedded Framework.framework/Resources/zh_TW.lproj/locale.pak': {'access_mode': '644'}, 'Frameworks/LiquidSky Helper.app/Contents/Info.plist': {'access_mode': '644'}, 'Frameworks/LiquidSky Helper.app/Contents/MacOS/LiquidSky Helper': {'access_mode': '755'}, 'Info.plist': {'access_mode': '644'}, 'MacOS/libavcodec.dylib': {'access_mode': '644'}, 'MacOS/libavformat.dylib': {'access_mode': '644'}, 'MacOS/libavutil.dylib': {'access_mode': '644'}, 'MacOS/libcollector.dylib': {'access_mode': '644', 'should_be_removed': True}, 'MacOS/liblogging.dylib': {'access_mode': '644'}, 'MacOS/libplayer-cef.dylib': {'access_mode': '644'}, 'MacOS/librender-ffmpeg-hw.dylib': {'access_mode': '644'}, 'MacOS/librender-ffmpeg.dylib': {'access_mode': '644'}, 'MacOS/librtspclient.dylib': {'access_mode': '644'}, 'MacOS/libswscale.dylib': {'access_mode': '644'}, 'MacOS/LiquidSky': {'access_mode': '755', 'should_be_removed': True}, 'MacOS/liquidsky-client': {'access_mode': '755'}, 'Resources/background.ts': {'access_mode': '644', 'should_be_removed': True}, 'Resources/benchmark_fullhd_hi.data': {'access_mode': '644', 'should_be_removed': True}, 'Resources/benchmark_hdready_hi.data': {'access_mode': '644', 'should_be_removed': True}, 'Resources/lang_en.ini': {'access_mode': '644'}, 'Resources/liquidsky.icns': {'access_mode': '644'}, 'Resources/localhost.pack': {'access_mode': '644'}} streamer_files_win = {'avcodec-57.dll': {'should_be_removed': True}, 'avformat-57.dll': {'should_be_removed': True}, 'avutil-55.dll': {'should_be_removed': True}, 'swscale-4.dll': {'should_be_removed': True}, 'avcodec-58.dll': {}, 'avformat-58.dll': {}, 'avutil-56.dll': {}, 'swscale-5.dll': {}, 'crashrpt_lang.ini': {}, 'CrashSender.exe': {}, 'osk-monitor.exe': {}, 'osk.exe': {}, 'sky.cfg': {'may_be_modified': True, 'may_be_removed': True}, 'streamer-service.exe': {}, 'streamer-updater.exe': {'should_be_removed': True}, 'update-executor.exe': {}, 'streamer.exe': {'should_be_removed': True}, 'SkyBeam.exe': {}, 'storagetool.exe': {}, 'setuptool.exe': {}, 'vmhelper.dll': {}, 'logging.dll': {}, 'changelang.exe': {}, 'app-sender.exe': {}, 'process-monitor.exe': {}, 'webrtc-lib.dll': {}, 'lsfb.exe': {}} streamer_files_win_cast = {'usb-service.exe': {}} branch_ini_disabled = {'lib/branch.ini': {'should_be_removed': True}} branch_ini_enabled = {'lib/branch.ini': {}} targets = {'player-win': {'files': playerFilesWin, 'path': ['buildproject', 'player'], 'brands': {'cast': playerFilesWinCast}}, 'player-mac': {'files': playerFilesMac, 'path': ['buildproject', 'LiquidSky.app', 'Contents'], 'brands': {}}, 'streamer-win': {'files': streamerFilesWin, 'path': ['buildproject', 'streamer'], 'brands': {'cast': streamerFilesWinCast}}}
# Hello world program to demonstrate running PYthon files print('Hello, world!') print('I live on a volcano!')
print('Hello, world!') print('I live on a volcano!')
class Productivity: def __init__(self, irradiance, hours,capacity): self.irradiance = irradiance self.hours = hours self.capacity = capacity def getUnits(self): print(self.irradiance) totalpower = 0 print(totalpower) for i in self.irradiance: power = int(self.capacity) * int(i) /1000 totalpower = totalpower+power # units= (self.irradiance*self.area*self.hours)/1000 print(totalpower) return totalpower
class Productivity: def __init__(self, irradiance, hours, capacity): self.irradiance = irradiance self.hours = hours self.capacity = capacity def get_units(self): print(self.irradiance) totalpower = 0 print(totalpower) for i in self.irradiance: power = int(self.capacity) * int(i) / 1000 totalpower = totalpower + power print(totalpower) return totalpower
def create_platform_routes(server): metrics = server._augur.metrics
def create_platform_routes(server): metrics = server._augur.metrics
__version__ = '0.1.7' default_app_config = 'dynamic_databases.apps.DynamicDatabasesConfig'
__version__ = '0.1.7' default_app_config = 'dynamic_databases.apps.DynamicDatabasesConfig'
PHYSICS_TECHS = { "tech_databank_uplinks", "tech_basic_science_lab_1", "tech_curator_lab", "tech_archeology_lab", "tech_physics_lab_1", "tech_physics_lab_2", "tech_physics_lab_3", "tech_global_research_initiative", "tech_administrative_ai", "tech_cryostasis_1", "tech_cryostasis_2", "tech_self_aware_logic", "tech_automated_exploration", "tech_sapient_ai", "tech_positronic_implants", "tech_combat_computers_1", "tech_combat_computers_2", "tech_combat_computers_3", "tech_combat_computers_autonomous", "tech_auxiliary_fire_control", "tech_synchronized_defences", "tech_fission_power", "tech_fusion_power", "tech_cold_fusion_power", "tech_antimatter_power", "tech_zero_point_power", "tech_reactor_boosters_1", "tech_reactor_boosters_2", "tech_reactor_boosters_3", "tech_shields_1", "tech_shields_2", "tech_shields_3", "tech_shields_4", "tech_shields_5", "tech_shield_rechargers_1", "tech_planetary_shield_generator", "tech_sensors_2", "tech_sensors_3", "tech_sensors_4", "tech_power_plant_1", "tech_power_plant_2", "tech_power_plant_3", "tech_power_plant_4", "tech_power_hub_1", "tech_power_hub_2", "tech_hyper_drive_1", "tech_hyper_drive_2", "tech_hyper_drive_3", "tech_wormhole_stabilization", "tech_gateway_activation", "tech_gateway_construction", "tech_jump_drive_1", "tech_ftl_inhibitor", "tech_matter_generator", } SOCIETY_TECHS = { "tech_planetary_defenses", "tech_eco_simulation", "tech_hydroponics", "tech_gene_crops", "tech_nano_vitality_crops", "tech_nutrient_replication", "tech_biolab_1", "tech_biolab_2", "tech_biolab_3", "tech_alien_life_studies", "tech_colonization_1", "tech_colonization_2", "tech_colonization_3", "tech_colonization_4", "tech_colonization_5", "tech_tomb_world_adaption", "tech_space_trading", "tech_frontier_health", "tech_frontier_hospital", "tech_tb_mountain_range", "tech_tb_volcano", "tech_tb_dangerous_wildlife", "tech_tb_dense_jungle", "tech_tb_quicksand_basin", "tech_tb_noxious_swamp", "tech_tb_massive_glacier", "tech_tb_toxic_kelp", "tech_tb_deep_sinkhole", "tech_terrestrial_sculpting", "tech_ecological_adaptation", "tech_climate_restoration", "tech_genome_mapping", "tech_vitality_boosters", "tech_epigenetic_triggers", "tech_cloning", "tech_gene_banks", "tech_gene_seed_purification", "tech_morphogenetic_field_mastery", "tech_gene_tailoring", "tech_glandular_acclimation", "tech_genetic_resequencing", "tech_gene_expressions", "tech_selected_lineages", "tech_capacity_boosters", "tech_regenerative_hull_tissue", "tech_doctrine_fleet_size_1", "tech_doctrine_fleet_size_2", "tech_doctrine_fleet_size_3", "tech_doctrine_fleet_size_4", "tech_doctrine_fleet_size_5", "tech_interstellar_fleet_traditions", "tech_refit_standards", "tech_command_matrix", "tech_doctrine_navy_size_1", "tech_doctrine_navy_size_2", "tech_doctrine_navy_size_3", "tech_doctrine_navy_size_4", "tech_centralized_command", "tech_combat_training", "tech_ground_defense_planning", "tech_global_defense_grid", "tech_psionic_theory", "tech_telepathy", "tech_precognition_interface", "tech_psi_jump_drive_1", "tech_galactic_ambitions", "tech_manifest_destiny", "tech_interstellar_campaigns", "tech_galactic_campaigns", "tech_planetary_government", "tech_planetary_unification", "tech_colonial_centralization", "tech_galactic_administration", "tech_galactic_markets", "tech_subdermal_stimulation", "tech_galactic_benevolence", "tech_adaptive_bureaucracy", "tech_colonial_bureaucracy", "tech_galactic_bureaucracy", "tech_living_state", "tech_collective_self", "tech_autonomous_agents", "tech_embodied_dynamism", "tech_neural_implants", "tech_artificial_moral_codes", "tech_synthetic_thought_patterns", "tech_collective_production_methods", "tech_resource_processing_algorithms", "tech_cultural_heritage", "tech_heritage_site", "tech_hypercomms_forum", "tech_autocurating_vault", "tech_holographic_rituals", "tech_consecration_fields", "tech_transcendent_faith", "tech_ascension_theory", "tech_ascension_theory_apoc", "tech_psionic_shield", } ENGINEERING_TECHS = { "tech_space_exploration", "tech_corvettes", "tech_destroyers", "tech_cruisers", "tech_battleships", "tech_titans", "tech_corvette_build_speed", "tech_corvette_hull_1", "tech_corvette_hull_2", "tech_destroyer_build_speed", "tech_destroyer_hull_1", "tech_destroyer_hull_2", "tech_cruiser_build_speed", "tech_cruiser_hull_1", "tech_cruiser_hull_2", "tech_battleship_build_speed", "tech_battleship_hull_1", "tech_battleship_hull_2", "tech_titan_hull_1", "tech_titan_hull_2", "tech_starbase_1", "tech_starbase_2", "tech_starbase_3", "tech_starbase_4", "tech_starbase_5", "tech_modular_engineering", "tech_space_defense_station_improvement", "tech_strike_craft_1", "tech_strike_craft_2", "tech_strike_craft_3", "tech_assault_armies", "tech_ship_armor_1", "tech_ship_armor_2", "tech_ship_armor_3", "tech_ship_armor_4", "tech_ship_armor_5", "tech_crystal_armor_1", "tech_crystal_armor_2", "tech_thrusters_1", "tech_thrusters_2", "tech_thrusters_3", "tech_thrusters_4", "tech_space_defense_station_1", "tech_defense_platform_hull_1", "tech_basic_industry", "tech_powered_exoskeletons", "tech_mining_network_2", "tech_mining_network_3", "tech_mining_network_4", "tech_mineral_processing_1", "tech_mineral_processing_2", "tech_engineering_lab_1", "tech_engineering_lab_2", "tech_engineering_lab_3", "tech_robotic_workers", "tech_droid_workers", "tech_synthetic_workers", "tech_synthetic_leaders", "tech_space_construction", "tech_afterburners_1", "tech_afterburners_2", "tech_assembly_pattern", "tech_construction_templates", "tech_mega_engineering", } ALL_KNOWN_TECHS = set.union(PHYSICS_TECHS, ENGINEERING_TECHS, SOCIETY_TECHS) ASCENSION_PERKS = { "ap_enigmatic_engineering", #: "Enigmatic Engineering", "ap_nihilistic_acquisition", #: "Nihilistic Acquisition", "ap_colossus", #: "Colossus", "ap_engineered_evolution", #: "Engineered Evolution", "ap_evolutionary_mastery", #: "Evolutionary Mastery", "ap_the_flesh_is_weak", #: "The Flesh is Weak", "ap_synthetic_evolution", #: "Synthetic Evolution", "ap_mind_over_matter", #: "Mind over Matter", "ap_transcendence", #: "Transcendence", "ap_world_shaper", #: "World Shaper", "ap_galactic_force_projection", #: "Galactic Force Projection", "ap_defender_of_the_galaxy", #: "Defender of the Galaxy", "ap_interstellar_dominion", #: "Interstellar Dominion", "ap_grasp_the_void", #: "Grasp the Void", "ap_eternal_vigilance", #: "Eternal Vigilance", "ap_galactic_contender", #: "Galactic Contender", "ap_technological_ascendancy", #: "Technological Ascendancy", "ap_one_vision", #: "One Vision", "ap_consecrated_worlds", #: "Consecrate Worlds", "ap_mastery_of_nature", #: "Mastery of Nature", "ap_imperial_prerogative", #: "Imperial Prerogative", "ap_executive_vigor", #: "Executive Vigor", "ap_transcendent_learning", #: "Transcendent Learning", "ap_shared_destiny", #: "Shared Destiny", "ap_voidborn", #: "Voidborn", "ap_master_builders", #: "Master Builders", "ap_galactic_wonders", #: "Galactic Wonders", "ap_synthetic_age", #: "Synthetic Age", "ap_machine_worlds", #: "Machine Worlds", } COLONIZABLE_PLANET_CLASSES_PLANETS = { "pc_desert", "pc_arid", "pc_savannah", "pc_tropical", "pc_continental", "pc_ocean", "pc_tundra", "pc_arctic", "pc_alpine", "pc_gaia", "pc_nuked", "pc_machine", } COLONIZABLE_PLANET_CLASSES_MEGA_STRUCTURES = { "pc_ringworld_habitable", "pc_habitat", } # Planet classes for the planetary diversity mod # (see https://steamcommunity.com/workshop/filedetails/discussion/1466534202/3397295779078104093/) COLONIZABLE_PLANET_CLASSES_PD_PLANETS = { "pc_antarctic", "pc_deadcity", "pc_retinal", "pc_irradiated_terrestrial", "pc_lush", "pc_geocrystalline", "pc_marginal", "pc_irradiated_marginal", "pc_marginal_cold", "pc_crystal", "pc_floating", "pc_graveyard", "pc_mushroom", "pc_city", "pc_archive", "pc_biolumen", "pc_technoorganic", "pc_tidallylocked", "pc_glacial", "pc_frozen_desert", "pc_steppe", "pc_hadesert", "pc_boreal", "pc_sandsea", "pc_subarctic", "pc_geothermal", "pc_cascadian", "pc_swamp", "pc_mangrove", "pc_desertislands", "pc_mesa", "pc_oasis", "pc_hajungle", "pc_methane", "pc_ammonia", } COLONIZABLE_PLANET_CLASSES = ( COLONIZABLE_PLANET_CLASSES_PLANETS | COLONIZABLE_PLANET_CLASSES_MEGA_STRUCTURES | COLONIZABLE_PLANET_CLASSES_PD_PLANETS ) DESTROYED_BY_WEAPONS_PLANET_CLASSES = { "pc_shattered", "pc_shielded", "pc_ringworld_shielded", "pc_habitat_shielded", "pc_ringworld_habitable_damaged", } DESTROYED_BY_EVENTS_AND_CRISES_PLANET_CLASSES = { "pc_egg_cracked", "pc_shrouded", "pc_ai", "pc_infested", "pc_gray_goo", } DESTROYED_PLANET_CLASSES = ( DESTROYED_BY_WEAPONS_PLANET_CLASSES | DESTROYED_BY_EVENTS_AND_CRISES_PLANET_CLASSES ) def is_destroyed_planet(planet_class): return planet_class in DESTROYED_PLANET_CLASSES def is_colonizable_planet(planet_class): return planet_class in COLONIZABLE_PLANET_CLASSES def is_colonizable_megastructure(planet_class): return planet_class in COLONIZABLE_PLANET_CLASSES_MEGA_STRUCTURES LOWERCASE_WORDS = {"the", "in", "of", "for", "is", "over", "under"} WORD_REPLACEMENT = { "Ai": "AI", "Ftl": "FTL", "Tb": "Tile Blocker", } def convert_id_to_name(object_id: str, remove_prefix="") -> str: words = [word for word in object_id.split("_") if word != remove_prefix] words = [ word.capitalize() if word not in LOWERCASE_WORDS else word for word in words ] words = [WORD_REPLACEMENT.get(word, word) for word in words] return " ".join(words)
physics_techs = {'tech_databank_uplinks', 'tech_basic_science_lab_1', 'tech_curator_lab', 'tech_archeology_lab', 'tech_physics_lab_1', 'tech_physics_lab_2', 'tech_physics_lab_3', 'tech_global_research_initiative', 'tech_administrative_ai', 'tech_cryostasis_1', 'tech_cryostasis_2', 'tech_self_aware_logic', 'tech_automated_exploration', 'tech_sapient_ai', 'tech_positronic_implants', 'tech_combat_computers_1', 'tech_combat_computers_2', 'tech_combat_computers_3', 'tech_combat_computers_autonomous', 'tech_auxiliary_fire_control', 'tech_synchronized_defences', 'tech_fission_power', 'tech_fusion_power', 'tech_cold_fusion_power', 'tech_antimatter_power', 'tech_zero_point_power', 'tech_reactor_boosters_1', 'tech_reactor_boosters_2', 'tech_reactor_boosters_3', 'tech_shields_1', 'tech_shields_2', 'tech_shields_3', 'tech_shields_4', 'tech_shields_5', 'tech_shield_rechargers_1', 'tech_planetary_shield_generator', 'tech_sensors_2', 'tech_sensors_3', 'tech_sensors_4', 'tech_power_plant_1', 'tech_power_plant_2', 'tech_power_plant_3', 'tech_power_plant_4', 'tech_power_hub_1', 'tech_power_hub_2', 'tech_hyper_drive_1', 'tech_hyper_drive_2', 'tech_hyper_drive_3', 'tech_wormhole_stabilization', 'tech_gateway_activation', 'tech_gateway_construction', 'tech_jump_drive_1', 'tech_ftl_inhibitor', 'tech_matter_generator'} society_techs = {'tech_planetary_defenses', 'tech_eco_simulation', 'tech_hydroponics', 'tech_gene_crops', 'tech_nano_vitality_crops', 'tech_nutrient_replication', 'tech_biolab_1', 'tech_biolab_2', 'tech_biolab_3', 'tech_alien_life_studies', 'tech_colonization_1', 'tech_colonization_2', 'tech_colonization_3', 'tech_colonization_4', 'tech_colonization_5', 'tech_tomb_world_adaption', 'tech_space_trading', 'tech_frontier_health', 'tech_frontier_hospital', 'tech_tb_mountain_range', 'tech_tb_volcano', 'tech_tb_dangerous_wildlife', 'tech_tb_dense_jungle', 'tech_tb_quicksand_basin', 'tech_tb_noxious_swamp', 'tech_tb_massive_glacier', 'tech_tb_toxic_kelp', 'tech_tb_deep_sinkhole', 'tech_terrestrial_sculpting', 'tech_ecological_adaptation', 'tech_climate_restoration', 'tech_genome_mapping', 'tech_vitality_boosters', 'tech_epigenetic_triggers', 'tech_cloning', 'tech_gene_banks', 'tech_gene_seed_purification', 'tech_morphogenetic_field_mastery', 'tech_gene_tailoring', 'tech_glandular_acclimation', 'tech_genetic_resequencing', 'tech_gene_expressions', 'tech_selected_lineages', 'tech_capacity_boosters', 'tech_regenerative_hull_tissue', 'tech_doctrine_fleet_size_1', 'tech_doctrine_fleet_size_2', 'tech_doctrine_fleet_size_3', 'tech_doctrine_fleet_size_4', 'tech_doctrine_fleet_size_5', 'tech_interstellar_fleet_traditions', 'tech_refit_standards', 'tech_command_matrix', 'tech_doctrine_navy_size_1', 'tech_doctrine_navy_size_2', 'tech_doctrine_navy_size_3', 'tech_doctrine_navy_size_4', 'tech_centralized_command', 'tech_combat_training', 'tech_ground_defense_planning', 'tech_global_defense_grid', 'tech_psionic_theory', 'tech_telepathy', 'tech_precognition_interface', 'tech_psi_jump_drive_1', 'tech_galactic_ambitions', 'tech_manifest_destiny', 'tech_interstellar_campaigns', 'tech_galactic_campaigns', 'tech_planetary_government', 'tech_planetary_unification', 'tech_colonial_centralization', 'tech_galactic_administration', 'tech_galactic_markets', 'tech_subdermal_stimulation', 'tech_galactic_benevolence', 'tech_adaptive_bureaucracy', 'tech_colonial_bureaucracy', 'tech_galactic_bureaucracy', 'tech_living_state', 'tech_collective_self', 'tech_autonomous_agents', 'tech_embodied_dynamism', 'tech_neural_implants', 'tech_artificial_moral_codes', 'tech_synthetic_thought_patterns', 'tech_collective_production_methods', 'tech_resource_processing_algorithms', 'tech_cultural_heritage', 'tech_heritage_site', 'tech_hypercomms_forum', 'tech_autocurating_vault', 'tech_holographic_rituals', 'tech_consecration_fields', 'tech_transcendent_faith', 'tech_ascension_theory', 'tech_ascension_theory_apoc', 'tech_psionic_shield'} engineering_techs = {'tech_space_exploration', 'tech_corvettes', 'tech_destroyers', 'tech_cruisers', 'tech_battleships', 'tech_titans', 'tech_corvette_build_speed', 'tech_corvette_hull_1', 'tech_corvette_hull_2', 'tech_destroyer_build_speed', 'tech_destroyer_hull_1', 'tech_destroyer_hull_2', 'tech_cruiser_build_speed', 'tech_cruiser_hull_1', 'tech_cruiser_hull_2', 'tech_battleship_build_speed', 'tech_battleship_hull_1', 'tech_battleship_hull_2', 'tech_titan_hull_1', 'tech_titan_hull_2', 'tech_starbase_1', 'tech_starbase_2', 'tech_starbase_3', 'tech_starbase_4', 'tech_starbase_5', 'tech_modular_engineering', 'tech_space_defense_station_improvement', 'tech_strike_craft_1', 'tech_strike_craft_2', 'tech_strike_craft_3', 'tech_assault_armies', 'tech_ship_armor_1', 'tech_ship_armor_2', 'tech_ship_armor_3', 'tech_ship_armor_4', 'tech_ship_armor_5', 'tech_crystal_armor_1', 'tech_crystal_armor_2', 'tech_thrusters_1', 'tech_thrusters_2', 'tech_thrusters_3', 'tech_thrusters_4', 'tech_space_defense_station_1', 'tech_defense_platform_hull_1', 'tech_basic_industry', 'tech_powered_exoskeletons', 'tech_mining_network_2', 'tech_mining_network_3', 'tech_mining_network_4', 'tech_mineral_processing_1', 'tech_mineral_processing_2', 'tech_engineering_lab_1', 'tech_engineering_lab_2', 'tech_engineering_lab_3', 'tech_robotic_workers', 'tech_droid_workers', 'tech_synthetic_workers', 'tech_synthetic_leaders', 'tech_space_construction', 'tech_afterburners_1', 'tech_afterburners_2', 'tech_assembly_pattern', 'tech_construction_templates', 'tech_mega_engineering'} all_known_techs = set.union(PHYSICS_TECHS, ENGINEERING_TECHS, SOCIETY_TECHS) ascension_perks = {'ap_enigmatic_engineering', 'ap_nihilistic_acquisition', 'ap_colossus', 'ap_engineered_evolution', 'ap_evolutionary_mastery', 'ap_the_flesh_is_weak', 'ap_synthetic_evolution', 'ap_mind_over_matter', 'ap_transcendence', 'ap_world_shaper', 'ap_galactic_force_projection', 'ap_defender_of_the_galaxy', 'ap_interstellar_dominion', 'ap_grasp_the_void', 'ap_eternal_vigilance', 'ap_galactic_contender', 'ap_technological_ascendancy', 'ap_one_vision', 'ap_consecrated_worlds', 'ap_mastery_of_nature', 'ap_imperial_prerogative', 'ap_executive_vigor', 'ap_transcendent_learning', 'ap_shared_destiny', 'ap_voidborn', 'ap_master_builders', 'ap_galactic_wonders', 'ap_synthetic_age', 'ap_machine_worlds'} colonizable_planet_classes_planets = {'pc_desert', 'pc_arid', 'pc_savannah', 'pc_tropical', 'pc_continental', 'pc_ocean', 'pc_tundra', 'pc_arctic', 'pc_alpine', 'pc_gaia', 'pc_nuked', 'pc_machine'} colonizable_planet_classes_mega_structures = {'pc_ringworld_habitable', 'pc_habitat'} colonizable_planet_classes_pd_planets = {'pc_antarctic', 'pc_deadcity', 'pc_retinal', 'pc_irradiated_terrestrial', 'pc_lush', 'pc_geocrystalline', 'pc_marginal', 'pc_irradiated_marginal', 'pc_marginal_cold', 'pc_crystal', 'pc_floating', 'pc_graveyard', 'pc_mushroom', 'pc_city', 'pc_archive', 'pc_biolumen', 'pc_technoorganic', 'pc_tidallylocked', 'pc_glacial', 'pc_frozen_desert', 'pc_steppe', 'pc_hadesert', 'pc_boreal', 'pc_sandsea', 'pc_subarctic', 'pc_geothermal', 'pc_cascadian', 'pc_swamp', 'pc_mangrove', 'pc_desertislands', 'pc_mesa', 'pc_oasis', 'pc_hajungle', 'pc_methane', 'pc_ammonia'} colonizable_planet_classes = COLONIZABLE_PLANET_CLASSES_PLANETS | COLONIZABLE_PLANET_CLASSES_MEGA_STRUCTURES | COLONIZABLE_PLANET_CLASSES_PD_PLANETS destroyed_by_weapons_planet_classes = {'pc_shattered', 'pc_shielded', 'pc_ringworld_shielded', 'pc_habitat_shielded', 'pc_ringworld_habitable_damaged'} destroyed_by_events_and_crises_planet_classes = {'pc_egg_cracked', 'pc_shrouded', 'pc_ai', 'pc_infested', 'pc_gray_goo'} destroyed_planet_classes = DESTROYED_BY_WEAPONS_PLANET_CLASSES | DESTROYED_BY_EVENTS_AND_CRISES_PLANET_CLASSES def is_destroyed_planet(planet_class): return planet_class in DESTROYED_PLANET_CLASSES def is_colonizable_planet(planet_class): return planet_class in COLONIZABLE_PLANET_CLASSES def is_colonizable_megastructure(planet_class): return planet_class in COLONIZABLE_PLANET_CLASSES_MEGA_STRUCTURES lowercase_words = {'the', 'in', 'of', 'for', 'is', 'over', 'under'} word_replacement = {'Ai': 'AI', 'Ftl': 'FTL', 'Tb': 'Tile Blocker'} def convert_id_to_name(object_id: str, remove_prefix='') -> str: words = [word for word in object_id.split('_') if word != remove_prefix] words = [word.capitalize() if word not in LOWERCASE_WORDS else word for word in words] words = [WORD_REPLACEMENT.get(word, word) for word in words] return ' '.join(words)
# Custom errors in classes. class TooManyPagesReadError(ValueError): pass class Book: def __init__(self, title, page_count): self.title = title self.page_count = page_count self.pages_read = 0 def __repr__(self): return ( f"<Book {self.title}, read {self.pages_read} pages out of {self.page_count}>" ) def read(self, pages): if self.pages_read + pages > self.page_count: msg = f"You tried to read {self.pages_read + pages} but this book only has {self.page_count} pages." raise TooManyPagesReadError(msg) self.pages_read += pages print(f"You have now read {self.pages_read} pages out of {self.page_count}") book_1 = Book("Fluent Python", 800) try: book_1.read(450) book_1.read(800) except TooManyPagesReadError as e: print(e) finally: print(book_1)
class Toomanypagesreaderror(ValueError): pass class Book: def __init__(self, title, page_count): self.title = title self.page_count = page_count self.pages_read = 0 def __repr__(self): return f'<Book {self.title}, read {self.pages_read} pages out of {self.page_count}>' def read(self, pages): if self.pages_read + pages > self.page_count: msg = f'You tried to read {self.pages_read + pages} but this book only has {self.page_count} pages.' raise too_many_pages_read_error(msg) self.pages_read += pages print(f'You have now read {self.pages_read} pages out of {self.page_count}') book_1 = book('Fluent Python', 800) try: book_1.read(450) book_1.read(800) except TooManyPagesReadError as e: print(e) finally: print(book_1)
Candies = [int(x) for x in input("Enter the numbers with space: ").split()] extraCandies=int(input("Enter the number of extra candies: ")) Output=[ ] i=0 while(i<len(Candies)): if(Candies[i]+extraCandies>=max(Candies)): Output.append("True") else: Output.append("False") i+=1 print(Output)
candies = [int(x) for x in input('Enter the numbers with space: ').split()] extra_candies = int(input('Enter the number of extra candies: ')) output = [] i = 0 while i < len(Candies): if Candies[i] + extraCandies >= max(Candies): Output.append('True') else: Output.append('False') i += 1 print(Output)
class MicromagneticModell: def __init__(self, name, Ms, calc): self.name = name self.Ms = Ms self.field = None self.calc = calc def __str__(self): return "AbstractMicromagneticModell(name={})".format(self.name) def relax(self): self.calc.relax(self) def set_H(self, field): print("AbstractMicromagneticModell: setting field = {}") self.field = field def hysteresis(self, fieldlist): print("AbstractMicromagneticModell: starting hysteresis") for field in fieldlist: self.set_H(field) self.relax() class OOMMFC(): def __init__(self): pass def __str__(self): return "OOMMFC()" def relax(self, mm): print("Calling OOMMF to run relax() with H={}".format(mm.field)) #a = AbstractMicromagneticModell('simulation-name', 10) #print(a) #a.hysteresis([10, 20]) ocalc = OOMMFC() o = MicromagneticModell(name='test', Ms=42, calc=ocalc) print(o) o.relax() #f = FIDIMAGC(name='fidimag-simulation', Ms=8e6) #print(o) #f.relax() #o.relax() #o.hysteresis([10, 20, 30])
class Micromagneticmodell: def __init__(self, name, Ms, calc): self.name = name self.Ms = Ms self.field = None self.calc = calc def __str__(self): return 'AbstractMicromagneticModell(name={})'.format(self.name) def relax(self): self.calc.relax(self) def set_h(self, field): print('AbstractMicromagneticModell: setting field = {}') self.field = field def hysteresis(self, fieldlist): print('AbstractMicromagneticModell: starting hysteresis') for field in fieldlist: self.set_H(field) self.relax() class Oommfc: def __init__(self): pass def __str__(self): return 'OOMMFC()' def relax(self, mm): print('Calling OOMMF to run relax() with H={}'.format(mm.field)) ocalc = oommfc() o = micromagnetic_modell(name='test', Ms=42, calc=ocalc) print(o) o.relax()
# eventually we will have a proper config ANONYMIZATION_THRESHOLD = 10 WAREHOUSE_URI = 'postgres://localhost' WAGE_RECORD_URI = 'postgres://localhost'
anonymization_threshold = 10 warehouse_uri = 'postgres://localhost' wage_record_uri = 'postgres://localhost'
N = int(input().strip()) names = [] for _ in range(N): name,email = input().strip().split(' ') name,email = [str(name),str(email)] if email.endswith("@gmail.com"): names.append(name) names.sort() for n in names: print(n)
n = int(input().strip()) names = [] for _ in range(N): (name, email) = input().strip().split(' ') (name, email) = [str(name), str(email)] if email.endswith('@gmail.com'): names.append(name) names.sort() for n in names: print(n)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' def upper_print(f): def wrapper(*args, **kwargs): f(*[i.upper() if hasattr(i, 'upper') else i for i in args], **kwargs) return wrapper if __name__ == '__main__': text = 'hello world!' print(text) # hello world! old_print = print print = upper_print(print) print(text) # HELLO WORLD! print = old_print print(text) # hello world!
__author__ = 'ipetrash' def upper_print(f): def wrapper(*args, **kwargs): f(*[i.upper() if hasattr(i, 'upper') else i for i in args], **kwargs) return wrapper if __name__ == '__main__': text = 'hello world!' print(text) old_print = print print = upper_print(print) print(text) print = old_print print(text)
if __name__ == '__main__': # Check correct price prediction price_input_path = 'tests/data/Price_Simple.csv' price_input = open(price_input_path, 'r').read().splitlines()[0].split(';') price_prediction = open('price_prediction.csv', 'r').read().splitlines()[0].split(';') assert price_input == price_prediction[:3] ground_truth = 1309 assert int(price_prediction[-1]) - ground_truth <= 15, "Prediction deviation > 15 deci-cents" # Check correct route prediction route_input_path = 'tests/data/Route_Bertha_Simple.csv' route_input = open(route_input_path, 'r').read().splitlines()[1].split(';') _, gas_station_id = route_input route_prediction = open('route_prediction.csv', 'r').read().splitlines()[0].split(';') gas_station_id2, price, liters = route_prediction assert gas_station_id == gas_station_id2 assert liters == '0' ground_truth = 1469 assert int(price) - ground_truth <= 15, "Prediction deviation > 15 deci-cents"
if __name__ == '__main__': price_input_path = 'tests/data/Price_Simple.csv' price_input = open(price_input_path, 'r').read().splitlines()[0].split(';') price_prediction = open('price_prediction.csv', 'r').read().splitlines()[0].split(';') assert price_input == price_prediction[:3] ground_truth = 1309 assert int(price_prediction[-1]) - ground_truth <= 15, 'Prediction deviation > 15 deci-cents' route_input_path = 'tests/data/Route_Bertha_Simple.csv' route_input = open(route_input_path, 'r').read().splitlines()[1].split(';') (_, gas_station_id) = route_input route_prediction = open('route_prediction.csv', 'r').read().splitlines()[0].split(';') (gas_station_id2, price, liters) = route_prediction assert gas_station_id == gas_station_id2 assert liters == '0' ground_truth = 1469 assert int(price) - ground_truth <= 15, 'Prediction deviation > 15 deci-cents'
rows = [] try: while True: rows.append(int(input())) except EOFError: pass rows.sort() goal = 2020 l = 0 r = len(rows) - 1 while rows[l] + rows[r] != goal and l < r: if rows[l] + rows[r] < goal: l += 1 else: r -= 1 if rows[l] + rows[r] == goal: print(rows[l] * rows[r]) else: print('FAIL')
rows = [] try: while True: rows.append(int(input())) except EOFError: pass rows.sort() goal = 2020 l = 0 r = len(rows) - 1 while rows[l] + rows[r] != goal and l < r: if rows[l] + rows[r] < goal: l += 1 else: r -= 1 if rows[l] + rows[r] == goal: print(rows[l] * rows[r]) else: print('FAIL')
class Telecom: def __init__(self, contact_db_id, system, value, use, rank, period): self.contact_db_id = contact_db_id self.system = system self.value = value self.use = use self.rank = rank self.period = period def get_contact_db_id(self): return self.contact_db_id def get_system(self): return self.system def get_value(self): return self.value def get_use(self): return self.use def get_rank(self): return self.rank def get_period(self): return self.period
class Telecom: def __init__(self, contact_db_id, system, value, use, rank, period): self.contact_db_id = contact_db_id self.system = system self.value = value self.use = use self.rank = rank self.period = period def get_contact_db_id(self): return self.contact_db_id def get_system(self): return self.system def get_value(self): return self.value def get_use(self): return self.use def get_rank(self): return self.rank def get_period(self): return self.period
# kasutaja sisestab 3 numbrit number1 = int(input("Sisesta esimene arv: ")) number2 = int(input("Sisesta teine arv: ")) number3 = int(input("Sisesta kolmas arv: ")) # funktsioon, mis tagastab kolmes sisestatud arvust suurima def largest(number1, number2, number3): biggest = 0 if number1 > biggest: biggest = number1 if number2 > number1: biggest = number2 if number3 > number2 and number3 > number1: biggest = number3 return biggest print(largest(number1, number2, number3))
number1 = int(input('Sisesta esimene arv: ')) number2 = int(input('Sisesta teine arv: ')) number3 = int(input('Sisesta kolmas arv: ')) def largest(number1, number2, number3): biggest = 0 if number1 > biggest: biggest = number1 if number2 > number1: biggest = number2 if number3 > number2 and number3 > number1: biggest = number3 return biggest print(largest(number1, number2, number3))
#Tuplas numeros = [1,2,4,5,6,7,8,9] #lista usuario = {'Nome':'Mateus' , 'senha':123456789 } #dicionario pessoa = ('Mateus' , 'Alves' , 16 , 14 , 90) #tupla print(numeros) print(usuario) print(pessoa) numeros[1] = 8 usuario['senha'] = 4545343
numeros = [1, 2, 4, 5, 6, 7, 8, 9] usuario = {'Nome': 'Mateus', 'senha': 123456789} pessoa = ('Mateus', 'Alves', 16, 14, 90) print(numeros) print(usuario) print(pessoa) numeros[1] = 8 usuario['senha'] = 4545343
############################################################################### # Utils functions for language models. # # NOTE: source from https://github.com/litian96/FedProx ############################################################################### ALL_LETTERS = "\n !\"&'(),-.0123456789:;>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz}" NUM_LETTERS = len(ALL_LETTERS) def _one_hot(index, size): '''returns one-hot vector with given size and value 1 at given index ''' vec = [0 for _ in range(size)] vec[int(index)] = 1 return vec def letter_to_vec(letter): '''returns one-hot representation of given letter ''' index = ALL_LETTERS.find(letter) return _one_hot(index, NUM_LETTERS) def word_to_indices(word): '''returns a list of character indices Args: word: string Return: indices: int list with length len(word) ''' indices = [] for c in word: indices.append(ALL_LETTERS.find(c)) return indices
all_letters = '\n !"&\'(),-.0123456789:;>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz}' num_letters = len(ALL_LETTERS) def _one_hot(index, size): """returns one-hot vector with given size and value 1 at given index """ vec = [0 for _ in range(size)] vec[int(index)] = 1 return vec def letter_to_vec(letter): """returns one-hot representation of given letter """ index = ALL_LETTERS.find(letter) return _one_hot(index, NUM_LETTERS) def word_to_indices(word): """returns a list of character indices Args: word: string Return: indices: int list with length len(word) """ indices = [] for c in word: indices.append(ALL_LETTERS.find(c)) return indices
a = str(input()) b = {'0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0} for i in a: b[i] = b[i] + 1 for i in range(len(b)): if b[str(i)] == 0: continue print(str(i) + ':' + str(b[str(i)]))
a = str(input()) b = {'0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0} for i in a: b[i] = b[i] + 1 for i in range(len(b)): if b[str(i)] == 0: continue print(str(i) + ':' + str(b[str(i)]))
class ModeIndicator: LENGTH = 4 TERMINATOR_VALUE = 0x0 NUMERIC_VALUE = 0x1 ALPHANUMERIC_VALUE = 0x2 STRUCTURED_APPEND_VALUE = 0x3 BYTE_VALUE = 0x4 KANJI_VALUE = 0x8
class Modeindicator: length = 4 terminator_value = 0 numeric_value = 1 alphanumeric_value = 2 structured_append_value = 3 byte_value = 4 kanji_value = 8
# 11/03/21 # What does this code do? # This code introduces a new idea, Dictionaries. The codes purpose is to take an input, and convert it into the numbers you'd need to press # on an alphanumeric keypad, as shown in the picture. # How do Dictionaries work? # To use our dictionary, we first need to initialise it. We can do this as follows: # Syntax: <DICTNAME> = {'Key1':'Value1'} # Example: MyPetSounds = {"Cat":"Meow", "Dog":"Woof"} # To explain further, dictionaries work in a Key and Value paired system. To create an entry, you need to define 2 things, # The key (or how the entry will be called), and then the value (What will be referenced when the key is called.) They are seperated by a colon. # A dictionary containing the letter to digit phone keypad mappings. KEYPAD = { 'A': '2', 'B': '2', 'C': '2', 'D': '3', 'E': '3', 'F': '3', 'G': '4', 'H': '4', 'I': '4', 'J': '5', 'K': '5', 'L': '5', 'M': '6', 'N': '6', 'O': '6', 'P': '7', 'Q': '7', 'R': '7', 'S': '7', 'T': '8', 'U': '8', 'V': '8', 'W': '9', 'X': '9', 'Y': '9', 'Z': '9', } word = input("Enter word: ") for key in word: print(KEYPAD[key], end='') print() print("This code was created by $pigot.") # What is happening here? # In the first 6 lines of this code, we are simply initialising our dictionary. We are associating the numbers on the keypad, to the 3 or 4 # letters that they can enter.
keypad = {'A': '2', 'B': '2', 'C': '2', 'D': '3', 'E': '3', 'F': '3', 'G': '4', 'H': '4', 'I': '4', 'J': '5', 'K': '5', 'L': '5', 'M': '6', 'N': '6', 'O': '6', 'P': '7', 'Q': '7', 'R': '7', 'S': '7', 'T': '8', 'U': '8', 'V': '8', 'W': '9', 'X': '9', 'Y': '9', 'Z': '9'} word = input('Enter word: ') for key in word: print(KEYPAD[key], end='') print() print('This code was created by $pigot.')
# # PySNMP MIB module Juniper-V35-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-V35-CONF # Produced by pysmi-0.3.4 at Wed May 1 14:04:44 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") ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection") juniAgents, = mibBuilder.importSymbols("Juniper-Agents", "juniAgents") ModuleCompliance, AgentCapabilities, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "AgentCapabilities", "NotificationGroup") Bits, Integer32, MibIdentifier, Counter32, Gauge32, NotificationType, IpAddress, ModuleIdentity, iso, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, TimeTicks, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Integer32", "MibIdentifier", "Counter32", "Gauge32", "NotificationType", "IpAddress", "ModuleIdentity", "iso", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "TimeTicks", "Unsigned32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") juniV35Agent = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 5, 2, 54)) juniV35Agent.setRevisions(('2002-09-06 16:54', '2002-01-25 21:43',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: juniV35Agent.setRevisionsDescriptions(('Replaced Unisphere names with Juniper names.', 'The initial release of this management information module.',)) if mibBuilder.loadTexts: juniV35Agent.setLastUpdated('200209061654Z') if mibBuilder.loadTexts: juniV35Agent.setOrganization('Juniper Networks, Inc.') if mibBuilder.loadTexts: juniV35Agent.setContactInfo(' Juniper Networks, Inc. Postal: 10 Technology Park Drive Westford, MA 01886-3146 USA Tel: +1 978 589 5800 E-mail: [email protected]') if mibBuilder.loadTexts: juniV35Agent.setDescription('The agent capabilities definitions for the X.21/V.35 server component of the SNMP agent in the Juniper E-series family of products.') juniV35AgentV1 = AgentCapabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 54, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniV35AgentV1 = juniV35AgentV1.setProductRelease('Version 1 of the X.21/V.35 component of the JUNOSe SNMP agent. This\n version of the X.21/V.35 component is supported in JUNOSe 4.0 and\n subsequent system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniV35AgentV1 = juniV35AgentV1.setStatus('current') if mibBuilder.loadTexts: juniV35AgentV1.setDescription('The MIB supported by the SNMP agent for the X.21/V.35 application in JUNOSe.') mibBuilder.exportSymbols("Juniper-V35-CONF", juniV35AgentV1=juniV35AgentV1, PYSNMP_MODULE_ID=juniV35Agent, juniV35Agent=juniV35Agent)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection') (juni_agents,) = mibBuilder.importSymbols('Juniper-Agents', 'juniAgents') (module_compliance, agent_capabilities, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'AgentCapabilities', 'NotificationGroup') (bits, integer32, mib_identifier, counter32, gauge32, notification_type, ip_address, module_identity, iso, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, time_ticks, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'Integer32', 'MibIdentifier', 'Counter32', 'Gauge32', 'NotificationType', 'IpAddress', 'ModuleIdentity', 'iso', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'TimeTicks', 'Unsigned32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') juni_v35_agent = module_identity((1, 3, 6, 1, 4, 1, 4874, 5, 2, 54)) juniV35Agent.setRevisions(('2002-09-06 16:54', '2002-01-25 21:43')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: juniV35Agent.setRevisionsDescriptions(('Replaced Unisphere names with Juniper names.', 'The initial release of this management information module.')) if mibBuilder.loadTexts: juniV35Agent.setLastUpdated('200209061654Z') if mibBuilder.loadTexts: juniV35Agent.setOrganization('Juniper Networks, Inc.') if mibBuilder.loadTexts: juniV35Agent.setContactInfo(' Juniper Networks, Inc. Postal: 10 Technology Park Drive Westford, MA 01886-3146 USA Tel: +1 978 589 5800 E-mail: [email protected]') if mibBuilder.loadTexts: juniV35Agent.setDescription('The agent capabilities definitions for the X.21/V.35 server component of the SNMP agent in the Juniper E-series family of products.') juni_v35_agent_v1 = agent_capabilities((1, 3, 6, 1, 4, 1, 4874, 5, 2, 54, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juni_v35_agent_v1 = juniV35AgentV1.setProductRelease('Version 1 of the X.21/V.35 component of the JUNOSe SNMP agent. This\n version of the X.21/V.35 component is supported in JUNOSe 4.0 and\n subsequent system releases.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juni_v35_agent_v1 = juniV35AgentV1.setStatus('current') if mibBuilder.loadTexts: juniV35AgentV1.setDescription('The MIB supported by the SNMP agent for the X.21/V.35 application in JUNOSe.') mibBuilder.exportSymbols('Juniper-V35-CONF', juniV35AgentV1=juniV35AgentV1, PYSNMP_MODULE_ID=juniV35Agent, juniV35Agent=juniV35Agent)
def maior_numero(lista): a = lista[0] for i in range(len(lista)): if lista[i] > a: a = lista[i] return a def remove_divisores_do_maior(lista): maiornumero=maior_numero(lista) for i in range(len(lista)-1,-1,-1): if (maiornumero%lista[i])==0: lista.pop(i) return None
def maior_numero(lista): a = lista[0] for i in range(len(lista)): if lista[i] > a: a = lista[i] return a def remove_divisores_do_maior(lista): maiornumero = maior_numero(lista) for i in range(len(lista) - 1, -1, -1): if maiornumero % lista[i] == 0: lista.pop(i) return None
# sample\core.py def run_core(): print("In pycharm run_core")
def run_core(): print('In pycharm run_core')
raise NotImplementedError("Getting an NPE trying to parse this code") class KeyValue: def __init__(self, key, value): self.key = key self.value = value def __repr__(self): return f"{self.key}->{self.value}" class MinHeap: def __init__(self, start_size): self.heap = [None] * start_size self.next_i = 0 def add(self, key, value): self.heap[self.next_i] = KeyValue(key, value) child_i = self.next_i parent_i = child_i // 2 while child_i != parent_i: if self.heap[child_i].key < self.heap[parent_i].key: swapper = self.heap[child_i] self.heap[child_i] = self.heap[parent_i] self.heap[parent_i] = swapper child_i = parent_i parent_i //= 2 self.next_i += 1 def get(self): if self.next_i == 0: return None elif self.next_i == 1: bye_bye_root = self.heap[0] self.heap[0] = None return bye_bye_root else: bye_bye_root = self.heap[0] self.next_i -= 1 self.heap[0] = self.heap[self.next_i] self.heap[self.next_i] = None # Heapify parent_i = 0 while 2 * parent_i < len(self.heap) and self.heap[parent_i] is not None: heapify_parent = self.heap[parent_i] lchild_i = 2*parent_i + 1 rchild_i = 2*parent_i + 2 lchild = self.heap[lchild_i] rchild = self.heap[rchild_i] best = heapify_parent best_i = parent_i if lchild is not None and lchild.key < best.key: best = lchild best_i = lchild_i if rchild is not None and rchild.key < best.key: best = rchild best_i = rchild_i if heapify_parent != best: swapper = self.heap[best_i] self.heap[best_i] = heapify_parent self.heap[parent_i] = swapper parent_i = best_i else: break return bye_bye_root min_heap = MinHeap(16) min_heap.add(2, 2) min_heap.add(3, 3) min_heap.add(4, 4) min_heap.add(1, 1) print(min_heap.get().key) print(min_heap.get().key) print(min_heap.get().key) print(min_heap.get().key)
raise not_implemented_error('Getting an NPE trying to parse this code') class Keyvalue: def __init__(self, key, value): self.key = key self.value = value def __repr__(self): return f'{self.key}->{self.value}' class Minheap: def __init__(self, start_size): self.heap = [None] * start_size self.next_i = 0 def add(self, key, value): self.heap[self.next_i] = key_value(key, value) child_i = self.next_i parent_i = child_i // 2 while child_i != parent_i: if self.heap[child_i].key < self.heap[parent_i].key: swapper = self.heap[child_i] self.heap[child_i] = self.heap[parent_i] self.heap[parent_i] = swapper child_i = parent_i parent_i //= 2 self.next_i += 1 def get(self): if self.next_i == 0: return None elif self.next_i == 1: bye_bye_root = self.heap[0] self.heap[0] = None return bye_bye_root else: bye_bye_root = self.heap[0] self.next_i -= 1 self.heap[0] = self.heap[self.next_i] self.heap[self.next_i] = None parent_i = 0 while 2 * parent_i < len(self.heap) and self.heap[parent_i] is not None: heapify_parent = self.heap[parent_i] lchild_i = 2 * parent_i + 1 rchild_i = 2 * parent_i + 2 lchild = self.heap[lchild_i] rchild = self.heap[rchild_i] best = heapify_parent best_i = parent_i if lchild is not None and lchild.key < best.key: best = lchild best_i = lchild_i if rchild is not None and rchild.key < best.key: best = rchild best_i = rchild_i if heapify_parent != best: swapper = self.heap[best_i] self.heap[best_i] = heapify_parent self.heap[parent_i] = swapper parent_i = best_i else: break return bye_bye_root min_heap = min_heap(16) min_heap.add(2, 2) min_heap.add(3, 3) min_heap.add(4, 4) min_heap.add(1, 1) print(min_heap.get().key) print(min_heap.get().key) print(min_heap.get().key) print(min_heap.get().key)
n = int(input()) c = [0]*n for i in range(n): l = int(input()) S = input() for j in range(l): if (S[j]=='0'): continue for k in range(j,l): if (S[k]=='1'): c[i] = c[i]+1 for i in range(n): print(c[i])
n = int(input()) c = [0] * n for i in range(n): l = int(input()) s = input() for j in range(l): if S[j] == '0': continue for k in range(j, l): if S[k] == '1': c[i] = c[i] + 1 for i in range(n): print(c[i])
# # PySNMP MIB module CHECKPOINT-TRAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CHECKPOINT-TRAP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:31:16 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") ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint") tempertureSensorStatus, haProblemVerified, fanSpeedSensorType, multiDiskFreeAvailablePercent, raidDiskID, memActiveReal64, haBlockState, haProblemPriority, voltageSensorName, svnNetIfState, fwLSConnState, fanSpeedSensorValue, haIfName, raidVolumeID, voltageSensorType, voltageSensorValue, raidDiskFlags, multiDiskName, fwLocalLoggingStat, fanSpeedSensorStatus, haIP, fanSpeedSensorUnit, tempertureSensorName, haTrusted, haStatShort, haStatus, multiProcIndex, svnNetIfName, haState, multiProcRunQueue, voltageSensorUnit, multiProcUsage, memTotalReal64, multiProcInterrupts, multiProcSystemTime, voltageSensorStatus, tempertureSensorUnit, haProblemStatus, tempertureSensorValue, fwLSConnOverall, fwLSConnStateDesc, fanSpeedSensorName, raidVolumeState, raidDiskVolumeID, fwLSConnOverallDesc, haIdentifier, memTotalVirtual64, memActiveVirtual64, raidDiskState, haStatCode, haStatLong, haProblemName, multiProcIdleTime, haProblemDescr, fwLSConnName, multiProcUserTime, fwLocalLoggingDesc, tempertureSensorType, haShared, svnNetIfAddress, svnNetIfOperState = mibBuilder.importSymbols("CHECKPOINT-MIB", "tempertureSensorStatus", "haProblemVerified", "fanSpeedSensorType", "multiDiskFreeAvailablePercent", "raidDiskID", "memActiveReal64", "haBlockState", "haProblemPriority", "voltageSensorName", "svnNetIfState", "fwLSConnState", "fanSpeedSensorValue", "haIfName", "raidVolumeID", "voltageSensorType", "voltageSensorValue", "raidDiskFlags", "multiDiskName", "fwLocalLoggingStat", "fanSpeedSensorStatus", "haIP", "fanSpeedSensorUnit", "tempertureSensorName", "haTrusted", "haStatShort", "haStatus", "multiProcIndex", "svnNetIfName", "haState", "multiProcRunQueue", "voltageSensorUnit", "multiProcUsage", "memTotalReal64", "multiProcInterrupts", "multiProcSystemTime", "voltageSensorStatus", "tempertureSensorUnit", "haProblemStatus", "tempertureSensorValue", "fwLSConnOverall", "fwLSConnStateDesc", "fanSpeedSensorName", "raidVolumeState", "raidDiskVolumeID", "fwLSConnOverallDesc", "haIdentifier", "memTotalVirtual64", "memActiveVirtual64", "raidDiskState", "haStatCode", "haStatLong", "haProblemName", "multiProcIdleTime", "haProblemDescr", "fwLSConnName", "multiProcUserTime", "fwLocalLoggingDesc", "tempertureSensorType", "haShared", "svnNetIfAddress", "svnNetIfOperState") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter32, NotificationType, iso, Integer32, IpAddress, TimeTicks, ObjectIdentity, Bits, Unsigned32, MibIdentifier, ModuleIdentity, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, enterprises = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "NotificationType", "iso", "Integer32", "IpAddress", "TimeTicks", "ObjectIdentity", "Bits", "Unsigned32", "MibIdentifier", "ModuleIdentity", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "enterprises") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") chkpntTrapMibModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 0)) chkpntTrapMibModule.setRevisions(('2013-12-26 13:09',)) if mibBuilder.loadTexts: chkpntTrapMibModule.setLastUpdated('201312261309Z') if mibBuilder.loadTexts: chkpntTrapMibModule.setOrganization('Check Point') checkpoint = MibIdentifier((1, 3, 6, 1, 4, 1, 2620)) products = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1)) chkpntTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000)) chkpntTrapInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0)) chkpntTrapNet = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1)) chkpntTrapDisk = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2)) chkpntTrapCPU = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 3)) chkpntTrapMemory = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 4)) chkpntTrapHWSensor = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5)) chkpntTrapHA = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6)) chkpntTrapLSConn = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7)) chkpntTrapOID = MibScalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 10), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: chkpntTrapOID.setStatus('current') chkpntTrapOIDValue = MibScalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 11), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: chkpntTrapOIDValue.setStatus('current') chkpntTrapMsgText = MibScalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 12), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: chkpntTrapMsgText.setStatus('current') chkpntTrapSeverity = MibScalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: chkpntTrapSeverity.setStatus('current') chkpntTrapCategory = MibScalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 14), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: chkpntTrapCategory.setStatus('current') chkpntDiskSpaceTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "multiDiskName"), ("CHECKPOINT-MIB", "multiDiskFreeAvailablePercent")) if mibBuilder.loadTexts: chkpntDiskSpaceTrap.setStatus('current') chkpntRAIDVolumeTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "raidVolumeID"), ("CHECKPOINT-MIB", "raidVolumeState")) if mibBuilder.loadTexts: chkpntRAIDVolumeTrap.setStatus('current') chkpntRAIDDiskTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 3)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "raidDiskVolumeID"), ("CHECKPOINT-MIB", "raidDiskID"), ("CHECKPOINT-MIB", "raidDiskState")) if mibBuilder.loadTexts: chkpntRAIDDiskTrap.setStatus('current') chkpntRAIDDiskFlagsTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 4)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "raidDiskVolumeID"), ("CHECKPOINT-MIB", "raidDiskID"), ("CHECKPOINT-MIB", "raidDiskState"), ("CHECKPOINT-MIB", "raidDiskFlags")) if mibBuilder.loadTexts: chkpntRAIDDiskFlagsTrap.setStatus('current') chkpntTrapNetIfState = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "svnNetIfName"), ("CHECKPOINT-MIB", "svnNetIfAddress"), ("CHECKPOINT-MIB", "svnNetIfState")) if mibBuilder.loadTexts: chkpntTrapNetIfState.setStatus('current') chkpntTrapNetIfUnplugged = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "svnNetIfName"), ("CHECKPOINT-MIB", "svnNetIfAddress")) if mibBuilder.loadTexts: chkpntTrapNetIfUnplugged.setStatus('current') chkpntTrapNewConnRate = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 3)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory")) if mibBuilder.loadTexts: chkpntTrapNewConnRate.setStatus('current') chkpntTrapConcurrentConnRate = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 4)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory")) if mibBuilder.loadTexts: chkpntTrapConcurrentConnRate.setStatus('current') chkpntTrapBytesThroughput = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 5)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory")) if mibBuilder.loadTexts: chkpntTrapBytesThroughput.setStatus('current') chkpntTrapAcceptedPacketRate = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 6)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory")) if mibBuilder.loadTexts: chkpntTrapAcceptedPacketRate.setStatus('current') chkpntTrapNetIfOperState = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 7)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "svnNetIfName"), ("CHECKPOINT-MIB", "svnNetIfAddress"), ("CHECKPOINT-MIB", "svnNetIfOperState")) if mibBuilder.loadTexts: chkpntTrapNetIfOperState.setStatus('current') chkpntCPUCoreUtilTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 3, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "multiProcIndex"), ("CHECKPOINT-MIB", "multiProcUserTime"), ("CHECKPOINT-MIB", "multiProcSystemTime"), ("CHECKPOINT-MIB", "multiProcIdleTime"), ("CHECKPOINT-MIB", "multiProcUsage"), ("CHECKPOINT-MIB", "multiProcRunQueue"), ("CHECKPOINT-MIB", "multiProcInterrupts")) if mibBuilder.loadTexts: chkpntCPUCoreUtilTrap.setStatus('current') chkpntCPUCoreInterruptsTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 3, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "multiProcIndex"), ("CHECKPOINT-MIB", "multiProcUserTime"), ("CHECKPOINT-MIB", "multiProcSystemTime"), ("CHECKPOINT-MIB", "multiProcIdleTime"), ("CHECKPOINT-MIB", "multiProcUsage"), ("CHECKPOINT-MIB", "multiProcRunQueue"), ("CHECKPOINT-MIB", "multiProcInterrupts")) if mibBuilder.loadTexts: chkpntCPUCoreInterruptsTrap.setStatus('current') chkpntSwapMemoryTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 4, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "memTotalVirtual64"), ("CHECKPOINT-MIB", "memActiveVirtual64")) if mibBuilder.loadTexts: chkpntSwapMemoryTrap.setStatus('current') chkpntRealMemoryTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 4, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "memTotalReal64"), ("CHECKPOINT-MIB", "memActiveReal64")) if mibBuilder.loadTexts: chkpntRealMemoryTrap.setStatus('current') chkpntTrapTempertureSensor = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 1)) chkpntTrapFanSpeedSensor = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 2)) chkpntTrapVoltageSensor = MibIdentifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 3)) chkpntTempertureTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 1, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "tempertureSensorName"), ("CHECKPOINT-MIB", "tempertureSensorValue"), ("CHECKPOINT-MIB", "tempertureSensorUnit"), ("CHECKPOINT-MIB", "tempertureSensorType"), ("CHECKPOINT-MIB", "tempertureSensorStatus")) if mibBuilder.loadTexts: chkpntTempertureTrap.setStatus('current') chkpntFanSpeedTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 2, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "fanSpeedSensorName"), ("CHECKPOINT-MIB", "fanSpeedSensorValue"), ("CHECKPOINT-MIB", "fanSpeedSensorUnit"), ("CHECKPOINT-MIB", "fanSpeedSensorType"), ("CHECKPOINT-MIB", "fanSpeedSensorStatus")) if mibBuilder.loadTexts: chkpntFanSpeedTrap.setStatus('current') chkpntVoltageTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 3, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "voltageSensorName"), ("CHECKPOINT-MIB", "voltageSensorValue"), ("CHECKPOINT-MIB", "voltageSensorUnit"), ("CHECKPOINT-MIB", "voltageSensorType"), ("CHECKPOINT-MIB", "voltageSensorStatus")) if mibBuilder.loadTexts: chkpntVoltageTrap.setStatus('current') chkpntClusterMemberStateTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "haIdentifier"), ("CHECKPOINT-MIB", "haState")) if mibBuilder.loadTexts: chkpntClusterMemberStateTrap.setStatus('current') chkpntClusterBlockStateTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "haIdentifier"), ("CHECKPOINT-MIB", "haBlockState"), ("CHECKPOINT-MIB", "haState")) if mibBuilder.loadTexts: chkpntClusterBlockStateTrap.setStatus('current') chkpntClusterStateTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 3)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "haIdentifier"), ("CHECKPOINT-MIB", "haBlockState"), ("CHECKPOINT-MIB", "haState"), ("CHECKPOINT-MIB", "haStatCode"), ("CHECKPOINT-MIB", "haStatShort"), ("CHECKPOINT-MIB", "haStatLong")) if mibBuilder.loadTexts: chkpntClusterStateTrap.setStatus('current') chkpntClusterProblemStateTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 4)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "haProblemName"), ("CHECKPOINT-MIB", "haProblemStatus"), ("CHECKPOINT-MIB", "haProblemPriority"), ("CHECKPOINT-MIB", "haProblemVerified"), ("CHECKPOINT-MIB", "haProblemDescr")) if mibBuilder.loadTexts: chkpntClusterProblemStateTrap.setStatus('current') chkpntClusterInterfaceStateTrap = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 5)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "haIfName"), ("CHECKPOINT-MIB", "haIP"), ("CHECKPOINT-MIB", "haStatus"), ("CHECKPOINT-MIB", "haTrusted"), ("CHECKPOINT-MIB", "haShared")) if mibBuilder.loadTexts: chkpntClusterInterfaceStateTrap.setStatus('current') chkpntTrapLSConnState = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7, 1)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "fwLSConnName"), ("CHECKPOINT-MIB", "fwLSConnState"), ("CHECKPOINT-MIB", "fwLSConnStateDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingStat")) if mibBuilder.loadTexts: chkpntTrapLSConnState.setStatus('current') chkpntTrapOverallLSConnState = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7, 2)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "fwLSConnOverall"), ("CHECKPOINT-MIB", "fwLSConnOverallDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingStat")) if mibBuilder.loadTexts: chkpntTrapOverallLSConnState.setStatus('current') chkpntTrapLocalLoggingState = NotificationType((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7, 3)).setObjects(("CHECKPOINT-TRAP-MIB", "chkpntTrapOID"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapOIDValue"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapMsgText"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapSeverity"), ("CHECKPOINT-TRAP-MIB", "chkpntTrapCategory"), ("CHECKPOINT-MIB", "fwLSConnOverall"), ("CHECKPOINT-MIB", "fwLSConnOverallDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingDesc"), ("CHECKPOINT-MIB", "fwLocalLoggingStat")) if mibBuilder.loadTexts: chkpntTrapLocalLoggingState.setStatus('current') mibBuilder.exportSymbols("CHECKPOINT-TRAP-MIB", chkpntTrapBytesThroughput=chkpntTrapBytesThroughput, chkpntClusterBlockStateTrap=chkpntClusterBlockStateTrap, chkpntTrap=chkpntTrap, chkpntRAIDDiskTrap=chkpntRAIDDiskTrap, chkpntCPUCoreInterruptsTrap=chkpntCPUCoreInterruptsTrap, chkpntTempertureTrap=chkpntTempertureTrap, chkpntTrapConcurrentConnRate=chkpntTrapConcurrentConnRate, chkpntTrapNewConnRate=chkpntTrapNewConnRate, chkpntFanSpeedTrap=chkpntFanSpeedTrap, chkpntSwapMemoryTrap=chkpntSwapMemoryTrap, chkpntVoltageTrap=chkpntVoltageTrap, chkpntTrapFanSpeedSensor=chkpntTrapFanSpeedSensor, chkpntCPUCoreUtilTrap=chkpntCPUCoreUtilTrap, chkpntTrapMsgText=chkpntTrapMsgText, checkpoint=checkpoint, chkpntRealMemoryTrap=chkpntRealMemoryTrap, chkpntTrapOID=chkpntTrapOID, chkpntTrapSeverity=chkpntTrapSeverity, chkpntClusterStateTrap=chkpntClusterStateTrap, chkpntTrapOverallLSConnState=chkpntTrapOverallLSConnState, chkpntTrapTempertureSensor=chkpntTrapTempertureSensor, chkpntClusterProblemStateTrap=chkpntClusterProblemStateTrap, chkpntClusterInterfaceStateTrap=chkpntClusterInterfaceStateTrap, chkpntTrapHWSensor=chkpntTrapHWSensor, chkpntTrapCategory=chkpntTrapCategory, chkpntTrapLocalLoggingState=chkpntTrapLocalLoggingState, chkpntTrapLSConnState=chkpntTrapLSConnState, chkpntTrapLSConn=chkpntTrapLSConn, chkpntTrapMibModule=chkpntTrapMibModule, chkpntTrapMemory=chkpntTrapMemory, chkpntTrapNetIfUnplugged=chkpntTrapNetIfUnplugged, chkpntTrapCPU=chkpntTrapCPU, chkpntDiskSpaceTrap=chkpntDiskSpaceTrap, products=products, chkpntTrapNet=chkpntTrapNet, chkpntTrapAcceptedPacketRate=chkpntTrapAcceptedPacketRate, chkpntTrapNetIfOperState=chkpntTrapNetIfOperState, chkpntTrapNetIfState=chkpntTrapNetIfState, chkpntTrapOIDValue=chkpntTrapOIDValue, chkpntRAIDVolumeTrap=chkpntRAIDVolumeTrap, chkpntClusterMemberStateTrap=chkpntClusterMemberStateTrap, chkpntTrapInfo=chkpntTrapInfo, chkpntRAIDDiskFlagsTrap=chkpntRAIDDiskFlagsTrap, chkpntTrapHA=chkpntTrapHA, chkpntTrapVoltageSensor=chkpntTrapVoltageSensor, chkpntTrapDisk=chkpntTrapDisk, PYSNMP_MODULE_ID=chkpntTrapMibModule)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint') (temperture_sensor_status, ha_problem_verified, fan_speed_sensor_type, multi_disk_free_available_percent, raid_disk_id, mem_active_real64, ha_block_state, ha_problem_priority, voltage_sensor_name, svn_net_if_state, fw_ls_conn_state, fan_speed_sensor_value, ha_if_name, raid_volume_id, voltage_sensor_type, voltage_sensor_value, raid_disk_flags, multi_disk_name, fw_local_logging_stat, fan_speed_sensor_status, ha_ip, fan_speed_sensor_unit, temperture_sensor_name, ha_trusted, ha_stat_short, ha_status, multi_proc_index, svn_net_if_name, ha_state, multi_proc_run_queue, voltage_sensor_unit, multi_proc_usage, mem_total_real64, multi_proc_interrupts, multi_proc_system_time, voltage_sensor_status, temperture_sensor_unit, ha_problem_status, temperture_sensor_value, fw_ls_conn_overall, fw_ls_conn_state_desc, fan_speed_sensor_name, raid_volume_state, raid_disk_volume_id, fw_ls_conn_overall_desc, ha_identifier, mem_total_virtual64, mem_active_virtual64, raid_disk_state, ha_stat_code, ha_stat_long, ha_problem_name, multi_proc_idle_time, ha_problem_descr, fw_ls_conn_name, multi_proc_user_time, fw_local_logging_desc, temperture_sensor_type, ha_shared, svn_net_if_address, svn_net_if_oper_state) = mibBuilder.importSymbols('CHECKPOINT-MIB', 'tempertureSensorStatus', 'haProblemVerified', 'fanSpeedSensorType', 'multiDiskFreeAvailablePercent', 'raidDiskID', 'memActiveReal64', 'haBlockState', 'haProblemPriority', 'voltageSensorName', 'svnNetIfState', 'fwLSConnState', 'fanSpeedSensorValue', 'haIfName', 'raidVolumeID', 'voltageSensorType', 'voltageSensorValue', 'raidDiskFlags', 'multiDiskName', 'fwLocalLoggingStat', 'fanSpeedSensorStatus', 'haIP', 'fanSpeedSensorUnit', 'tempertureSensorName', 'haTrusted', 'haStatShort', 'haStatus', 'multiProcIndex', 'svnNetIfName', 'haState', 'multiProcRunQueue', 'voltageSensorUnit', 'multiProcUsage', 'memTotalReal64', 'multiProcInterrupts', 'multiProcSystemTime', 'voltageSensorStatus', 'tempertureSensorUnit', 'haProblemStatus', 'tempertureSensorValue', 'fwLSConnOverall', 'fwLSConnStateDesc', 'fanSpeedSensorName', 'raidVolumeState', 'raidDiskVolumeID', 'fwLSConnOverallDesc', 'haIdentifier', 'memTotalVirtual64', 'memActiveVirtual64', 'raidDiskState', 'haStatCode', 'haStatLong', 'haProblemName', 'multiProcIdleTime', 'haProblemDescr', 'fwLSConnName', 'multiProcUserTime', 'fwLocalLoggingDesc', 'tempertureSensorType', 'haShared', 'svnNetIfAddress', 'svnNetIfOperState') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (counter32, notification_type, iso, integer32, ip_address, time_ticks, object_identity, bits, unsigned32, mib_identifier, module_identity, gauge32, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, enterprises) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'NotificationType', 'iso', 'Integer32', 'IpAddress', 'TimeTicks', 'ObjectIdentity', 'Bits', 'Unsigned32', 'MibIdentifier', 'ModuleIdentity', 'Gauge32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'enterprises') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') chkpnt_trap_mib_module = module_identity((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 0)) chkpntTrapMibModule.setRevisions(('2013-12-26 13:09',)) if mibBuilder.loadTexts: chkpntTrapMibModule.setLastUpdated('201312261309Z') if mibBuilder.loadTexts: chkpntTrapMibModule.setOrganization('Check Point') checkpoint = mib_identifier((1, 3, 6, 1, 4, 1, 2620)) products = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1)) chkpnt_trap = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000)) chkpnt_trap_info = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0)) chkpnt_trap_net = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1)) chkpnt_trap_disk = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2)) chkpnt_trap_cpu = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 3)) chkpnt_trap_memory = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 4)) chkpnt_trap_hw_sensor = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5)) chkpnt_trap_ha = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6)) chkpnt_trap_ls_conn = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7)) chkpnt_trap_oid = mib_scalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 10), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: chkpntTrapOID.setStatus('current') chkpnt_trap_oid_value = mib_scalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 11), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: chkpntTrapOIDValue.setStatus('current') chkpnt_trap_msg_text = mib_scalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 12), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: chkpntTrapMsgText.setStatus('current') chkpnt_trap_severity = mib_scalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 13), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: chkpntTrapSeverity.setStatus('current') chkpnt_trap_category = mib_scalar((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 0, 14), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: chkpntTrapCategory.setStatus('current') chkpnt_disk_space_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 1)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'multiDiskName'), ('CHECKPOINT-MIB', 'multiDiskFreeAvailablePercent')) if mibBuilder.loadTexts: chkpntDiskSpaceTrap.setStatus('current') chkpnt_raid_volume_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 2)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'raidVolumeID'), ('CHECKPOINT-MIB', 'raidVolumeState')) if mibBuilder.loadTexts: chkpntRAIDVolumeTrap.setStatus('current') chkpnt_raid_disk_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 3)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'raidDiskVolumeID'), ('CHECKPOINT-MIB', 'raidDiskID'), ('CHECKPOINT-MIB', 'raidDiskState')) if mibBuilder.loadTexts: chkpntRAIDDiskTrap.setStatus('current') chkpnt_raid_disk_flags_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 2, 4)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'raidDiskVolumeID'), ('CHECKPOINT-MIB', 'raidDiskID'), ('CHECKPOINT-MIB', 'raidDiskState'), ('CHECKPOINT-MIB', 'raidDiskFlags')) if mibBuilder.loadTexts: chkpntRAIDDiskFlagsTrap.setStatus('current') chkpnt_trap_net_if_state = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 1)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'svnNetIfName'), ('CHECKPOINT-MIB', 'svnNetIfAddress'), ('CHECKPOINT-MIB', 'svnNetIfState')) if mibBuilder.loadTexts: chkpntTrapNetIfState.setStatus('current') chkpnt_trap_net_if_unplugged = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 2)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'svnNetIfName'), ('CHECKPOINT-MIB', 'svnNetIfAddress')) if mibBuilder.loadTexts: chkpntTrapNetIfUnplugged.setStatus('current') chkpnt_trap_new_conn_rate = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 3)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory')) if mibBuilder.loadTexts: chkpntTrapNewConnRate.setStatus('current') chkpnt_trap_concurrent_conn_rate = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 4)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory')) if mibBuilder.loadTexts: chkpntTrapConcurrentConnRate.setStatus('current') chkpnt_trap_bytes_throughput = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 5)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory')) if mibBuilder.loadTexts: chkpntTrapBytesThroughput.setStatus('current') chkpnt_trap_accepted_packet_rate = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 6)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory')) if mibBuilder.loadTexts: chkpntTrapAcceptedPacketRate.setStatus('current') chkpnt_trap_net_if_oper_state = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 1, 7)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'svnNetIfName'), ('CHECKPOINT-MIB', 'svnNetIfAddress'), ('CHECKPOINT-MIB', 'svnNetIfOperState')) if mibBuilder.loadTexts: chkpntTrapNetIfOperState.setStatus('current') chkpnt_cpu_core_util_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 3, 1)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'multiProcIndex'), ('CHECKPOINT-MIB', 'multiProcUserTime'), ('CHECKPOINT-MIB', 'multiProcSystemTime'), ('CHECKPOINT-MIB', 'multiProcIdleTime'), ('CHECKPOINT-MIB', 'multiProcUsage'), ('CHECKPOINT-MIB', 'multiProcRunQueue'), ('CHECKPOINT-MIB', 'multiProcInterrupts')) if mibBuilder.loadTexts: chkpntCPUCoreUtilTrap.setStatus('current') chkpnt_cpu_core_interrupts_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 3, 2)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'multiProcIndex'), ('CHECKPOINT-MIB', 'multiProcUserTime'), ('CHECKPOINT-MIB', 'multiProcSystemTime'), ('CHECKPOINT-MIB', 'multiProcIdleTime'), ('CHECKPOINT-MIB', 'multiProcUsage'), ('CHECKPOINT-MIB', 'multiProcRunQueue'), ('CHECKPOINT-MIB', 'multiProcInterrupts')) if mibBuilder.loadTexts: chkpntCPUCoreInterruptsTrap.setStatus('current') chkpnt_swap_memory_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 4, 1)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'memTotalVirtual64'), ('CHECKPOINT-MIB', 'memActiveVirtual64')) if mibBuilder.loadTexts: chkpntSwapMemoryTrap.setStatus('current') chkpnt_real_memory_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 4, 2)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'memTotalReal64'), ('CHECKPOINT-MIB', 'memActiveReal64')) if mibBuilder.loadTexts: chkpntRealMemoryTrap.setStatus('current') chkpnt_trap_temperture_sensor = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 1)) chkpnt_trap_fan_speed_sensor = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 2)) chkpnt_trap_voltage_sensor = mib_identifier((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 3)) chkpnt_temperture_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 1, 1)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'tempertureSensorName'), ('CHECKPOINT-MIB', 'tempertureSensorValue'), ('CHECKPOINT-MIB', 'tempertureSensorUnit'), ('CHECKPOINT-MIB', 'tempertureSensorType'), ('CHECKPOINT-MIB', 'tempertureSensorStatus')) if mibBuilder.loadTexts: chkpntTempertureTrap.setStatus('current') chkpnt_fan_speed_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 2, 1)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'fanSpeedSensorName'), ('CHECKPOINT-MIB', 'fanSpeedSensorValue'), ('CHECKPOINT-MIB', 'fanSpeedSensorUnit'), ('CHECKPOINT-MIB', 'fanSpeedSensorType'), ('CHECKPOINT-MIB', 'fanSpeedSensorStatus')) if mibBuilder.loadTexts: chkpntFanSpeedTrap.setStatus('current') chkpnt_voltage_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 5, 3, 1)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'voltageSensorName'), ('CHECKPOINT-MIB', 'voltageSensorValue'), ('CHECKPOINT-MIB', 'voltageSensorUnit'), ('CHECKPOINT-MIB', 'voltageSensorType'), ('CHECKPOINT-MIB', 'voltageSensorStatus')) if mibBuilder.loadTexts: chkpntVoltageTrap.setStatus('current') chkpnt_cluster_member_state_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 1)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'haIdentifier'), ('CHECKPOINT-MIB', 'haState')) if mibBuilder.loadTexts: chkpntClusterMemberStateTrap.setStatus('current') chkpnt_cluster_block_state_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 2)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'haIdentifier'), ('CHECKPOINT-MIB', 'haBlockState'), ('CHECKPOINT-MIB', 'haState')) if mibBuilder.loadTexts: chkpntClusterBlockStateTrap.setStatus('current') chkpnt_cluster_state_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 3)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'haIdentifier'), ('CHECKPOINT-MIB', 'haBlockState'), ('CHECKPOINT-MIB', 'haState'), ('CHECKPOINT-MIB', 'haStatCode'), ('CHECKPOINT-MIB', 'haStatShort'), ('CHECKPOINT-MIB', 'haStatLong')) if mibBuilder.loadTexts: chkpntClusterStateTrap.setStatus('current') chkpnt_cluster_problem_state_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 4)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'haProblemName'), ('CHECKPOINT-MIB', 'haProblemStatus'), ('CHECKPOINT-MIB', 'haProblemPriority'), ('CHECKPOINT-MIB', 'haProblemVerified'), ('CHECKPOINT-MIB', 'haProblemDescr')) if mibBuilder.loadTexts: chkpntClusterProblemStateTrap.setStatus('current') chkpnt_cluster_interface_state_trap = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 6, 5)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'haIfName'), ('CHECKPOINT-MIB', 'haIP'), ('CHECKPOINT-MIB', 'haStatus'), ('CHECKPOINT-MIB', 'haTrusted'), ('CHECKPOINT-MIB', 'haShared')) if mibBuilder.loadTexts: chkpntClusterInterfaceStateTrap.setStatus('current') chkpnt_trap_ls_conn_state = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7, 1)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'fwLSConnName'), ('CHECKPOINT-MIB', 'fwLSConnState'), ('CHECKPOINT-MIB', 'fwLSConnStateDesc'), ('CHECKPOINT-MIB', 'fwLocalLoggingDesc'), ('CHECKPOINT-MIB', 'fwLocalLoggingStat')) if mibBuilder.loadTexts: chkpntTrapLSConnState.setStatus('current') chkpnt_trap_overall_ls_conn_state = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7, 2)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'fwLSConnOverall'), ('CHECKPOINT-MIB', 'fwLSConnOverallDesc'), ('CHECKPOINT-MIB', 'fwLocalLoggingDesc'), ('CHECKPOINT-MIB', 'fwLocalLoggingStat')) if mibBuilder.loadTexts: chkpntTrapOverallLSConnState.setStatus('current') chkpnt_trap_local_logging_state = notification_type((1, 3, 6, 1, 4, 1, 2620, 1, 2000, 7, 3)).setObjects(('CHECKPOINT-TRAP-MIB', 'chkpntTrapOID'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapOIDValue'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapMsgText'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapSeverity'), ('CHECKPOINT-TRAP-MIB', 'chkpntTrapCategory'), ('CHECKPOINT-MIB', 'fwLSConnOverall'), ('CHECKPOINT-MIB', 'fwLSConnOverallDesc'), ('CHECKPOINT-MIB', 'fwLocalLoggingDesc'), ('CHECKPOINT-MIB', 'fwLocalLoggingStat')) if mibBuilder.loadTexts: chkpntTrapLocalLoggingState.setStatus('current') mibBuilder.exportSymbols('CHECKPOINT-TRAP-MIB', chkpntTrapBytesThroughput=chkpntTrapBytesThroughput, chkpntClusterBlockStateTrap=chkpntClusterBlockStateTrap, chkpntTrap=chkpntTrap, chkpntRAIDDiskTrap=chkpntRAIDDiskTrap, chkpntCPUCoreInterruptsTrap=chkpntCPUCoreInterruptsTrap, chkpntTempertureTrap=chkpntTempertureTrap, chkpntTrapConcurrentConnRate=chkpntTrapConcurrentConnRate, chkpntTrapNewConnRate=chkpntTrapNewConnRate, chkpntFanSpeedTrap=chkpntFanSpeedTrap, chkpntSwapMemoryTrap=chkpntSwapMemoryTrap, chkpntVoltageTrap=chkpntVoltageTrap, chkpntTrapFanSpeedSensor=chkpntTrapFanSpeedSensor, chkpntCPUCoreUtilTrap=chkpntCPUCoreUtilTrap, chkpntTrapMsgText=chkpntTrapMsgText, checkpoint=checkpoint, chkpntRealMemoryTrap=chkpntRealMemoryTrap, chkpntTrapOID=chkpntTrapOID, chkpntTrapSeverity=chkpntTrapSeverity, chkpntClusterStateTrap=chkpntClusterStateTrap, chkpntTrapOverallLSConnState=chkpntTrapOverallLSConnState, chkpntTrapTempertureSensor=chkpntTrapTempertureSensor, chkpntClusterProblemStateTrap=chkpntClusterProblemStateTrap, chkpntClusterInterfaceStateTrap=chkpntClusterInterfaceStateTrap, chkpntTrapHWSensor=chkpntTrapHWSensor, chkpntTrapCategory=chkpntTrapCategory, chkpntTrapLocalLoggingState=chkpntTrapLocalLoggingState, chkpntTrapLSConnState=chkpntTrapLSConnState, chkpntTrapLSConn=chkpntTrapLSConn, chkpntTrapMibModule=chkpntTrapMibModule, chkpntTrapMemory=chkpntTrapMemory, chkpntTrapNetIfUnplugged=chkpntTrapNetIfUnplugged, chkpntTrapCPU=chkpntTrapCPU, chkpntDiskSpaceTrap=chkpntDiskSpaceTrap, products=products, chkpntTrapNet=chkpntTrapNet, chkpntTrapAcceptedPacketRate=chkpntTrapAcceptedPacketRate, chkpntTrapNetIfOperState=chkpntTrapNetIfOperState, chkpntTrapNetIfState=chkpntTrapNetIfState, chkpntTrapOIDValue=chkpntTrapOIDValue, chkpntRAIDVolumeTrap=chkpntRAIDVolumeTrap, chkpntClusterMemberStateTrap=chkpntClusterMemberStateTrap, chkpntTrapInfo=chkpntTrapInfo, chkpntRAIDDiskFlagsTrap=chkpntRAIDDiskFlagsTrap, chkpntTrapHA=chkpntTrapHA, chkpntTrapVoltageSensor=chkpntTrapVoltageSensor, chkpntTrapDisk=chkpntTrapDisk, PYSNMP_MODULE_ID=chkpntTrapMibModule)
colors_per_chi = {2: 'green', 3: 'orange', 4: 'purple', 5: 'pink', 6: 'red'} style_per_chi = {2: '-', 3: '-.', 4: 'dotted'} markers_per_reason = {'converged': 'o', 'progress': 'x', 'ressources': 'v'} linewidth = 5.31596
colors_per_chi = {2: 'green', 3: 'orange', 4: 'purple', 5: 'pink', 6: 'red'} style_per_chi = {2: '-', 3: '-.', 4: 'dotted'} markers_per_reason = {'converged': 'o', 'progress': 'x', 'ressources': 'v'} linewidth = 5.31596
def get_failed_ids(txt_file): id = [] fh = open(txt_file, 'r') for row in fh: id.append(row.split('/')[1].split('.')[0]) return(id)
def get_failed_ids(txt_file): id = [] fh = open(txt_file, 'r') for row in fh: id.append(row.split('/')[1].split('.')[0]) return id
d=int(input("enter d")) n='' max='' for i in range(d): if i==0: n=n+str(1) else : n=n+str(0) max=max+str(9) n=int(n)+1 #smallest odd no. with d digits if d>1 or 2 if d==1 max=int(max) #largest no. with d digits def check_prime(m_odd): #returns truth value of an odd no. or of 2 being prime if m_odd==2:return True i=3 while m_odd%i!=0 and i<m_odd: i=i+2 return i==m_odd l=[] #list of prime no.s of d digits while n<=max: if check_prime(n): l.append(n) if n==2: n=n+1 continue if n>2: n=n+2 print(l) d=[] #list of tuples with consecutive difference 2 for i in range(len(l)-1): if (l[i+1]-l[i]==2): d.append((l[i],l[i+1])) f=open('myFirstFile.txt','w') for i in range(len(d)): f.write(str(d[i][0])+' '+str(d[i][1])+"\n") f.close()
d = int(input('enter d')) n = '' max = '' for i in range(d): if i == 0: n = n + str(1) else: n = n + str(0) max = max + str(9) n = int(n) + 1 max = int(max) def check_prime(m_odd): if m_odd == 2: return True i = 3 while m_odd % i != 0 and i < m_odd: i = i + 2 return i == m_odd l = [] while n <= max: if check_prime(n): l.append(n) if n == 2: n = n + 1 continue if n > 2: n = n + 2 print(l) d = [] for i in range(len(l) - 1): if l[i + 1] - l[i] == 2: d.append((l[i], l[i + 1])) f = open('myFirstFile.txt', 'w') for i in range(len(d)): f.write(str(d[i][0]) + ' ' + str(d[i][1]) + '\n') f.close()
class Boolable: def __bool__(self): return False class DescriptiveTrue(Boolable): def __init__(self, description): self.description = description def __bool__(self): return True def __str__(self): return f"{self.description}" def __repr__(self): return f"{self.__class__.__name__}({repr(self.description)})" class Intable: def __int__(self): return 0 def __add__(self, other): return Addition(self, other) def __repr__(self): return f"{self.__class__.__name__}()" class DescriptiveInt(Intable): def __init__(self, value, description): self.value = value self.description = description def __int__(self): return self.value def __str__(self): return f"{self.value} ({self.description})" def __repr__(self): return f"{self.__class__.__name__}({repr(self.value)}, " \ f"{repr(self.description)})" class Addition(Intable): def __init__(self, *intables): self.intables = list(intables) def __int__(self): return sum(int(i) for i in self.intables) def __repr__(self): return f"{self.__class__.__name__}(*{repr(self.intables)})" def __str__(self): return " + ".join(str(x) for x in self.intables) class Subtraction(Intable): def __init__(self, left_operand, right_operand): self.left = left_operand self.right = right_operand def __int__(self): return int(self.left) - int(self.right) def __repr__(self): return f"{self.__class__.__name__}({repr(self.left)}, " \ f"{repr(self.right)})" def __str__(self): return f"{self.left} - {self.right}"
class Boolable: def __bool__(self): return False class Descriptivetrue(Boolable): def __init__(self, description): self.description = description def __bool__(self): return True def __str__(self): return f'{self.description}' def __repr__(self): return f'{self.__class__.__name__}({repr(self.description)})' class Intable: def __int__(self): return 0 def __add__(self, other): return addition(self, other) def __repr__(self): return f'{self.__class__.__name__}()' class Descriptiveint(Intable): def __init__(self, value, description): self.value = value self.description = description def __int__(self): return self.value def __str__(self): return f'{self.value} ({self.description})' def __repr__(self): return f'{self.__class__.__name__}({repr(self.value)}, {repr(self.description)})' class Addition(Intable): def __init__(self, *intables): self.intables = list(intables) def __int__(self): return sum((int(i) for i in self.intables)) def __repr__(self): return f'{self.__class__.__name__}(*{repr(self.intables)})' def __str__(self): return ' + '.join((str(x) for x in self.intables)) class Subtraction(Intable): def __init__(self, left_operand, right_operand): self.left = left_operand self.right = right_operand def __int__(self): return int(self.left) - int(self.right) def __repr__(self): return f'{self.__class__.__name__}({repr(self.left)}, {repr(self.right)})' def __str__(self): return f'{self.left} - {self.right}'
def fuel_required(weight: int) -> int: return weight // 3 - 2 def fuel_required_accurate(weight: int) -> int: fuel = 0 while weight > 0: weight = max(0, weight // 3 - 2) fuel += weight return fuel def test_fuel_required() -> None: cases = [(12, 2), (14, 2), (1969, 654), (100756, 33583)] for x, y in cases: assert fuel_required(x) == y def test_fuel_required_accurate() -> None: cases = [(14, 2), (1969, 966), (100756, 50346)] for x, y in cases: assert fuel_required_accurate(x) == y def test_solutions() -> None: with open("input/01.txt") as f: modules = [int(line) for line in f] part_1 = sum(map(fuel_required, modules)) part_2 = sum(map(fuel_required_accurate, modules)) assert part_1 == 3375962 assert part_2 == 5061072
def fuel_required(weight: int) -> int: return weight // 3 - 2 def fuel_required_accurate(weight: int) -> int: fuel = 0 while weight > 0: weight = max(0, weight // 3 - 2) fuel += weight return fuel def test_fuel_required() -> None: cases = [(12, 2), (14, 2), (1969, 654), (100756, 33583)] for (x, y) in cases: assert fuel_required(x) == y def test_fuel_required_accurate() -> None: cases = [(14, 2), (1969, 966), (100756, 50346)] for (x, y) in cases: assert fuel_required_accurate(x) == y def test_solutions() -> None: with open('input/01.txt') as f: modules = [int(line) for line in f] part_1 = sum(map(fuel_required, modules)) part_2 = sum(map(fuel_required_accurate, modules)) assert part_1 == 3375962 assert part_2 == 5061072
class Node: def __init__(self, value, index, next, previous): self.value = value self.next_value = value self.index = index self.next = next self.previous = previous def main(): input_data = read_input() initial_row = input_data.pop(0) # Extract the initial state input_data.pop(0) # Remove the empty row rules = list(map(lambda x: x.split(" => "), input_data)) initial_row = initial_row[15:] # Build the initial state current = None for i in range(len(initial_row)): previous = None if current is not None: previous = current current = Node(initial_row[0], i, None, None) initial_row = initial_row[1:] if previous is not None: previous.next = current current.previous = previous # When growing - add 3 more to both ends, and in the end remove the non-grown nodes from both ends # Current node is always some node in the hierarchy generation_number = 0 #debug(current, True, True) for i in range(20): generation_number += 1 current = grow(current, rules) #debug(current, True, True) leftmost = get_leftmost(current) index_sum = 0 while leftmost is not None: if leftmost.value == '#': index_sum += leftmost.index leftmost = leftmost.next print(index_sum) def grow(node, rules): '''Take the current state described by one node''' # Find the leftmost node and add the 3 nodes leftmost = get_leftmost(node) for i in range(3): new_node = Node('.', leftmost.index - 1, None, None) leftmost.previous = new_node new_node.next = leftmost leftmost = new_node # Find the rightmost and add 3 nodes rightmost = get_rightmost(node) for i in range(3): new_node = Node('.', rightmost.index + 1, None, None) rightmost.next = new_node new_node.previous = rightmost rightmost = new_node # Go through the nodes and test all rules current = leftmost.next.next while current.next.next is not None: pp = current.previous.previous p = current.previous n = current.next nn = current.next.next for rule in rules: if rule[0][0] == pp.value and rule[0][1] == p.value and rule[0][2] == current.value and rule[0][3] == n.value and rule[0][4] == nn.value: current.next_value = rule[1] # Assumes that every combination is in the rules current = current.next # Remove the ungrown nodes from both ends leftmost = get_leftmost(node) while leftmost.next_value == '.': leftmost.next.previous = None leftmost = leftmost.next rightmost = get_rightmost(leftmost) while rightmost.next_value == '.': rightmost.previous.next = None rightmost = rightmost.previous # Finally update the state for all nodes current = get_leftmost(rightmost) while current is not None: current.value = current.next_value current = current.next return rightmost # Return any valid node - in this case rightmost was updated last def get_leftmost(node): leftmost = node while leftmost.previous is not None: leftmost = leftmost.previous return leftmost def get_rightmost(node): rightmost = node while rightmost.next is not None: rightmost = rightmost.next return rightmost def debug(node, p, n): if p and node.previous is not None: debug(node.previous, True, False) print(node.value, end="") if n and node.next is not None: debug(node.next, False, True) def read_input(): '''Read the file and remove trailing new line characters''' f = open('input.txt', 'r') data = list(map(lambda x: x[:-1], f.readlines())) f.close() return data if __name__ == '__main__': main()
class Node: def __init__(self, value, index, next, previous): self.value = value self.next_value = value self.index = index self.next = next self.previous = previous def main(): input_data = read_input() initial_row = input_data.pop(0) input_data.pop(0) rules = list(map(lambda x: x.split(' => '), input_data)) initial_row = initial_row[15:] current = None for i in range(len(initial_row)): previous = None if current is not None: previous = current current = node(initial_row[0], i, None, None) initial_row = initial_row[1:] if previous is not None: previous.next = current current.previous = previous generation_number = 0 for i in range(20): generation_number += 1 current = grow(current, rules) leftmost = get_leftmost(current) index_sum = 0 while leftmost is not None: if leftmost.value == '#': index_sum += leftmost.index leftmost = leftmost.next print(index_sum) def grow(node, rules): """Take the current state described by one node""" leftmost = get_leftmost(node) for i in range(3): new_node = node('.', leftmost.index - 1, None, None) leftmost.previous = new_node new_node.next = leftmost leftmost = new_node rightmost = get_rightmost(node) for i in range(3): new_node = node('.', rightmost.index + 1, None, None) rightmost.next = new_node new_node.previous = rightmost rightmost = new_node current = leftmost.next.next while current.next.next is not None: pp = current.previous.previous p = current.previous n = current.next nn = current.next.next for rule in rules: if rule[0][0] == pp.value and rule[0][1] == p.value and (rule[0][2] == current.value) and (rule[0][3] == n.value) and (rule[0][4] == nn.value): current.next_value = rule[1] current = current.next leftmost = get_leftmost(node) while leftmost.next_value == '.': leftmost.next.previous = None leftmost = leftmost.next rightmost = get_rightmost(leftmost) while rightmost.next_value == '.': rightmost.previous.next = None rightmost = rightmost.previous current = get_leftmost(rightmost) while current is not None: current.value = current.next_value current = current.next return rightmost def get_leftmost(node): leftmost = node while leftmost.previous is not None: leftmost = leftmost.previous return leftmost def get_rightmost(node): rightmost = node while rightmost.next is not None: rightmost = rightmost.next return rightmost def debug(node, p, n): if p and node.previous is not None: debug(node.previous, True, False) print(node.value, end='') if n and node.next is not None: debug(node.next, False, True) def read_input(): """Read the file and remove trailing new line characters""" f = open('input.txt', 'r') data = list(map(lambda x: x[:-1], f.readlines())) f.close() return data if __name__ == '__main__': main()
# David Hickox # Jan 12 17 # HickoxProject2 # Displayes name and classes # prints my name and classes in columns and waits for the user to hit enter to end the program print("David Hickox") print() print("1st Band") print("2nd Programming") print("3rd Ap Pysics C") print("4th Lunch") print("5th Ap Lang") print("6th TA for R&D") print("7th Gym") print("8th AP Calc BC") print() input("Press Enter To Continue") #this works too #input("David Hickox\n\n1st Band\n2nd Programming\n3rd Ap Pysics C\n4th Lunch\n5th Ap Lang\n6th TA for R&D\n7th Gym\n8th AP Calc BC\n\nPress Enter to continue")
print('David Hickox') print() print('1st Band') print('2nd Programming') print('3rd Ap Pysics C') print('4th Lunch') print('5th Ap Lang') print('6th TA for R&D') print('7th Gym') print('8th AP Calc BC') print() input('Press Enter To Continue')
class Node(): def __init__(self, value): self.value = value self.adjacentlist = [] self.visited = False class Graph(): def DFS(self, node, traversal): node.visited = True traversal.append(node.value) for element in node.adjacentlist: if element.visited is False: self.DFS(element, traversal) return traversal node1 = Node("A") node2 = Node("B") node3 = Node("C") node4 = Node("D") node5 = Node("E") node6 = Node("F") node7 = Node("G") node8 = Node("H") node1.adjacentlist.append(node2) node1.adjacentlist.append(node3) node1.adjacentlist.append(node4) node2.adjacentlist.append(node5) node2.adjacentlist.append(node6) node4.adjacentlist.append(node7) node6.adjacentlist.append(node8) graph = Graph() print(graph.DFS(node1, []))
class Node: def __init__(self, value): self.value = value self.adjacentlist = [] self.visited = False class Graph: def dfs(self, node, traversal): node.visited = True traversal.append(node.value) for element in node.adjacentlist: if element.visited is False: self.DFS(element, traversal) return traversal node1 = node('A') node2 = node('B') node3 = node('C') node4 = node('D') node5 = node('E') node6 = node('F') node7 = node('G') node8 = node('H') node1.adjacentlist.append(node2) node1.adjacentlist.append(node3) node1.adjacentlist.append(node4) node2.adjacentlist.append(node5) node2.adjacentlist.append(node6) node4.adjacentlist.append(node7) node6.adjacentlist.append(node8) graph = graph() print(graph.DFS(node1, []))
# https://www.hackerrank.com/challenges/utopian-tree def tree_height(tree, N, start): if not N: return tree if start == 'spring': for i in range(N // 2): tree = tree * 2 + 1 if N % 2: return tree * 2 else: return tree elif start == 'summer': for i in range(N // 2): tree = (tree + 1) * 2 if N % 2: return tree + 1 else: return tree else: raise ValueError('start season must be spring or summer') T = int(input().strip()) for i in range(T): print(tree_height(1, int(input().strip()), start='spring'))
def tree_height(tree, N, start): if not N: return tree if start == 'spring': for i in range(N // 2): tree = tree * 2 + 1 if N % 2: return tree * 2 else: return tree elif start == 'summer': for i in range(N // 2): tree = (tree + 1) * 2 if N % 2: return tree + 1 else: return tree else: raise value_error('start season must be spring or summer') t = int(input().strip()) for i in range(T): print(tree_height(1, int(input().strip()), start='spring'))
### Maximum Number of Coins You Can Get - Solution class Solution: def maxCoins(self, piles: List[int]) -> int: piles.sort() max_coin, n = 0, len(piles) for i in range(n//3, n, 2): max_coin += piles[i] return max_coin
class Solution: def max_coins(self, piles: List[int]) -> int: piles.sort() (max_coin, n) = (0, len(piles)) for i in range(n // 3, n, 2): max_coin += piles[i] return max_coin
#Antonio Karlo Mijares #ICS4U-01 #November 24 2016 #1D_2D_arrays.py #Creates 1D arrays, for the variables to be placed in characteristics = [] num = [] #Creates a percentage value for the numbers to be calculated with base = 20 percentage = 100 #2d Arrays #Ugly Arrays ugly_one_D = [] ugly_one_D_two = [] ugly_two_D = [] #Nice Array nice_two_D = [] #Sets the default file name to be open filename = ('character') #Strength function that will write to a 1D Array def strength(): #Opens the file with open(str(filename)+'.txt','r') as s: #Reads the file into a list line = s.read().splitlines() #Strips a part from the selected section name = line[3].strip(': 17') number = line[3].strip('Strength: ') #Appends the info to the 1D Arrays characteristics.append(name) num.append(number) #Constitution function that will write to a 1D Array def constitution(): #Opens the file with open(str(filename)+'.txt','r') as s: #Reads the file into a list line = s.read().splitlines() #Strips a part from the selected section name = line[4].strip(': 10') number = line[4].strip('Constitution: ') #Appends the info to the 1D Arrays characteristics.append(name) num.append(number) #Dexerity function that will write to a 1D Array def dexerity(): with open(str(filename)+'.txt','r') as s: #Reads the file into a list line = s.read().splitlines() #Strips a part from the selected section name = line[5].strip(': 8') number = line[5].strip('Dexerity: ') characteristics.append(name) num.append(number) #Intelligence function that will write to def intelligence(): with open(str(filename)+'.txt','r') as s: #Reads the file into a list line = s.read().splitlines() #Strips a part from the selected section name = line[6].strip(': 19') number = line[6].strip('Intelligence: ') #Appends the info to the 1D Arrays characteristics.append(name) num.append(number) #Wisdom function that will write to def wisdom(): with open(str(filename)+'.txt','r') as s: #Reads the file into a list line = s.read().splitlines() #Strips a part from the selected section name = line[7].strip(': 2') number = line[7].strip('Wisdom: ') #Appends the info to the 1D Arrays characteristics.append(name) num.append(number) #Charisma function that will write to def charisma(): with open(str(filename)+'.txt','r') as s: #Reads the file into a list line = s.read().splitlines() #Strips a part from the selected section name = line[8].strip(': 9') number = line[8].strip('Charisma: ') #Appends the info to the 1D Arrays characteristics.append(name) num.append(number) #2d function Array that creates the 2D Array (Nice Way) def real_two_d(nice_two_D): nice_two_D = [characteristics,num] for row in nice_two_D: for element in row: print(element, end=" ") print() return nice_two_D #2d function Array that creates the 2D Array (UGLY Way) def notreal_two_d(ugly_two_D): ugly_two_D = [characteristics,num] return ugly_two_D #Percentage function calculation that determines the #percentage for each stat def percentagecalc(): #Converts the number into a interger #Then divides it by base to be multiplied by 100 strengthpercent = int(num[0]) / base * percentage constitutionpercent = int(num[1]) / base * percentage dexeritypercent = int(num[2]) / base * percentage intelligencepercent = int(num[3]) / base * percentage wisdompercent = int(num[4]) / base * percentage charismapercent = int(num[5]) / base * percentage #Displays the percentage results print('') print('Strength: '+ str(strengthpercent)+'%') print('Constitution: '+ str(constitutionpercent)+'%') print('Dexerity: '+ str(dexeritypercent)+'%') print('Intelligence: '+ str(intelligencepercent)+'%') print('Wisdom: '+ str(wisdompercent)+'%') print('Charisma: '+ str(charismapercent)+'%') menu = True #Runs the menu loop while menu: #Menu Screen print('') print('Welcome to the 2D Array Creation!') print('Press:') print('S to start') print('H for help') print('Q to quit') #Waits for player input menuinput = input('Response: ') #States if user inputs s if (menuinput == 's') or (menuinput == 'S'): #Runs the 1D array functions strength() constitution() dexerity() intelligence() wisdom() charisma() #Runs the percentage function percentagecalc() #Runs the ugly 2d function uglytwo_d= notreal_two_d(ugly_two_D) #Displays the ugly 2d function print('') print('Ugly Two D Array:') print(uglytwo_d) print('') print('Nice Two D Array: ') #Runs the nice 2d function nice_two_D2= real_two_d(nice_two_D) #Displays the nice 2d function #print('Nice Two D Array:') #print(nice_two_D2) #States if user inputs h elif (menuinput == 'h') or (menuinput == 'H'): print('') print('This program creates a 2D array') print('') helpinput = input('Press Enter to continue.') #States if user inputs q elif (menuinput == 'q') or (menuinput == 'Q'): #Quits the program print('') print('You hage quit the program') print('Have a nice day!') menu = False #States if user inputs anything else else: #Error screen print("Sorry, that's an invalid input!")
characteristics = [] num = [] base = 20 percentage = 100 ugly_one_d = [] ugly_one_d_two = [] ugly_two_d = [] nice_two_d = [] filename = 'character' def strength(): with open(str(filename) + '.txt', 'r') as s: line = s.read().splitlines() name = line[3].strip(': 17') number = line[3].strip('Strength: ') characteristics.append(name) num.append(number) def constitution(): with open(str(filename) + '.txt', 'r') as s: line = s.read().splitlines() name = line[4].strip(': 10') number = line[4].strip('Constitution: ') characteristics.append(name) num.append(number) def dexerity(): with open(str(filename) + '.txt', 'r') as s: line = s.read().splitlines() name = line[5].strip(': 8') number = line[5].strip('Dexerity: ') characteristics.append(name) num.append(number) def intelligence(): with open(str(filename) + '.txt', 'r') as s: line = s.read().splitlines() name = line[6].strip(': 19') number = line[6].strip('Intelligence: ') characteristics.append(name) num.append(number) def wisdom(): with open(str(filename) + '.txt', 'r') as s: line = s.read().splitlines() name = line[7].strip(': 2') number = line[7].strip('Wisdom: ') characteristics.append(name) num.append(number) def charisma(): with open(str(filename) + '.txt', 'r') as s: line = s.read().splitlines() name = line[8].strip(': 9') number = line[8].strip('Charisma: ') characteristics.append(name) num.append(number) def real_two_d(nice_two_D): nice_two_d = [characteristics, num] for row in nice_two_D: for element in row: print(element, end=' ') print() return nice_two_D def notreal_two_d(ugly_two_D): ugly_two_d = [characteristics, num] return ugly_two_D def percentagecalc(): strengthpercent = int(num[0]) / base * percentage constitutionpercent = int(num[1]) / base * percentage dexeritypercent = int(num[2]) / base * percentage intelligencepercent = int(num[3]) / base * percentage wisdompercent = int(num[4]) / base * percentage charismapercent = int(num[5]) / base * percentage print('') print('Strength: ' + str(strengthpercent) + '%') print('Constitution: ' + str(constitutionpercent) + '%') print('Dexerity: ' + str(dexeritypercent) + '%') print('Intelligence: ' + str(intelligencepercent) + '%') print('Wisdom: ' + str(wisdompercent) + '%') print('Charisma: ' + str(charismapercent) + '%') menu = True while menu: print('') print('Welcome to the 2D Array Creation!') print('Press:') print('S to start') print('H for help') print('Q to quit') menuinput = input('Response: ') if menuinput == 's' or menuinput == 'S': strength() constitution() dexerity() intelligence() wisdom() charisma() percentagecalc() uglytwo_d = notreal_two_d(ugly_two_D) print('') print('Ugly Two D Array:') print(uglytwo_d) print('') print('Nice Two D Array: ') nice_two_d2 = real_two_d(nice_two_D) elif menuinput == 'h' or menuinput == 'H': print('') print('This program creates a 2D array') print('') helpinput = input('Press Enter to continue.') elif menuinput == 'q' or menuinput == 'Q': print('') print('You hage quit the program') print('Have a nice day!') menu = False else: print("Sorry, that's an invalid input!")
kamus = {"elephant" : "gajah", "zebra" : "zebra", "dog" : "anjing", "camel" : "unta"} kata = input("Masukan kata berbahasa inggris : ") if kata in kamus: print("Terjemahan dari " + kata + " adalah " + kamus[kata]) else: print("Kata tersebt belum ada di kamus")
kamus = {'elephant': 'gajah', 'zebra': 'zebra', 'dog': 'anjing', 'camel': 'unta'} kata = input('Masukan kata berbahasa inggris : ') if kata in kamus: print('Terjemahan dari ' + kata + ' adalah ' + kamus[kata]) else: print('Kata tersebt belum ada di kamus')
# -*- coding: utf-8 -*- ''' nbpkg defspec ''' NBPKG_MAGIC_NUMBER = b'\x1f\x8b' NBPKG_HEADER_MAGIC_NUMBER = '\037\213' NBPKGINFO_MIN_NUMBER = 1000 NBPKGINFO_MAX_NUMBER = 1146 # data types definition NBPKG_DATA_TYPE_NULL = 0 NBPKG_DATA_TYPE_CHAR = 1 NBPKG_DATA_TYPE_INT8 = 2 NBPKG_DATA_TYPE_INT16 = 3 NBPKG_DATA_TYPE_INT32 = 4 NBPKG_DATA_TYPE_INT64 = 5 NBPKG_DATA_TYPE_STRING = 6 NBPKG_DATA_TYPE_BIN = 7 NBPKG_DATA_TYPE_STRING_ARRAY = 8 NBPKG_DATA_TYPE_I18NSTRING_TYPE = 9 NBPKG_DATA_TYPES = (NBPKG_DATA_TYPE_NULL, NBPKG_DATA_TYPE_CHAR, NBPKG_DATA_TYPE_INT8, NBPKG_DATA_TYPE_INT16, NBPKG_DATA_TYPE_INT32, NBPKG_DATA_TYPE_INT64, NBPKG_DATA_TYPE_STRING, NBPKG_DATA_TYPE_BIN, NBPKG_DATA_TYPE_STRING_ARRAY,) NBPKGINFO_DISTNAME = 1000 NBPKGINFO_PKGNAME = 1000 NBPKGINFO_CATEGORY = 1000 NBPKGINFO_MAINTAINER = 1000 NBPKGINFO_HOMEPAGE = 1020 NBPKGINFO_COMMENT = 1000 NBPKGINFO_LICENSE = 1000 NBPKGINFO_VERSION = 1001 NBPKGINFO_RELEASE = 1002 NBPKGINFO_DESCRIPTION = 1005 NBPKGINFO_LONG_DESCRIPTION = 1005 NBPKGINFO_OS_VERSION = 1000 NBPKGINFO_COPYRIGHT = 1014 NBPKGINFO_SIZE_PKG = 1000 NBPKGINFO_MACHINE_ARCH = 1022 NBPKGINFOS = ( NBPKGINFO_DISTNAME, NBPKGINFO_PKGNAME, NBPKGINFO_CATEGORY, NBPKGINFO_MAINTAINER, NBPKGINFO_HOMEPAGE, NBPKGINFO_COMMENT, NBPKGINFO_LICENSE, NBPKGINFO_VERSION, NBPKGINFO_RELEASE, NBPKGINFO_LONG_DESCRIPTION, NBPKGINFO_OS_VERSION, NBPKGINFO_SIZE_PKG, NBPKGINFO_MACHINE_ARCH, ) NBPKG_HEADER_BASIC_FILES = dict() NBPKG_HEADER_BASIC_FILES = { 'NBPKG_BUILD_INFO':'+BUILD_INFO', 'NBPKG_BUILD_VERSION':'+BUILD_VERSION', 'NBPKG_COMMENT':'+COMMENT', 'NBPKG_CONTENTS':'+CONTENTS', 'NBPKG_DESC':'+DESC', 'NBPKG_SIZE_ALL':'+SIZE_ALL', 'NBPKG_SIZE_PKG':'+SIZE_PKG', }
""" nbpkg defspec """ nbpkg_magic_number = b'\x1f\x8b' nbpkg_header_magic_number = '\x1f\x8b' nbpkginfo_min_number = 1000 nbpkginfo_max_number = 1146 nbpkg_data_type_null = 0 nbpkg_data_type_char = 1 nbpkg_data_type_int8 = 2 nbpkg_data_type_int16 = 3 nbpkg_data_type_int32 = 4 nbpkg_data_type_int64 = 5 nbpkg_data_type_string = 6 nbpkg_data_type_bin = 7 nbpkg_data_type_string_array = 8 nbpkg_data_type_i18_nstring_type = 9 nbpkg_data_types = (NBPKG_DATA_TYPE_NULL, NBPKG_DATA_TYPE_CHAR, NBPKG_DATA_TYPE_INT8, NBPKG_DATA_TYPE_INT16, NBPKG_DATA_TYPE_INT32, NBPKG_DATA_TYPE_INT64, NBPKG_DATA_TYPE_STRING, NBPKG_DATA_TYPE_BIN, NBPKG_DATA_TYPE_STRING_ARRAY) nbpkginfo_distname = 1000 nbpkginfo_pkgname = 1000 nbpkginfo_category = 1000 nbpkginfo_maintainer = 1000 nbpkginfo_homepage = 1020 nbpkginfo_comment = 1000 nbpkginfo_license = 1000 nbpkginfo_version = 1001 nbpkginfo_release = 1002 nbpkginfo_description = 1005 nbpkginfo_long_description = 1005 nbpkginfo_os_version = 1000 nbpkginfo_copyright = 1014 nbpkginfo_size_pkg = 1000 nbpkginfo_machine_arch = 1022 nbpkginfos = (NBPKGINFO_DISTNAME, NBPKGINFO_PKGNAME, NBPKGINFO_CATEGORY, NBPKGINFO_MAINTAINER, NBPKGINFO_HOMEPAGE, NBPKGINFO_COMMENT, NBPKGINFO_LICENSE, NBPKGINFO_VERSION, NBPKGINFO_RELEASE, NBPKGINFO_LONG_DESCRIPTION, NBPKGINFO_OS_VERSION, NBPKGINFO_SIZE_PKG, NBPKGINFO_MACHINE_ARCH) nbpkg_header_basic_files = dict() nbpkg_header_basic_files = {'NBPKG_BUILD_INFO': '+BUILD_INFO', 'NBPKG_BUILD_VERSION': '+BUILD_VERSION', 'NBPKG_COMMENT': '+COMMENT', 'NBPKG_CONTENTS': '+CONTENTS', 'NBPKG_DESC': '+DESC', 'NBPKG_SIZE_ALL': '+SIZE_ALL', 'NBPKG_SIZE_PKG': '+SIZE_PKG'}
#Write a program which can compute the factorial of a given numbers. #The results should be printed in a comma-separated sequence on a single line number=int(input("Please Enter factorial Number: ")) j=1 fact = 1 for i in range(number,0,-1): fact =fact*i print(fact)
number = int(input('Please Enter factorial Number: ')) j = 1 fact = 1 for i in range(number, 0, -1): fact = fact * i print(fact)
##Write a program to input from the input file a familiar greeting of any length, each word on a line. Output the greeting file you just received on a single line, the words separated by a space #Mo file voi mode='r' de doc file with open('05_ip.txt', 'r') as fileInp: #Dung ham read() doc toan bo du lieu tu file Filecomplete = fileInp.read() #Dung ham splitlines() cat du lieu theo tung dong va luu thanh danh sach listOfligne = Filecomplete.splitlines() #Dung ham join() noi cac dong du lieu lai cach nhau 1 khoang trang phrasecomplete = ' '.join(listOfligne) print(phrasecomplete) #Mo file voi mode='w' de ghi file with open('05_out.txt', 'w') as fileOut: #Ghi noi dung vao file fileOut.write(phrasecomplete)
with open('05_ip.txt', 'r') as file_inp: filecomplete = fileInp.read() list_ofligne = Filecomplete.splitlines() phrasecomplete = ' '.join(listOfligne) print(phrasecomplete) with open('05_out.txt', 'w') as file_out: fileOut.write(phrasecomplete)
def fuel_required_single_module(mass): fuel = int(mass / 3) - 2 return fuel if fuel > 0 else 0 def fuel_required_multiple_modules(masses): total_fuel = 0 for mass in masses: total_fuel += fuel_required_single_module(mass) return total_fuel def recursive_fuel_required_single_module(mass): total_fuel = 0 while mass := fuel_required_single_module(mass): total_fuel += mass return total_fuel def recursive_fuel_required_multiple_modules(masses): total_fuel = 0 for mass in masses: total_fuel += recursive_fuel_required_single_module(mass) return total_fuel
def fuel_required_single_module(mass): fuel = int(mass / 3) - 2 return fuel if fuel > 0 else 0 def fuel_required_multiple_modules(masses): total_fuel = 0 for mass in masses: total_fuel += fuel_required_single_module(mass) return total_fuel def recursive_fuel_required_single_module(mass): total_fuel = 0 while (mass := fuel_required_single_module(mass)): total_fuel += mass return total_fuel def recursive_fuel_required_multiple_modules(masses): total_fuel = 0 for mass in masses: total_fuel += recursive_fuel_required_single_module(mass) return total_fuel
str_xdigits = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", ] def convert_digit(value: int, base: int) -> str: return str_xdigits[value % base] def convert_to_val(value: int, base: int) -> str: if value == None: return "Error" current = int(value) result = "" while current != 0: result = result + convert_digit(current, base) current = current // base if len(result) == 0: return "0" return result[::-1] # reverse string def val_to_hex(value: int) -> str: return "0x" + convert_to_val(value, 16) def val_to_bin(value: int) -> str: return "0b" + convert_to_val(value, 2) def val_to_dec(value: int) -> str: return convert_to_val(value, 10) def val_from_str(value: str, base: int) -> int: value = value.lower() result = 0 for c in value: if c not in str_xdigits or int(str_xdigits.index(c)) >= base: return None result = result * base + str_xdigits.index(c) return result def val_from_hex(value: str) -> int: return val_from_str(value.removeprefix("0x"), 16) def val_from_bin(value: str) -> int: return val_from_str(value.removeprefix("0b"), 2) def val_from_dec(value: str) -> int: return val_from_str(value, 10)
str_xdigits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'] def convert_digit(value: int, base: int) -> str: return str_xdigits[value % base] def convert_to_val(value: int, base: int) -> str: if value == None: return 'Error' current = int(value) result = '' while current != 0: result = result + convert_digit(current, base) current = current // base if len(result) == 0: return '0' return result[::-1] def val_to_hex(value: int) -> str: return '0x' + convert_to_val(value, 16) def val_to_bin(value: int) -> str: return '0b' + convert_to_val(value, 2) def val_to_dec(value: int) -> str: return convert_to_val(value, 10) def val_from_str(value: str, base: int) -> int: value = value.lower() result = 0 for c in value: if c not in str_xdigits or int(str_xdigits.index(c)) >= base: return None result = result * base + str_xdigits.index(c) return result def val_from_hex(value: str) -> int: return val_from_str(value.removeprefix('0x'), 16) def val_from_bin(value: str) -> int: return val_from_str(value.removeprefix('0b'), 2) def val_from_dec(value: str) -> int: return val_from_str(value, 10)
class SimpleOpt(): def __init__(self): self.method = 'cpgan' self.max_epochs = 100 self.graph_type = 'ENZYMES' self.data_dir = './data/facebook.graphs' self.gpu = '2' self.lr = 0.003 self.encode_size = 16 self.decode_size = 16 self.pool_size = 10 self.epochs_log = 1 self.batch_size = 8 self.random_seed = 123 self.gen_times = 10 self.gen_gamma = 10 self.milestones = [4000, 8000, 12000] class Options(): def __init__(self): self.opt_type = 'simple' # self.opt_type = 'argparser' @staticmethod def initialize(epoch_num=180): opt = SimpleOpt() opt.max_epochs = epoch_num return opt
class Simpleopt: def __init__(self): self.method = 'cpgan' self.max_epochs = 100 self.graph_type = 'ENZYMES' self.data_dir = './data/facebook.graphs' self.gpu = '2' self.lr = 0.003 self.encode_size = 16 self.decode_size = 16 self.pool_size = 10 self.epochs_log = 1 self.batch_size = 8 self.random_seed = 123 self.gen_times = 10 self.gen_gamma = 10 self.milestones = [4000, 8000, 12000] class Options: def __init__(self): self.opt_type = 'simple' @staticmethod def initialize(epoch_num=180): opt = simple_opt() opt.max_epochs = epoch_num return opt
# What will the gender ratio be after every family stops having children after # after they have a girl and not until then. def birth_ratio(): # Everytime a child is born, there is a 0.5 chance of the baby being male # and 0.5 chance of the baby being a girl. So the ratio is 1:1. return 1
def birth_ratio(): return 1
# You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are(i, 0) and (i, height[i]). # Find two lines that together with the x-axis form a container, such that the container contains the most water. # Return the maximum amount of water a container can store. # Notice that you may not slant the container. # Example 1: # Input: height = [1, 8, 6, 2, 5, 4, 8, 3, 7] # Output: 49 # Explanation: The above vertical lines are represented by array[1, 8, 6, 2, 5, 4, 8, 3, 7]. In this case, the max area of water(blue section) the container can contain is 49. # Example 2: # Input: height = [1, 1] # Output: 1 class Solution: def maxArea(self, height: List[int]) -> int: left, right = 0, len(height)-1 result = 0 while left < right: water = (right-left) * min(height[left], height[right]) if water > result: result = water if height[left] < height[right]: left += 1 else: right -= 1 return result
class Solution: def max_area(self, height: List[int]) -> int: (left, right) = (0, len(height) - 1) result = 0 while left < right: water = (right - left) * min(height[left], height[right]) if water > result: result = water if height[left] < height[right]: left += 1 else: right -= 1 return result
# server backend server = 'cherrypy' # debug error messages debug = False # auto-reload reloader = False # database url db_url = 'postgresql://user:pass@localhost/dbname' # echo database engine messages db_echo = False
server = 'cherrypy' debug = False reloader = False db_url = 'postgresql://user:pass@localhost/dbname' db_echo = False
#decorators def decorator(myfunc): def wrapper(*args): return myfunc(*args) return wrapper @decorator def display(): print('display function') @decorator def info(name, age): print('name is {} and age is {}'.format(name,age)) info('john', 23) #hi = decorator(display) #hi() display()
def decorator(myfunc): def wrapper(*args): return myfunc(*args) return wrapper @decorator def display(): print('display function') @decorator def info(name, age): print('name is {} and age is {}'.format(name, age)) info('john', 23) display()
def connected_tree(n, edge_list): current_edges = len(edge_list) edges_needed = (n-1) - current_edges return edges_needed def main(): with open('datasets/rosalind_tree.txt') as input_file: input_data = input_file.read().strip().split('\n') n = int(input_data.pop(0)) edge_list = list(map(int,edge.split()) for edge in input_data) edges_needed = connected_tree(n, edge_list) print(str(edges_needed)) with open('solutions/rosalind_tree.txt', 'w') as output_file: output_file.write(str(edges_needed)) if(__name__=='__main__'): main()
def connected_tree(n, edge_list): current_edges = len(edge_list) edges_needed = n - 1 - current_edges return edges_needed def main(): with open('datasets/rosalind_tree.txt') as input_file: input_data = input_file.read().strip().split('\n') n = int(input_data.pop(0)) edge_list = list((map(int, edge.split()) for edge in input_data)) edges_needed = connected_tree(n, edge_list) print(str(edges_needed)) with open('solutions/rosalind_tree.txt', 'w') as output_file: output_file.write(str(edges_needed)) if __name__ == '__main__': main()
# Released under the MIT License. See LICENSE for details. # # This file was automatically generated from "rampage.ma" # pylint: disable=all points = {} # noinspection PyDictCreation boxes = {} boxes['area_of_interest_bounds'] = (0.3544110667, 5.616383286, -4.066055072) + (0.0, 0.0, 0.0) + ( 19.90053969, 10.34051135, 8.16221072) boxes['edge_box'] = (0.3544110667, 5.438284793, -4.100357672) + ( 0.0, 0.0, 0.0) + (12.57718032, 4.645176013, 3.605557343) points['ffa_spawn1'] = (0.5006944438, 5.051501304, -5.79356326) + (6.626174027, 1.0, 0.3402012662) points['ffa_spawn2'] = (0.5006944438, 5.051501304, -2.435321368) + (6.626174027, 1.0, 0.3402012662) points['flag1'] = (-5.885814199, 5.112162255, -4.251754911) points['flag2'] = (6.700855451, 5.10270501, -4.259912982) points['flag_default'] = (0.3196701116, 5.110914413, -4.292515158) boxes['map_bounds'] = (0.4528955042, 4.899663734, -3.543675157) + ( 0.0, 0.0, 0.0) + (23.54502348, 14.19991443, 12.08017448) points['powerup_spawn1'] = (-2.645358507, 6.426340583, -4.226597191) points['powerup_spawn2'] = (3.540102796, 6.549722855, -4.198476335) points['shadow_lower_bottom'] = (5.580073911, 3.136491026, 5.341226521) points['shadow_lower_top'] = (5.580073911, 4.321758709, 5.341226521) points['shadow_upper_bottom'] = (5.274539479, 8.425373402, 5.341226521) points['shadow_upper_top'] = (5.274539479, 11.93458162, 5.341226521) points['spawn1'] = (-4.745706238, 5.051501304, -4.247934288) + (0.9186962739, 1.0, 0.5153189341) points['spawn2'] = (5.838590388, 5.051501304, -4.259627405) + (0.9186962739, 1.0, 0.5153189341)
points = {} boxes = {} boxes['area_of_interest_bounds'] = (0.3544110667, 5.616383286, -4.066055072) + (0.0, 0.0, 0.0) + (19.90053969, 10.34051135, 8.16221072) boxes['edge_box'] = (0.3544110667, 5.438284793, -4.100357672) + (0.0, 0.0, 0.0) + (12.57718032, 4.645176013, 3.605557343) points['ffa_spawn1'] = (0.5006944438, 5.051501304, -5.79356326) + (6.626174027, 1.0, 0.3402012662) points['ffa_spawn2'] = (0.5006944438, 5.051501304, -2.435321368) + (6.626174027, 1.0, 0.3402012662) points['flag1'] = (-5.885814199, 5.112162255, -4.251754911) points['flag2'] = (6.700855451, 5.10270501, -4.259912982) points['flag_default'] = (0.3196701116, 5.110914413, -4.292515158) boxes['map_bounds'] = (0.4528955042, 4.899663734, -3.543675157) + (0.0, 0.0, 0.0) + (23.54502348, 14.19991443, 12.08017448) points['powerup_spawn1'] = (-2.645358507, 6.426340583, -4.226597191) points['powerup_spawn2'] = (3.540102796, 6.549722855, -4.198476335) points['shadow_lower_bottom'] = (5.580073911, 3.136491026, 5.341226521) points['shadow_lower_top'] = (5.580073911, 4.321758709, 5.341226521) points['shadow_upper_bottom'] = (5.274539479, 8.425373402, 5.341226521) points['shadow_upper_top'] = (5.274539479, 11.93458162, 5.341226521) points['spawn1'] = (-4.745706238, 5.051501304, -4.247934288) + (0.9186962739, 1.0, 0.5153189341) points['spawn2'] = (5.838590388, 5.051501304, -4.259627405) + (0.9186962739, 1.0, 0.5153189341)
# # PySNMP MIB module HPN-ICF-8021PAE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-8021PAE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:24:57 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") ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint") hpnicfRhw, = mibBuilder.importSymbols("HPN-ICF-OID-MIB", "hpnicfRhw") dot1xPaePortNumber, = mibBuilder.importSymbols("IEEE8021-PAE-MIB", "dot1xPaePortNumber") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Integer32, Bits, Counter64, Unsigned32, Counter32, ObjectIdentity, iso, NotificationType, MibIdentifier, Gauge32, IpAddress, TimeTicks, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "Bits", "Counter64", "Unsigned32", "Counter32", "ObjectIdentity", "iso", "NotificationType", "MibIdentifier", "Gauge32", "IpAddress", "TimeTicks", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TextualConvention, MacAddress, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "MacAddress", "DisplayString") hpnicfpaeExtMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6)) hpnicfpaeExtMib.setRevisions(('2001-06-29 00:00',)) if mibBuilder.loadTexts: hpnicfpaeExtMib.setLastUpdated('200106290000Z') if mibBuilder.loadTexts: hpnicfpaeExtMib.setOrganization('') hpnicfpaeExtMibObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1)) hpnicfdot1xPaeSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1)) hpnicfdot1xPaeAuthenticator = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2)) hpnicfdot1xAuthQuietPeriod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 1), Unsigned32().clone(60)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xAuthQuietPeriod.setStatus('current') hpnicfdot1xAuthTxPeriod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 2), Unsigned32().clone(30)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xAuthTxPeriod.setStatus('current') hpnicfdot1xAuthSuppTimeout = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 3), Unsigned32().clone(30)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xAuthSuppTimeout.setStatus('current') hpnicfdot1xAuthServerTimeout = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 4), Unsigned32().clone(100)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xAuthServerTimeout.setStatus('current') hpnicfdot1xAuthMaxReq = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 5), Unsigned32().clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xAuthMaxReq.setStatus('current') hpnicfdot1xAuthReAuthPeriod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 6), Unsigned32().clone(3600)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xAuthReAuthPeriod.setStatus('current') hpnicfdot1xAuthMethod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("chap", 1), ("pap", 2), ("eap", 3))).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xAuthMethod.setStatus('current') hpnicfdot1xAuthConfigExtTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1), ) if mibBuilder.loadTexts: hpnicfdot1xAuthConfigExtTable.setStatus('current') hpnicfdot1xAuthConfigExtEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1), ).setIndexNames((0, "IEEE8021-PAE-MIB", "dot1xPaePortNumber")) if mibBuilder.loadTexts: hpnicfdot1xAuthConfigExtEntry.setStatus('current') hpnicfdot1xpaeportAuthAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xpaeportAuthAdminStatus.setStatus('current') hpnicfdot1xpaeportControlledType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("port", 1), ("mac", 2))).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xpaeportControlledType.setStatus('current') hpnicfdot1xpaeportMaxUserNum = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 3), Integer32().clone(256)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xpaeportMaxUserNum.setStatus('current') hpnicfdot1xpaeportUserNumNow = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfdot1xpaeportUserNumNow.setStatus('current') hpnicfdot1xpaeportClearStatistics = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("clear", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xpaeportClearStatistics.setStatus('current') hpnicfdot1xpaeportMcastTrigStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xpaeportMcastTrigStatus.setStatus('current') hpnicfdot1xpaeportHandshakeStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfdot1xpaeportHandshakeStatus.setStatus('current') hpnicfdot1xPaeTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0)) hpnicfsupplicantproxycheck = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 1)).setObjects(("HPN-ICF-8021PAE-MIB", "hpnicfproxycheckVlanId"), ("HPN-ICF-8021PAE-MIB", "hpnicfproxycheckPortName"), ("HPN-ICF-8021PAE-MIB", "hpnicfproxycheckMacAddr"), ("HPN-ICF-8021PAE-MIB", "hpnicfproxycheckIpaddr"), ("HPN-ICF-8021PAE-MIB", "hpnicfproxycheckUsrName")) if mibBuilder.loadTexts: hpnicfsupplicantproxycheck.setStatus('current') hpnicfproxycheckVlanId = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 2), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfproxycheckVlanId.setStatus('current') hpnicfproxycheckPortName = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 3), OctetString()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfproxycheckPortName.setStatus('current') hpnicfproxycheckMacAddr = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 4), MacAddress()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfproxycheckMacAddr.setStatus('current') hpnicfproxycheckIpaddr = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 5), IpAddress()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfproxycheckIpaddr.setStatus('current') hpnicfproxycheckUsrName = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 6), OctetString()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfproxycheckUsrName.setStatus('current') mibBuilder.exportSymbols("HPN-ICF-8021PAE-MIB", hpnicfpaeExtMibObjects=hpnicfpaeExtMibObjects, hpnicfpaeExtMib=hpnicfpaeExtMib, hpnicfdot1xAuthServerTimeout=hpnicfdot1xAuthServerTimeout, hpnicfproxycheckUsrName=hpnicfproxycheckUsrName, hpnicfsupplicantproxycheck=hpnicfsupplicantproxycheck, hpnicfproxycheckMacAddr=hpnicfproxycheckMacAddr, PYSNMP_MODULE_ID=hpnicfpaeExtMib, hpnicfdot1xAuthMethod=hpnicfdot1xAuthMethod, hpnicfdot1xpaeportMcastTrigStatus=hpnicfdot1xpaeportMcastTrigStatus, hpnicfdot1xPaeAuthenticator=hpnicfdot1xPaeAuthenticator, hpnicfdot1xPaeSystem=hpnicfdot1xPaeSystem, hpnicfdot1xPaeTraps=hpnicfdot1xPaeTraps, hpnicfdot1xAuthReAuthPeriod=hpnicfdot1xAuthReAuthPeriod, hpnicfdot1xAuthConfigExtEntry=hpnicfdot1xAuthConfigExtEntry, hpnicfdot1xpaeportControlledType=hpnicfdot1xpaeportControlledType, hpnicfdot1xAuthSuppTimeout=hpnicfdot1xAuthSuppTimeout, hpnicfproxycheckVlanId=hpnicfproxycheckVlanId, hpnicfdot1xpaeportClearStatistics=hpnicfdot1xpaeportClearStatistics, hpnicfdot1xAuthTxPeriod=hpnicfdot1xAuthTxPeriod, hpnicfdot1xAuthMaxReq=hpnicfdot1xAuthMaxReq, hpnicfproxycheckIpaddr=hpnicfproxycheckIpaddr, hpnicfproxycheckPortName=hpnicfproxycheckPortName, hpnicfdot1xAuthConfigExtTable=hpnicfdot1xAuthConfigExtTable, hpnicfdot1xpaeportUserNumNow=hpnicfdot1xpaeportUserNumNow, hpnicfdot1xpaeportMaxUserNum=hpnicfdot1xpaeportMaxUserNum, hpnicfdot1xAuthQuietPeriod=hpnicfdot1xAuthQuietPeriod, hpnicfdot1xpaeportHandshakeStatus=hpnicfdot1xpaeportHandshakeStatus, hpnicfdot1xpaeportAuthAdminStatus=hpnicfdot1xpaeportAuthAdminStatus)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint') (hpnicf_rhw,) = mibBuilder.importSymbols('HPN-ICF-OID-MIB', 'hpnicfRhw') (dot1x_pae_port_number,) = mibBuilder.importSymbols('IEEE8021-PAE-MIB', 'dot1xPaePortNumber') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (integer32, bits, counter64, unsigned32, counter32, object_identity, iso, notification_type, mib_identifier, gauge32, ip_address, time_ticks, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'Bits', 'Counter64', 'Unsigned32', 'Counter32', 'ObjectIdentity', 'iso', 'NotificationType', 'MibIdentifier', 'Gauge32', 'IpAddress', 'TimeTicks', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn') (textual_convention, mac_address, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'MacAddress', 'DisplayString') hpnicfpae_ext_mib = module_identity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6)) hpnicfpaeExtMib.setRevisions(('2001-06-29 00:00',)) if mibBuilder.loadTexts: hpnicfpaeExtMib.setLastUpdated('200106290000Z') if mibBuilder.loadTexts: hpnicfpaeExtMib.setOrganization('') hpnicfpae_ext_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1)) hpnicfdot1x_pae_system = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1)) hpnicfdot1x_pae_authenticator = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2)) hpnicfdot1x_auth_quiet_period = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 1), unsigned32().clone(60)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xAuthQuietPeriod.setStatus('current') hpnicfdot1x_auth_tx_period = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 2), unsigned32().clone(30)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xAuthTxPeriod.setStatus('current') hpnicfdot1x_auth_supp_timeout = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 3), unsigned32().clone(30)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xAuthSuppTimeout.setStatus('current') hpnicfdot1x_auth_server_timeout = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 4), unsigned32().clone(100)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xAuthServerTimeout.setStatus('current') hpnicfdot1x_auth_max_req = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 5), unsigned32().clone(2)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xAuthMaxReq.setStatus('current') hpnicfdot1x_auth_re_auth_period = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 6), unsigned32().clone(3600)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xAuthReAuthPeriod.setStatus('current') hpnicfdot1x_auth_method = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('chap', 1), ('pap', 2), ('eap', 3))).clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xAuthMethod.setStatus('current') hpnicfdot1x_auth_config_ext_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1)) if mibBuilder.loadTexts: hpnicfdot1xAuthConfigExtTable.setStatus('current') hpnicfdot1x_auth_config_ext_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1)).setIndexNames((0, 'IEEE8021-PAE-MIB', 'dot1xPaePortNumber')) if mibBuilder.loadTexts: hpnicfdot1xAuthConfigExtEntry.setStatus('current') hpnicfdot1xpaeport_auth_admin_status = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone(2)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xpaeportAuthAdminStatus.setStatus('current') hpnicfdot1xpaeport_controlled_type = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('port', 1), ('mac', 2))).clone(2)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xpaeportControlledType.setStatus('current') hpnicfdot1xpaeport_max_user_num = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 3), integer32().clone(256)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xpaeportMaxUserNum.setStatus('current') hpnicfdot1xpaeport_user_num_now = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfdot1xpaeportUserNumNow.setStatus('current') hpnicfdot1xpaeport_clear_statistics = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('clear', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xpaeportClearStatistics.setStatus('current') hpnicfdot1xpaeport_mcast_trig_status = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xpaeportMcastTrigStatus.setStatus('current') hpnicfdot1xpaeport_handshake_status = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 2, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfdot1xpaeportHandshakeStatus.setStatus('current') hpnicfdot1x_pae_traps = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0)) hpnicfsupplicantproxycheck = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 1)).setObjects(('HPN-ICF-8021PAE-MIB', 'hpnicfproxycheckVlanId'), ('HPN-ICF-8021PAE-MIB', 'hpnicfproxycheckPortName'), ('HPN-ICF-8021PAE-MIB', 'hpnicfproxycheckMacAddr'), ('HPN-ICF-8021PAE-MIB', 'hpnicfproxycheckIpaddr'), ('HPN-ICF-8021PAE-MIB', 'hpnicfproxycheckUsrName')) if mibBuilder.loadTexts: hpnicfsupplicantproxycheck.setStatus('current') hpnicfproxycheck_vlan_id = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 2), integer32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfproxycheckVlanId.setStatus('current') hpnicfproxycheck_port_name = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 3), octet_string()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfproxycheckPortName.setStatus('current') hpnicfproxycheck_mac_addr = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 4), mac_address()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfproxycheckMacAddr.setStatus('current') hpnicfproxycheck_ipaddr = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 5), ip_address()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfproxycheckIpaddr.setStatus('current') hpnicfproxycheck_usr_name = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 6, 1, 0, 6), octet_string()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfproxycheckUsrName.setStatus('current') mibBuilder.exportSymbols('HPN-ICF-8021PAE-MIB', hpnicfpaeExtMibObjects=hpnicfpaeExtMibObjects, hpnicfpaeExtMib=hpnicfpaeExtMib, hpnicfdot1xAuthServerTimeout=hpnicfdot1xAuthServerTimeout, hpnicfproxycheckUsrName=hpnicfproxycheckUsrName, hpnicfsupplicantproxycheck=hpnicfsupplicantproxycheck, hpnicfproxycheckMacAddr=hpnicfproxycheckMacAddr, PYSNMP_MODULE_ID=hpnicfpaeExtMib, hpnicfdot1xAuthMethod=hpnicfdot1xAuthMethod, hpnicfdot1xpaeportMcastTrigStatus=hpnicfdot1xpaeportMcastTrigStatus, hpnicfdot1xPaeAuthenticator=hpnicfdot1xPaeAuthenticator, hpnicfdot1xPaeSystem=hpnicfdot1xPaeSystem, hpnicfdot1xPaeTraps=hpnicfdot1xPaeTraps, hpnicfdot1xAuthReAuthPeriod=hpnicfdot1xAuthReAuthPeriod, hpnicfdot1xAuthConfigExtEntry=hpnicfdot1xAuthConfigExtEntry, hpnicfdot1xpaeportControlledType=hpnicfdot1xpaeportControlledType, hpnicfdot1xAuthSuppTimeout=hpnicfdot1xAuthSuppTimeout, hpnicfproxycheckVlanId=hpnicfproxycheckVlanId, hpnicfdot1xpaeportClearStatistics=hpnicfdot1xpaeportClearStatistics, hpnicfdot1xAuthTxPeriod=hpnicfdot1xAuthTxPeriod, hpnicfdot1xAuthMaxReq=hpnicfdot1xAuthMaxReq, hpnicfproxycheckIpaddr=hpnicfproxycheckIpaddr, hpnicfproxycheckPortName=hpnicfproxycheckPortName, hpnicfdot1xAuthConfigExtTable=hpnicfdot1xAuthConfigExtTable, hpnicfdot1xpaeportUserNumNow=hpnicfdot1xpaeportUserNumNow, hpnicfdot1xpaeportMaxUserNum=hpnicfdot1xpaeportMaxUserNum, hpnicfdot1xAuthQuietPeriod=hpnicfdot1xAuthQuietPeriod, hpnicfdot1xpaeportHandshakeStatus=hpnicfdot1xpaeportHandshakeStatus, hpnicfdot1xpaeportAuthAdminStatus=hpnicfdot1xpaeportAuthAdminStatus)
class SchemaError(Exception): def __init__(self, schema, code): self.schema = schema self.code = code msg = schema.errors[code].format(**schema.__dict__) super().__init__(msg) class NoCurrentApp(Exception): pass class ConfigurationError(Exception): pass
class Schemaerror(Exception): def __init__(self, schema, code): self.schema = schema self.code = code msg = schema.errors[code].format(**schema.__dict__) super().__init__(msg) class Nocurrentapp(Exception): pass class Configurationerror(Exception): pass
__author__ = "Wild Print" __maintainer__ = __author__ __email__ = "[email protected]" __license__ = "MIT" __version__ = "0.0.1" __all__ = ( "__author__", "__email__", "__license__", "__maintainer__", "__version__", )
__author__ = 'Wild Print' __maintainer__ = __author__ __email__ = '[email protected]' __license__ = 'MIT' __version__ = '0.0.1' __all__ = ('__author__', '__email__', '__license__', '__maintainer__', '__version__')
''' Created on Oct 10, 2012 @author: Brian Jimenez-Garcia @contact: [email protected] ''' class Color: def __init__(self, red=0., green=0., blue=0., alpha=1.0): self.__red = red self.__green = green self.__blue = blue self.__alpha = alpha def get_rgba(self): return self.__red, self.__green, self.__blue, self.__alpha def get_red(self): return self.__red def get_blue(self): return self.__blue def get_green(self): return self.__green def get_alpha(self): return self.__alpha # Useful predefined colors White = Color(1.0, 1.0, 1.0, 1.0) Black = Color(0.0, 0.0, 0.0, 1.0) Carbon = Color(0.17, 0.17, 0.18, 1.0) Red = Color(0.95, 0.03, 0.01, 1.0) Blue = Color(0.01, 0.03, 0.95, 1.0) Sky = Color(0.233, 0.686, 1.0, 1.0) Yellow = Color(1.0, 1.0, 0.0, 1.0) Green = Color(0.0, 0.53, 0.0, 1.0) Pink = Color(0.53, 0.12, 0.36, 1.0) DarkRed = Color(0.59, 0.13, 0.0, 1.0) Violet = Color(0.46, 0.0, 1.0, 1.0) DarkViolet = Color(0.39, 0.0, 0.73, 1.0) Cyan = Color(0.0, 1.0, 1.0, 1.0) Orange = Color(1.0, 0.59, 0.0, 1.0) Peach = Color(1.0, 0.66, 0.46, 1.0) DarkGreen = Color(0.0, 0.46, 0.0, 1.0) Gray = Color(0.59, 0.59, 0.59, 1.0) DarkOrange = Color(0.86, 0.46, 0.0, 1.0)
""" Created on Oct 10, 2012 @author: Brian Jimenez-Garcia @contact: [email protected] """ class Color: def __init__(self, red=0.0, green=0.0, blue=0.0, alpha=1.0): self.__red = red self.__green = green self.__blue = blue self.__alpha = alpha def get_rgba(self): return (self.__red, self.__green, self.__blue, self.__alpha) def get_red(self): return self.__red def get_blue(self): return self.__blue def get_green(self): return self.__green def get_alpha(self): return self.__alpha white = color(1.0, 1.0, 1.0, 1.0) black = color(0.0, 0.0, 0.0, 1.0) carbon = color(0.17, 0.17, 0.18, 1.0) red = color(0.95, 0.03, 0.01, 1.0) blue = color(0.01, 0.03, 0.95, 1.0) sky = color(0.233, 0.686, 1.0, 1.0) yellow = color(1.0, 1.0, 0.0, 1.0) green = color(0.0, 0.53, 0.0, 1.0) pink = color(0.53, 0.12, 0.36, 1.0) dark_red = color(0.59, 0.13, 0.0, 1.0) violet = color(0.46, 0.0, 1.0, 1.0) dark_violet = color(0.39, 0.0, 0.73, 1.0) cyan = color(0.0, 1.0, 1.0, 1.0) orange = color(1.0, 0.59, 0.0, 1.0) peach = color(1.0, 0.66, 0.46, 1.0) dark_green = color(0.0, 0.46, 0.0, 1.0) gray = color(0.59, 0.59, 0.59, 1.0) dark_orange = color(0.86, 0.46, 0.0, 1.0)
__COL_GOOD = '\033[32m' __COL_FAIL = '\033[31m' __COL_INFO = '\033[34m' __COL_BOLD = '\033[1m' __COL_ULIN = '\033[4m' __COL_ENDC = '\033[0m' def __TEST__(status, msg, color, args): args = ", ".join([str(key)+'='+str(args[key]) for key in args.keys()]) if args: args = "(" + args + ")" return "[{color}{status}{end}] {msg} {args}".format( color=color, status=status, end=__COL_ENDC, msg=msg, args=args ) def SUCCESS(test_name, **kwargs): msg = "Test {tname} passed.".format(tname=test_name) return __TEST__('PASS', msg, __COL_GOOD, kwargs) def FAILURE(test_name, **kwargs): msg = "Test {tname} failed.".format(tname=test_name) return __TEST__('FAIL', msg, __COL_FAIL, kwargs) def ANSI_wrapper(prefix): def inner(message): return prefix + message + __COL_ENDC return inner def truncate_repr(val, priority=None): if priority and isinstance(val, dict): val_copy = dict(val) output = '{' for k, v in priority.items(): output += "%s, %s" % (k, v) val_copy.pop(k) output += ", " + str(val_copy)[1:] else: output = str(val) if len(output) <= 64: return output output = output[:64] if isinstance(val, dict): output += "...}" elif isinstance(val, list): output += "...]" return output INFO = ANSI_wrapper(__COL_INFO) BOLD = ANSI_wrapper(__COL_BOLD) UNDERLINE = ANSI_wrapper(__COL_ULIN)
__col_good = '\x1b[32m' __col_fail = '\x1b[31m' __col_info = '\x1b[34m' __col_bold = '\x1b[1m' __col_ulin = '\x1b[4m' __col_endc = '\x1b[0m' def __test__(status, msg, color, args): args = ', '.join([str(key) + '=' + str(args[key]) for key in args.keys()]) if args: args = '(' + args + ')' return '[{color}{status}{end}] {msg} {args}'.format(color=color, status=status, end=__COL_ENDC, msg=msg, args=args) def success(test_name, **kwargs): msg = 'Test {tname} passed.'.format(tname=test_name) return __test__('PASS', msg, __COL_GOOD, kwargs) def failure(test_name, **kwargs): msg = 'Test {tname} failed.'.format(tname=test_name) return __test__('FAIL', msg, __COL_FAIL, kwargs) def ansi_wrapper(prefix): def inner(message): return prefix + message + __COL_ENDC return inner def truncate_repr(val, priority=None): if priority and isinstance(val, dict): val_copy = dict(val) output = '{' for (k, v) in priority.items(): output += '%s, %s' % (k, v) val_copy.pop(k) output += ', ' + str(val_copy)[1:] else: output = str(val) if len(output) <= 64: return output output = output[:64] if isinstance(val, dict): output += '...}' elif isinstance(val, list): output += '...]' return output info = ansi_wrapper(__COL_INFO) bold = ansi_wrapper(__COL_BOLD) underline = ansi_wrapper(__COL_ULIN)
def find_metric_transformation_by_name(metric_transformations, metric_name): for metric in metric_transformations: if metric["metricName"] == metric_name: return metric def find_metric_transformation_by_namespace(metric_transformations, metric_namespace): for metric in metric_transformations: if metric["metricNamespace"] == metric_namespace: return metric class MetricFilters: def __init__(self): self.metric_filters = [] def add_filter( self, filter_name, filter_pattern, log_group_name, metric_transformations ): self.metric_filters.append( { "filterName": filter_name, "filterPattern": filter_pattern, "logGroupName": log_group_name, "metricTransformations": metric_transformations, } ) def get_matching_filters( self, prefix=None, log_group_name=None, metric_name=None, metric_namespace=None ): result = [] for f in self.metric_filters: prefix_matches = prefix is None or f["filterName"].startswith(prefix) log_group_matches = ( log_group_name is None or f["logGroupName"] == log_group_name ) metric_name_matches = ( metric_name is None or find_metric_transformation_by_name( f["metricTransformations"], metric_name ) ) namespace_matches = ( metric_namespace is None or find_metric_transformation_by_namespace( f["metricTransformations"], metric_namespace ) ) if ( prefix_matches and log_group_matches and metric_name_matches and namespace_matches ): result.append(f) return result def delete_filter(self, filter_name=None, log_group_name=None): for f in self.metric_filters: if f["filterName"] == filter_name and f["logGroupName"] == log_group_name: self.metric_filters.remove(f) return self.metric_filters
def find_metric_transformation_by_name(metric_transformations, metric_name): for metric in metric_transformations: if metric['metricName'] == metric_name: return metric def find_metric_transformation_by_namespace(metric_transformations, metric_namespace): for metric in metric_transformations: if metric['metricNamespace'] == metric_namespace: return metric class Metricfilters: def __init__(self): self.metric_filters = [] def add_filter(self, filter_name, filter_pattern, log_group_name, metric_transformations): self.metric_filters.append({'filterName': filter_name, 'filterPattern': filter_pattern, 'logGroupName': log_group_name, 'metricTransformations': metric_transformations}) def get_matching_filters(self, prefix=None, log_group_name=None, metric_name=None, metric_namespace=None): result = [] for f in self.metric_filters: prefix_matches = prefix is None or f['filterName'].startswith(prefix) log_group_matches = log_group_name is None or f['logGroupName'] == log_group_name metric_name_matches = metric_name is None or find_metric_transformation_by_name(f['metricTransformations'], metric_name) namespace_matches = metric_namespace is None or find_metric_transformation_by_namespace(f['metricTransformations'], metric_namespace) if prefix_matches and log_group_matches and metric_name_matches and namespace_matches: result.append(f) return result def delete_filter(self, filter_name=None, log_group_name=None): for f in self.metric_filters: if f['filterName'] == filter_name and f['logGroupName'] == log_group_name: self.metric_filters.remove(f) return self.metric_filters
# (C) Datadog, Inc. 2020-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) # metrics namespaced under 'scylla' SCYLLA_ALIEN = { 'scylla_alien_receive_batch_queue_length': 'alien.receive_batch_queue_length', 'scylla_alien_total_received_messages': 'alien.total_received_messages', 'scylla_alien_total_sent_messages': 'alien.total_sent_messages', } SCYLLA_BATCHLOG = { 'scylla_batchlog_manager_total_write_replay_attempts': 'batchlog_manager.total_write_replay_attempts', } SCYLLA_CACHE = { 'scylla_cache_active_reads': 'cache.active_reads', 'scylla_cache_bytes_total': 'cache.bytes_total', 'scylla_cache_bytes_used': 'cache.bytes_used', 'scylla_cache_concurrent_misses_same_key': 'cache.concurrent_misses_same_key', 'scylla_cache_mispopulations': 'cache.mispopulations', 'scylla_cache_partition_evictions': 'cache.partition_evictions', 'scylla_cache_partition_hits': 'cache.partition_hits', 'scylla_cache_partition_insertions': 'cache.partition_insertions', 'scylla_cache_partition_merges': 'cache.partition_merges', 'scylla_cache_partition_misses': 'cache.partition_misses', 'scylla_cache_partition_removals': 'cache.partition_removals', 'scylla_cache_partitions': 'cache.partitions', 'scylla_cache_pinned_dirty_memory_overload': 'cache.pinned_dirty_memory_overload', 'scylla_cache_reads': 'cache.reads', 'scylla_cache_reads_with_misses': 'cache.reads_with_misses', 'scylla_cache_row_evictions': 'cache.row_evictions', 'scylla_cache_row_hits': 'cache.row_hits', 'scylla_cache_row_insertions': 'cache.row_insertions', 'scylla_cache_row_misses': 'cache.row_misses', 'scylla_cache_row_removals': 'cache.row_removals', 'scylla_cache_rows': 'cache.rows', 'scylla_cache_rows_dropped_from_memtable': 'cache.rows_dropped_from_memtable', 'scylla_cache_rows_merged_from_memtable': 'cache.rows_merged_from_memtable', 'scylla_cache_rows_processed_from_memtable': 'cache.rows_processed_from_memtable', 'scylla_cache_sstable_partition_skips': 'cache.sstable_partition_skips', 'scylla_cache_sstable_reader_recreations': 'cache.sstable_reader_recreations', 'scylla_cache_sstable_row_skips': 'cache.sstable_row_skips', 'scylla_cache_static_row_insertions': 'cache.static_row_insertions', } SCYLLA_COMMITLOG = { 'scylla_commitlog_alloc': 'commitlog.alloc', 'scylla_commitlog_allocating_segments': 'commitlog.allocating_segments', 'scylla_commitlog_bytes_written': 'commitlog.bytes_written', 'scylla_commitlog_cycle': 'commitlog.cycle', 'scylla_commitlog_disk_total_bytes': 'commitlog.disk_total_bytes', 'scylla_commitlog_flush': 'commitlog.flush', 'scylla_commitlog_flush_limit_exceeded': 'commitlog.flush_limit_exceeded', 'scylla_commitlog_memory_buffer_bytes': 'commitlog.memory_buffer_bytes', 'scylla_commitlog_pending_allocations': 'commitlog.pending_allocations', 'scylla_commitlog_pending_flushes': 'commitlog.pending_flushes', 'scylla_commitlog_requests_blocked_memory': 'commitlog.requests_blocked_memory', 'scylla_commitlog_segments': 'commitlog.segments', 'scylla_commitlog_slack': 'commitlog.slack', 'scylla_commitlog_unused_segments': 'commitlog.unused_segments', } SCYLLA_COMPACTION = { 'scylla_compaction_manager_compactions': 'compaction_manager.compactions', } SCYLLA_CQL = { 'scylla_cql_authorized_prepared_statements_cache_evictions': 'cql.authorized_prepared_statements_cache_evictions', 'scylla_cql_authorized_prepared_statements_cache_size': 'cql.authorized_prepared_statements_cache_size', 'scylla_cql_batches': 'cql.batches', 'scylla_cql_batches_pure_logged': 'cql.batches_pure_logged', 'scylla_cql_batches_pure_unlogged': 'cql.batches_pure_unlogged', 'scylla_cql_batches_unlogged_from_logged': 'cql.batches_unlogged_from_logged', 'scylla_cql_deletes': 'cql.deletes', 'scylla_cql_filtered_read_requests': 'cql.filtered_read_requests', 'scylla_cql_filtered_rows_dropped_total': 'cql.filtered_rows_dropped_total', 'scylla_cql_filtered_rows_matched_total': 'cql.filtered_rows_matched_total', 'scylla_cql_filtered_rows_read_total': 'cql.filtered_rows_read_total', 'scylla_cql_inserts': 'cql.inserts', 'scylla_cql_prepared_cache_evictions': 'cql.prepared_cache_evictions', 'scylla_cql_prepared_cache_memory_footprint': 'cql.prepared_cache_memory_footprint', 'scylla_cql_prepared_cache_size': 'cql.prepared_cache_size', 'scylla_cql_reads': 'cql.reads', 'scylla_cql_reverse_queries': 'cql.reverse_queries', 'scylla_cql_rows_read': 'cql.rows_read', 'scylla_cql_secondary_index_creates': 'cql.secondary_index_creates', 'scylla_cql_secondary_index_drops': 'cql.secondary_index_drops', 'scylla_cql_secondary_index_reads': 'cql.secondary_index_reads', 'scylla_cql_secondary_index_rows_read': 'cql.secondary_index_rows_read', 'scylla_cql_statements_in_batches': 'cql.statements_in_batches', 'scylla_cql_unpaged_select_queries': 'cql.unpaged_select_queries', 'scylla_cql_updates': 'cql.updates', 'scylla_cql_user_prepared_auth_cache_footprint': 'cql.user_prepared_auth_cache_footprint', } SCYLLA_DATABASE = { 'scylla_database_active_reads': 'database.active_reads', 'scylla_database_active_reads_memory_consumption': 'database.active_reads_memory_consumption', 'scylla_database_clustering_filter_count': 'database.clustering_filter_count', 'scylla_database_clustering_filter_fast_path_count': 'database.clustering_filter_fast_path_count', 'scylla_database_clustering_filter_sstables_checked': 'database.clustering_filter_sstables_checked', 'scylla_database_clustering_filter_surviving_sstables': 'database.clustering_filter_surviving_sstables', 'scylla_database_counter_cell_lock_acquisition': 'database.counter_cell_lock_acquisition', 'scylla_database_counter_cell_lock_pending': 'database.counter_cell_lock_pending', 'scylla_database_dropped_view_updates': 'database.dropped_view_updates', 'scylla_database_large_partition_exceeding_threshold': 'database.large_partition_exceeding_threshold', 'scylla_database_multishard_query_failed_reader_saves': 'database.multishard_query_failed_reader_saves', 'scylla_database_multishard_query_failed_reader_stops': 'database.multishard_query_failed_reader_stops', 'scylla_database_multishard_query_unpopped_bytes': 'database.multishard_query_unpopped_bytes', 'scylla_database_multishard_query_unpopped_fragments': 'database.multishard_query_unpopped_fragments', 'scylla_database_paused_reads': 'database.paused_reads', 'scylla_database_paused_reads_permit_based_evictions': 'database.paused_reads_permit_based_evictions', 'scylla_database_querier_cache_drops': 'database.querier_cache_drops', 'scylla_database_querier_cache_lookups': 'database.querier_cache_lookups', 'scylla_database_querier_cache_memory_based_evictions': 'database.querier_cache_memory_based_evictions', 'scylla_database_querier_cache_misses': 'database.querier_cache_misses', 'scylla_database_querier_cache_population': 'database.querier_cache_population', 'scylla_database_querier_cache_resource_based_evictions': 'database.querier_cache_resource_based_evictions', 'scylla_database_querier_cache_time_based_evictions': 'database.querier_cache_time_based_evictions', 'scylla_database_queued_reads': 'database.queued_reads', 'scylla_database_requests_blocked_memory': 'database.requests_blocked_memory', 'scylla_database_requests_blocked_memory_current': 'database.requests_blocked_memory_current', 'scylla_database_short_data_queries': 'database.short_data_queries', 'scylla_database_short_mutation_queries': 'database.short_mutation_queries', 'scylla_database_sstable_read_queue_overloads': 'database.sstable_read_queue_overloads', 'scylla_database_total_reads': 'database.total_reads', 'scylla_database_total_reads_failed': 'database.total_reads_failed', 'scylla_database_total_result_bytes': 'database.total_result_bytes', 'scylla_database_total_view_updates_failed_local': 'database.total_view_updates_failed_local', 'scylla_database_total_view_updates_failed_remote': 'database.total_view_updates_failed_remote', 'scylla_database_total_view_updates_pushed_local': 'database.total_view_updates_pushed_local', 'scylla_database_total_view_updates_pushed_remote': 'database.total_view_updates_pushed_remote', 'scylla_database_total_writes': 'database.total_writes', 'scylla_database_total_writes_failed': 'database.total_writes_failed', 'scylla_database_total_writes_timedout': 'database.total_writes_timedout', 'scylla_database_view_building_paused': 'database.view_building_paused', 'scylla_database_view_update_backlog': 'database.view_update_backlog', } SCYLLA_EXECUTION = { 'scylla_execution_stages_function_calls_enqueued': 'execution_stages.function_calls_enqueued', 'scylla_execution_stages_function_calls_executed': 'execution_stages.function_calls_executed', 'scylla_execution_stages_tasks_preempted': 'execution_stages.tasks_preempted', 'scylla_execution_stages_tasks_scheduled': 'execution_stages.tasks_scheduled', } SCYLLA_GOSSIP = { 'scylla_gossip_heart_beat': 'gossip.heart_beat', } SCYLLA_HINTS = { 'scylla_hints_for_views_manager_corrupted_files': 'hints.for_views_manager_corrupted_files', 'scylla_hints_for_views_manager_discarded': 'hints.for_views_manager_discarded', 'scylla_hints_for_views_manager_dropped': 'hints.for_views_manager_dropped', 'scylla_hints_for_views_manager_errors': 'hints.for_views_manager_errors', 'scylla_hints_for_views_manager_sent': 'hints.for_views_manager_sent', 'scylla_hints_for_views_manager_size_of_hints_in_progress': 'hints.for_views_manager_size_of_hints_in_progress', 'scylla_hints_for_views_manager_written': 'hints.for_views_manager_written', 'scylla_hints_manager_corrupted_files': 'hints.manager_corrupted_files', 'scylla_hints_manager_discarded': 'hints.manager_discarded', 'scylla_hints_manager_dropped': 'hints.manager_dropped', 'scylla_hints_manager_errors': 'hints.manager_errors', 'scylla_hints_manager_sent': 'hints.manager_sent', 'scylla_hints_manager_size_of_hints_in_progress': 'hints.manager_size_of_hints_in_progress', 'scylla_hints_manager_written': 'hints.manager_written', } SCYLLA_HTTPD = { 'scylla_httpd_connections_current': 'httpd.connections_current', 'scylla_httpd_connections_total': 'httpd.connections_total', 'scylla_httpd_read_errors': 'httpd.read_errors', 'scylla_httpd_reply_errors': 'httpd.reply_errors', 'scylla_httpd_requests_served': 'httpd.requests_served', } SCYLLA_IO = { 'scylla_io_queue_delay': 'io_queue.delay', 'scylla_io_queue_queue_length': 'io_queue.queue_length', 'scylla_io_queue_shares': 'io_queue.shares', 'scylla_io_queue_total_bytes': 'io_queue.total_bytes', 'scylla_io_queue_total_operations': 'io_queue.total_operations', } SCYLLA_LSA = { 'scylla_lsa_free_space': 'lsa.free_space', 'scylla_lsa_large_objects_total_space_bytes': 'lsa.large_objects_total_space_bytes', 'scylla_lsa_memory_allocated': 'lsa.memory_allocated', 'scylla_lsa_memory_compacted': 'lsa.memory_compacted', 'scylla_lsa_non_lsa_used_space_bytes': 'lsa.non_lsa_used_space_bytes', 'scylla_lsa_occupancy': 'lsa.occupancy', 'scylla_lsa_segments_compacted': 'lsa.segments_compacted', 'scylla_lsa_segments_migrated': 'lsa.segments_migrated', 'scylla_lsa_small_objects_total_space_bytes': 'lsa.small_objects_total_space_bytes', 'scylla_lsa_small_objects_used_space_bytes': 'lsa.small_objects_used_space_bytes', 'scylla_lsa_total_space_bytes': 'lsa.total_space_bytes', 'scylla_lsa_used_space_bytes': 'lsa.used_space_bytes', } SCYLLA_MEMORY = { 'scylla_memory_allocated_memory': 'memory.allocated_memory', 'scylla_memory_cross_cpu_free_operations': 'memory.cross_cpu_free_operations', 'scylla_memory_dirty_bytes': 'memory.dirty_bytes', 'scylla_memory_free_memory': 'memory.free_memory', 'scylla_memory_free_operations': 'memory.free_operations', 'scylla_memory_malloc_live_objects': 'memory.malloc_live_objects', 'scylla_memory_malloc_operations': 'memory.malloc_operations', 'scylla_memory_reclaims_operations': 'memory.reclaims_operations', 'scylla_memory_regular_dirty_bytes': 'memory.regular_dirty_bytes', 'scylla_memory_regular_virtual_dirty_bytes': 'memory.regular_virtual_dirty_bytes', 'scylla_memory_streaming_dirty_bytes': 'memory.streaming_dirty_bytes', 'scylla_memory_streaming_virtual_dirty_bytes': 'memory.streaming_virtual_dirty_bytes', 'scylla_memory_system_dirty_bytes': 'memory.system_dirty_bytes', 'scylla_memory_system_virtual_dirty_bytes': 'memory.system_virtual_dirty_bytes', 'scylla_memory_total_memory': 'memory.total_memory', 'scylla_memory_virtual_dirty_bytes': 'memory.virtual_dirty_bytes', } SCYLLA_MEMTABLES = { 'scylla_memtables_pending_flushes': 'memtables.pending_flushes', 'scylla_memtables_pending_flushes_bytes': 'memtables.pending_flushes_bytes', } SCYLLA_NODE = { 'scylla_node_operation_mode': 'node.operation_mode', } SCYLLA_QUERY = { 'scylla_query_processor_queries': 'query_processor.queries', 'scylla_query_processor_statements_prepared': 'query_processor.statements_prepared', } SCYLLA_REACTOR = { 'scylla_reactor_aio_bytes_read': 'reactor.aio_bytes_read', 'scylla_reactor_aio_bytes_write': 'reactor.aio_bytes_write', 'scylla_reactor_aio_errors': 'reactor.aio_errors', 'scylla_reactor_aio_reads': 'reactor.aio_reads', 'scylla_reactor_aio_writes': 'reactor.aio_writes', 'scylla_reactor_cpp_exceptions': 'reactor.cpp_exceptions', 'scylla_reactor_cpu_busy_ms': 'reactor.cpu_busy_ms', 'scylla_reactor_cpu_steal_time_ms': 'reactor.cpu_steal_time_ms', 'scylla_reactor_fstream_read_bytes': 'reactor.fstream_read_bytes', 'scylla_reactor_fstream_read_bytes_blocked': 'reactor.fstream_read_bytes_blocked', 'scylla_reactor_fstream_reads': 'reactor.fstream_reads', 'scylla_reactor_fstream_reads_ahead_bytes_discarded': 'reactor.fstream_reads_ahead_bytes_discarded', 'scylla_reactor_fstream_reads_aheads_discarded': 'reactor.fstream_reads_aheads_discarded', 'scylla_reactor_fstream_reads_blocked': 'reactor.fstream_reads_blocked', 'scylla_reactor_fsyncs': 'reactor.fsyncs', 'scylla_reactor_io_queue_requests': 'reactor.io_queue_requests', 'scylla_reactor_io_threaded_fallbacks': 'reactor.io_threaded_fallbacks', 'scylla_reactor_logging_failures': 'reactor.logging_failures', 'scylla_reactor_polls': 'reactor.polls', 'scylla_reactor_tasks_pending': 'reactor.tasks_pending', 'scylla_reactor_tasks_processed': 'reactor.tasks_processed', 'scylla_reactor_timers_pending': 'reactor.timers_pending', 'scylla_reactor_utilization': 'reactor.utilization', } SCYLLA_SCHEDULER = { 'scylla_scheduler_queue_length': 'scheduler.queue_length', 'scylla_scheduler_runtime_ms': 'scheduler.runtime_ms', 'scylla_scheduler_shares': 'scheduler.shares', 'scylla_scheduler_tasks_processed': 'scheduler.tasks_processed', 'scylla_scheduler_time_spent_on_task_quota_violations_ms': 'scheduler.time_spent_on_task_quota_violations_ms', } SCYLLA_SSTABLES = { 'scylla_sstables_capped_local_deletion_time': 'sstables.capped_local_deletion_time', 'scylla_sstables_capped_tombstone_deletion_time': 'sstables.capped_tombstone_deletion_time', 'scylla_sstables_cell_tombstone_writes': 'sstables.cell_tombstone_writes', 'scylla_sstables_cell_writes': 'sstables.cell_writes', 'scylla_sstables_index_page_blocks': 'sstables.index_page_blocks', 'scylla_sstables_index_page_hits': 'sstables.index_page_hits', 'scylla_sstables_index_page_misses': 'sstables.index_page_misses', 'scylla_sstables_partition_reads': 'sstables.partition_reads', 'scylla_sstables_partition_seeks': 'sstables.partition_seeks', 'scylla_sstables_partition_writes': 'sstables.partition_writes', 'scylla_sstables_range_partition_reads': 'sstables.range_partition_reads', 'scylla_sstables_range_tombstone_writes': 'sstables.range_tombstone_writes', 'scylla_sstables_row_reads': 'sstables.row_reads', 'scylla_sstables_row_writes': 'sstables.row_writes', 'scylla_sstables_single_partition_reads': 'sstables.single_partition_reads', 'scylla_sstables_sstable_partition_reads': 'sstables.sstable_partition_reads', 'scylla_sstables_static_row_writes': 'sstables.static_row_writes', 'scylla_sstables_tombstone_writes': 'sstables.tombstone_writes', } SCYLLA_STORAGE = { # Scylla 3.1 'scylla_storage_proxy_coordinator_background_read_repairs': 'storage.proxy.coordinator_background_read_repairs', 'scylla_storage_proxy_coordinator_background_reads': 'storage.proxy.coordinator_background_reads', 'scylla_storage_proxy_coordinator_background_replica_writes_failed_local_node': 'storage.proxy.coordinator_background_replica_writes_failed_local_node', # noqa E501 'scylla_storage_proxy_coordinator_background_write_bytes': 'storage.proxy.coordinator_background_write_bytes', 'scylla_storage_proxy_coordinator_background_writes': 'storage.proxy.coordinator_background_writes', 'scylla_storage_proxy_coordinator_background_writes_failed': 'storage.proxy.coordinator_background_writes_failed', 'scylla_storage_proxy_coordinator_canceled_read_repairs': 'storage.proxy.coordinator_canceled_read_repairs', 'scylla_storage_proxy_coordinator_completed_reads_local_node': 'storage.proxy.coordinator_completed_reads_local_node', # noqa E501 'scylla_storage_proxy_coordinator_current_throttled_base_writes': 'storage.proxy.coordinator_current_throttled_base_writes', # noqa E501 'scylla_storage_proxy_coordinator_current_throttled_writes': 'storage.proxy.coordinator_current_throttled_writes', 'scylla_storage_proxy_coordinator_foreground_read_repair': 'storage.proxy.coordinator_foreground_read_repair', 'scylla_storage_proxy_coordinator_foreground_reads': 'storage.proxy.coordinator_foreground_reads', 'scylla_storage_proxy_coordinator_foreground_writes': 'storage.proxy.coordinator_foreground_writes', 'scylla_storage_proxy_coordinator_last_mv_flow_control_delay': 'storage.proxy.coordinator_last_mv_flow_control_delay', # noqa E501 'scylla_storage_proxy_coordinator_queued_write_bytes': 'storage.proxy.coordinator_queued_write_bytes', 'scylla_storage_proxy_coordinator_range_timeouts': 'storage.proxy.coordinator_range_timeouts', 'scylla_storage_proxy_coordinator_range_unavailable': 'storage.proxy.coordinator_range_unavailable', 'scylla_storage_proxy_coordinator_read_errors_local_node': 'storage.proxy.coordinator_read_errors_local_node', 'scylla_storage_proxy_coordinator_read_latency': 'storage.proxy.coordinator_read_latency', 'scylla_storage_proxy_coordinator_read_repair_write_attempts_local_node': 'storage.proxy.coordinator_read_repair_write_attempts_local_node', # noqa E501 'scylla_storage_proxy_coordinator_read_retries': 'storage.proxy.coordinator_read_retries', 'scylla_storage_proxy_coordinator_read_timeouts': 'storage.proxy.coordinator_read_timeouts', 'scylla_storage_proxy_coordinator_read_unavailable': 'storage.proxy.coordinator_read_unavailable', 'scylla_storage_proxy_coordinator_reads_local_node': 'storage.proxy.coordinator_reads_local_node', 'scylla_storage_proxy_coordinator_speculative_data_reads': 'storage.proxy.coordinator_speculative_data_reads', 'scylla_storage_proxy_coordinator_speculative_digest_reads': 'storage.proxy.coordinator_speculative_digest_reads', 'scylla_storage_proxy_coordinator_throttled_writes': 'storage.proxy.coordinator_throttled_writes', 'scylla_storage_proxy_coordinator_total_write_attempts_local_node': 'storage.proxy.coordinator_total_write_attempts_local_node', # noqa E501 'scylla_storage_proxy_coordinator_write_errors_local_node': 'storage.proxy.coordinator_write_errors_local_node', 'scylla_storage_proxy_coordinator_write_latency': 'storage.proxy.coordinator_write_latency', 'scylla_storage_proxy_coordinator_write_timeouts': 'storage.proxy.coordinator_write_timeouts', 'scylla_storage_proxy_coordinator_write_unavailable': 'storage.proxy.coordinator_write_unavailable', 'scylla_storage_proxy_replica_cross_shard_ops': 'storage.proxy.replica_cross_shard_ops', 'scylla_storage_proxy_replica_forwarded_mutations': 'storage.proxy.replica_forwarded_mutations', 'scylla_storage_proxy_replica_forwarding_errors': 'storage.proxy.replica_forwarding_errors', 'scylla_storage_proxy_replica_reads': 'storage.proxy.replica_reads', 'scylla_storage_proxy_replica_received_counter_updates': 'storage.proxy.replica_received_counter_updates', 'scylla_storage_proxy_replica_received_mutations': 'storage.proxy.replica_received_mutations', # Scylla 3.2 - renamed 'scylla_storage_proxy_coordinator_foreground_read_repairs': 'storage.proxy.coordinator_foreground_read_repair', } SCYLLA_STREAMING = { 'scylla_streaming_total_incoming_bytes': 'streaming.total_incoming_bytes', 'scylla_streaming_total_outgoing_bytes': 'streaming.total_outgoing_bytes', } SCYLLA_THRIFT = { 'scylla_thrift_current_connections': 'thrift.current_connections', 'scylla_thrift_served': 'thrift.served', 'scylla_thrift_thrift_connections': 'thrift.thrift_connections', } SCYLLA_TRACING = { 'scylla_tracing_active_sessions': 'tracing.active_sessions', 'scylla_tracing_cached_records': 'tracing.cached_records', 'scylla_tracing_dropped_records': 'tracing.dropped_records', 'scylla_tracing_dropped_sessions': 'tracing.dropped_sessions', 'scylla_tracing_flushing_records': 'tracing.flushing_records', 'scylla_tracing_keyspace_helper_bad_column_family_errors': 'tracing.keyspace_helper_bad_column_family_errors', 'scylla_tracing_keyspace_helper_tracing_errors': 'tracing.keyspace_helper_tracing_errors', 'scylla_tracing_pending_for_write_records': 'tracing.pending_for_write_records', 'scylla_tracing_trace_errors': 'tracing.trace_errors', 'scylla_tracing_trace_records_count': 'tracing.trace_records_count', } SCYLLA_TRANSPORT = { 'scylla_transport_cql_connections': 'transport.cql_connections', 'scylla_transport_current_connections': 'transport.current_connections', 'scylla_transport_requests_blocked_memory': 'transport.requests_blocked_memory', 'scylla_transport_requests_blocked_memory_current': 'transport.requests_blocked_memory_current', 'scylla_transport_requests_served': 'transport.requests_served', 'scylla_transport_requests_serving': 'transport.requests_serving', } INSTANCE_DEFAULT_METRICS = [ SCYLLA_CACHE, SCYLLA_COMPACTION, SCYLLA_GOSSIP, SCYLLA_NODE, SCYLLA_REACTOR, SCYLLA_STORAGE, SCYLLA_STREAMING, SCYLLA_TRANSPORT, ] ADDITIONAL_METRICS_MAP = { 'scylla.alien': SCYLLA_ALIEN, 'scylla.batchlog': SCYLLA_BATCHLOG, 'scylla.commitlog': SCYLLA_COMMITLOG, 'scylla.cql': SCYLLA_CQL, 'scylla.database': SCYLLA_DATABASE, 'scylla.execution': SCYLLA_EXECUTION, 'scylla.hints': SCYLLA_HINTS, 'scylla.httpd': SCYLLA_HTTPD, 'scylla.io': SCYLLA_IO, 'scylla.lsa': SCYLLA_LSA, 'scylla.memory': SCYLLA_MEMORY, 'scylla.memtables': SCYLLA_MEMTABLES, 'scylla.query': SCYLLA_QUERY, 'scylla.scheduler': SCYLLA_SCHEDULER, 'scylla.sstables': SCYLLA_SSTABLES, 'scylla.thrift': SCYLLA_THRIFT, 'scylla.tracing': SCYLLA_TRACING, }
scylla_alien = {'scylla_alien_receive_batch_queue_length': 'alien.receive_batch_queue_length', 'scylla_alien_total_received_messages': 'alien.total_received_messages', 'scylla_alien_total_sent_messages': 'alien.total_sent_messages'} scylla_batchlog = {'scylla_batchlog_manager_total_write_replay_attempts': 'batchlog_manager.total_write_replay_attempts'} scylla_cache = {'scylla_cache_active_reads': 'cache.active_reads', 'scylla_cache_bytes_total': 'cache.bytes_total', 'scylla_cache_bytes_used': 'cache.bytes_used', 'scylla_cache_concurrent_misses_same_key': 'cache.concurrent_misses_same_key', 'scylla_cache_mispopulations': 'cache.mispopulations', 'scylla_cache_partition_evictions': 'cache.partition_evictions', 'scylla_cache_partition_hits': 'cache.partition_hits', 'scylla_cache_partition_insertions': 'cache.partition_insertions', 'scylla_cache_partition_merges': 'cache.partition_merges', 'scylla_cache_partition_misses': 'cache.partition_misses', 'scylla_cache_partition_removals': 'cache.partition_removals', 'scylla_cache_partitions': 'cache.partitions', 'scylla_cache_pinned_dirty_memory_overload': 'cache.pinned_dirty_memory_overload', 'scylla_cache_reads': 'cache.reads', 'scylla_cache_reads_with_misses': 'cache.reads_with_misses', 'scylla_cache_row_evictions': 'cache.row_evictions', 'scylla_cache_row_hits': 'cache.row_hits', 'scylla_cache_row_insertions': 'cache.row_insertions', 'scylla_cache_row_misses': 'cache.row_misses', 'scylla_cache_row_removals': 'cache.row_removals', 'scylla_cache_rows': 'cache.rows', 'scylla_cache_rows_dropped_from_memtable': 'cache.rows_dropped_from_memtable', 'scylla_cache_rows_merged_from_memtable': 'cache.rows_merged_from_memtable', 'scylla_cache_rows_processed_from_memtable': 'cache.rows_processed_from_memtable', 'scylla_cache_sstable_partition_skips': 'cache.sstable_partition_skips', 'scylla_cache_sstable_reader_recreations': 'cache.sstable_reader_recreations', 'scylla_cache_sstable_row_skips': 'cache.sstable_row_skips', 'scylla_cache_static_row_insertions': 'cache.static_row_insertions'} scylla_commitlog = {'scylla_commitlog_alloc': 'commitlog.alloc', 'scylla_commitlog_allocating_segments': 'commitlog.allocating_segments', 'scylla_commitlog_bytes_written': 'commitlog.bytes_written', 'scylla_commitlog_cycle': 'commitlog.cycle', 'scylla_commitlog_disk_total_bytes': 'commitlog.disk_total_bytes', 'scylla_commitlog_flush': 'commitlog.flush', 'scylla_commitlog_flush_limit_exceeded': 'commitlog.flush_limit_exceeded', 'scylla_commitlog_memory_buffer_bytes': 'commitlog.memory_buffer_bytes', 'scylla_commitlog_pending_allocations': 'commitlog.pending_allocations', 'scylla_commitlog_pending_flushes': 'commitlog.pending_flushes', 'scylla_commitlog_requests_blocked_memory': 'commitlog.requests_blocked_memory', 'scylla_commitlog_segments': 'commitlog.segments', 'scylla_commitlog_slack': 'commitlog.slack', 'scylla_commitlog_unused_segments': 'commitlog.unused_segments'} scylla_compaction = {'scylla_compaction_manager_compactions': 'compaction_manager.compactions'} scylla_cql = {'scylla_cql_authorized_prepared_statements_cache_evictions': 'cql.authorized_prepared_statements_cache_evictions', 'scylla_cql_authorized_prepared_statements_cache_size': 'cql.authorized_prepared_statements_cache_size', 'scylla_cql_batches': 'cql.batches', 'scylla_cql_batches_pure_logged': 'cql.batches_pure_logged', 'scylla_cql_batches_pure_unlogged': 'cql.batches_pure_unlogged', 'scylla_cql_batches_unlogged_from_logged': 'cql.batches_unlogged_from_logged', 'scylla_cql_deletes': 'cql.deletes', 'scylla_cql_filtered_read_requests': 'cql.filtered_read_requests', 'scylla_cql_filtered_rows_dropped_total': 'cql.filtered_rows_dropped_total', 'scylla_cql_filtered_rows_matched_total': 'cql.filtered_rows_matched_total', 'scylla_cql_filtered_rows_read_total': 'cql.filtered_rows_read_total', 'scylla_cql_inserts': 'cql.inserts', 'scylla_cql_prepared_cache_evictions': 'cql.prepared_cache_evictions', 'scylla_cql_prepared_cache_memory_footprint': 'cql.prepared_cache_memory_footprint', 'scylla_cql_prepared_cache_size': 'cql.prepared_cache_size', 'scylla_cql_reads': 'cql.reads', 'scylla_cql_reverse_queries': 'cql.reverse_queries', 'scylla_cql_rows_read': 'cql.rows_read', 'scylla_cql_secondary_index_creates': 'cql.secondary_index_creates', 'scylla_cql_secondary_index_drops': 'cql.secondary_index_drops', 'scylla_cql_secondary_index_reads': 'cql.secondary_index_reads', 'scylla_cql_secondary_index_rows_read': 'cql.secondary_index_rows_read', 'scylla_cql_statements_in_batches': 'cql.statements_in_batches', 'scylla_cql_unpaged_select_queries': 'cql.unpaged_select_queries', 'scylla_cql_updates': 'cql.updates', 'scylla_cql_user_prepared_auth_cache_footprint': 'cql.user_prepared_auth_cache_footprint'} scylla_database = {'scylla_database_active_reads': 'database.active_reads', 'scylla_database_active_reads_memory_consumption': 'database.active_reads_memory_consumption', 'scylla_database_clustering_filter_count': 'database.clustering_filter_count', 'scylla_database_clustering_filter_fast_path_count': 'database.clustering_filter_fast_path_count', 'scylla_database_clustering_filter_sstables_checked': 'database.clustering_filter_sstables_checked', 'scylla_database_clustering_filter_surviving_sstables': 'database.clustering_filter_surviving_sstables', 'scylla_database_counter_cell_lock_acquisition': 'database.counter_cell_lock_acquisition', 'scylla_database_counter_cell_lock_pending': 'database.counter_cell_lock_pending', 'scylla_database_dropped_view_updates': 'database.dropped_view_updates', 'scylla_database_large_partition_exceeding_threshold': 'database.large_partition_exceeding_threshold', 'scylla_database_multishard_query_failed_reader_saves': 'database.multishard_query_failed_reader_saves', 'scylla_database_multishard_query_failed_reader_stops': 'database.multishard_query_failed_reader_stops', 'scylla_database_multishard_query_unpopped_bytes': 'database.multishard_query_unpopped_bytes', 'scylla_database_multishard_query_unpopped_fragments': 'database.multishard_query_unpopped_fragments', 'scylla_database_paused_reads': 'database.paused_reads', 'scylla_database_paused_reads_permit_based_evictions': 'database.paused_reads_permit_based_evictions', 'scylla_database_querier_cache_drops': 'database.querier_cache_drops', 'scylla_database_querier_cache_lookups': 'database.querier_cache_lookups', 'scylla_database_querier_cache_memory_based_evictions': 'database.querier_cache_memory_based_evictions', 'scylla_database_querier_cache_misses': 'database.querier_cache_misses', 'scylla_database_querier_cache_population': 'database.querier_cache_population', 'scylla_database_querier_cache_resource_based_evictions': 'database.querier_cache_resource_based_evictions', 'scylla_database_querier_cache_time_based_evictions': 'database.querier_cache_time_based_evictions', 'scylla_database_queued_reads': 'database.queued_reads', 'scylla_database_requests_blocked_memory': 'database.requests_blocked_memory', 'scylla_database_requests_blocked_memory_current': 'database.requests_blocked_memory_current', 'scylla_database_short_data_queries': 'database.short_data_queries', 'scylla_database_short_mutation_queries': 'database.short_mutation_queries', 'scylla_database_sstable_read_queue_overloads': 'database.sstable_read_queue_overloads', 'scylla_database_total_reads': 'database.total_reads', 'scylla_database_total_reads_failed': 'database.total_reads_failed', 'scylla_database_total_result_bytes': 'database.total_result_bytes', 'scylla_database_total_view_updates_failed_local': 'database.total_view_updates_failed_local', 'scylla_database_total_view_updates_failed_remote': 'database.total_view_updates_failed_remote', 'scylla_database_total_view_updates_pushed_local': 'database.total_view_updates_pushed_local', 'scylla_database_total_view_updates_pushed_remote': 'database.total_view_updates_pushed_remote', 'scylla_database_total_writes': 'database.total_writes', 'scylla_database_total_writes_failed': 'database.total_writes_failed', 'scylla_database_total_writes_timedout': 'database.total_writes_timedout', 'scylla_database_view_building_paused': 'database.view_building_paused', 'scylla_database_view_update_backlog': 'database.view_update_backlog'} scylla_execution = {'scylla_execution_stages_function_calls_enqueued': 'execution_stages.function_calls_enqueued', 'scylla_execution_stages_function_calls_executed': 'execution_stages.function_calls_executed', 'scylla_execution_stages_tasks_preempted': 'execution_stages.tasks_preempted', 'scylla_execution_stages_tasks_scheduled': 'execution_stages.tasks_scheduled'} scylla_gossip = {'scylla_gossip_heart_beat': 'gossip.heart_beat'} scylla_hints = {'scylla_hints_for_views_manager_corrupted_files': 'hints.for_views_manager_corrupted_files', 'scylla_hints_for_views_manager_discarded': 'hints.for_views_manager_discarded', 'scylla_hints_for_views_manager_dropped': 'hints.for_views_manager_dropped', 'scylla_hints_for_views_manager_errors': 'hints.for_views_manager_errors', 'scylla_hints_for_views_manager_sent': 'hints.for_views_manager_sent', 'scylla_hints_for_views_manager_size_of_hints_in_progress': 'hints.for_views_manager_size_of_hints_in_progress', 'scylla_hints_for_views_manager_written': 'hints.for_views_manager_written', 'scylla_hints_manager_corrupted_files': 'hints.manager_corrupted_files', 'scylla_hints_manager_discarded': 'hints.manager_discarded', 'scylla_hints_manager_dropped': 'hints.manager_dropped', 'scylla_hints_manager_errors': 'hints.manager_errors', 'scylla_hints_manager_sent': 'hints.manager_sent', 'scylla_hints_manager_size_of_hints_in_progress': 'hints.manager_size_of_hints_in_progress', 'scylla_hints_manager_written': 'hints.manager_written'} scylla_httpd = {'scylla_httpd_connections_current': 'httpd.connections_current', 'scylla_httpd_connections_total': 'httpd.connections_total', 'scylla_httpd_read_errors': 'httpd.read_errors', 'scylla_httpd_reply_errors': 'httpd.reply_errors', 'scylla_httpd_requests_served': 'httpd.requests_served'} scylla_io = {'scylla_io_queue_delay': 'io_queue.delay', 'scylla_io_queue_queue_length': 'io_queue.queue_length', 'scylla_io_queue_shares': 'io_queue.shares', 'scylla_io_queue_total_bytes': 'io_queue.total_bytes', 'scylla_io_queue_total_operations': 'io_queue.total_operations'} scylla_lsa = {'scylla_lsa_free_space': 'lsa.free_space', 'scylla_lsa_large_objects_total_space_bytes': 'lsa.large_objects_total_space_bytes', 'scylla_lsa_memory_allocated': 'lsa.memory_allocated', 'scylla_lsa_memory_compacted': 'lsa.memory_compacted', 'scylla_lsa_non_lsa_used_space_bytes': 'lsa.non_lsa_used_space_bytes', 'scylla_lsa_occupancy': 'lsa.occupancy', 'scylla_lsa_segments_compacted': 'lsa.segments_compacted', 'scylla_lsa_segments_migrated': 'lsa.segments_migrated', 'scylla_lsa_small_objects_total_space_bytes': 'lsa.small_objects_total_space_bytes', 'scylla_lsa_small_objects_used_space_bytes': 'lsa.small_objects_used_space_bytes', 'scylla_lsa_total_space_bytes': 'lsa.total_space_bytes', 'scylla_lsa_used_space_bytes': 'lsa.used_space_bytes'} scylla_memory = {'scylla_memory_allocated_memory': 'memory.allocated_memory', 'scylla_memory_cross_cpu_free_operations': 'memory.cross_cpu_free_operations', 'scylla_memory_dirty_bytes': 'memory.dirty_bytes', 'scylla_memory_free_memory': 'memory.free_memory', 'scylla_memory_free_operations': 'memory.free_operations', 'scylla_memory_malloc_live_objects': 'memory.malloc_live_objects', 'scylla_memory_malloc_operations': 'memory.malloc_operations', 'scylla_memory_reclaims_operations': 'memory.reclaims_operations', 'scylla_memory_regular_dirty_bytes': 'memory.regular_dirty_bytes', 'scylla_memory_regular_virtual_dirty_bytes': 'memory.regular_virtual_dirty_bytes', 'scylla_memory_streaming_dirty_bytes': 'memory.streaming_dirty_bytes', 'scylla_memory_streaming_virtual_dirty_bytes': 'memory.streaming_virtual_dirty_bytes', 'scylla_memory_system_dirty_bytes': 'memory.system_dirty_bytes', 'scylla_memory_system_virtual_dirty_bytes': 'memory.system_virtual_dirty_bytes', 'scylla_memory_total_memory': 'memory.total_memory', 'scylla_memory_virtual_dirty_bytes': 'memory.virtual_dirty_bytes'} scylla_memtables = {'scylla_memtables_pending_flushes': 'memtables.pending_flushes', 'scylla_memtables_pending_flushes_bytes': 'memtables.pending_flushes_bytes'} scylla_node = {'scylla_node_operation_mode': 'node.operation_mode'} scylla_query = {'scylla_query_processor_queries': 'query_processor.queries', 'scylla_query_processor_statements_prepared': 'query_processor.statements_prepared'} scylla_reactor = {'scylla_reactor_aio_bytes_read': 'reactor.aio_bytes_read', 'scylla_reactor_aio_bytes_write': 'reactor.aio_bytes_write', 'scylla_reactor_aio_errors': 'reactor.aio_errors', 'scylla_reactor_aio_reads': 'reactor.aio_reads', 'scylla_reactor_aio_writes': 'reactor.aio_writes', 'scylla_reactor_cpp_exceptions': 'reactor.cpp_exceptions', 'scylla_reactor_cpu_busy_ms': 'reactor.cpu_busy_ms', 'scylla_reactor_cpu_steal_time_ms': 'reactor.cpu_steal_time_ms', 'scylla_reactor_fstream_read_bytes': 'reactor.fstream_read_bytes', 'scylla_reactor_fstream_read_bytes_blocked': 'reactor.fstream_read_bytes_blocked', 'scylla_reactor_fstream_reads': 'reactor.fstream_reads', 'scylla_reactor_fstream_reads_ahead_bytes_discarded': 'reactor.fstream_reads_ahead_bytes_discarded', 'scylla_reactor_fstream_reads_aheads_discarded': 'reactor.fstream_reads_aheads_discarded', 'scylla_reactor_fstream_reads_blocked': 'reactor.fstream_reads_blocked', 'scylla_reactor_fsyncs': 'reactor.fsyncs', 'scylla_reactor_io_queue_requests': 'reactor.io_queue_requests', 'scylla_reactor_io_threaded_fallbacks': 'reactor.io_threaded_fallbacks', 'scylla_reactor_logging_failures': 'reactor.logging_failures', 'scylla_reactor_polls': 'reactor.polls', 'scylla_reactor_tasks_pending': 'reactor.tasks_pending', 'scylla_reactor_tasks_processed': 'reactor.tasks_processed', 'scylla_reactor_timers_pending': 'reactor.timers_pending', 'scylla_reactor_utilization': 'reactor.utilization'} scylla_scheduler = {'scylla_scheduler_queue_length': 'scheduler.queue_length', 'scylla_scheduler_runtime_ms': 'scheduler.runtime_ms', 'scylla_scheduler_shares': 'scheduler.shares', 'scylla_scheduler_tasks_processed': 'scheduler.tasks_processed', 'scylla_scheduler_time_spent_on_task_quota_violations_ms': 'scheduler.time_spent_on_task_quota_violations_ms'} scylla_sstables = {'scylla_sstables_capped_local_deletion_time': 'sstables.capped_local_deletion_time', 'scylla_sstables_capped_tombstone_deletion_time': 'sstables.capped_tombstone_deletion_time', 'scylla_sstables_cell_tombstone_writes': 'sstables.cell_tombstone_writes', 'scylla_sstables_cell_writes': 'sstables.cell_writes', 'scylla_sstables_index_page_blocks': 'sstables.index_page_blocks', 'scylla_sstables_index_page_hits': 'sstables.index_page_hits', 'scylla_sstables_index_page_misses': 'sstables.index_page_misses', 'scylla_sstables_partition_reads': 'sstables.partition_reads', 'scylla_sstables_partition_seeks': 'sstables.partition_seeks', 'scylla_sstables_partition_writes': 'sstables.partition_writes', 'scylla_sstables_range_partition_reads': 'sstables.range_partition_reads', 'scylla_sstables_range_tombstone_writes': 'sstables.range_tombstone_writes', 'scylla_sstables_row_reads': 'sstables.row_reads', 'scylla_sstables_row_writes': 'sstables.row_writes', 'scylla_sstables_single_partition_reads': 'sstables.single_partition_reads', 'scylla_sstables_sstable_partition_reads': 'sstables.sstable_partition_reads', 'scylla_sstables_static_row_writes': 'sstables.static_row_writes', 'scylla_sstables_tombstone_writes': 'sstables.tombstone_writes'} scylla_storage = {'scylla_storage_proxy_coordinator_background_read_repairs': 'storage.proxy.coordinator_background_read_repairs', 'scylla_storage_proxy_coordinator_background_reads': 'storage.proxy.coordinator_background_reads', 'scylla_storage_proxy_coordinator_background_replica_writes_failed_local_node': 'storage.proxy.coordinator_background_replica_writes_failed_local_node', 'scylla_storage_proxy_coordinator_background_write_bytes': 'storage.proxy.coordinator_background_write_bytes', 'scylla_storage_proxy_coordinator_background_writes': 'storage.proxy.coordinator_background_writes', 'scylla_storage_proxy_coordinator_background_writes_failed': 'storage.proxy.coordinator_background_writes_failed', 'scylla_storage_proxy_coordinator_canceled_read_repairs': 'storage.proxy.coordinator_canceled_read_repairs', 'scylla_storage_proxy_coordinator_completed_reads_local_node': 'storage.proxy.coordinator_completed_reads_local_node', 'scylla_storage_proxy_coordinator_current_throttled_base_writes': 'storage.proxy.coordinator_current_throttled_base_writes', 'scylla_storage_proxy_coordinator_current_throttled_writes': 'storage.proxy.coordinator_current_throttled_writes', 'scylla_storage_proxy_coordinator_foreground_read_repair': 'storage.proxy.coordinator_foreground_read_repair', 'scylla_storage_proxy_coordinator_foreground_reads': 'storage.proxy.coordinator_foreground_reads', 'scylla_storage_proxy_coordinator_foreground_writes': 'storage.proxy.coordinator_foreground_writes', 'scylla_storage_proxy_coordinator_last_mv_flow_control_delay': 'storage.proxy.coordinator_last_mv_flow_control_delay', 'scylla_storage_proxy_coordinator_queued_write_bytes': 'storage.proxy.coordinator_queued_write_bytes', 'scylla_storage_proxy_coordinator_range_timeouts': 'storage.proxy.coordinator_range_timeouts', 'scylla_storage_proxy_coordinator_range_unavailable': 'storage.proxy.coordinator_range_unavailable', 'scylla_storage_proxy_coordinator_read_errors_local_node': 'storage.proxy.coordinator_read_errors_local_node', 'scylla_storage_proxy_coordinator_read_latency': 'storage.proxy.coordinator_read_latency', 'scylla_storage_proxy_coordinator_read_repair_write_attempts_local_node': 'storage.proxy.coordinator_read_repair_write_attempts_local_node', 'scylla_storage_proxy_coordinator_read_retries': 'storage.proxy.coordinator_read_retries', 'scylla_storage_proxy_coordinator_read_timeouts': 'storage.proxy.coordinator_read_timeouts', 'scylla_storage_proxy_coordinator_read_unavailable': 'storage.proxy.coordinator_read_unavailable', 'scylla_storage_proxy_coordinator_reads_local_node': 'storage.proxy.coordinator_reads_local_node', 'scylla_storage_proxy_coordinator_speculative_data_reads': 'storage.proxy.coordinator_speculative_data_reads', 'scylla_storage_proxy_coordinator_speculative_digest_reads': 'storage.proxy.coordinator_speculative_digest_reads', 'scylla_storage_proxy_coordinator_throttled_writes': 'storage.proxy.coordinator_throttled_writes', 'scylla_storage_proxy_coordinator_total_write_attempts_local_node': 'storage.proxy.coordinator_total_write_attempts_local_node', 'scylla_storage_proxy_coordinator_write_errors_local_node': 'storage.proxy.coordinator_write_errors_local_node', 'scylla_storage_proxy_coordinator_write_latency': 'storage.proxy.coordinator_write_latency', 'scylla_storage_proxy_coordinator_write_timeouts': 'storage.proxy.coordinator_write_timeouts', 'scylla_storage_proxy_coordinator_write_unavailable': 'storage.proxy.coordinator_write_unavailable', 'scylla_storage_proxy_replica_cross_shard_ops': 'storage.proxy.replica_cross_shard_ops', 'scylla_storage_proxy_replica_forwarded_mutations': 'storage.proxy.replica_forwarded_mutations', 'scylla_storage_proxy_replica_forwarding_errors': 'storage.proxy.replica_forwarding_errors', 'scylla_storage_proxy_replica_reads': 'storage.proxy.replica_reads', 'scylla_storage_proxy_replica_received_counter_updates': 'storage.proxy.replica_received_counter_updates', 'scylla_storage_proxy_replica_received_mutations': 'storage.proxy.replica_received_mutations', 'scylla_storage_proxy_coordinator_foreground_read_repairs': 'storage.proxy.coordinator_foreground_read_repair'} scylla_streaming = {'scylla_streaming_total_incoming_bytes': 'streaming.total_incoming_bytes', 'scylla_streaming_total_outgoing_bytes': 'streaming.total_outgoing_bytes'} scylla_thrift = {'scylla_thrift_current_connections': 'thrift.current_connections', 'scylla_thrift_served': 'thrift.served', 'scylla_thrift_thrift_connections': 'thrift.thrift_connections'} scylla_tracing = {'scylla_tracing_active_sessions': 'tracing.active_sessions', 'scylla_tracing_cached_records': 'tracing.cached_records', 'scylla_tracing_dropped_records': 'tracing.dropped_records', 'scylla_tracing_dropped_sessions': 'tracing.dropped_sessions', 'scylla_tracing_flushing_records': 'tracing.flushing_records', 'scylla_tracing_keyspace_helper_bad_column_family_errors': 'tracing.keyspace_helper_bad_column_family_errors', 'scylla_tracing_keyspace_helper_tracing_errors': 'tracing.keyspace_helper_tracing_errors', 'scylla_tracing_pending_for_write_records': 'tracing.pending_for_write_records', 'scylla_tracing_trace_errors': 'tracing.trace_errors', 'scylla_tracing_trace_records_count': 'tracing.trace_records_count'} scylla_transport = {'scylla_transport_cql_connections': 'transport.cql_connections', 'scylla_transport_current_connections': 'transport.current_connections', 'scylla_transport_requests_blocked_memory': 'transport.requests_blocked_memory', 'scylla_transport_requests_blocked_memory_current': 'transport.requests_blocked_memory_current', 'scylla_transport_requests_served': 'transport.requests_served', 'scylla_transport_requests_serving': 'transport.requests_serving'} instance_default_metrics = [SCYLLA_CACHE, SCYLLA_COMPACTION, SCYLLA_GOSSIP, SCYLLA_NODE, SCYLLA_REACTOR, SCYLLA_STORAGE, SCYLLA_STREAMING, SCYLLA_TRANSPORT] additional_metrics_map = {'scylla.alien': SCYLLA_ALIEN, 'scylla.batchlog': SCYLLA_BATCHLOG, 'scylla.commitlog': SCYLLA_COMMITLOG, 'scylla.cql': SCYLLA_CQL, 'scylla.database': SCYLLA_DATABASE, 'scylla.execution': SCYLLA_EXECUTION, 'scylla.hints': SCYLLA_HINTS, 'scylla.httpd': SCYLLA_HTTPD, 'scylla.io': SCYLLA_IO, 'scylla.lsa': SCYLLA_LSA, 'scylla.memory': SCYLLA_MEMORY, 'scylla.memtables': SCYLLA_MEMTABLES, 'scylla.query': SCYLLA_QUERY, 'scylla.scheduler': SCYLLA_SCHEDULER, 'scylla.sstables': SCYLLA_SSTABLES, 'scylla.thrift': SCYLLA_THRIFT, 'scylla.tracing': SCYLLA_TRACING}
# List of tables that should be routed to this app. # Note that this is not intended to be a complete list of the available tables. TABLE_NAMES = ( 'lemma', 'inflection', 'aspect_pair', )
table_names = ('lemma', 'inflection', 'aspect_pair')
nome = [] temp = [] pesoMaior = pesoMenor = 0 count = 1 while True: temp.append(str(input('Nome: '))) temp.append(float(input('Peso: '))) if count == 1: pesoMaior = pesoMenor = temp[1] else: if temp[1] >= pesoMaior: pesoMaior = temp[1] elif temp[1] <= pesoMenor: pesoMenor = temp[1] nome.append(temp[:]) temp.clear() usuario = 'O' while usuario != 'S' or usuario != 'N': usuario = str(input('Deseja Continuar ? S/N: ')).upper().strip()[0] if usuario == 'S': break elif usuario == 'N': break if usuario == 'N': break count += 1 print(f'Foram cadastradas {len(nome)} pessoas') print(f'O menor peso foi {pesoMenor}.', end=' ') for c in nome: if c[1] == pesoMenor: print(c[0], end=' ') print() print(f'O maior peso foi {pesoMaior}.') for c in nome: if c[1] == pesoMaior: print(c[0])
nome = [] temp = [] peso_maior = peso_menor = 0 count = 1 while True: temp.append(str(input('Nome: '))) temp.append(float(input('Peso: '))) if count == 1: peso_maior = peso_menor = temp[1] elif temp[1] >= pesoMaior: peso_maior = temp[1] elif temp[1] <= pesoMenor: peso_menor = temp[1] nome.append(temp[:]) temp.clear() usuario = 'O' while usuario != 'S' or usuario != 'N': usuario = str(input('Deseja Continuar ? S/N: ')).upper().strip()[0] if usuario == 'S': break elif usuario == 'N': break if usuario == 'N': break count += 1 print(f'Foram cadastradas {len(nome)} pessoas') print(f'O menor peso foi {pesoMenor}.', end=' ') for c in nome: if c[1] == pesoMenor: print(c[0], end=' ') print() print(f'O maior peso foi {pesoMaior}.') for c in nome: if c[1] == pesoMaior: print(c[0])
tcase = int(input()) while(tcase): str= input() [::-1] print(int(str)) tcase -= 1
tcase = int(input()) while tcase: str = input()[::-1] print(int(str)) tcase -= 1
class FixtureException(Exception): pass class FixtureUploadError(FixtureException): pass class DuplicateFixtureTagException(FixtureUploadError): pass class ExcelMalformatException(FixtureUploadError): pass class FixtureAPIException(Exception): pass class FixtureTypeCheckError(Exception): pass class FixtureVersionError(Exception): pass
class Fixtureexception(Exception): pass class Fixtureuploaderror(FixtureException): pass class Duplicatefixturetagexception(FixtureUploadError): pass class Excelmalformatexception(FixtureUploadError): pass class Fixtureapiexception(Exception): pass class Fixturetypecheckerror(Exception): pass class Fixtureversionerror(Exception): pass
#!/usr/bin/env python3 # tuples is a type of list. # tuples is immutable. # the structure of a tuple: (1, "nice work", 2.3, [1,2,"hey"]) my_tuple = ("hey", 1, 2, "hey ho!", "hey", "hey") print("My tuple:", my_tuple) # to get a tuple value use it's index print("Second item in my_tuple:", my_tuple[1]) # to count how many times a values appears in a tuple: tuple.count(value) # returns 0 if no values exists. print("How many 'hey' in my_tuple:", my_tuple.count("hey")) # go get the index value of a tuple item. tuple.index(value) # if value does not exist you will get an error like "ValueError: tuple.index(x): x not in tuple" print("Index position of 'hey ho!' in my_tuple:", my_tuple.index("hey ho!")) # tuples are immutable so you cannot reassign a value like # my_tuple[2] = "wop wop" # TypeError: 'tuple' object does not support item assignment
my_tuple = ('hey', 1, 2, 'hey ho!', 'hey', 'hey') print('My tuple:', my_tuple) print('Second item in my_tuple:', my_tuple[1]) print("How many 'hey' in my_tuple:", my_tuple.count('hey')) print("Index position of 'hey ho!' in my_tuple:", my_tuple.index('hey ho!'))
def possibleHeights(parent): edges = [[] for i in range(len(parent))] height = [0 for i in range(len(parent))] isPossibleHeight = [False for i in range(len(parent))] def initGraph(parent): for i in range(1, len(parent)): edges[parent[i]].append(i) def calcHeight(v): for u in edges[v]: calcHeight(u) height[v] = max(height[v], height[u]+1) countHeights = [[] for i in range(len(edges))] for i in range(len(edges[v])): u = edges[v][i] countHeights[height[u]].append(u) edges[v] = [] for i in range(len(edges) - 1, -1, -1): for j in range(len(countHeights[i])): edges[v].append(countHeights[i][j]) def findNewHeights(v, tailHeight): isPossibleHeight[max(height[v], tailHeight)] = True firstMaxHeight = tailHeight + 1 secondMaxHeight = tailHeight + 1 if len(edges[v]) > 0: firstMaxHeight = max(firstMaxHeight, height[edges[v][0]] + 2) if len(edges[v]) > 1: secondMaxHeight = max(secondMaxHeight, height[edges[v][1]] + 2) if len(edges[v]) > 0: findNewHeights(edges[v][0], secondMaxHeight) for i in range(1, len(edges[v])): findNewHeights(edges[v][i], firstMaxHeight) initGraph(parent) calcHeight(0) findNewHeights(0, 0) heights = [] for i in range(len(parent)): if isPossibleHeight[i]: heights.append(i) return heights
def possible_heights(parent): edges = [[] for i in range(len(parent))] height = [0 for i in range(len(parent))] is_possible_height = [False for i in range(len(parent))] def init_graph(parent): for i in range(1, len(parent)): edges[parent[i]].append(i) def calc_height(v): for u in edges[v]: calc_height(u) height[v] = max(height[v], height[u] + 1) count_heights = [[] for i in range(len(edges))] for i in range(len(edges[v])): u = edges[v][i] countHeights[height[u]].append(u) edges[v] = [] for i in range(len(edges) - 1, -1, -1): for j in range(len(countHeights[i])): edges[v].append(countHeights[i][j]) def find_new_heights(v, tailHeight): isPossibleHeight[max(height[v], tailHeight)] = True first_max_height = tailHeight + 1 second_max_height = tailHeight + 1 if len(edges[v]) > 0: first_max_height = max(firstMaxHeight, height[edges[v][0]] + 2) if len(edges[v]) > 1: second_max_height = max(secondMaxHeight, height[edges[v][1]] + 2) if len(edges[v]) > 0: find_new_heights(edges[v][0], secondMaxHeight) for i in range(1, len(edges[v])): find_new_heights(edges[v][i], firstMaxHeight) init_graph(parent) calc_height(0) find_new_heights(0, 0) heights = [] for i in range(len(parent)): if isPossibleHeight[i]: heights.append(i) return heights