content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class VaderStreamsConstants(object): __slots__ = [] BASE_URL = 'http://vapi.vaders.tv/' CATEGORIES_JSON_FILE_NAME = 'categories.json' CATEGORIES_PATH = 'epg/categories' CHANNELS_JSON_FILE_NAME = 'channels.json' CHANNELS_PATH = 'epg/channels' DB_FILE_NAME = 'vaderstreams.db' DEFAULT_EPG_SOURCE = 'vaderstreams' DEFAULT_PLAYLIST_PROTOCOL = 'hls' DEFAULT_PLAYLIST_TYPE = 'dynamic' EPG_BASE_URL = 'http://vaders.tv/' JSON_EPG_TIME_DELTA_HOURS = 1 MATCHCENTER_SCHEDULE_JSON_FILE_NAME = 'schedule.json' MATCHCENTER_SCHEDULE_PATH = 'mc/schedule' PROVIDER_NAME = 'VaderStreams' TEMPORARY_DB_FILE_NAME = 'vaderstreams_temp.db' VALID_EPG_SOURCE_VALUES = ['other', 'vaderstreams'] VALID_PLAYLIST_PROTOCOL_VALUES = ['hls', 'mpegts'] VALID_PLAYLIST_TYPE_VALUES = ['dynamic', 'static'] VALID_SERVER_VALUES = ['auto'] XML_EPG_FILE_NAME = 'p2.xml.gz' _provider_name = PROVIDER_NAME.lower()
class Vaderstreamsconstants(object): __slots__ = [] base_url = 'http://vapi.vaders.tv/' categories_json_file_name = 'categories.json' categories_path = 'epg/categories' channels_json_file_name = 'channels.json' channels_path = 'epg/channels' db_file_name = 'vaderstreams.db' default_epg_source = 'vaderstreams' default_playlist_protocol = 'hls' default_playlist_type = 'dynamic' epg_base_url = 'http://vaders.tv/' json_epg_time_delta_hours = 1 matchcenter_schedule_json_file_name = 'schedule.json' matchcenter_schedule_path = 'mc/schedule' provider_name = 'VaderStreams' temporary_db_file_name = 'vaderstreams_temp.db' valid_epg_source_values = ['other', 'vaderstreams'] valid_playlist_protocol_values = ['hls', 'mpegts'] valid_playlist_type_values = ['dynamic', 'static'] valid_server_values = ['auto'] xml_epg_file_name = 'p2.xml.gz' _provider_name = PROVIDER_NAME.lower()
class Vector: def __init__(self, inputs: list): self.inputs = inputs def dot(self, weigths): dot_product = 0 for index in range(len(self.inputs)): dot_product = dot_product + (self.inputs[index] * weigths.inputs[index]) return dot_product
class Vector: def __init__(self, inputs: list): self.inputs = inputs def dot(self, weigths): dot_product = 0 for index in range(len(self.inputs)): dot_product = dot_product + self.inputs[index] * weigths.inputs[index] return dot_product
dependency_matcher_patterns = { "pattern_parameter_adverbial_clause": [ {"RIGHT_ID": "action_head", "RIGHT_ATTRS": {"POS": "VERB"}}, { "LEFT_ID": "action_head", "REL_OP": ">", "RIGHT_ID": "condition_head", "RIGHT_ATTRS": {"DEP": "advcl"}, }, { "LEFT_ID": "condition_head", "REL_OP": ">", "RIGHT_ID": "dependee_param", "RIGHT_ATTRS": {"DEP": {"IN": ["nsubj", "nsubjpass"]}}, }, ] }
dependency_matcher_patterns = {'pattern_parameter_adverbial_clause': [{'RIGHT_ID': 'action_head', 'RIGHT_ATTRS': {'POS': 'VERB'}}, {'LEFT_ID': 'action_head', 'REL_OP': '>', 'RIGHT_ID': 'condition_head', 'RIGHT_ATTRS': {'DEP': 'advcl'}}, {'LEFT_ID': 'condition_head', 'REL_OP': '>', 'RIGHT_ID': 'dependee_param', 'RIGHT_ATTRS': {'DEP': {'IN': ['nsubj', 'nsubjpass']}}}]}
PAGE_ITEM_LIMIT = 10 RSS_ITEM_LIMIT = 10 OUTPUT_DIRECTORY = ""
page_item_limit = 10 rss_item_limit = 10 output_directory = ''
"""Provides a macro to import all TensorFlow Serving dependencies. Some of the external dependencies need to be initialized. To do this, duplicate the initialization code from TensorFlow Serving's WORKSPACE file. """ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def tf_serving_workspace(): """All TensorFlow Serving external dependencies.""" # ===== Bazel package rules dependency ===== http_archive( name = "rules_pkg", sha256 = "352c090cc3d3f9a6b4e676cf42a6047c16824959b438895a76c2989c6d7c246a", url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz", ) # ===== RapidJSON (rapidjson.org) dependency ===== http_archive( name = "com_github_tencent_rapidjson", url = "https://github.com/Tencent/rapidjson/archive/v1.1.0.zip", sha256 = "8e00c38829d6785a2dfb951bb87c6974fa07dfe488aa5b25deec4b8bc0f6a3ab", strip_prefix = "rapidjson-1.1.0", build_file = "@//third_party/rapidjson:BUILD", ) # ===== libevent (libevent.org) dependency ===== http_archive( name = "com_github_libevent_libevent", url = "https://github.com/libevent/libevent/archive/release-2.1.8-stable.zip", sha256 = "70158101eab7ed44fd9cc34e7f247b3cae91a8e4490745d9d6eb7edc184e4d96", strip_prefix = "libevent-release-2.1.8-stable", build_file = "@//third_party/libevent:BUILD", ) # ===== ICU dependency ===== # Note: This overrides the dependency from TensorFlow with a version # that contains all data. http_archive( name = "icu", strip_prefix = "icu-release-64-2", sha256 = "dfc62618aa4bd3ca14a3df548cd65fe393155edd213e49c39f3a30ccd618fc27", urls = [ "https://storage.googleapis.com/mirror.tensorflow.org/github.com/unicode-org/icu/archive/release-64-2.zip", "https://github.com/unicode-org/icu/archive/release-64-2.zip", ], build_file = "//third_party/icu:BUILD", patches = ["//third_party/icu:data.patch"], patch_args = ["-p1", "-s"], ) # ===== TF.Text dependencies # NOTE: Before updating this version, you must update the test model # and double check all custom ops have a test: # https://github.com/tensorflow/text/blob/master/oss_scripts/model_server/save_models.py http_archive( name = "org_tensorflow_text", sha256 = "918e612a4c5e00d4223db2f7eaced1dc33ec4f989ab8cfee094ae237e22b090b", strip_prefix = "text-2.4.3", url = "https://github.com/tensorflow/text/archive/v2.4.3.zip", patches = ["@//third_party/tf_text:tftext.patch"], patch_args = ["-p1"], repo_mapping = {"@com_google_re2": "@com_googlesource_code_re2"}, ) http_archive( name = "com_google_sentencepiece", strip_prefix = "sentencepiece-1.0.0", sha256 = "c05901f30a1d0ed64cbcf40eba08e48894e1b0e985777217b7c9036cac631346", url = "https://github.com/google/sentencepiece/archive/1.0.0.zip", ) http_archive( name = "com_google_glog", sha256 = "1ee310e5d0a19b9d584a855000434bb724aa744745d5b8ab1855c85bff8a8e21", strip_prefix = "glog-028d37889a1e80e8a07da1b8945ac706259e5fd8", urls = [ "https://mirror.bazel.build/github.com/google/glog/archive/028d37889a1e80e8a07da1b8945ac706259e5fd8.tar.gz", "https://github.com/google/glog/archive/028d37889a1e80e8a07da1b8945ac706259e5fd8.tar.gz", ], )
"""Provides a macro to import all TensorFlow Serving dependencies. Some of the external dependencies need to be initialized. To do this, duplicate the initialization code from TensorFlow Serving's WORKSPACE file. """ load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def tf_serving_workspace(): """All TensorFlow Serving external dependencies.""" http_archive(name='rules_pkg', sha256='352c090cc3d3f9a6b4e676cf42a6047c16824959b438895a76c2989c6d7c246a', url='https://github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz') http_archive(name='com_github_tencent_rapidjson', url='https://github.com/Tencent/rapidjson/archive/v1.1.0.zip', sha256='8e00c38829d6785a2dfb951bb87c6974fa07dfe488aa5b25deec4b8bc0f6a3ab', strip_prefix='rapidjson-1.1.0', build_file='@//third_party/rapidjson:BUILD') http_archive(name='com_github_libevent_libevent', url='https://github.com/libevent/libevent/archive/release-2.1.8-stable.zip', sha256='70158101eab7ed44fd9cc34e7f247b3cae91a8e4490745d9d6eb7edc184e4d96', strip_prefix='libevent-release-2.1.8-stable', build_file='@//third_party/libevent:BUILD') http_archive(name='icu', strip_prefix='icu-release-64-2', sha256='dfc62618aa4bd3ca14a3df548cd65fe393155edd213e49c39f3a30ccd618fc27', urls=['https://storage.googleapis.com/mirror.tensorflow.org/github.com/unicode-org/icu/archive/release-64-2.zip', 'https://github.com/unicode-org/icu/archive/release-64-2.zip'], build_file='//third_party/icu:BUILD', patches=['//third_party/icu:data.patch'], patch_args=['-p1', '-s']) http_archive(name='org_tensorflow_text', sha256='918e612a4c5e00d4223db2f7eaced1dc33ec4f989ab8cfee094ae237e22b090b', strip_prefix='text-2.4.3', url='https://github.com/tensorflow/text/archive/v2.4.3.zip', patches=['@//third_party/tf_text:tftext.patch'], patch_args=['-p1'], repo_mapping={'@com_google_re2': '@com_googlesource_code_re2'}) http_archive(name='com_google_sentencepiece', strip_prefix='sentencepiece-1.0.0', sha256='c05901f30a1d0ed64cbcf40eba08e48894e1b0e985777217b7c9036cac631346', url='https://github.com/google/sentencepiece/archive/1.0.0.zip') http_archive(name='com_google_glog', sha256='1ee310e5d0a19b9d584a855000434bb724aa744745d5b8ab1855c85bff8a8e21', strip_prefix='glog-028d37889a1e80e8a07da1b8945ac706259e5fd8', urls=['https://mirror.bazel.build/github.com/google/glog/archive/028d37889a1e80e8a07da1b8945ac706259e5fd8.tar.gz', 'https://github.com/google/glog/archive/028d37889a1e80e8a07da1b8945ac706259e5fd8.tar.gz'])
# %% ####################################### def match_str_len_with_padding( string1: str, string2: str, padding="#", align=("left", "center", "right")[1] ): """Returns a list containing the original longer string, and the smaller string with padding. Examples: >>> mystring = "Complex is better than complicated." >>> secondstring = " blah " >>> blah_song = "blah ba blah blah blah" >>> match_str_len_with_padding(mystring, secondstring)\n ['Complex is better than complicated.', '############## blah ###############'] >>> match_str_len_with_padding(mystring, blah_song, padding="*")\n ['Complex is better than complicated.', '******blah ba blah blah blah*******'] >>> match_str_len_with_padding(mystring[::-1], mystring)\n ['.detacilpmoc naht retteb si xelpmoC', 'Complex is better than complicated.'] >>> match_str_len_with_padding(mystring, blah_song, padding="&", align='right')\n ['Complex is better than complicated.', '&&&&&&&&&&&&&blah ba blah blah blah'] >>> match_str_len_with_padding(mystring, blah_song, padding="<", align='left')\n ['Complex is better than complicated.', 'blah ba blah blah blah<<<<<<<<<<<<<'] References: One liner if/else: https://youtu.be/MHlwl6GsT8s?t=990\n Format() with embedded variables for 'format specifiers': https://stackoverflow.com/questions/3228865/how-do-i-format-a-number-with-a-variable-number-of-digits-in-python Args: string1 (str): String number 1 to use in the comparison string2 (str): String number 2 to use in the comparison padding (str, optional): Here you can specify the padding character. Defaults to "#". align (str, optional): This is used to show valid arguments for this parameter (the default value is 'center'). Defaults to ('left','center','right')[1]. Returns: list: Returns a list containing two strings of the same length, with the smaller string being padded. """ bigger_str = string1 if len(string1) >= len(string2) else string2 smaller_str = string1 if len(string1) < len(string2) else string2 length_to_match = len(bigger_str) if align == "left": padded_string = "{small_str:{somepad}<{thelength}}".format( thelength=length_to_match, small_str=smaller_str, somepad=padding ) elif align == "center": padded_string = "{small_str:{somepad}^{thelength}}".format( thelength=length_to_match, small_str=smaller_str, somepad=padding ) elif align == "right": padded_string = "{small_str:{somepad}>{thelength}}".format( thelength=length_to_match, small_str=smaller_str, somepad=padding ) if padded_string: return [bigger_str, padded_string]
def match_str_len_with_padding(string1: str, string2: str, padding='#', align=('left', 'center', 'right')[1]): """Returns a list containing the original longer string, and the smaller string with padding. Examples: >>> mystring = "Complex is better than complicated." >>> secondstring = " blah " >>> blah_song = "blah ba blah blah blah" >>> match_str_len_with_padding(mystring, secondstring) ['Complex is better than complicated.', '############## blah ###############'] >>> match_str_len_with_padding(mystring, blah_song, padding="*") ['Complex is better than complicated.', '******blah ba blah blah blah*******'] >>> match_str_len_with_padding(mystring[::-1], mystring) ['.detacilpmoc naht retteb si xelpmoC', 'Complex is better than complicated.'] >>> match_str_len_with_padding(mystring, blah_song, padding="&", align='right') ['Complex is better than complicated.', '&&&&&&&&&&&&&blah ba blah blah blah'] >>> match_str_len_with_padding(mystring, blah_song, padding="<", align='left') ['Complex is better than complicated.', 'blah ba blah blah blah<<<<<<<<<<<<<'] References: One liner if/else: https://youtu.be/MHlwl6GsT8s?t=990 Format() with embedded variables for 'format specifiers': https://stackoverflow.com/questions/3228865/how-do-i-format-a-number-with-a-variable-number-of-digits-in-python Args: string1 (str): String number 1 to use in the comparison string2 (str): String number 2 to use in the comparison padding (str, optional): Here you can specify the padding character. Defaults to "#". align (str, optional): This is used to show valid arguments for this parameter (the default value is 'center'). Defaults to ('left','center','right')[1]. Returns: list: Returns a list containing two strings of the same length, with the smaller string being padded. """ bigger_str = string1 if len(string1) >= len(string2) else string2 smaller_str = string1 if len(string1) < len(string2) else string2 length_to_match = len(bigger_str) if align == 'left': padded_string = '{small_str:{somepad}<{thelength}}'.format(thelength=length_to_match, small_str=smaller_str, somepad=padding) elif align == 'center': padded_string = '{small_str:{somepad}^{thelength}}'.format(thelength=length_to_match, small_str=smaller_str, somepad=padding) elif align == 'right': padded_string = '{small_str:{somepad}>{thelength}}'.format(thelength=length_to_match, small_str=smaller_str, somepad=padding) if padded_string: return [bigger_str, padded_string]
''' EASY 203. Remove Linked List Elements You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes. Given a number K, we would want to reformat the strings such that each group contains exactly K characters, except for the first group which could be shorter than K, but still must contain at least one character. Furthermore, there must be a dash inserted between two groups and all lowercase letters should be converted to uppercase. Given a non-empty string S and a number K, format the string according to the rules described above. Example 1: Input: S = "5F3Z-2e-9-w", K = 4 Output: "5F3Z-2E9W" Explanation: The string S has been split into two parts, each part has 4 characters. Note that the two extra dashes are not needed and can be removed. ''' class Solution: def removeElements(self, head: ListNode, val: int) -> ListNode: dummy_head = ListNode(-1) dummy_head.next = head curr = dummy_head while curr.next: if curr.next.val == val: curr.next = curr.next.next else: curr = curr.next return dummy_head.next
""" EASY 203. Remove Linked List Elements You are given a license key represented as a string S which consists only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes. Given a number K, we would want to reformat the strings such that each group contains exactly K characters, except for the first group which could be shorter than K, but still must contain at least one character. Furthermore, there must be a dash inserted between two groups and all lowercase letters should be converted to uppercase. Given a non-empty string S and a number K, format the string according to the rules described above. Example 1: Input: S = "5F3Z-2e-9-w", K = 4 Output: "5F3Z-2E9W" Explanation: The string S has been split into two parts, each part has 4 characters. Note that the two extra dashes are not needed and can be removed. """ class Solution: def remove_elements(self, head: ListNode, val: int) -> ListNode: dummy_head = list_node(-1) dummy_head.next = head curr = dummy_head while curr.next: if curr.next.val == val: curr.next = curr.next.next else: curr = curr.next return dummy_head.next
cities = [ 'Vilnius', 'Kaunas', 'Klaipeda', 'Siauliai', 'Panevezys', 'Alytus', 'Dainava (Kaunas)', 'Eiguliai', 'Marijampole', 'Mazeikiai', 'Silainiai', 'Fabijoniskes', 'Jonava', 'Utena', 'Pasilaiciai', 'Kedainiai', 'Seskine', 'Lazdynai', 'Telsiai', 'Visaginas', 'Taurage', 'Justiniskes', 'Ukmerge', 'Aleksotas', 'Plunge', 'Naujamiestis', 'Kretinga', 'Silute', 'Vilkpede', 'Radviliskis', 'Pilaite', 'Palanga', 'Druskininkai', 'Gargzdai', 'Rokiskis', 'Birzai', 'Kursenai', 'Garliava', 'Elektrenai', 'Jurbarkas', 'Vilkaviskis', 'Raseiniai', 'Anyksciai', 'Naujoji Akmene', 'Lentvaris', 'Grigiskes', 'Prienai', 'Joniskis', 'Kelme', 'Rasos', 'Varena', 'Kaisiadorys', 'Pasvalys', 'Kupiskis', 'Zarasai', 'Skuodas', 'Sirvintos', 'Kazlu Ruda', 'Moletai', 'Salcininkai', 'Svencioneliai', 'Sakiai', 'Ignalina', 'Pabrade', 'Kybartai', 'Nemencine', 'Silale', 'Pakruojis', 'Svencionys', 'Trakai', 'Vievis' ]
cities = ['Vilnius', 'Kaunas', 'Klaipeda', 'Siauliai', 'Panevezys', 'Alytus', 'Dainava (Kaunas)', 'Eiguliai', 'Marijampole', 'Mazeikiai', 'Silainiai', 'Fabijoniskes', 'Jonava', 'Utena', 'Pasilaiciai', 'Kedainiai', 'Seskine', 'Lazdynai', 'Telsiai', 'Visaginas', 'Taurage', 'Justiniskes', 'Ukmerge', 'Aleksotas', 'Plunge', 'Naujamiestis', 'Kretinga', 'Silute', 'Vilkpede', 'Radviliskis', 'Pilaite', 'Palanga', 'Druskininkai', 'Gargzdai', 'Rokiskis', 'Birzai', 'Kursenai', 'Garliava', 'Elektrenai', 'Jurbarkas', 'Vilkaviskis', 'Raseiniai', 'Anyksciai', 'Naujoji Akmene', 'Lentvaris', 'Grigiskes', 'Prienai', 'Joniskis', 'Kelme', 'Rasos', 'Varena', 'Kaisiadorys', 'Pasvalys', 'Kupiskis', 'Zarasai', 'Skuodas', 'Sirvintos', 'Kazlu Ruda', 'Moletai', 'Salcininkai', 'Svencioneliai', 'Sakiai', 'Ignalina', 'Pabrade', 'Kybartai', 'Nemencine', 'Silale', 'Pakruojis', 'Svencionys', 'Trakai', 'Vievis']
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str """ result = [] def dfs(root): if root == None: result.append("null") return result.append(str(root.val)) dfs(root.left) dfs(root.right) dfs(root) return ','.join(result) def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode """ array = data.split(",") def dfs(array): if len(array) == 0: return None first = array.pop(0) if first == "null": return None node = TreeNode(int(first)) node.left = dfs(array) node.right = dfs(array) return node return dfs(array) # Your Codec object will be instantiated and called as such: # codec = Codec() # codec.deserialize(codec.serialize(root))
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str """ result = [] def dfs(root): if root == None: result.append('null') return result.append(str(root.val)) dfs(root.left) dfs(root.right) dfs(root) return ','.join(result) def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode """ array = data.split(',') def dfs(array): if len(array) == 0: return None first = array.pop(0) if first == 'null': return None node = tree_node(int(first)) node.left = dfs(array) node.right = dfs(array) return node return dfs(array)
def add_numbers(num1, num2): return num1 + num2 def subtract_numbers(num1, num2): return num1 - num2 def multiply_numbers(num1, num2): return num1 * num2 def divide_numbers(num1, num2): return num1 / num2
def add_numbers(num1, num2): return num1 + num2 def subtract_numbers(num1, num2): return num1 - num2 def multiply_numbers(num1, num2): return num1 * num2 def divide_numbers(num1, num2): return num1 / num2
REQUEST_DELETE_CONTENT_RANGE = 'deleteContentRange' REQUEST_DELETE_TABLE_ROW = 'deleteTableRow' REQUEST_INSERT_TABLE = 'insertTable' REQUEST_INSERT_TABLE_ROW = 'insertTableRow' REQUEST_INSERT_TEXT = 'insertText' REQUEST_MERGE_TABLE_CELLS = 'mergeTableCells' REQUEST_UPDATE_TEXT_STYLE = 'updateTextStyle' BODY = 'body' BOLD = 'bold' BOOKMARK_ID = 'bookmarkId' CONTENT = 'content' COLUMN_INDEX = 'columnIndex' COLUMN_SPAN = 'columnSpan' CONTENT = 'content' ELEMENTS = 'elements' END_INDEX = 'endIndex' END_OF_SEGMENT_LOCATION = 'endOfSegmentLocation' FIELDS = 'fields' HEADING_ID = 'headingId' INDEX = 'index' INSERT_BELOW = 'insertBelow' ITALIC = 'italic' LINK = 'link' LOCATION = 'location' NUMBER_OF_COLUMNS = 'columns' NUMBER_OF_ROWS = 'rows' PARAGRAPH = 'paragraph' RANGE = 'range' ROW_INDEX = 'rowIndex' ROW_SPAN = 'rowSpan' SEGMENT_ID = 'segmentId' SMALL_CAPS = 'smallCaps' START_INDEX = 'startIndex' STRIKETHROUGH = 'strikethrough' TABLE = 'table' TABLE_CELLS = 'tableCells' TABLE_CELL_LOCATION = 'tableCellLocation' TABLE_RANGE = 'tableRange' TABLE_ROWS = 'tableRows' TABLE_START_LOCATION = 'tableStartLocation' TEXT = 'text' TEXT_RUN = 'textRun' TEXT_STYLE = 'textStyle' UNDERLINE = 'underline' URL = 'url' GOOGLE_DOC_URL_PREFIX = 'https://docs.google.com/document/d/' GOOGLE_DOC_MIMETYPE = 'application/vnd.google-apps.document' WORD_DOC_MIMETYPE = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
request_delete_content_range = 'deleteContentRange' request_delete_table_row = 'deleteTableRow' request_insert_table = 'insertTable' request_insert_table_row = 'insertTableRow' request_insert_text = 'insertText' request_merge_table_cells = 'mergeTableCells' request_update_text_style = 'updateTextStyle' body = 'body' bold = 'bold' bookmark_id = 'bookmarkId' content = 'content' column_index = 'columnIndex' column_span = 'columnSpan' content = 'content' elements = 'elements' end_index = 'endIndex' end_of_segment_location = 'endOfSegmentLocation' fields = 'fields' heading_id = 'headingId' index = 'index' insert_below = 'insertBelow' italic = 'italic' link = 'link' location = 'location' number_of_columns = 'columns' number_of_rows = 'rows' paragraph = 'paragraph' range = 'range' row_index = 'rowIndex' row_span = 'rowSpan' segment_id = 'segmentId' small_caps = 'smallCaps' start_index = 'startIndex' strikethrough = 'strikethrough' table = 'table' table_cells = 'tableCells' table_cell_location = 'tableCellLocation' table_range = 'tableRange' table_rows = 'tableRows' table_start_location = 'tableStartLocation' text = 'text' text_run = 'textRun' text_style = 'textStyle' underline = 'underline' url = 'url' google_doc_url_prefix = 'https://docs.google.com/document/d/' google_doc_mimetype = 'application/vnd.google-apps.document' word_doc_mimetype = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
sum = lambda a,b : a + b print("suma: "+ str(sum(1,2))) # Map lambdas names = ["Christian", "yamile", "Anddy", "Lucero", "Evelyn"] names = map(lambda name:name.upper(),names) print(list(names)) def decrement_list (*vargs): return list(map(lambda number: number - 1,vargs)) print(decrement_list(1,2,3)) #all def is_all_strings(lst): return all(type(l) == str for l in lst) print(is_all_strings(['2',3])) #sorted numbers = [2,3,5,1,8,3,7,9,4] print(numbers) print(sorted(numbers)) print(sorted(numbers,reverse=True)) print(numbers) def extremes(ass): return min (ass),max(ass) print(extremes([1,2,3,4,5])) print(extremes("alcatraz")) print(extremes([1,2,3,4,5])) print(all(n%2==0 for n in [10, 2, 0, 4, 4, 4, 40]))
sum = lambda a, b: a + b print('suma: ' + str(sum(1, 2))) names = ['Christian', 'yamile', 'Anddy', 'Lucero', 'Evelyn'] names = map(lambda name: name.upper(), names) print(list(names)) def decrement_list(*vargs): return list(map(lambda number: number - 1, vargs)) print(decrement_list(1, 2, 3)) def is_all_strings(lst): return all((type(l) == str for l in lst)) print(is_all_strings(['2', 3])) numbers = [2, 3, 5, 1, 8, 3, 7, 9, 4] print(numbers) print(sorted(numbers)) print(sorted(numbers, reverse=True)) print(numbers) def extremes(ass): return (min(ass), max(ass)) print(extremes([1, 2, 3, 4, 5])) print(extremes('alcatraz')) print(extremes([1, 2, 3, 4, 5])) print(all((n % 2 == 0 for n in [10, 2, 0, 4, 4, 4, 40])))
""" This file is create and managed by Tahir Iqbal ---------------------------------------------- It can be use only for education purpose """ # List Modification mix_list = [1, 'Programmer', 5.0, True] print(mix_list) # Mutable : Because re-assign value mix_list[0] = 2 print(mix_list) # Adding item in list mix_list.append('Python') print(mix_list) # Shortcut version of adding item mix_list += ['Solo'] print(mix_list) # Adding item at order place mix_list.insert(1, 'I am') print(mix_list) # Delete a list item del mix_list[0] print(mix_list)
""" This file is create and managed by Tahir Iqbal ---------------------------------------------- It can be use only for education purpose """ mix_list = [1, 'Programmer', 5.0, True] print(mix_list) mix_list[0] = 2 print(mix_list) mix_list.append('Python') print(mix_list) mix_list += ['Solo'] print(mix_list) mix_list.insert(1, 'I am') print(mix_list) del mix_list[0] print(mix_list)
""" ED Data imports exception types """ class FieldsValidationError(Exception): """ Exception type for validation errors related to DataModel instances. """ pass class UnexpectedQueryResult(Exception): """ Exception for unexpected database results. """ pass class NoResultsError(UnexpectedQueryResult): """ Exception when results from a query were expected but none were found. """
""" ED Data imports exception types """ class Fieldsvalidationerror(Exception): """ Exception type for validation errors related to DataModel instances. """ pass class Unexpectedqueryresult(Exception): """ Exception for unexpected database results. """ pass class Noresultserror(UnexpectedQueryResult): """ Exception when results from a query were expected but none were found. """
def author_picture(): author_picture_list = [ "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "2ca50ff2ca024a75a893b80257458104.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "f3b24a5e1d534ba49b36f4ac36ce4f09.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "e7c07866de6f4cb0bccac1baad568d93.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "9c405d8ba8824dcab891b483afbea2bb.png", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "8800fb7a237740779f17b8ac57defa57.png" ] return author_picture_list def work_picture(): work_picture_list = [ "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "4a60ada1fc0f478ca109f9fe49419328.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "20595550fe6e4830bcc8a03f2f7d4b9c.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "83c57efc02d74c7687bcbe62b06b5245.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "330d96fde0644196bc9a87276782b1f0.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "19e2e5ad971a4bf4af25d2b62b428854.jpg", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "26b333ce54724623aeb1d83f68b4b512.png", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "3734093298344d09834fd4897100530f.png", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/" "8005c7f2b69a4111ad5351c5dec8f022.png", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "8800fb7a237740779f17b8ac57defa57.png", "https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/" "4b3f7fdef342445fb2941dbb15a7eed0.jpg" ] return work_picture_list def turtle_code(): code = """import turtle t = turtle.Turtle() screen = turtle.Screen() screen.bgpic('userupload/sucai/3702/20200218/58eb54f9753d1.jpg') t.begin_fill() turtle.colormode(255) t.forward(150) t.right(90) t.forward(170) t.right(90) t.forward(150) t.right(90) t.forward(170) t.fillcolor(250, 255, 230) t.end_fill() t.right(30) t.begin_fill() t.fillcolor(255, 120, 60) t.forward(150) t.right(120) t.forward(150) t.end_fill() print('abc')""" return code def wrong_code(): code = "import turtle\n\n" \ "t = turtle.Turtle()\n" \ "t.forward(150)\n" \ "print(abc)\n" return code def pygame_code(): code = """import pygame from pygame.locals import * background_image = 'userupload/sucai/3702/20200118/bgimg.jpg' mouse_image = 'userupload/sucai/3702/20200224/Snipaste_2019-07-23_17-44-01.png' pygame.init() screen = pygame.display.set_mode((640, 480), 0, 32) pygame.display.set_caption('hello world') background = pygame.image.load(background_image) mouse_cursor = pygame.image.load(mouse_image) while True: screen.blit(background, (0, 0)) x, y = pygame.mouse.get_pos() x -= mouse_cursor.get_width()/2 y -= mouse_cursor.get_height()/2 screen.blit(mouse_cursor, (x, y)) pygame.display.update() """ return code def multiple_files_code(file_name, content): main_code = f"from {file_name} import hello\n\na = hello()\nprint(a)\n\n" file_code = f"def hello():\n s = '{content}'\n\n return s" return main_code, file_code def three_dimensional_code(): code = """import cadquery as cq model = cq.Workplane("XY") model = model.box(10, 20, 30) show_model(model, cq) """ return code def robot_code(): code = 'import robot\n\n' \ 'r=robot.robot()\n' \ 'r.up(1)\n' \ 'r.nod(1)\n' return code
def author_picture(): author_picture_list = ['https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/2ca50ff2ca024a75a893b80257458104.jpg', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/f3b24a5e1d534ba49b36f4ac36ce4f09.jpg', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/e7c07866de6f4cb0bccac1baad568d93.jpg', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/9c405d8ba8824dcab891b483afbea2bb.png', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/8800fb7a237740779f17b8ac57defa57.png'] return author_picture_list def work_picture(): work_picture_list = ['https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/4a60ada1fc0f478ca109f9fe49419328.jpg', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/20595550fe6e4830bcc8a03f2f7d4b9c.jpg', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/83c57efc02d74c7687bcbe62b06b5245.jpg', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/330d96fde0644196bc9a87276782b1f0.jpg', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/19e2e5ad971a4bf4af25d2b62b428854.jpg', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/26b333ce54724623aeb1d83f68b4b512.png', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/3734093298344d09834fd4897100530f.png', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/8005c7f2b69a4111ad5351c5dec8f022.png', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/8800fb7a237740779f17b8ac57defa57.png', 'https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/4b3f7fdef342445fb2941dbb15a7eed0.jpg'] return work_picture_list def turtle_code(): code = "import turtle\n\nt = turtle.Turtle()\nscreen = turtle.Screen()\nscreen.bgpic('userupload/sucai/3702/20200218/58eb54f9753d1.jpg')\nt.begin_fill()\nturtle.colormode(255)\nt.forward(150)\nt.right(90)\nt.forward(170)\nt.right(90)\nt.forward(150)\nt.right(90)\nt.forward(170)\nt.fillcolor(250, 255, 230)\nt.end_fill()\nt.right(30)\nt.begin_fill()\nt.fillcolor(255, 120, 60)\nt.forward(150)\nt.right(120)\nt.forward(150)\nt.end_fill()\n\nprint('abc')" return code def wrong_code(): code = 'import turtle\n\nt = turtle.Turtle()\nt.forward(150)\nprint(abc)\n' return code def pygame_code(): code = "import pygame\n\nfrom pygame.locals import *\nbackground_image = 'userupload/sucai/3702/20200118/bgimg.jpg'\nmouse_image = 'userupload/sucai/3702/20200224/Snipaste_2019-07-23_17-44-01.png'\npygame.init()\nscreen = pygame.display.set_mode((640, 480), 0, 32)\npygame.display.set_caption('hello world')\nbackground = pygame.image.load(background_image)\nmouse_cursor = pygame.image.load(mouse_image)\nwhile True:\n screen.blit(background, (0, 0))\n x, y = pygame.mouse.get_pos()\n x -= mouse_cursor.get_width()/2\n y -= mouse_cursor.get_height()/2\n screen.blit(mouse_cursor, (x, y))\n pygame.display.update()\n" return code def multiple_files_code(file_name, content): main_code = f'from {file_name} import hello\n\na = hello()\nprint(a)\n\n' file_code = f"def hello():\n s = '{content}'\n\n return s" return (main_code, file_code) def three_dimensional_code(): code = 'import cadquery as cq\nmodel = cq.Workplane("XY")\nmodel = model.box(10, 20, 30)\nshow_model(model, cq)\n' return code def robot_code(): code = 'import robot\n\nr=robot.robot()\nr.up(1)\nr.nod(1)\n' return code
# python3 theory/conditionals.py def plus(a, b): if type(a) is int or type(a) is float: if type(b) is int or type(b) is float: return a + b else: return None else: return None print(plus(1, '10')) def can_drink(age): print(f"You are {age} years old.") if age < 18: print("You can't drink.") elif age == 18 or age == 19: print("Go easy on it cowbow.") elif age > 19 and age < 25: print("Buckle up son.") else: print("Enjoy your drink!") can_drink(17) can_drink(19) can_drink(21) can_drink(25)
def plus(a, b): if type(a) is int or type(a) is float: if type(b) is int or type(b) is float: return a + b else: return None else: return None print(plus(1, '10')) def can_drink(age): print(f'You are {age} years old.') if age < 18: print("You can't drink.") elif age == 18 or age == 19: print('Go easy on it cowbow.') elif age > 19 and age < 25: print('Buckle up son.') else: print('Enjoy your drink!') can_drink(17) can_drink(19) can_drink(21) can_drink(25)
def os_return(distro): if distro == 'rhel': return_value = { 'distribution': 'centos', 'version': '7.5', 'dist_name': 'CentOS Linux', 'based_on': 'rhel' } elif distro == 'ubuntu': return_value = { 'distribution': 'ec2', 'version': '16.04', 'dist_name': 'Ubuntu', 'based_on': 'debian' } elif distro == 'suse': return_value = { 'distribution': 'sles', 'version': '12', 'dist_name': 'SLES', 'based_on': 'suse' } return return_value def system_compatability(test_pass=True): if test_pass: return { 'OS': 'PASS', 'version': 'PASS' } return { 'OS': 'PASS', 'version': 'FAIL' } def memory_cpu(test_pass=True): if test_pass: return { 'memory': { 'minimum': 16.0, 'actual': 251.88 }, 'cpu_cores': { 'minimum': 8, 'actual': 64 } } return { 'memory': { 'minimum': 16.0, 'actual': 14.88 }, 'cpu_cores': { 'minimum': 8, 'actual': 4 } } def mounts(test_pass=True): if test_pass: return { '/': { 'recommended': 130.0, 'free': 498.13, 'total': 499.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'xfs', 'ftype': '1' }, '/tmp': { 'recommended': 30.0, 'free': 39.13, 'total': 39.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'ext4' }, } return { '/': { 'recommended': 0.0, 'free': 19.13, 'total': 19.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'xfs', 'ftype': '0' }, '/tmp': { 'recommended': 30.0, 'free': 19.13, 'total': 19.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'ext4' }, '/opt/anaconda': { 'recommended': 100.0, 'free': 98.13, 'total': 99.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'ext4' }, '/var': { 'recommended': 100.0, 'free': 98.13, 'total': 99.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'ext4' } } def resolv_conf(test_pass=True): if test_pass: return { 'search_domains': ['test.domain', 'another.domain'], 'options': [] } return { 'search_domains': [ 'test.domain', 'another.domain', 'again.domain', 'optional.domain' ], 'options': ['timeout:2', 'rotate'] } def resolv_conf_warn(): return { 'search_domains': ['test.domain', 'another.domain'], 'options': ['rotate'] } def ports(test_pass=True): if test_pass: return { 'eth0': { '80': 'open', '443': 'open', '32009': 'open', '61009': 'open', '65535': 'open' } } return { 'eth0': { '80': 'open', '443': 'closed', '32009': 'closed', '61009': 'closed', '65535': 'closed' } } def agents(test_pass=True): if test_pass: return {'running': []} return {'running': ['puppet-agent']} def modules(test_pass=True): if test_pass: return { 'missing': [], 'enabled': [ 'iptable_filter', 'br_netfilter', 'iptable_nat', 'ebtables', 'overlay' ] } return { 'missing': [ 'iptable_filter', 'br_netfilter', 'iptable_nat', 'ebtables' ], 'enabled': ['overlay'] } def sysctl(test_pass=True): if test_pass: return { 'enabled': [ 'net.bridge.bridge-nf-call-iptables', 'net.bridge.bridge-nf-call-ip6tables', 'fs.may_detach_mounts', 'net.ipv4.ip_forward' ], 'disabled': [] } return { 'enabled': ['net.ipv4.ip_forward'], 'disabled': [ 'net.bridge.bridge-nf-call-ip6tables', 'net.bridge.bridge-nf-call-iptables', 'fs.may_detach_mounts' ] } def selinux(test_pass=True): if test_pass: return { 'getenforce': 'disabled', 'config': 'permissive' } return { 'getenforce': 'disabled', 'config': 'enforcing' } def infinity(test_pass=True): if test_pass: return True return False
def os_return(distro): if distro == 'rhel': return_value = {'distribution': 'centos', 'version': '7.5', 'dist_name': 'CentOS Linux', 'based_on': 'rhel'} elif distro == 'ubuntu': return_value = {'distribution': 'ec2', 'version': '16.04', 'dist_name': 'Ubuntu', 'based_on': 'debian'} elif distro == 'suse': return_value = {'distribution': 'sles', 'version': '12', 'dist_name': 'SLES', 'based_on': 'suse'} return return_value def system_compatability(test_pass=True): if test_pass: return {'OS': 'PASS', 'version': 'PASS'} return {'OS': 'PASS', 'version': 'FAIL'} def memory_cpu(test_pass=True): if test_pass: return {'memory': {'minimum': 16.0, 'actual': 251.88}, 'cpu_cores': {'minimum': 8, 'actual': 64}} return {'memory': {'minimum': 16.0, 'actual': 14.88}, 'cpu_cores': {'minimum': 8, 'actual': 4}} def mounts(test_pass=True): if test_pass: return {'/': {'recommended': 130.0, 'free': 498.13, 'total': 499.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'xfs', 'ftype': '1'}, '/tmp': {'recommended': 30.0, 'free': 39.13, 'total': 39.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'ext4'}} return {'/': {'recommended': 0.0, 'free': 19.13, 'total': 19.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'xfs', 'ftype': '0'}, '/tmp': {'recommended': 30.0, 'free': 19.13, 'total': 19.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'ext4'}, '/opt/anaconda': {'recommended': 100.0, 'free': 98.13, 'total': 99.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'ext4'}, '/var': {'recommended': 100.0, 'free': 98.13, 'total': 99.7, 'mount_options': 'rw,inode64,noquota', 'file_system': 'ext4'}} def resolv_conf(test_pass=True): if test_pass: return {'search_domains': ['test.domain', 'another.domain'], 'options': []} return {'search_domains': ['test.domain', 'another.domain', 'again.domain', 'optional.domain'], 'options': ['timeout:2', 'rotate']} def resolv_conf_warn(): return {'search_domains': ['test.domain', 'another.domain'], 'options': ['rotate']} def ports(test_pass=True): if test_pass: return {'eth0': {'80': 'open', '443': 'open', '32009': 'open', '61009': 'open', '65535': 'open'}} return {'eth0': {'80': 'open', '443': 'closed', '32009': 'closed', '61009': 'closed', '65535': 'closed'}} def agents(test_pass=True): if test_pass: return {'running': []} return {'running': ['puppet-agent']} def modules(test_pass=True): if test_pass: return {'missing': [], 'enabled': ['iptable_filter', 'br_netfilter', 'iptable_nat', 'ebtables', 'overlay']} return {'missing': ['iptable_filter', 'br_netfilter', 'iptable_nat', 'ebtables'], 'enabled': ['overlay']} def sysctl(test_pass=True): if test_pass: return {'enabled': ['net.bridge.bridge-nf-call-iptables', 'net.bridge.bridge-nf-call-ip6tables', 'fs.may_detach_mounts', 'net.ipv4.ip_forward'], 'disabled': []} return {'enabled': ['net.ipv4.ip_forward'], 'disabled': ['net.bridge.bridge-nf-call-ip6tables', 'net.bridge.bridge-nf-call-iptables', 'fs.may_detach_mounts']} def selinux(test_pass=True): if test_pass: return {'getenforce': 'disabled', 'config': 'permissive'} return {'getenforce': 'disabled', 'config': 'enforcing'} def infinity(test_pass=True): if test_pass: return True return False
"""Return list of values that are multiplies of x.""" def count_by(x, n): """Return a sequence of numbers counting by `x` `n` times.""" return [i * x for i in range(1, n + 1)]
"""Return list of values that are multiplies of x.""" def count_by(x, n): """Return a sequence of numbers counting by `x` `n` times.""" return [i * x for i in range(1, n + 1)]
class NoGloveValueError(Exception): """ Raised if no value can be found in GloVe for a user's text. """ pass
class Noglovevalueerror(Exception): """ Raised if no value can be found in GloVe for a user's text. """ pass
class Config: @staticmethod def get(repo, config_key): splitted_keys = config_key.split('.') splitted_keys_in_byte = [key.encode() for key in splitted_keys] if splitted_keys.__len__() > 2: section = tuple(splitted_keys_in_byte[:-1]) arg = splitted_keys_in_byte[-1] else: section = splitted_keys_in_byte[0] arg = splitted_keys_in_byte[1] config = repo.get_config() try: value = config.get(section, arg) except KeyError: value = None return value.decode() if value else value
class Config: @staticmethod def get(repo, config_key): splitted_keys = config_key.split('.') splitted_keys_in_byte = [key.encode() for key in splitted_keys] if splitted_keys.__len__() > 2: section = tuple(splitted_keys_in_byte[:-1]) arg = splitted_keys_in_byte[-1] else: section = splitted_keys_in_byte[0] arg = splitted_keys_in_byte[1] config = repo.get_config() try: value = config.get(section, arg) except KeyError: value = None return value.decode() if value else value
path = 'home/sample.mp4' akhil = [] akhil = path.split(".") video = akhil[0].split("/") print(video[len(video)-1])
path = 'home/sample.mp4' akhil = [] akhil = path.split('.') video = akhil[0].split('/') print(video[len(video) - 1])
def converteHora(hora): # Se a hora for 00: if int(hora[:2]) == 0: return f"12{hora[2:]} AM" # Se for 12 if int(hora[:2]) == 12: return f"12{hora[2:]} PM" # Se for de tarde if int(hora[:2]) > 12: return f"0{int(hora[:2]) - 12 }{hora[2:]} PM" return f"{hora} AM" print(converteHora("09:39"))
def converte_hora(hora): if int(hora[:2]) == 0: return f'12{hora[2:]} AM' if int(hora[:2]) == 12: return f'12{hora[2:]} PM' if int(hora[:2]) > 12: return f'0{int(hora[:2]) - 12}{hora[2:]} PM' return f'{hora} AM' print(converte_hora('09:39'))
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'includes': [ '../../build/common.gypi', ], 'targets': [ { 'target_name': 'libpng', 'type': '<(library)', 'dependencies': [ '../zlib/zlib.gyp:zlib', ], 'defines': [ 'CHROME_PNG_WRITE_SUPPORT', 'PNG_USER_CONFIG', ], 'msvs_guid': 'C564F145-9172-42C3-BFCB-6014CA97DBCD', 'sources': [ 'png.c', 'png.h', 'pngconf.h', 'pngerror.c', 'pnggccrd.c', 'pngget.c', 'pngmem.c', 'pngpread.c', 'pngread.c', 'pngrio.c', 'pngrtran.c', 'pngrutil.c', 'pngset.c', 'pngtrans.c', 'pngusr.h', 'pngvcrd.c', 'pngwio.c', 'pngwrite.c', 'pngwtran.c', 'pngwutil.c', ], 'direct_dependent_settings': { 'include_dirs': [ '.', ], 'defines': [ 'CHROME_PNG_WRITE_SUPPORT', 'PNG_USER_CONFIG', ], }, 'export_dependent_settings': [ '../zlib/zlib.gyp:zlib', ], 'conditions': [ ['OS!="win"', {'product_name': 'png'}], ], }, ], }
{'includes': ['../../build/common.gypi'], 'targets': [{'target_name': 'libpng', 'type': '<(library)', 'dependencies': ['../zlib/zlib.gyp:zlib'], 'defines': ['CHROME_PNG_WRITE_SUPPORT', 'PNG_USER_CONFIG'], 'msvs_guid': 'C564F145-9172-42C3-BFCB-6014CA97DBCD', 'sources': ['png.c', 'png.h', 'pngconf.h', 'pngerror.c', 'pnggccrd.c', 'pngget.c', 'pngmem.c', 'pngpread.c', 'pngread.c', 'pngrio.c', 'pngrtran.c', 'pngrutil.c', 'pngset.c', 'pngtrans.c', 'pngusr.h', 'pngvcrd.c', 'pngwio.c', 'pngwrite.c', 'pngwtran.c', 'pngwutil.c'], 'direct_dependent_settings': {'include_dirs': ['.'], 'defines': ['CHROME_PNG_WRITE_SUPPORT', 'PNG_USER_CONFIG']}, 'export_dependent_settings': ['../zlib/zlib.gyp:zlib'], 'conditions': [['OS!="win"', {'product_name': 'png'}]]}]}
# # PySNMP MIB module HPN-ICF-FC-PSM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-FC-PSM-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:38:51 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") ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint") HpnicfFcNameIdOrZero, = mibBuilder.importSymbols("HPN-ICF-FC-TC-MIB", "HpnicfFcNameIdOrZero") hpnicfSan, = mibBuilder.importSymbols("HPN-ICF-VSAN-MIB", "hpnicfSan") ifDescr, InterfaceIndexOrZero, InterfaceIndex = mibBuilder.importSymbols("IF-MIB", "ifDescr", "InterfaceIndexOrZero", "InterfaceIndex") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Counter64, NotificationType, Bits, Gauge32, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, MibIdentifier, IpAddress, TimeTicks, Integer32, ModuleIdentity, iso, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "NotificationType", "Bits", "Gauge32", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "MibIdentifier", "IpAddress", "TimeTicks", "Integer32", "ModuleIdentity", "iso", "Counter32") TruthValue, RowStatus, TextualConvention, TimeStamp, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "RowStatus", "TextualConvention", "TimeStamp", "DisplayString") hpnicfFcPsm = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8)) hpnicfFcPsm.setRevisions(('2013-10-17 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hpnicfFcPsm.setRevisionsDescriptions(('HPN-ICF-FC-PSM-MIB module is for managing the implementation of FC port security.',)) if mibBuilder.loadTexts: hpnicfFcPsm.setLastUpdated('201310170000Z') if mibBuilder.loadTexts: hpnicfFcPsm.setOrganization('') if mibBuilder.loadTexts: hpnicfFcPsm.setContactInfo('') if mibBuilder.loadTexts: hpnicfFcPsm.setDescription('This MIB contains the objects for FC port security.') hpnicfFcPsmNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0)) hpnicfFcPsmObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1)) hpnicfFcPsmScalarObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 1)) hpnicfFcPsmConfiguration = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2)) hpnicfFcPsmStats = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3)) class HpnicfFcPsmPortBindDevType(TextualConvention, Integer32): description = 'The types of the instance of hpnicfFcPsmLoginDev, including nWWN(Node World Wide Name), pWWN(Port World Wide Name), sWWN(Switch World Wide Name), and wildCard.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4)) namedValues = NamedValues(("nWWN", 1), ("pWWN", 2), ("sWWN", 3), ("wildCard", 4)) class HpnicfFcPsmClearEntryType(TextualConvention, Integer32): description = 'This object when set to clearStatic, results in port bind static entries being cleared on this VSAN(Virtual Storage Area Networks). This object when set to clearAutoLearn, results in port bind auto-learnt entries being cleared on this VSAN. This object when set to clearAll, results in all of the port bind entries being cleared on this VSAN. No action is taken if this object is set to noop. The value of this object when read is always noop.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4)) namedValues = NamedValues(("clearStatic", 1), ("clearAutoLearn", 2), ("clearAll", 3), ("noop", 4)) hpnicfFcPsmNotifyEnable = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmNotifyEnable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmNotifyEnable.setDescription('Whether to generate the notification or not depends on the object.') hpnicfFcPsmEnableTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1), ) if mibBuilder.loadTexts: hpnicfFcPsmEnableTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableTable.setDescription('Enable or disable the port security feature on a specified VSAN.') hpnicfFcPsmEnableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex")) if mibBuilder.loadTexts: hpnicfFcPsmEnableEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableEntry.setDescription('Detailed information about the port security.') hpnicfFcPsmEnableVsanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4095))) if mibBuilder.loadTexts: hpnicfFcPsmEnableVsanIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableVsanIndex.setDescription('The ID of VSAN on this entry.') hpnicfFcPsmEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("enable", 1), ("enableWithAutoLearn", 2), ("disable", 3), ("noop", 4))).clone('noop')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmEnable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnable.setDescription('When set to enable, the port security is on, the value of hpnicfFcPsmEnableState will be true. When set to enableWithAutoLearn, the port security is on with auto-learning, the value of hpnicfFcPsmEnableState will be true. When set to disable, the port security is off, the value of hpnicfFcPsmEnableState will be false. The noop means no action. The value of this object when read is always noop.') hpnicfFcPsmEnableState = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 3), TruthValue().clone('false')).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmEnableState.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableState.setDescription('The state of the port security. When the value is true, it means the port security is on, while the false means the port security is off.') hpnicfFcPsmConfigTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2), ) if mibBuilder.loadTexts: hpnicfFcPsmConfigTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmConfigTable.setDescription('A table that contains the configured entries.') hpnicfFcPsmConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"), (0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmIndex")) if mibBuilder.loadTexts: hpnicfFcPsmConfigEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmConfigEntry.setDescription('Detailed information about each configuration.') hpnicfFcPsmIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 32768))) if mibBuilder.loadTexts: hpnicfFcPsmIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmIndex.setDescription('The index of this entry.') hpnicfFcPsmLoginDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 2), HpnicfFcPsmPortBindDevType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFcPsmLoginDevType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginDevType.setDescription('This represents the type of the instance of hpnicfFcPsmLoginDev, which includes nWWN, pWWN, sWWN, and wildCard.') hpnicfFcPsmLoginDev = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 3), HpnicfFcNameIdOrZero()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFcPsmLoginDev.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginDev.setDescription('The logging-in device name, which is decided by the hpnicfFcPsmLoginDevType object. It represents node WWN when the value of hpnicfFcPsmLoginDevType is nWWN. It represents port WWN when the value of hpnicfFcPsmLoginDevType is pWWN. It represents switch WWN when the value of hpnicfFcPsmLoginDevType is sWWN. It represents any device when the value of hpnicfFcPsmLoginDevType is wildCard, and the value of the instance of this object should be zero-length string. The value of this object should not be invalid when hpnicfFcPsmRowStatus is set to createAndGo or active.') hpnicfFcPsmLoginPoint = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 4), InterfaceIndexOrZero()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFcPsmLoginPoint.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginPoint.setDescription('The address of the port on the local switch through which the instance of hpnicfFcPsmLoginDev can log in. It represents ifindex when the value is not zero. It represents any port when the value is zero.') hpnicfFcPsmRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 5), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfFcPsmRowStatus.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmRowStatus.setDescription('Entry status. When creating a new instance of this table, the following objects should be set simultaneously: hpnicfFcPsmLoginDevType, h3cFcPsmLoginDev, hpnicfFcPsmLoginPoint, hpnicfFcPsmRowStatus. If hpnicfFcPsmLoginDevType is set to wildCard, the value of the instance of hpnicfFcPsmLoginDev should be zero-length string. The value of hpnicfFcPsmLoginDevType and hpnicfFcPsmLoginPoint cannot be set to wildCard and zero at the same time.') hpnicfFcPsmEnfTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3), ) if mibBuilder.loadTexts: hpnicfFcPsmEnfTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfTable.setDescription('The FC port security enforced table. It contains not only the configured policies, but also the learning ones learnt by the switch itself.') hpnicfFcPsmEnfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"), (0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnfIndex")) if mibBuilder.loadTexts: hpnicfFcPsmEnfEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfEntry.setDescription('Detailed information about the FC port security enforced policy.') hpnicfFcPsmEnfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 32768))) if mibBuilder.loadTexts: hpnicfFcPsmEnfIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfIndex.setDescription('The index of this entry.') hpnicfFcPsmEnfLoginDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 2), HpnicfFcPsmPortBindDevType()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDevType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDevType.setDescription('This represents the type of the instance of hpnicfFcPsmEnfLoginDev, which includes nWWN, pWWN, sWWN, and wildCard.') hpnicfFcPsmEnfLoginDev = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 3), HpnicfFcNameIdOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDev.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDev.setDescription('The logging-in device name, which is decided by the hpnicfFcPsmEnfLoginDevType object. It represents node WWN when the value of hpnicfFcPsmEnfLoginDevType is nWWN. It represents port WWN when the value of hpnicfFcPsmEnfLoginDevType is pWWN. It represents switch WWN when the value of hpnicfFcPsmEnfLoginDevType is sWWN. It represents any device when the value of hpnicfFcPsmEnfLoginDevType is wildCard, and the value of the instance of this object should be zero-length string.') hpnicfFcPsmEnfLoginPoint = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 4), InterfaceIndexOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginPoint.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginPoint.setDescription('The address of the port on the local switch through which the instance of hpnicfFcPsmEnfLoginDev can log in. It represents ifindex when the value is not zero. It represents any port when the value is zero.') hpnicfFcPsmEnfEntryType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("learning", 1), ("learnt", 2), ("static", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmEnfEntryType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfEntryType.setDescription('When the value is learning, it represents the entry is learnt by the switch itself temporarily and will be deleted when the device log out. When the value is learnt, it represents the entry is learnt by the switch permanently. When the value is static, it represents the entry is configured.') hpnicfFcPsmCopyToConfigTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4), ) if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigTable.setDescription('Specifies whether to copy the entries from enforced table to the ones on configured table.') hpnicfFcPsmCopyToConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex")) if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigEntry.setDescription('Detailed information about the operation.') hpnicfFcPsmCopyToConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("copy", 1), ("noop", 2))).clone('noop')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfig.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfig.setDescription('When the object is set to copy, the learned entries will be copied on to the configured table on this VSAN, while the noop means no operation. The value of this object when read is always noop.') hpnicfFcPsmAutoLearnTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5), ) if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnTable.setDescription('This table shows whether the auto-learning is enabled or not on specific VSANs.') hpnicfFcPsmAutoLearnEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex")) if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEntry.setDescription('Detailed information about the auto-learning.') hpnicfFcPsmAutoLearnEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEnable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEnable.setDescription('This object is set to true to enable, or false to disable auto-learning on the local switch. When set to true, the switch can learn the devices that have already logged in as learning entries on the enforced table, while the false can stop the learning operation with the learning entries transformed to learnt ones.') hpnicfFcPsmClearTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6), ) if mibBuilder.loadTexts: hpnicfFcPsmClearTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearTable.setDescription('This table is used for cleaning specific entries in enforced table.') hpnicfFcPsmClearEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex")) if mibBuilder.loadTexts: hpnicfFcPsmClearEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearEntry.setDescription('Detailed information about the cleaning options.') hpnicfFcPsmClearType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1, 1), HpnicfFcPsmClearEntryType().clone('noop')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmClearType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearType.setDescription('This object when set to clearStatic, results in port bind static entries being cleared on this VSAN. This object when set to clearAutoLearn, results in auto-learnt entries being cleared on this VSAN. This object when set to clearAll, results in all of the port bind entries being cleared on this VSAN. No action is taken if this object is set to noop. The value of this object when read is always noop.') hpnicfFcPsmClearIntf = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmClearIntf.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearIntf.setDescription('The object specifies the interface on which the entries will be cleared. If the object is zero or not set, it means the specified entries on all interfaces will be cleared.') hpnicfFcPsmStatsTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1), ) if mibBuilder.loadTexts: hpnicfFcPsmStatsTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmStatsTable.setDescription('This table contains statistics of devices, which had been allowed or denied to log into the switch.') hpnicfFcPsmStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex")) if mibBuilder.loadTexts: hpnicfFcPsmStatsEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmStatsEntry.setDescription('Detailed information about the statistics.') hpnicfFcPsmAllowedLogins = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmAllowedLogins.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAllowedLogins.setDescription('The number of requests that have been allowed on the specified VSAN.') hpnicfFcPsmDeniedLogins = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmDeniedLogins.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmDeniedLogins.setDescription('The number of requests that have been denied on the specified VSAN.') hpnicfFcPsmStatsClear = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("clear", 1), ("noop", 2))).clone('noop')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfFcPsmStatsClear.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmStatsClear.setDescription('The statistics on this VSAN will be cleared if this object is set to clear. No action is taken if this object is set to noop. The value of this object when read is always noop.') hpnicfFcPsmViolationTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2), ) if mibBuilder.loadTexts: hpnicfFcPsmViolationTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmViolationTable.setDescription('This table maintains the information about the violations happened, containing at most 1024 items. When the number exceeds 1024, the earliest item will be over-written.') hpnicfFcPsmViolationEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"), (0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmViolationIndex")) if mibBuilder.loadTexts: hpnicfFcPsmViolationEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmViolationEntry.setDescription('Detailed information about the violation.') hpnicfFcPsmViolationIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))) if mibBuilder.loadTexts: hpnicfFcPsmViolationIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmViolationIndex.setDescription('The index of this entry. The entry is uniquely distinguished by WWN, WWN type and ifindex where the login was denied.') hpnicfFcPsmLoginPWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 2), HpnicfFcNameIdOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginPWWN.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginPWWN.setDescription('The pWWN of the device whose FLOGI(Fabric Login) request had been denied. If the device is an n-node, the value of the instance of hpnicfFcPsmLoginSWWN should be zero-length string.') hpnicfFcPsmLoginNWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 3), HpnicfFcNameIdOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginNWWN.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginNWWN.setDescription('The nWWN of the device whose FLOGI request had been denied. If the device is an n-node, the value of the instance of hpnicfFcPsmLoginSWWN should be zero-length string.') hpnicfFcPsmLoginSWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 4), HpnicfFcNameIdOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginSWWN.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginSWWN.setDescription('The sWWN of the device whose FLOGI request had been denied. If the device is a switch, the values of the instance of hpnicfFcPsmLoginPWWN and hpnicfFcPsmLoginNWWN should be zero-length string.') hpnicfFcPsmLoginIntf = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 5), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginIntf.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginIntf.setDescription('The ifindex of the port where the login was denied.') hpnicfFcPsmLoginTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 6), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginTime.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginTime.setDescription('Specifies the value of SysUpTime when the last denied login happened.') hpnicfFcPsmLoginCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfFcPsmLoginCount.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginCount.setDescription('The number of times for a certain nWWN/pWWN or sWWN had been denied to log into an interface of the local device.') hpnicfFcPsmFPortDenyNotify = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0, 1)).setObjects(("IF-MIB", "ifDescr"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginPWWN"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginIntf"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginTime")) if mibBuilder.loadTexts: hpnicfFcPsmFPortDenyNotify.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmFPortDenyNotify.setDescription('Notifies that a FLOGI is denied on an F port of the local device.') hpnicfFcPsmEPortDenyNotify = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0, 2)).setObjects(("IF-MIB", "ifDescr"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginSWWN"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginIntf"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginTime")) if mibBuilder.loadTexts: hpnicfFcPsmEPortDenyNotify.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEPortDenyNotify.setDescription('Notifies that a switch is denied on an E port of the local device.') mibBuilder.exportSymbols("HPN-ICF-FC-PSM-MIB", hpnicfFcPsmClearIntf=hpnicfFcPsmClearIntf, hpnicfFcPsmStats=hpnicfFcPsmStats, hpnicfFcPsmClearType=hpnicfFcPsmClearType, hpnicfFcPsmLoginDevType=hpnicfFcPsmLoginDevType, hpnicfFcPsmClearTable=hpnicfFcPsmClearTable, hpnicfFcPsmEnfIndex=hpnicfFcPsmEnfIndex, hpnicfFcPsmConfiguration=hpnicfFcPsmConfiguration, hpnicfFcPsmStatsTable=hpnicfFcPsmStatsTable, hpnicfFcPsmConfigTable=hpnicfFcPsmConfigTable, hpnicfFcPsmEnable=hpnicfFcPsmEnable, hpnicfFcPsmLoginPWWN=hpnicfFcPsmLoginPWWN, hpnicfFcPsmEnfTable=hpnicfFcPsmEnfTable, hpnicfFcPsmLoginTime=hpnicfFcPsmLoginTime, hpnicfFcPsmEnfLoginPoint=hpnicfFcPsmEnfLoginPoint, hpnicfFcPsmClearEntry=hpnicfFcPsmClearEntry, hpnicfFcPsmIndex=hpnicfFcPsmIndex, HpnicfFcPsmPortBindDevType=HpnicfFcPsmPortBindDevType, hpnicfFcPsmCopyToConfigEntry=hpnicfFcPsmCopyToConfigEntry, hpnicfFcPsmLoginNWWN=hpnicfFcPsmLoginNWWN, hpnicfFcPsm=hpnicfFcPsm, hpnicfFcPsmAutoLearnTable=hpnicfFcPsmAutoLearnTable, hpnicfFcPsmEnfEntryType=hpnicfFcPsmEnfEntryType, hpnicfFcPsmEnfLoginDevType=hpnicfFcPsmEnfLoginDevType, hpnicfFcPsmEnableVsanIndex=hpnicfFcPsmEnableVsanIndex, hpnicfFcPsmViolationTable=hpnicfFcPsmViolationTable, hpnicfFcPsmLoginPoint=hpnicfFcPsmLoginPoint, hpnicfFcPsmScalarObjects=hpnicfFcPsmScalarObjects, hpnicfFcPsmViolationIndex=hpnicfFcPsmViolationIndex, hpnicfFcPsmLoginDev=hpnicfFcPsmLoginDev, hpnicfFcPsmNotifyEnable=hpnicfFcPsmNotifyEnable, hpnicfFcPsmDeniedLogins=hpnicfFcPsmDeniedLogins, hpnicfFcPsmCopyToConfig=hpnicfFcPsmCopyToConfig, hpnicfFcPsmObjects=hpnicfFcPsmObjects, hpnicfFcPsmEnfEntry=hpnicfFcPsmEnfEntry, hpnicfFcPsmViolationEntry=hpnicfFcPsmViolationEntry, hpnicfFcPsmConfigEntry=hpnicfFcPsmConfigEntry, PYSNMP_MODULE_ID=hpnicfFcPsm, hpnicfFcPsmEnfLoginDev=hpnicfFcPsmEnfLoginDev, hpnicfFcPsmLoginIntf=hpnicfFcPsmLoginIntf, hpnicfFcPsmEnableTable=hpnicfFcPsmEnableTable, hpnicfFcPsmEnableEntry=hpnicfFcPsmEnableEntry, hpnicfFcPsmFPortDenyNotify=hpnicfFcPsmFPortDenyNotify, hpnicfFcPsmNotifications=hpnicfFcPsmNotifications, hpnicfFcPsmAutoLearnEnable=hpnicfFcPsmAutoLearnEnable, hpnicfFcPsmLoginCount=hpnicfFcPsmLoginCount, hpnicfFcPsmAllowedLogins=hpnicfFcPsmAllowedLogins, hpnicfFcPsmEnableState=hpnicfFcPsmEnableState, hpnicfFcPsmAutoLearnEntry=hpnicfFcPsmAutoLearnEntry, hpnicfFcPsmRowStatus=hpnicfFcPsmRowStatus, hpnicfFcPsmLoginSWWN=hpnicfFcPsmLoginSWWN, hpnicfFcPsmStatsEntry=hpnicfFcPsmStatsEntry, hpnicfFcPsmStatsClear=hpnicfFcPsmStatsClear, hpnicfFcPsmCopyToConfigTable=hpnicfFcPsmCopyToConfigTable, HpnicfFcPsmClearEntryType=HpnicfFcPsmClearEntryType, hpnicfFcPsmEPortDenyNotify=hpnicfFcPsmEPortDenyNotify)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint') (hpnicf_fc_name_id_or_zero,) = mibBuilder.importSymbols('HPN-ICF-FC-TC-MIB', 'HpnicfFcNameIdOrZero') (hpnicf_san,) = mibBuilder.importSymbols('HPN-ICF-VSAN-MIB', 'hpnicfSan') (if_descr, interface_index_or_zero, interface_index) = mibBuilder.importSymbols('IF-MIB', 'ifDescr', 'InterfaceIndexOrZero', 'InterfaceIndex') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (counter64, notification_type, bits, gauge32, unsigned32, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, mib_identifier, ip_address, time_ticks, integer32, module_identity, iso, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'NotificationType', 'Bits', 'Gauge32', 'Unsigned32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'MibIdentifier', 'IpAddress', 'TimeTicks', 'Integer32', 'ModuleIdentity', 'iso', 'Counter32') (truth_value, row_status, textual_convention, time_stamp, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'RowStatus', 'TextualConvention', 'TimeStamp', 'DisplayString') hpnicf_fc_psm = module_identity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8)) hpnicfFcPsm.setRevisions(('2013-10-17 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hpnicfFcPsm.setRevisionsDescriptions(('HPN-ICF-FC-PSM-MIB module is for managing the implementation of FC port security.',)) if mibBuilder.loadTexts: hpnicfFcPsm.setLastUpdated('201310170000Z') if mibBuilder.loadTexts: hpnicfFcPsm.setOrganization('') if mibBuilder.loadTexts: hpnicfFcPsm.setContactInfo('') if mibBuilder.loadTexts: hpnicfFcPsm.setDescription('This MIB contains the objects for FC port security.') hpnicf_fc_psm_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0)) hpnicf_fc_psm_objects = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1)) hpnicf_fc_psm_scalar_objects = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 1)) hpnicf_fc_psm_configuration = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2)) hpnicf_fc_psm_stats = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3)) class Hpnicffcpsmportbinddevtype(TextualConvention, Integer32): description = 'The types of the instance of hpnicfFcPsmLoginDev, including nWWN(Node World Wide Name), pWWN(Port World Wide Name), sWWN(Switch World Wide Name), and wildCard.' status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4)) named_values = named_values(('nWWN', 1), ('pWWN', 2), ('sWWN', 3), ('wildCard', 4)) class Hpnicffcpsmclearentrytype(TextualConvention, Integer32): description = 'This object when set to clearStatic, results in port bind static entries being cleared on this VSAN(Virtual Storage Area Networks). This object when set to clearAutoLearn, results in port bind auto-learnt entries being cleared on this VSAN. This object when set to clearAll, results in all of the port bind entries being cleared on this VSAN. No action is taken if this object is set to noop. The value of this object when read is always noop.' status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4)) named_values = named_values(('clearStatic', 1), ('clearAutoLearn', 2), ('clearAll', 3), ('noop', 4)) hpnicf_fc_psm_notify_enable = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 1, 1), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfFcPsmNotifyEnable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmNotifyEnable.setDescription('Whether to generate the notification or not depends on the object.') hpnicf_fc_psm_enable_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1)) if mibBuilder.loadTexts: hpnicfFcPsmEnableTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableTable.setDescription('Enable or disable the port security feature on a specified VSAN.') hpnicf_fc_psm_enable_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1)).setIndexNames((0, 'HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmEnableVsanIndex')) if mibBuilder.loadTexts: hpnicfFcPsmEnableEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableEntry.setDescription('Detailed information about the port security.') hpnicf_fc_psm_enable_vsan_index = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4095))) if mibBuilder.loadTexts: hpnicfFcPsmEnableVsanIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableVsanIndex.setDescription('The ID of VSAN on this entry.') hpnicf_fc_psm_enable = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('enable', 1), ('enableWithAutoLearn', 2), ('disable', 3), ('noop', 4))).clone('noop')).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfFcPsmEnable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnable.setDescription('When set to enable, the port security is on, the value of hpnicfFcPsmEnableState will be true. When set to enableWithAutoLearn, the port security is on with auto-learning, the value of hpnicfFcPsmEnableState will be true. When set to disable, the port security is off, the value of hpnicfFcPsmEnableState will be false. The noop means no action. The value of this object when read is always noop.') hpnicf_fc_psm_enable_state = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 3), truth_value().clone('false')).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmEnableState.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnableState.setDescription('The state of the port security. When the value is true, it means the port security is on, while the false means the port security is off.') hpnicf_fc_psm_config_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2)) if mibBuilder.loadTexts: hpnicfFcPsmConfigTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmConfigTable.setDescription('A table that contains the configured entries.') hpnicf_fc_psm_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1)).setIndexNames((0, 'HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmEnableVsanIndex'), (0, 'HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmIndex')) if mibBuilder.loadTexts: hpnicfFcPsmConfigEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmConfigEntry.setDescription('Detailed information about each configuration.') hpnicf_fc_psm_index = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 32768))) if mibBuilder.loadTexts: hpnicfFcPsmIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmIndex.setDescription('The index of this entry.') hpnicf_fc_psm_login_dev_type = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 2), hpnicf_fc_psm_port_bind_dev_type()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hpnicfFcPsmLoginDevType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginDevType.setDescription('This represents the type of the instance of hpnicfFcPsmLoginDev, which includes nWWN, pWWN, sWWN, and wildCard.') hpnicf_fc_psm_login_dev = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 3), hpnicf_fc_name_id_or_zero()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hpnicfFcPsmLoginDev.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginDev.setDescription('The logging-in device name, which is decided by the hpnicfFcPsmLoginDevType object. It represents node WWN when the value of hpnicfFcPsmLoginDevType is nWWN. It represents port WWN when the value of hpnicfFcPsmLoginDevType is pWWN. It represents switch WWN when the value of hpnicfFcPsmLoginDevType is sWWN. It represents any device when the value of hpnicfFcPsmLoginDevType is wildCard, and the value of the instance of this object should be zero-length string. The value of this object should not be invalid when hpnicfFcPsmRowStatus is set to createAndGo or active.') hpnicf_fc_psm_login_point = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 4), interface_index_or_zero()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hpnicfFcPsmLoginPoint.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginPoint.setDescription('The address of the port on the local switch through which the instance of hpnicfFcPsmLoginDev can log in. It represents ifindex when the value is not zero. It represents any port when the value is zero.') hpnicf_fc_psm_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 5), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: hpnicfFcPsmRowStatus.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmRowStatus.setDescription('Entry status. When creating a new instance of this table, the following objects should be set simultaneously: hpnicfFcPsmLoginDevType, h3cFcPsmLoginDev, hpnicfFcPsmLoginPoint, hpnicfFcPsmRowStatus. If hpnicfFcPsmLoginDevType is set to wildCard, the value of the instance of hpnicfFcPsmLoginDev should be zero-length string. The value of hpnicfFcPsmLoginDevType and hpnicfFcPsmLoginPoint cannot be set to wildCard and zero at the same time.') hpnicf_fc_psm_enf_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3)) if mibBuilder.loadTexts: hpnicfFcPsmEnfTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfTable.setDescription('The FC port security enforced table. It contains not only the configured policies, but also the learning ones learnt by the switch itself.') hpnicf_fc_psm_enf_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1)).setIndexNames((0, 'HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmEnableVsanIndex'), (0, 'HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmEnfIndex')) if mibBuilder.loadTexts: hpnicfFcPsmEnfEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfEntry.setDescription('Detailed information about the FC port security enforced policy.') hpnicf_fc_psm_enf_index = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 32768))) if mibBuilder.loadTexts: hpnicfFcPsmEnfIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfIndex.setDescription('The index of this entry.') hpnicf_fc_psm_enf_login_dev_type = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 2), hpnicf_fc_psm_port_bind_dev_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDevType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDevType.setDescription('This represents the type of the instance of hpnicfFcPsmEnfLoginDev, which includes nWWN, pWWN, sWWN, and wildCard.') hpnicf_fc_psm_enf_login_dev = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 3), hpnicf_fc_name_id_or_zero()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDev.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDev.setDescription('The logging-in device name, which is decided by the hpnicfFcPsmEnfLoginDevType object. It represents node WWN when the value of hpnicfFcPsmEnfLoginDevType is nWWN. It represents port WWN when the value of hpnicfFcPsmEnfLoginDevType is pWWN. It represents switch WWN when the value of hpnicfFcPsmEnfLoginDevType is sWWN. It represents any device when the value of hpnicfFcPsmEnfLoginDevType is wildCard, and the value of the instance of this object should be zero-length string.') hpnicf_fc_psm_enf_login_point = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 4), interface_index_or_zero()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginPoint.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginPoint.setDescription('The address of the port on the local switch through which the instance of hpnicfFcPsmEnfLoginDev can log in. It represents ifindex when the value is not zero. It represents any port when the value is zero.') hpnicf_fc_psm_enf_entry_type = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('learning', 1), ('learnt', 2), ('static', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmEnfEntryType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEnfEntryType.setDescription('When the value is learning, it represents the entry is learnt by the switch itself temporarily and will be deleted when the device log out. When the value is learnt, it represents the entry is learnt by the switch permanently. When the value is static, it represents the entry is configured.') hpnicf_fc_psm_copy_to_config_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4)) if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigTable.setDescription('Specifies whether to copy the entries from enforced table to the ones on configured table.') hpnicf_fc_psm_copy_to_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4, 1)).setIndexNames((0, 'HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmEnableVsanIndex')) if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigEntry.setDescription('Detailed information about the operation.') hpnicf_fc_psm_copy_to_config = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('copy', 1), ('noop', 2))).clone('noop')).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfig.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfig.setDescription('When the object is set to copy, the learned entries will be copied on to the configured table on this VSAN, while the noop means no operation. The value of this object when read is always noop.') hpnicf_fc_psm_auto_learn_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5)) if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnTable.setDescription('This table shows whether the auto-learning is enabled or not on specific VSANs.') hpnicf_fc_psm_auto_learn_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5, 1)).setIndexNames((0, 'HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmEnableVsanIndex')) if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEntry.setDescription('Detailed information about the auto-learning.') hpnicf_fc_psm_auto_learn_enable = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5, 1, 1), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEnable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEnable.setDescription('This object is set to true to enable, or false to disable auto-learning on the local switch. When set to true, the switch can learn the devices that have already logged in as learning entries on the enforced table, while the false can stop the learning operation with the learning entries transformed to learnt ones.') hpnicf_fc_psm_clear_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6)) if mibBuilder.loadTexts: hpnicfFcPsmClearTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearTable.setDescription('This table is used for cleaning specific entries in enforced table.') hpnicf_fc_psm_clear_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1)).setIndexNames((0, 'HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmEnableVsanIndex')) if mibBuilder.loadTexts: hpnicfFcPsmClearEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearEntry.setDescription('Detailed information about the cleaning options.') hpnicf_fc_psm_clear_type = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1, 1), hpnicf_fc_psm_clear_entry_type().clone('noop')).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfFcPsmClearType.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearType.setDescription('This object when set to clearStatic, results in port bind static entries being cleared on this VSAN. This object when set to clearAutoLearn, results in auto-learnt entries being cleared on this VSAN. This object when set to clearAll, results in all of the port bind entries being cleared on this VSAN. No action is taken if this object is set to noop. The value of this object when read is always noop.') hpnicf_fc_psm_clear_intf = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1, 2), interface_index_or_zero()).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfFcPsmClearIntf.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmClearIntf.setDescription('The object specifies the interface on which the entries will be cleared. If the object is zero or not set, it means the specified entries on all interfaces will be cleared.') hpnicf_fc_psm_stats_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1)) if mibBuilder.loadTexts: hpnicfFcPsmStatsTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmStatsTable.setDescription('This table contains statistics of devices, which had been allowed or denied to log into the switch.') hpnicf_fc_psm_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1)).setIndexNames((0, 'HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmEnableVsanIndex')) if mibBuilder.loadTexts: hpnicfFcPsmStatsEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmStatsEntry.setDescription('Detailed information about the statistics.') hpnicf_fc_psm_allowed_logins = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmAllowedLogins.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmAllowedLogins.setDescription('The number of requests that have been allowed on the specified VSAN.') hpnicf_fc_psm_denied_logins = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmDeniedLogins.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmDeniedLogins.setDescription('The number of requests that have been denied on the specified VSAN.') hpnicf_fc_psm_stats_clear = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('clear', 1), ('noop', 2))).clone('noop')).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfFcPsmStatsClear.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmStatsClear.setDescription('The statistics on this VSAN will be cleared if this object is set to clear. No action is taken if this object is set to noop. The value of this object when read is always noop.') hpnicf_fc_psm_violation_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2)) if mibBuilder.loadTexts: hpnicfFcPsmViolationTable.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmViolationTable.setDescription('This table maintains the information about the violations happened, containing at most 1024 items. When the number exceeds 1024, the earliest item will be over-written.') hpnicf_fc_psm_violation_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1)).setIndexNames((0, 'HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmEnableVsanIndex'), (0, 'HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmViolationIndex')) if mibBuilder.loadTexts: hpnicfFcPsmViolationEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmViolationEntry.setDescription('Detailed information about the violation.') hpnicf_fc_psm_violation_index = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 1024))) if mibBuilder.loadTexts: hpnicfFcPsmViolationIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmViolationIndex.setDescription('The index of this entry. The entry is uniquely distinguished by WWN, WWN type and ifindex where the login was denied.') hpnicf_fc_psm_login_pwwn = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 2), hpnicf_fc_name_id_or_zero()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmLoginPWWN.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginPWWN.setDescription('The pWWN of the device whose FLOGI(Fabric Login) request had been denied. If the device is an n-node, the value of the instance of hpnicfFcPsmLoginSWWN should be zero-length string.') hpnicf_fc_psm_login_nwwn = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 3), hpnicf_fc_name_id_or_zero()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmLoginNWWN.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginNWWN.setDescription('The nWWN of the device whose FLOGI request had been denied. If the device is an n-node, the value of the instance of hpnicfFcPsmLoginSWWN should be zero-length string.') hpnicf_fc_psm_login_swwn = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 4), hpnicf_fc_name_id_or_zero()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmLoginSWWN.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginSWWN.setDescription('The sWWN of the device whose FLOGI request had been denied. If the device is a switch, the values of the instance of hpnicfFcPsmLoginPWWN and hpnicfFcPsmLoginNWWN should be zero-length string.') hpnicf_fc_psm_login_intf = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 5), interface_index()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmLoginIntf.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginIntf.setDescription('The ifindex of the port where the login was denied.') hpnicf_fc_psm_login_time = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 6), time_stamp()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmLoginTime.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginTime.setDescription('Specifies the value of SysUpTime when the last denied login happened.') hpnicf_fc_psm_login_count = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfFcPsmLoginCount.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmLoginCount.setDescription('The number of times for a certain nWWN/pWWN or sWWN had been denied to log into an interface of the local device.') hpnicf_fc_psm_f_port_deny_notify = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0, 1)).setObjects(('IF-MIB', 'ifDescr'), ('HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmLoginPWWN'), ('HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmLoginIntf'), ('HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmLoginTime')) if mibBuilder.loadTexts: hpnicfFcPsmFPortDenyNotify.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmFPortDenyNotify.setDescription('Notifies that a FLOGI is denied on an F port of the local device.') hpnicf_fc_psm_e_port_deny_notify = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0, 2)).setObjects(('IF-MIB', 'ifDescr'), ('HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmLoginSWWN'), ('HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmLoginIntf'), ('HPN-ICF-FC-PSM-MIB', 'hpnicfFcPsmLoginTime')) if mibBuilder.loadTexts: hpnicfFcPsmEPortDenyNotify.setStatus('current') if mibBuilder.loadTexts: hpnicfFcPsmEPortDenyNotify.setDescription('Notifies that a switch is denied on an E port of the local device.') mibBuilder.exportSymbols('HPN-ICF-FC-PSM-MIB', hpnicfFcPsmClearIntf=hpnicfFcPsmClearIntf, hpnicfFcPsmStats=hpnicfFcPsmStats, hpnicfFcPsmClearType=hpnicfFcPsmClearType, hpnicfFcPsmLoginDevType=hpnicfFcPsmLoginDevType, hpnicfFcPsmClearTable=hpnicfFcPsmClearTable, hpnicfFcPsmEnfIndex=hpnicfFcPsmEnfIndex, hpnicfFcPsmConfiguration=hpnicfFcPsmConfiguration, hpnicfFcPsmStatsTable=hpnicfFcPsmStatsTable, hpnicfFcPsmConfigTable=hpnicfFcPsmConfigTable, hpnicfFcPsmEnable=hpnicfFcPsmEnable, hpnicfFcPsmLoginPWWN=hpnicfFcPsmLoginPWWN, hpnicfFcPsmEnfTable=hpnicfFcPsmEnfTable, hpnicfFcPsmLoginTime=hpnicfFcPsmLoginTime, hpnicfFcPsmEnfLoginPoint=hpnicfFcPsmEnfLoginPoint, hpnicfFcPsmClearEntry=hpnicfFcPsmClearEntry, hpnicfFcPsmIndex=hpnicfFcPsmIndex, HpnicfFcPsmPortBindDevType=HpnicfFcPsmPortBindDevType, hpnicfFcPsmCopyToConfigEntry=hpnicfFcPsmCopyToConfigEntry, hpnicfFcPsmLoginNWWN=hpnicfFcPsmLoginNWWN, hpnicfFcPsm=hpnicfFcPsm, hpnicfFcPsmAutoLearnTable=hpnicfFcPsmAutoLearnTable, hpnicfFcPsmEnfEntryType=hpnicfFcPsmEnfEntryType, hpnicfFcPsmEnfLoginDevType=hpnicfFcPsmEnfLoginDevType, hpnicfFcPsmEnableVsanIndex=hpnicfFcPsmEnableVsanIndex, hpnicfFcPsmViolationTable=hpnicfFcPsmViolationTable, hpnicfFcPsmLoginPoint=hpnicfFcPsmLoginPoint, hpnicfFcPsmScalarObjects=hpnicfFcPsmScalarObjects, hpnicfFcPsmViolationIndex=hpnicfFcPsmViolationIndex, hpnicfFcPsmLoginDev=hpnicfFcPsmLoginDev, hpnicfFcPsmNotifyEnable=hpnicfFcPsmNotifyEnable, hpnicfFcPsmDeniedLogins=hpnicfFcPsmDeniedLogins, hpnicfFcPsmCopyToConfig=hpnicfFcPsmCopyToConfig, hpnicfFcPsmObjects=hpnicfFcPsmObjects, hpnicfFcPsmEnfEntry=hpnicfFcPsmEnfEntry, hpnicfFcPsmViolationEntry=hpnicfFcPsmViolationEntry, hpnicfFcPsmConfigEntry=hpnicfFcPsmConfigEntry, PYSNMP_MODULE_ID=hpnicfFcPsm, hpnicfFcPsmEnfLoginDev=hpnicfFcPsmEnfLoginDev, hpnicfFcPsmLoginIntf=hpnicfFcPsmLoginIntf, hpnicfFcPsmEnableTable=hpnicfFcPsmEnableTable, hpnicfFcPsmEnableEntry=hpnicfFcPsmEnableEntry, hpnicfFcPsmFPortDenyNotify=hpnicfFcPsmFPortDenyNotify, hpnicfFcPsmNotifications=hpnicfFcPsmNotifications, hpnicfFcPsmAutoLearnEnable=hpnicfFcPsmAutoLearnEnable, hpnicfFcPsmLoginCount=hpnicfFcPsmLoginCount, hpnicfFcPsmAllowedLogins=hpnicfFcPsmAllowedLogins, hpnicfFcPsmEnableState=hpnicfFcPsmEnableState, hpnicfFcPsmAutoLearnEntry=hpnicfFcPsmAutoLearnEntry, hpnicfFcPsmRowStatus=hpnicfFcPsmRowStatus, hpnicfFcPsmLoginSWWN=hpnicfFcPsmLoginSWWN, hpnicfFcPsmStatsEntry=hpnicfFcPsmStatsEntry, hpnicfFcPsmStatsClear=hpnicfFcPsmStatsClear, hpnicfFcPsmCopyToConfigTable=hpnicfFcPsmCopyToConfigTable, HpnicfFcPsmClearEntryType=HpnicfFcPsmClearEntryType, hpnicfFcPsmEPortDenyNotify=hpnicfFcPsmEPortDenyNotify)
print('=-'*25) print(f'{"Sequencia de fibonacci": ^50}') print('=-'*25, '\n') termos = int(input('Quantos termos voce quer mostrar: ')) controle = 0 fibonacci = 0 n1 = 0 n2 = 1 print(n1, '->', n2, end=' -> ') while controle != termos - 2: controle += 1 fibonacci = n1 + n2 n1 = n2 n2 = fibonacci print(fibonacci, end=' -> ') print('FIM') print('\n','=-'*25)
print('=-' * 25) print(f"{'Sequencia de fibonacci': ^50}") print('=-' * 25, '\n') termos = int(input('Quantos termos voce quer mostrar: ')) controle = 0 fibonacci = 0 n1 = 0 n2 = 1 print(n1, '->', n2, end=' -> ') while controle != termos - 2: controle += 1 fibonacci = n1 + n2 n1 = n2 n2 = fibonacci print(fibonacci, end=' -> ') print('FIM') print('\n', '=-' * 25)
def count_and_say(palavra): dicionario = {} palavra = palavra.replace(' ', '') for letra in palavra: if not letra in dicionario.keys(): dicionario[letra] = 1 else: dicionario[letra] += 1 retorno = '' for letra, quantidade in dicionario.items(): retorno += '%d %s ' % (quantidade, letra) return retorno.rstrip()
def count_and_say(palavra): dicionario = {} palavra = palavra.replace(' ', '') for letra in palavra: if not letra in dicionario.keys(): dicionario[letra] = 1 else: dicionario[letra] += 1 retorno = '' for (letra, quantidade) in dicionario.items(): retorno += '%d %s ' % (quantidade, letra) return retorno.rstrip()
# https://www.hackerrank.com/challenges/recursive-digit-sum def super_digit(n, k): def _compute(num): num_str = str(num) total = sum(map(int, num_str)) if len(str(total)) == 1: return total else: return _compute(total) # n, k = [int(x) for x in raw_input().strip().split()] concat = int(str(n) * k) if len(str(concat)) == 1: return concat else: return _compute(concat)
def super_digit(n, k): def _compute(num): num_str = str(num) total = sum(map(int, num_str)) if len(str(total)) == 1: return total else: return _compute(total) concat = int(str(n) * k) if len(str(concat)) == 1: return concat else: return _compute(concat)
# Copyright 2018 Google LLC # # 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 # # https://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. """Errors used by the Google Ads API library.""" class GoogleAdsException(Exception): """Exception thrown in response to an API error from GoogleAds servers.""" def __init__(self, error, call, failure, request_id): """Initializer. Args: error: the grpc.RpcError raised by an rpc call. call: the grpc.Call object containing the details of the rpc call. failure: the GoogleAdsFailure instance describing how the GoogleAds API call failed. request_id: a str request ID associated with the GoogleAds API call. """ self.error = error self.call = call self.failure = failure self.request_id = request_id
"""Errors used by the Google Ads API library.""" class Googleadsexception(Exception): """Exception thrown in response to an API error from GoogleAds servers.""" def __init__(self, error, call, failure, request_id): """Initializer. Args: error: the grpc.RpcError raised by an rpc call. call: the grpc.Call object containing the details of the rpc call. failure: the GoogleAdsFailure instance describing how the GoogleAds API call failed. request_id: a str request ID associated with the GoogleAds API call. """ self.error = error self.call = call self.failure = failure self.request_id = request_id
def remove_char(str,n): first_part = str[:n] last_part = str[n+1:] return first_part + last_part def unify(E1, E2): E1_Variable = E1[0].isupper() E2_Variable = E2[0].isupper() SUBSET = "" if not E1_Variable and not E2_Variable or(len(E1) == 0 and len(E2) == 0): if E1[0] == E2[0]: E1 = remove_char(E1,0) E2 = remove_char(E2,0) else: print("FAIL") return "FAIL" if E1_Variable: if E1[0] in E2[0]: print("FAIL") return "FAIL" else: SUBSET = E2[0] + "/" + E1[0] return SUBSET if E2_Variable: if E2[0] in E1[0]: print("FAIL") return "FAIL" else: SUBSET = E1[0] + "/" + E2[0] return SUBSET if E1[0] == "" or E2[0] == "": print("FAIL") quit() else: HE1 = E1[0] HE2 = E2[0] SUBS1 = unify(HE1,HE2) if SUBS1 == "FAIL": print("SUBS1: FAILED") quit() temp = SUBS1.split("/") if temp[1] == E1[1]: TE1 = temp[0] if temp[1] != E1[1]: TE1 = E1[1] if temp[1] == E2[1]: TE2 = temp[0] if temp[1] != E2[1]: TE2 = E2[1] SUBS2 = unify(TE1,TE2) if SUBS2 == "FAIL": quit() else: print(SUBS1 + ", " + SUBS2 ) list1 = "pXX" list2 = "pab" unify(list1, list2)
def remove_char(str, n): first_part = str[:n] last_part = str[n + 1:] return first_part + last_part def unify(E1, E2): e1__variable = E1[0].isupper() e2__variable = E2[0].isupper() subset = '' if not E1_Variable and (not E2_Variable) or (len(E1) == 0 and len(E2) == 0): if E1[0] == E2[0]: e1 = remove_char(E1, 0) e2 = remove_char(E2, 0) else: print('FAIL') return 'FAIL' if E1_Variable: if E1[0] in E2[0]: print('FAIL') return 'FAIL' else: subset = E2[0] + '/' + E1[0] return SUBSET if E2_Variable: if E2[0] in E1[0]: print('FAIL') return 'FAIL' else: subset = E1[0] + '/' + E2[0] return SUBSET if E1[0] == '' or E2[0] == '': print('FAIL') quit() else: he1 = E1[0] he2 = E2[0] subs1 = unify(HE1, HE2) if SUBS1 == 'FAIL': print('SUBS1: FAILED') quit() temp = SUBS1.split('/') if temp[1] == E1[1]: te1 = temp[0] if temp[1] != E1[1]: te1 = E1[1] if temp[1] == E2[1]: te2 = temp[0] if temp[1] != E2[1]: te2 = E2[1] subs2 = unify(TE1, TE2) if SUBS2 == 'FAIL': quit() else: print(SUBS1 + ', ' + SUBS2) list1 = 'pXX' list2 = 'pab' unify(list1, list2)
# Create a script that has: #a function accept a list of grades (i.e. [99, 88, 77]) #and returns a grading report for that list. # Data # List of Integers # blank_list = [] # grades = [99, 75, 89, 45, 68, 94, 87, 86, 80] # Conditional logic # A >= 90 # B < 90 and B >= 80 # C < 80 and C >= 70 # D < 70 and D >= 60 # F < 60 #grade = grades[0] ## do logic #grade = grades[1] ## do logic # until no more grades left #ind = 0 #while ind < len(grades): # grade = grades[ind] # # do logic # ind += 1 # def scorer(scores: list): # accepts a list of scores # def func_name(param1, param2,...): def scorer(scores): class_scores = {"A": 0, "B": 0, "C": 0, "D": 0, "F": 0} for grade in scores: if grade >= 90: print(f"{grade} is an A!") print(str(grade) + " is an A!") # class_scores["A"] = class_scores["A"] + 1 class_scores["A"] += 1 elif grade >= 80: print(f"{grade} is a B!") class_scores["B"] += 1 elif grade >= 70: print(f"{grade} is a C!") class_scores["C"] += 1 elif grade >= 60: print(f"{grade} is a D!") class_scores["D"] += 1 else: print(f"{grade} is a FAILURE!!!") class_scores["F"] += 1 print(class_scores) grades = [99, 75, 89, 45, 68, 94, 87, 86, 80] scorer(grades) print("mrs_ts_grades") mrs_ts_grades = [101, 22, 55, 77, 88, 99] scorer(mrs_ts_grades) print("mr_s_grades") mr_s_grades = [99, 76, 56, 65] scorer(mr_s_grades) # Expected Output # print out number of A's, B's, etc.. # OR # dictionary output { "A": 2, "B": 4 ...}
def scorer(scores): class_scores = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'F': 0} for grade in scores: if grade >= 90: print(f'{grade} is an A!') print(str(grade) + ' is an A!') class_scores['A'] += 1 elif grade >= 80: print(f'{grade} is a B!') class_scores['B'] += 1 elif grade >= 70: print(f'{grade} is a C!') class_scores['C'] += 1 elif grade >= 60: print(f'{grade} is a D!') class_scores['D'] += 1 else: print(f'{grade} is a FAILURE!!!') class_scores['F'] += 1 print(class_scores) grades = [99, 75, 89, 45, 68, 94, 87, 86, 80] scorer(grades) print('mrs_ts_grades') mrs_ts_grades = [101, 22, 55, 77, 88, 99] scorer(mrs_ts_grades) print('mr_s_grades') mr_s_grades = [99, 76, 56, 65] scorer(mr_s_grades)
def titulo(txt): print('-' * 35) print(f'{txt:^35}') print('-' * 35)
def titulo(txt): print('-' * 35) print(f'{txt:^35}') print('-' * 35)
def make_shirt(size='Large', message='I love Python'): print(f"The size of the shirt is {size} and the message is {message}") make_shirt() make_shirt('m') make_shirt('xs', "I'm okay")
def make_shirt(size='Large', message='I love Python'): print(f'The size of the shirt is {size} and the message is {message}') make_shirt() make_shirt('m') make_shirt('xs', "I'm okay")
def fib(n): '''Takes in a number n, and returns the nth fibonacci number, starting with: 1, 1, 2, 3, 5,...''' if n<=1: return n else: f = [0, 1] for i in range(2,n+1): f.append(f[i-1] + f[i-2]) return f[n]
def fib(n): """Takes in a number n, and returns the nth fibonacci number, starting with: 1, 1, 2, 3, 5,...""" if n <= 1: return n else: f = [0, 1] for i in range(2, n + 1): f.append(f[i - 1] + f[i - 2]) return f[n]
# Created by MechAviv # Map ID :: 940011080 # Western Region of Pantheon : Heliseum Hideout # [SET_DRESS_CHANGED] [00 00 ] sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.forcedInput(0) sm.forcedInput(2) sm.sendDelay(60) sm.forcedInput(0) sm.setSpeakerID(0) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.setSpeakerType(3) sm.sendNext("What am I gonna do?! Maybe I can just hide in here until I die of old age.") sm.sendDelay(300) sm.forcedInput(2)
sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.forcedInput(0) sm.forcedInput(2) sm.sendDelay(60) sm.forcedInput(0) sm.setSpeakerID(0) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.setSpeakerType(3) sm.sendNext('What am I gonna do?! Maybe I can just hide in here until I die of old age.') sm.sendDelay(300) sm.forcedInput(2)
class Solution: # @param root, a tree link node # @return nothing def connect(self, root): if not root or (not root.left and not root.right): return root strut = dict() level_0 = [root] lv = 0 strut[lv] = level_0 is_last_level = False while not is_last_level: new_level = [] last_node = None is_last_level = True for ele in strut[lv]: if last_node: last_node.next = ele last_node = ele is_last_level = is_last_level and (ele.left is None) new_level.append(ele.left) is_last_level = is_last_level and (ele.right is None) new_level.append(ele.right) lv += 1 strut[lv] = new_level return root def has_less_then_one_gen(self, parent): left = parent.left right = parent.right if left and self.has_kids(left): return False if right and self.has_kids(right): return False return True def has_kids(self, parent): return parent.left or parent.right
class Solution: def connect(self, root): if not root or (not root.left and (not root.right)): return root strut = dict() level_0 = [root] lv = 0 strut[lv] = level_0 is_last_level = False while not is_last_level: new_level = [] last_node = None is_last_level = True for ele in strut[lv]: if last_node: last_node.next = ele last_node = ele is_last_level = is_last_level and ele.left is None new_level.append(ele.left) is_last_level = is_last_level and ele.right is None new_level.append(ele.right) lv += 1 strut[lv] = new_level return root def has_less_then_one_gen(self, parent): left = parent.left right = parent.right if left and self.has_kids(left): return False if right and self.has_kids(right): return False return True def has_kids(self, parent): return parent.left or parent.right
class Solution: def partition(self, s: str) -> List[List[str]]: res=[] self.helper(res,s,[]) return res def helper(self,res,s,path): if not s: res.append(path) return for i in range(1,len(s)+1): if self.check(s[:i])==True: self.helper(res,s[i:],path+[s[:i]]) def check(self,s): return s==s[::-1]
class Solution: def partition(self, s: str) -> List[List[str]]: res = [] self.helper(res, s, []) return res def helper(self, res, s, path): if not s: res.append(path) return for i in range(1, len(s) + 1): if self.check(s[:i]) == True: self.helper(res, s[i:], path + [s[:i]]) def check(self, s): return s == s[::-1]
#entrada nFuncionarios = int(input()) qEventos = int(input()) #processamento mesas = [] for i in range(1, nFuncionarios + 1): #inserindo funcionarios nas mesas mesas.append(i) for i in range(0, qEventos): entrada = str(input()).split() eTipo = int(entrada[0]) a = int(entrada[1]) if eTipo == 1: #update b = int(entrada[2]) aux = mesas.index(b) mesas[mesas.index(a)] = b mesas[aux] = a else: flag = 0 indice = a while mesas[indice - 1] != a: flag += 1 indice = mesas[indice - 1] print(flag) #saida
n_funcionarios = int(input()) q_eventos = int(input()) mesas = [] for i in range(1, nFuncionarios + 1): mesas.append(i) for i in range(0, qEventos): entrada = str(input()).split() e_tipo = int(entrada[0]) a = int(entrada[1]) if eTipo == 1: b = int(entrada[2]) aux = mesas.index(b) mesas[mesas.index(a)] = b mesas[aux] = a else: flag = 0 indice = a while mesas[indice - 1] != a: flag += 1 indice = mesas[indice - 1] print(flag)
#58: Next Day a=input("Enter the date:") b=[1,3,5,7,8,10,12] c=[4,6,9,11] d=a.split('-') year=int(d[0]) month=int(d[1]) date=int(d[2]) if year%400==0: x=True elif year%100==0: x=False elif year%4==0: x=True else: x=False if 1<=month<=12 and 1<=date<=31: if month in b: date+=1 if date>31: month+=1 date=1 if month>12: year+=1 month=1 elif month in c: date+=1 if date>30: month+=1 date=1 elif month==2: if x: date+=1 if date>29: month+=1 date=1 else: date+=1 if date>28: month+=1 date=1 print(year,"-",month,"-",date) else: print("Invalid input")
a = input('Enter the date:') b = [1, 3, 5, 7, 8, 10, 12] c = [4, 6, 9, 11] d = a.split('-') year = int(d[0]) month = int(d[1]) date = int(d[2]) if year % 400 == 0: x = True elif year % 100 == 0: x = False elif year % 4 == 0: x = True else: x = False if 1 <= month <= 12 and 1 <= date <= 31: if month in b: date += 1 if date > 31: month += 1 date = 1 if month > 12: year += 1 month = 1 elif month in c: date += 1 if date > 30: month += 1 date = 1 elif month == 2: if x: date += 1 if date > 29: month += 1 date = 1 else: date += 1 if date > 28: month += 1 date = 1 print(year, '-', month, '-', date) else: print('Invalid input')
class Solution(object): def checkSubarraySum(self, nums, k): """ :type nums: List[int] :type k: int :rtype: bool """ remainders = {0:-1} subSum = 0 for i, ni in enumerate(nums): subSum += ni if k != 0: subSum %= k if subSum in remainders: if i - remainders[subSum] > 1: return True else: remainders[subSum] = i return False
class Solution(object): def check_subarray_sum(self, nums, k): """ :type nums: List[int] :type k: int :rtype: bool """ remainders = {0: -1} sub_sum = 0 for (i, ni) in enumerate(nums): sub_sum += ni if k != 0: sub_sum %= k if subSum in remainders: if i - remainders[subSum] > 1: return True else: remainders[subSum] = i return False
def get_soundex(token): temp='' token=token.upper() temp+=token[0] dic={'BFPV':1,'CGJKQSXZ':2,'DT':3,'L':4,'MN':5,'R':6,'AEIOUYHW':''} for char in token[1:]: for key in dic.keys(): if char in key: code=str(dic[key]) break if temp[-1]!=code: temp+=code temp=temp[:4].ljust(4,'0') return temp
def get_soundex(token): temp = '' token = token.upper() temp += token[0] dic = {'BFPV': 1, 'CGJKQSXZ': 2, 'DT': 3, 'L': 4, 'MN': 5, 'R': 6, 'AEIOUYHW': ''} for char in token[1:]: for key in dic.keys(): if char in key: code = str(dic[key]) break if temp[-1] != code: temp += code temp = temp[:4].ljust(4, '0') return temp
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def minDepth(self, root: TreeNode) -> int: def depth(node, x): if node == None: return x-1 if node.left == None and node.right == None: return x l = 10**5 r = 10**5 if node.left != None: l = depth(node.left,x+1) if node.right != None: r = depth(node.right,x+1) return min(l,r) return depth(root,1)
class Solution: def min_depth(self, root: TreeNode) -> int: def depth(node, x): if node == None: return x - 1 if node.left == None and node.right == None: return x l = 10 ** 5 r = 10 ** 5 if node.left != None: l = depth(node.left, x + 1) if node.right != None: r = depth(node.right, x + 1) return min(l, r) return depth(root, 1)
def longest_palin_substring(str1): """ dp[size][i] = dp[size-2][i+1] if str[i] == str[j] else dp[size][i] = False where dp[size][i] = If substring of size `size` starting at index `i` is palindrome or not. Answer = max of all (j-i+1) where dp[i][j] is True. """ str_len = len(str1) is_palin = [[False for j in range(str_len)] for i in range(str_len + 1)] for i in range(str_len): is_palin[0][i] = True is_palin[1][i] = True ans_idx_left = 0 ans_idx_right = 0 for size in range(2, str_len + 1): for idx_left in range(0, str_len): idx_right = idx_left + size - 1 if idx_right >= str_len: break if str1[idx_left] == str1[idx_right]: if is_palin[size - 2][idx_left + 1]: is_palin[size][idx_left] = True # Only update if it is strictly greater. # Which means in case of conflict, the lefmost palindrome # will be printed. if idx_right - idx_left > ans_idx_right - ans_idx_left: ans_idx_left = idx_left ans_idx_right = idx_right return (ans_idx_left, ans_idx_right) def longest_palin__substring_space_optimized(str1): """ Find all odd-length palindromes first in O(n*n). Do this by choosing all the characters as the centre one-by-one and then expanding outwards. Next, find all the even-length palindromes in O(n*n). Do this by taking all the adjacent character pairs and expanding. Then compute the maximum of both. """ pass
def longest_palin_substring(str1): """ dp[size][i] = dp[size-2][i+1] if str[i] == str[j] else dp[size][i] = False where dp[size][i] = If substring of size `size` starting at index `i` is palindrome or not. Answer = max of all (j-i+1) where dp[i][j] is True. """ str_len = len(str1) is_palin = [[False for j in range(str_len)] for i in range(str_len + 1)] for i in range(str_len): is_palin[0][i] = True is_palin[1][i] = True ans_idx_left = 0 ans_idx_right = 0 for size in range(2, str_len + 1): for idx_left in range(0, str_len): idx_right = idx_left + size - 1 if idx_right >= str_len: break if str1[idx_left] == str1[idx_right]: if is_palin[size - 2][idx_left + 1]: is_palin[size][idx_left] = True if idx_right - idx_left > ans_idx_right - ans_idx_left: ans_idx_left = idx_left ans_idx_right = idx_right return (ans_idx_left, ans_idx_right) def longest_palin__substring_space_optimized(str1): """ Find all odd-length palindromes first in O(n*n). Do this by choosing all the characters as the centre one-by-one and then expanding outwards. Next, find all the even-length palindromes in O(n*n). Do this by taking all the adjacent character pairs and expanding. Then compute the maximum of both. """ pass
#!/usr/bin/env python3 # Import data with open('/home/agaspari/aoc2021/dec_8/dec8_input.txt') as f: signal_list = f.read().split('\n') unique_signals_one = {'c', 'f'} unique_signals_four = {'b', 'c', 'd', 'f'} unique_signals_seven = {'a', 'c', 'f'} unique_signals_eight = {'a', 'b', 'c', 'd', 'e', 'f', 'g'} unique_signals = [ unique_signals_one, unique_signals_four, unique_signals_seven, unique_signals_eight ] unique_signals_lengths = [len(x) for x in unique_signals] # Task 1 - How many times is a number with a unique number of segments output? inputs = [x.split(' | ')[0] for x in signal_list] outputs = [x.split(' | ')[1] for x in signal_list] recognized_count = 0 for output in outputs: signal_patterns = [signal for signal in output.split(' ')] for signal_pattern in signal_patterns: if len(signal_pattern) in unique_signals_lengths: recognized_count += 1 print("Number of unique signal counts:", recognized_count) # Task 2 - Decode the signals and get the output sum # Known digits # one: len == 2 # four: len == 4 # seven: len == 3 # eight: len == 7 # Unknown digits # zero: len == 6, len(set(4) - set(0)) == 1, len(set(seven) - set(0)) == 0 # two: len == 5, len(set(4) - set(2)) == 2, len(set(7) - set(2)) == 1 # three: len == 5, len(set(4) - set(3)) == 1, len(set(7) - set(3)) == 0 # five: len == 5, len(set(4) - set(5)) == 1, len(set(7) - set(5)) == 1 # six: len == 6, len(set(4) - set(6)) == 1, len(set(7) - set(6)) == 1 # nine: len == 6, len(set(4) - set(9)) == 0, len(set(7) - set(5)) == 0 decoded_outputs = list() # Loop through inputs for signal_input, signal_output in zip(inputs, outputs): known_digits = list() unknown_digits = list() # Check for known digits, check for unknown digits digits = [x for x in signal_input.split(' ')] for digit in digits: if len(digit) in unique_signals_lengths: known_digits.append({x for x in digit}) else: unknown_digits.append({x for x in digit}) known_digits = sorted(known_digits, key=len) all_digits = [0] * 10 all_digits[1], all_digits[7], all_digits[4], all_digits[8] = known_digits[0],known_digits[1],known_digits[2],known_digits[3], for digit in unknown_digits: if len(digit) == 5: if len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 0: all_digits[3] = digit elif len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 1: all_digits[5] = digit else: all_digits[2] = digit else: if len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 0: all_digits[0] = digit elif len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 1: all_digits[6] = digit else: all_digits[9] = digit output_value = '' signal_outputs = [{x for x in output} for output in signal_output.split(' ')] for output_digit in signal_outputs: for index, input_digit in enumerate(all_digits): if output_digit == input_digit: output_value += str(index) break else: continue if len(output_value) < 4: raise ValueError("Error: not enough output values decoded") decoded_outputs.append(int(output_value)) print("Sum of output values:", sum(decoded_outputs))
with open('/home/agaspari/aoc2021/dec_8/dec8_input.txt') as f: signal_list = f.read().split('\n') unique_signals_one = {'c', 'f'} unique_signals_four = {'b', 'c', 'd', 'f'} unique_signals_seven = {'a', 'c', 'f'} unique_signals_eight = {'a', 'b', 'c', 'd', 'e', 'f', 'g'} unique_signals = [unique_signals_one, unique_signals_four, unique_signals_seven, unique_signals_eight] unique_signals_lengths = [len(x) for x in unique_signals] inputs = [x.split(' | ')[0] for x in signal_list] outputs = [x.split(' | ')[1] for x in signal_list] recognized_count = 0 for output in outputs: signal_patterns = [signal for signal in output.split(' ')] for signal_pattern in signal_patterns: if len(signal_pattern) in unique_signals_lengths: recognized_count += 1 print('Number of unique signal counts:', recognized_count) decoded_outputs = list() for (signal_input, signal_output) in zip(inputs, outputs): known_digits = list() unknown_digits = list() digits = [x for x in signal_input.split(' ')] for digit in digits: if len(digit) in unique_signals_lengths: known_digits.append({x for x in digit}) else: unknown_digits.append({x for x in digit}) known_digits = sorted(known_digits, key=len) all_digits = [0] * 10 (all_digits[1], all_digits[7], all_digits[4], all_digits[8]) = (known_digits[0], known_digits[1], known_digits[2], known_digits[3]) for digit in unknown_digits: if len(digit) == 5: if len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 0: all_digits[3] = digit elif len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 1: all_digits[5] = digit else: all_digits[2] = digit elif len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 0: all_digits[0] = digit elif len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 1: all_digits[6] = digit else: all_digits[9] = digit output_value = '' signal_outputs = [{x for x in output} for output in signal_output.split(' ')] for output_digit in signal_outputs: for (index, input_digit) in enumerate(all_digits): if output_digit == input_digit: output_value += str(index) break else: continue if len(output_value) < 4: raise value_error('Error: not enough output values decoded') decoded_outputs.append(int(output_value)) print('Sum of output values:', sum(decoded_outputs))
x = 1 + 2 * 3 - 3 ** 5 / 2 y = 3 ** 5 - 2 z = x / y zz = x // y z -= z zz += zz xx = -x xx %= 10 if type(x) is int: print(x and y)
x = 1 + 2 * 3 - 3 ** 5 / 2 y = 3 ** 5 - 2 z = x / y zz = x // y z -= z zz += zz xx = -x xx %= 10 if type(x) is int: print(x and y)
""" bender_mc.utils ~~~~~~~~~~~~~~~ Utility tools for bender-mc. """ # :copyright: (c) 2020 by Nicholas Repole. # :license: MIT - See LICENSE for more details. def deformat_title(formatted_title): return formatted_title.replace( "__COLON__", ":").replace( "__DOT__", ".").replace( "__DASH__", "-").replace( "__SPACE__", " ").replace( "__APOSTROPHE__", "'").replace( "__UNDERSCORE__", "_")
""" bender_mc.utils ~~~~~~~~~~~~~~~ Utility tools for bender-mc. """ def deformat_title(formatted_title): return formatted_title.replace('__COLON__', ':').replace('__DOT__', '.').replace('__DASH__', '-').replace('__SPACE__', ' ').replace('__APOSTROPHE__', "'").replace('__UNDERSCORE__', '_')
class Queue: qu = [] size = 0 front = 0 rear = 0 def __init__(self, size): self.size = size def en_queue(self, data): self.qu.append(data) self.size = self.size + 1 self.rear = self.rear + 1 def de_queue(self): temp = self.qu[self.front] del self.qu[self.front] self.rear = self.rear - 1 self.size = self.size - 1 return temp def de_que_all(self): while not self.is_empty(): print(self.de_queue().__str__()) def get_front(self): return self.qu[self.front] def get_rear(self): return self.qu[-1] def is_full(self): return self.rear == self.get_size() def is_empty(self): return self.rear == 0 def get_size(self): return self.size
class Queue: qu = [] size = 0 front = 0 rear = 0 def __init__(self, size): self.size = size def en_queue(self, data): self.qu.append(data) self.size = self.size + 1 self.rear = self.rear + 1 def de_queue(self): temp = self.qu[self.front] del self.qu[self.front] self.rear = self.rear - 1 self.size = self.size - 1 return temp def de_que_all(self): while not self.is_empty(): print(self.de_queue().__str__()) def get_front(self): return self.qu[self.front] def get_rear(self): return self.qu[-1] def is_full(self): return self.rear == self.get_size() def is_empty(self): return self.rear == 0 def get_size(self): return self.size
class parser(object): def __call__(self, line): self.rank = 0 self.in_garbage = False # if False, then we're in garbage self.ignore = False self.points = [] self.garbage_count = 0 for char in line: self._inc(char) return self.points def _inc(self, char): if self.ignore: self.ignore = False return if char == "!": self.ignore = True return if self.in_garbage: if char == ">": self.in_garbage = False return self.garbage_count += 1 if not self.in_garbage: if char == "<": self.in_garbage = True return if char == "{" : self.rank += 1 return if char == "}" : self.points.insert(0, self.rank) self.rank -= 1 return if __name__ == "__main__": test1_input = ( ('{}', [1]), ('{{{}}}', [1,2,3]), ('{{},{}}', [1,2,2]), ('{{{},{},{{}}}}', [1,2,3,3,3,4]), ('{<a>,<a>,<a>,<a>}', [1]), ('{{<ab>},{<ab>},{<ab>},{<ab>}}', [1,2,2,2,2]), ('{{<!!>},{<!!>},{<!!>},{<!!>}}', [1,2,2,2,2]), ('{{<a!>},{<a!>},{<a!>},{<ab>}}', [1,2]) ) p = parser() for t in test1_input: check = p(t[0]) print(t[0], t[1], check) real_input = open('day9_input.txt').readline() p(real_input) print('real1', sum(p.points)) print('real2', p.garbage_count)
class Parser(object): def __call__(self, line): self.rank = 0 self.in_garbage = False self.ignore = False self.points = [] self.garbage_count = 0 for char in line: self._inc(char) return self.points def _inc(self, char): if self.ignore: self.ignore = False return if char == '!': self.ignore = True return if self.in_garbage: if char == '>': self.in_garbage = False return self.garbage_count += 1 if not self.in_garbage: if char == '<': self.in_garbage = True return if char == '{': self.rank += 1 return if char == '}': self.points.insert(0, self.rank) self.rank -= 1 return if __name__ == '__main__': test1_input = (('{}', [1]), ('{{{}}}', [1, 2, 3]), ('{{},{}}', [1, 2, 2]), ('{{{},{},{{}}}}', [1, 2, 3, 3, 3, 4]), ('{<a>,<a>,<a>,<a>}', [1]), ('{{<ab>},{<ab>},{<ab>},{<ab>}}', [1, 2, 2, 2, 2]), ('{{<!!>},{<!!>},{<!!>},{<!!>}}', [1, 2, 2, 2, 2]), ('{{<a!>},{<a!>},{<a!>},{<ab>}}', [1, 2])) p = parser() for t in test1_input: check = p(t[0]) print(t[0], t[1], check) real_input = open('day9_input.txt').readline() p(real_input) print('real1', sum(p.points)) print('real2', p.garbage_count)
# -*- coding: utf-8 -*- """ >>> import os >>> import json >>> from samila import * >>> from pytest import warns >>> g = GenerativeImage(lambda x,y: 0, lambda x,y: 0) >>> g.generate(step=0.1) >>> result = g.save_data() >>> g_ = GenerativeImage(data=open('data.json', 'r')) >>> g_.data1 == g.data1 True >>> g_.data2 == g.data2 True >>> with open('data.json', 'w') as fp: ... json.dump({'data1': [0], 'data2': [0], 'matplotlib_version': '0'}, fp) >>> with warns(RuntimeWarning, match=r"Source matplotlib version(.*) is different from yours, plots may be different."): ... g = GenerativeImage(lambda x,y: 0, lambda x,y: 0, data=open('data.json', 'r')) >>> with open('config.json', 'w') as fp: ... json.dump({'f1': 'x', 'f2': 'y', 'matplotlib_version': '0'}, fp) >>> with warns(RuntimeWarning, match=r"Source matplotlib version(.*) is different from yours, plots may be different."): ... g = GenerativeImage(config=open('config.json', 'r')) >>> os.remove('data.json') >>> os.remove('config.json') """
""" >>> import os >>> import json >>> from samila import * >>> from pytest import warns >>> g = GenerativeImage(lambda x,y: 0, lambda x,y: 0) >>> g.generate(step=0.1) >>> result = g.save_data() >>> g_ = GenerativeImage(data=open('data.json', 'r')) >>> g_.data1 == g.data1 True >>> g_.data2 == g.data2 True >>> with open('data.json', 'w') as fp: ... json.dump({'data1': [0], 'data2': [0], 'matplotlib_version': '0'}, fp) >>> with warns(RuntimeWarning, match=r"Source matplotlib version(.*) is different from yours, plots may be different."): ... g = GenerativeImage(lambda x,y: 0, lambda x,y: 0, data=open('data.json', 'r')) >>> with open('config.json', 'w') as fp: ... json.dump({'f1': 'x', 'f2': 'y', 'matplotlib_version': '0'}, fp) >>> with warns(RuntimeWarning, match=r"Source matplotlib version(.*) is different from yours, plots may be different."): ... g = GenerativeImage(config=open('config.json', 'r')) >>> os.remove('data.json') >>> os.remove('config.json') """
"""Various functions to help deal with exceptions. Released under the MIT license (https://opensource.org/licenses/MIT). """ def raises(callable, args=(), kwargs={}): """Check if `callable(*args, **kwargs)` raises an exception. Returns `True` if an exception is raised, else `False`. Arguments: - callable: A callable object. - args: A list or tuple containing positional arguments to `callable`. Defaults to an empty tuple. - kwargs: A dictionary containing keyword arguments to `callable`. Defaults to an empty dictionary. """ try: callable(*args, **kwargs) except Exception as exc: return True return False def suppress(*exceptions): """Suppress `exceptions` when calling a function. If an exception is raised and it is not contained in `exceptions`, it is propagated back to the caller without context. If no exceptions are raised, return `callable(*args, **kwargs)`. Arguments: - *exceptions: The exceptions to suppress. All exceptions must derive from `BaseException`. - callable: A callable object. - *args: Positional arguments to `callable`. - **kwargs: Keyword arguments to `callable`. """ def wrap(callable): def call(*args, **kwargs): try: return callable(*args, **kwargs) except exceptions: pass except Exception as exc: raise_from_context(exc) return call return wrap def raise_from_context(exception, context=None): """Raise `exception` from `context`. This function is compatible with Python 2 as it sets `__context__`. Arguments: - exception: An exception (derived from `BaseException`). - context: The context from which to raise `exception`. Defaults to `None`. """ exception.__context__ = context raise exception
"""Various functions to help deal with exceptions. Released under the MIT license (https://opensource.org/licenses/MIT). """ def raises(callable, args=(), kwargs={}): """Check if `callable(*args, **kwargs)` raises an exception. Returns `True` if an exception is raised, else `False`. Arguments: - callable: A callable object. - args: A list or tuple containing positional arguments to `callable`. Defaults to an empty tuple. - kwargs: A dictionary containing keyword arguments to `callable`. Defaults to an empty dictionary. """ try: callable(*args, **kwargs) except Exception as exc: return True return False def suppress(*exceptions): """Suppress `exceptions` when calling a function. If an exception is raised and it is not contained in `exceptions`, it is propagated back to the caller without context. If no exceptions are raised, return `callable(*args, **kwargs)`. Arguments: - *exceptions: The exceptions to suppress. All exceptions must derive from `BaseException`. - callable: A callable object. - *args: Positional arguments to `callable`. - **kwargs: Keyword arguments to `callable`. """ def wrap(callable): def call(*args, **kwargs): try: return callable(*args, **kwargs) except exceptions: pass except Exception as exc: raise_from_context(exc) return call return wrap def raise_from_context(exception, context=None): """Raise `exception` from `context`. This function is compatible with Python 2 as it sets `__context__`. Arguments: - exception: An exception (derived from `BaseException`). - context: The context from which to raise `exception`. Defaults to `None`. """ exception.__context__ = context raise exception
""" This demonstrates the use of object properties as a way to give the illusion of private members and getters/setters per object oriented programming. Variables prefixed by underscore are a signal to other programmers that they should be changing them directly, but there really isn't any enforcement. There are still ways around it, but this makes it harder to change members that shouldn't change. """ class myThing(object): def __init__(self, foo=None): self._foo = foo # This decorator acts as a getter, accessed with "myFoo.foo" @property def foo(self): return self._foo # This decorator acts as a setter, but only once @foo.setter def foo(self, newFoo): if self._foo is None: self._foo = newFoo else: raise Exception("Immutable member foo has already been assigned...") # This decorator protects against inadvertent deletion via "del myFoo.foo" @foo.deleter def foo(self): raise Exception("Cannot remove immutable member foo") if __name__ == "__main__": myFoo = myThing() print(myFoo.foo) myFoo.foo = "bar" print(myFoo.foo) try: myFoo.foo = "baz" except Exception as e: print(e) print(myFoo.foo) try: del myFoo.foo except Exception as e: print(e)
""" This demonstrates the use of object properties as a way to give the illusion of private members and getters/setters per object oriented programming. Variables prefixed by underscore are a signal to other programmers that they should be changing them directly, but there really isn't any enforcement. There are still ways around it, but this makes it harder to change members that shouldn't change. """ class Mything(object): def __init__(self, foo=None): self._foo = foo @property def foo(self): return self._foo @foo.setter def foo(self, newFoo): if self._foo is None: self._foo = newFoo else: raise exception('Immutable member foo has already been assigned...') @foo.deleter def foo(self): raise exception('Cannot remove immutable member foo') if __name__ == '__main__': my_foo = my_thing() print(myFoo.foo) myFoo.foo = 'bar' print(myFoo.foo) try: myFoo.foo = 'baz' except Exception as e: print(e) print(myFoo.foo) try: del myFoo.foo except Exception as e: print(e)
class Text(): '''text to write to console''' def __init__(self, text, fg='black', bg='white'): self.text = text self.fg = fg self.bg = bg class Value(): '''a value for the status bar''' def __init__(self, name, text, row=0, fg='black', bg='white'): self.name = name self.text = text self.row = row self.fg = fg self.bg = bg
class Text: """text to write to console""" def __init__(self, text, fg='black', bg='white'): self.text = text self.fg = fg self.bg = bg class Value: """a value for the status bar""" def __init__(self, name, text, row=0, fg='black', bg='white'): self.name = name self.text = text self.row = row self.fg = fg self.bg = bg
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ n=int(input()) a=*map(int,input()), a,b=sorted(a[:n]),sorted(a[n:]) d=[1,-1][a[0]>b[0]] print('NYOE S'[all(d*x<d*y for x,y in zip(a,b))::2])
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ n = int(input()) a = (*map(int, input()),) (a, b) = (sorted(a[:n]), sorted(a[n:])) d = [1, -1][a[0] > b[0]] print('NYOE S'[all((d * x < d * y for (x, y) in zip(a, b)))::2])
# *********************************************************************************** # * Copyright 2010 - 2016 Paulo A. Herrera. All rights reserved * # * * # * Redistribution and use in source and binary forms, with or without * # * modification, are permitted provided that the following conditions are met: * # * * # * 1. Redistributions of source code must retain the above copyright notice, * # * this list of conditions and the following disclaimer. * # * * # * 2. Redistributions in binary form must reproduce the above copyright notice, * # * this list of conditions and the following disclaimer in the documentation * # * and/or other materials provided with the distribution. * # * * # * THIS SOFTWARE IS PROVIDED BY PAULO A. HERRERA ``AS IS'' AND ANY EXPRESS OR * # * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * # * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * # * EVENT SHALL <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * # * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * # * BUT NOT LIMITED TO, PROCUREMEN OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * # * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * # * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * # * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * # * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * # *********************************************************************************** """Simple class to generate a well-formed XML file.""" class XmlWriter: """ xml writer class. Parameters ---------- filepath : str Path to the xml file. addDeclaration : bool, optional Whether to add the declaration. The default is True. """ def __init__(self, filepath, addDeclaration=True): self.stream = open(filepath, "wb") self.openTag = False self.current = [] if addDeclaration: self.addDeclaration() def close(self): """Close the file.""" assert not self.openTag self.stream.close() def addDeclaration(self): """Add xml declaration.""" self.stream.write(b'<?xml version="1.0"?>') def openElement(self, tag): """Open a new xml element.""" if self.openTag: self.stream.write(b">") st = "\n<%s" % tag self.stream.write(str.encode(st)) self.openTag = True self.current.append(tag) return self def closeElement(self, tag=None): """ Close the current element. Parameters ---------- tag : str, optional Tag of the element. The default is None. Returns ------- XmlWriter The XmlWriter itself for chained calles. """ if tag: assert self.current.pop() == tag if self.openTag: self.stream.write(b">") self.openTag = False st = "\n</%s>" % tag self.stream.write(str.encode(st)) else: self.stream.write(b"/>") self.openTag = False self.current.pop() return self def addText(self, text): """ Add text. Parameters ---------- text : str Text to add. Returns ------- XmlWriter The XmlWriter itself for chained calles. """ if self.openTag: self.stream.write(b">\n") self.openTag = False #mp self.stream.write(str.encode(text)) self.stream.write(text.encode()) return self def addAttributes(self, **kwargs): """ Add attributes. Parameters ---------- **kwargs keys as attribute names. Returns ------- XmlWriter The XmlWriter itself for chained calles. """ assert self.openTag for key in kwargs: st = ' %s="%s"' % (key, kwargs[key]) #mp self.stream.write(str.encode(st)) self.stream.write(st.encode()) return self
"""Simple class to generate a well-formed XML file.""" class Xmlwriter: """ xml writer class. Parameters ---------- filepath : str Path to the xml file. addDeclaration : bool, optional Whether to add the declaration. The default is True. """ def __init__(self, filepath, addDeclaration=True): self.stream = open(filepath, 'wb') self.openTag = False self.current = [] if addDeclaration: self.addDeclaration() def close(self): """Close the file.""" assert not self.openTag self.stream.close() def add_declaration(self): """Add xml declaration.""" self.stream.write(b'<?xml version="1.0"?>') def open_element(self, tag): """Open a new xml element.""" if self.openTag: self.stream.write(b'>') st = '\n<%s' % tag self.stream.write(str.encode(st)) self.openTag = True self.current.append(tag) return self def close_element(self, tag=None): """ Close the current element. Parameters ---------- tag : str, optional Tag of the element. The default is None. Returns ------- XmlWriter The XmlWriter itself for chained calles. """ if tag: assert self.current.pop() == tag if self.openTag: self.stream.write(b'>') self.openTag = False st = '\n</%s>' % tag self.stream.write(str.encode(st)) else: self.stream.write(b'/>') self.openTag = False self.current.pop() return self def add_text(self, text): """ Add text. Parameters ---------- text : str Text to add. Returns ------- XmlWriter The XmlWriter itself for chained calles. """ if self.openTag: self.stream.write(b'>\n') self.openTag = False self.stream.write(text.encode()) return self def add_attributes(self, **kwargs): """ Add attributes. Parameters ---------- **kwargs keys as attribute names. Returns ------- XmlWriter The XmlWriter itself for chained calles. """ assert self.openTag for key in kwargs: st = ' %s="%s"' % (key, kwargs[key]) self.stream.write(st.encode()) return self
"""django-solo helps working with singletons: things like global settings that you want to edit from the admin site. """ __version__ = '1.0.5'
"""django-solo helps working with singletons: things like global settings that you want to edit from the admin site. """ __version__ = '1.0.5'
m = int(input()) n = int(input()) + 1 for i in range(m, n, ): if (i % 17 == 0) or (i % 10 == 9) or (i % 3 == 0 and i % 5 == 0): print(i)
m = int(input()) n = int(input()) + 1 for i in range(m, n): if i % 17 == 0 or i % 10 == 9 or (i % 3 == 0 and i % 5 == 0): print(i)
def print_formatted(number): binlen = len(str(bin(number))) - 2 for i in range(1, number+1): print("{0} {1} {2} {3}".format(str(i).rjust(binlen), str(oct(i))[1:].rjust(binlen), format(i, 'x').upper().rjust(binlen), bin(i)[2:].rjust(binlen)))
def print_formatted(number): binlen = len(str(bin(number))) - 2 for i in range(1, number + 1): print('{0} {1} {2} {3}'.format(str(i).rjust(binlen), str(oct(i))[1:].rjust(binlen), format(i, 'x').upper().rjust(binlen), bin(i)[2:].rjust(binlen)))
class RequestHandler: def __init__ (self, logger): self.logger = logger def log (self, message, type = "info"): self.logger.log ("%s - %s" % (self.request.uri, message), type) def log_info (self, message, type='info'): self.log (message, type) def trace (self): self.logger.trace (self.request.uri) def working (self): return False
class Requesthandler: def __init__(self, logger): self.logger = logger def log(self, message, type='info'): self.logger.log('%s - %s' % (self.request.uri, message), type) def log_info(self, message, type='info'): self.log(message, type) def trace(self): self.logger.trace(self.request.uri) def working(self): return False
# # PySNMP MIB module HH3C-LOCAL-AAA-SERVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-LOCAL-AAA-SERVER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:15:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion", "ValueRangeConstraint") hh3cCommon, = mibBuilder.importSymbols("HH3C-OID-MIB", "hh3cCommon") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") ObjectIdentity, Integer32, Counter32, Unsigned32, IpAddress, MibIdentifier, NotificationType, Counter64, iso, Bits, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "Integer32", "Counter32", "Unsigned32", "IpAddress", "MibIdentifier", "NotificationType", "Counter64", "iso", "Bits", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Gauge32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") hh3cLocAAASvr = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 141)) hh3cLocAAASvr.setRevisions(('2013-07-06 09:45',)) if mibBuilder.loadTexts: hh3cLocAAASvr.setLastUpdated('201307060945Z') if mibBuilder.loadTexts: hh3cLocAAASvr.setOrganization('Hangzhou H3C Tech. Co., Ltd.') hh3cLocAAASvrControl = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 1)) hh3cLocAAASvrTables = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 2)) hh3cLocAAASvrTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3)) hh3cLocAAASvrTrapPrex = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3, 0)) hh3cLocAAASvrBillExportFailed = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3, 0, 1)) if mibBuilder.loadTexts: hh3cLocAAASvrBillExportFailed.setStatus('current') mibBuilder.exportSymbols("HH3C-LOCAL-AAA-SERVER-MIB", hh3cLocAAASvrControl=hh3cLocAAASvrControl, PYSNMP_MODULE_ID=hh3cLocAAASvr, hh3cLocAAASvrTrap=hh3cLocAAASvrTrap, hh3cLocAAASvr=hh3cLocAAASvr, hh3cLocAAASvrTrapPrex=hh3cLocAAASvrTrapPrex, hh3cLocAAASvrBillExportFailed=hh3cLocAAASvrBillExportFailed, hh3cLocAAASvrTables=hh3cLocAAASvrTables)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, single_value_constraint, constraints_union, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ConstraintsUnion', 'ValueRangeConstraint') (hh3c_common,) = mibBuilder.importSymbols('HH3C-OID-MIB', 'hh3cCommon') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (object_identity, integer32, counter32, unsigned32, ip_address, mib_identifier, notification_type, counter64, iso, bits, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'ObjectIdentity', 'Integer32', 'Counter32', 'Unsigned32', 'IpAddress', 'MibIdentifier', 'NotificationType', 'Counter64', 'iso', 'Bits', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'Gauge32') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') hh3c_loc_aaa_svr = module_identity((1, 3, 6, 1, 4, 1, 25506, 2, 141)) hh3cLocAAASvr.setRevisions(('2013-07-06 09:45',)) if mibBuilder.loadTexts: hh3cLocAAASvr.setLastUpdated('201307060945Z') if mibBuilder.loadTexts: hh3cLocAAASvr.setOrganization('Hangzhou H3C Tech. Co., Ltd.') hh3c_loc_aaa_svr_control = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 1)) hh3c_loc_aaa_svr_tables = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 2)) hh3c_loc_aaa_svr_trap = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3)) hh3c_loc_aaa_svr_trap_prex = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3, 0)) hh3c_loc_aaa_svr_bill_export_failed = notification_type((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3, 0, 1)) if mibBuilder.loadTexts: hh3cLocAAASvrBillExportFailed.setStatus('current') mibBuilder.exportSymbols('HH3C-LOCAL-AAA-SERVER-MIB', hh3cLocAAASvrControl=hh3cLocAAASvrControl, PYSNMP_MODULE_ID=hh3cLocAAASvr, hh3cLocAAASvrTrap=hh3cLocAAASvrTrap, hh3cLocAAASvr=hh3cLocAAASvr, hh3cLocAAASvrTrapPrex=hh3cLocAAASvrTrapPrex, hh3cLocAAASvrBillExportFailed=hh3cLocAAASvrBillExportFailed, hh3cLocAAASvrTables=hh3cLocAAASvrTables)
__version__ = '1.0.1' default_app_config = ( 'django_selectel_storage.apps.' 'DjangoSelectelStorageAppConfig' )
__version__ = '1.0.1' default_app_config = 'django_selectel_storage.apps.DjangoSelectelStorageAppConfig'
class Solution(object): def findWords(self, words): """ :type words: List[str] :rtype: List[str] """ result = [] keyb = {'a': '2', 'b': '3', 'c': '3', 'd': '2', 'e': '1', 'f': '2', 'g': '2', 'h': '2', 'i': '1', 'j': '2', 'k': '2', 'l': '2', 'm': '3', 'n': '3', 'o': '1', 'p': '1', 'q': '1', 'r': '1', 's': '2', 't': '1', 'u': '1', 'v': '3', 'w': '1', 'x': '3', 'y': '1', 'z': '3'} for i in words: tmp = keyb[i[0].lower()] l = True j = 1 while l and j < len(i): if keyb[i[j].lower()] != tmp: l = False j+=1 if l: result.append(i) return(result)
class Solution(object): def find_words(self, words): """ :type words: List[str] :rtype: List[str] """ result = [] keyb = {'a': '2', 'b': '3', 'c': '3', 'd': '2', 'e': '1', 'f': '2', 'g': '2', 'h': '2', 'i': '1', 'j': '2', 'k': '2', 'l': '2', 'm': '3', 'n': '3', 'o': '1', 'p': '1', 'q': '1', 'r': '1', 's': '2', 't': '1', 'u': '1', 'v': '3', 'w': '1', 'x': '3', 'y': '1', 'z': '3'} for i in words: tmp = keyb[i[0].lower()] l = True j = 1 while l and j < len(i): if keyb[i[j].lower()] != tmp: l = False j += 1 if l: result.append(i) return result
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2016 JiNong Inc. # """ Reference * http://stackoverflow.com/questions/36932/how-can-i-represent-an-enum-in-python """ def enum(*sequential, **named): """ a function to generate enum type """ enums = dict(zip(sequential, range(len(sequential))), **named) reverse = dict((value, key) for key, value in enums.iteritems()) enums['reverse_mapping'] = reverse return type('Enum', (), enums)
""" Reference * http://stackoverflow.com/questions/36932/how-can-i-represent-an-enum-in-python """ def enum(*sequential, **named): """ a function to generate enum type """ enums = dict(zip(sequential, range(len(sequential))), **named) reverse = dict(((value, key) for (key, value) in enums.iteritems())) enums['reverse_mapping'] = reverse return type('Enum', (), enums)
XMajor = [[15, 13.333333333333334, 26.666666666666668, 46.666666666666664, 13.333333333333334, 0.0, 0.0, 0.0],[13, 15.384615384615385, 38.46153846153846, 7.6923076923076925, 15.384615384615385, 15.384615384615385, 0.0, 7.6923076923076925],[4, 25.0, 0.0, 25.0, 50.0, 0.0, 0.0, 0.0],[10, 20.0, 30.0, 0.0, 0.0, 0.0, 20.0, 30.0],[6, 0.0, 33.333333333333336, 33.333333333333336, 0.0, 33.333333333333336, 0.0, 0.0],[8, 12.5, 37.5, 12.5, 12.5, 25.0, 0.0, 0.0],[12, 0.0, 41.666666666666664, 0.0, 16.666666666666668, 8.333333333333334, 16.666666666666668, 16.666666666666668],[4, 0.0, 0.0, 0.0, 50.0, 0.0, 50.0, 0.0],[11, 36.36363636363637, 36.36363636363637, 18.181818181818183, 9.090909090909092, 0.0, 0.0, 0.0],[9, 22.22222222222222, 22.22222222222222, 33.333333333333336, 0.0, 0.0, 22.22222222222222, 0.0],[11, 18.181818181818183, 9.090909090909092, 18.181818181818183, 9.090909090909092, 18.181818181818183, 27.272727272727273, 0.0],[9, 22.22222222222222, 44.44444444444444, 33.333333333333336, 0.0, 0.0, 0.0, 0.0],[12, 16.666666666666668, 8.333333333333334, 25.0, 41.666666666666664, 8.333333333333334, 0.0, 0.0],[7, 28.571428571428573, 28.571428571428573, 0.0, 0.0, 14.285714285714286, 28.571428571428573, 0.0],[10, 30.0, 10.0, 10.0, 20.0, 10.0, 10.0, 10.0],[7, 14.285714285714286, 14.285714285714286, 28.571428571428573, 14.285714285714286, 28.571428571428573, 0.0, 0.0],[6, 16.666666666666668, 33.333333333333336, 0.0, 16.666666666666668, 0.0, 33.333333333333336, 0.0],[12, 8.333333333333334, 50.0, 16.666666666666668, 8.333333333333334, 16.666666666666668, 0.0, 0.0],[12, 25.0, 41.666666666666664, 16.666666666666668, 16.666666666666668, 0.0, 0.0, 0.0],[7, 28.571428571428573, 0.0, 14.285714285714286, 14.285714285714286, 14.285714285714286, 14.285714285714286, 14.285714285714286],[13, 23.076923076923077, 7.6923076923076925, 30.76923076923077, 0.0, 15.384615384615385, 23.076923076923077, 0.0],[10, 20.0, 30.0, 20.0, 20.0, 10.0, 0.0, 0.0],[10, 10.0, 30.0, 20.0, 30.0, 0.0, 10.0, 0.0],[15, 20.0, 13.333333333333334, 26.666666666666668, 13.333333333333334, 20.0, 6.666666666666667, 0.0],[7, 28.571428571428573, 42.857142857142854, 0.0, 14.285714285714286, 14.285714285714286, 0.0, 0.0],[6, 33.333333333333336, 0.0, 0.0, 33.333333333333336, 0.0, 16.666666666666668, 16.666666666666668],[7, 14.285714285714286, 28.571428571428573, 14.285714285714286, 28.571428571428573, 0.0, 14.285714285714286, 0.0],[6, 16.666666666666668, 33.333333333333336, 16.666666666666668, 16.666666666666668, 0.0, 16.666666666666668, 0.0],[5, 20.0, 20.0, 0.0, 60.0, 0.0, 0.0, 0.0],[13, 0.0, 15.384615384615385, 15.384615384615385, 38.46153846153846, 15.384615384615385, 7.6923076923076925, 7.6923076923076925],[6, 16.666666666666668, 33.333333333333336, 0.0, 0.0, 33.333333333333336, 16.666666666666668, 0.0],[8, 25.0, 25.0, 25.0, 12.5, 0.0, 12.5, 0.0],[7, 28.571428571428573, 28.571428571428573, 14.285714285714286, 14.285714285714286, 0.0, 14.285714285714286, 0.0],[7, 28.571428571428573, 0.0, 42.857142857142854, 28.571428571428573, 0.0, 0.0, 0.0],[9, 33.333333333333336, 11.11111111111111, 11.11111111111111, 11.11111111111111, 22.22222222222222, 11.11111111111111, 0.0],[8, 12.5, 12.5, 50.0, 0.0, 12.5, 12.5, 0.0],[7, 28.571428571428573, 0.0, 0.0, 57.142857142857146, 14.285714285714286, 0.0, 0.0],[10, 0.0, 20.0, 20.0, 10.0, 10.0, 30.0, 10.0],[7, 28.571428571428573, 28.571428571428573, 0.0, 0.0, 14.285714285714286, 28.571428571428573, 0.0],[14, 7.142857142857143, 21.428571428571427, 14.285714285714286, 14.285714285714286, 42.857142857142854, 0.0, 0.0],[8, 12.5, 37.5, 37.5, 0.0, 12.5, 0.0, 0.0],[7, 0.0, 0.0, 28.571428571428573, 0.0, 28.571428571428573, 42.857142857142854, 0.0],[8, 12.5, 12.5, 12.5, 12.5, 25.0, 25.0, 0.0],[7, 14.285714285714286, 14.285714285714286, 14.285714285714286, 42.857142857142854, 14.285714285714286, 0.0, 0.0],[8, 25.0, 25.0, 12.5, 0.0, 12.5, 0.0, 25.0],[13, 30.76923076923077, 15.384615384615385, 15.384615384615385, 15.384615384615385, 15.384615384615385, 7.6923076923076925, 0.0],[7, 28.571428571428573, 14.285714285714286, 14.285714285714286, 0.0, 0.0, 28.571428571428573, 14.285714285714286],[6, 16.666666666666668, 50.0, 16.666666666666668, 0.0, 0.0, 16.666666666666668, 0.0],[8, 25.0, 37.5, 12.5, 0.0, 0.0, 12.5, 12.5],[9, 22.22222222222222, 0.0, 33.333333333333336, 22.22222222222222, 0.0, 0.0, 22.22222222222222],[6, 50.0, 0.0, 33.333333333333336, 0.0, 0.0, 16.666666666666668, 0.0],[9, 0.0, 22.22222222222222, 22.22222222222222, 22.22222222222222, 22.22222222222222, 11.11111111111111, 0.0],[7, 0.0, 28.571428571428573, 14.285714285714286, 28.571428571428573, 0.0, 0.0, 28.571428571428573],[11, 0.0, 27.272727272727273, 9.090909090909092, 18.181818181818183, 27.272727272727273, 9.090909090909092, 9.090909090909092],[13, 15.384615384615385, 23.076923076923077, 15.384615384615385, 7.6923076923076925, 23.076923076923077, 15.384615384615385, 0.0],[9, 22.22222222222222, 44.44444444444444, 11.11111111111111, 22.22222222222222, 0.0, 0.0, 0.0]] YMajor = [0, 0, 1, 0, 3, 0, 0, 3, 0, 3, 0, 0, 0, 3, 1, 3, 3, 0, 0, 0, 2, 3, 3, 0, 3, 0, 3, 3, 3, 3, 0, 0, 0, 3, 0, 3, 0, 0, 3, 3, 0, 3, 3, 3, 0, 0, 3, 3, 0, 0, 1, 3, 3, 1, 0, 3] XMinor = [[11, 9.090909090909092, 36.36363636363637, 18.181818181818183, 9.090909090909092, 9.090909090909092, 9.090909090909092, 9.090909090909092],[7, 28.571428571428573, 14.285714285714286, 28.571428571428573, 14.285714285714286, 0.0, 0.0, 14.285714285714286],[5, 20.0, 40.0, 20.0, 20.0, 0.0, 0.0, 0.0],[8, 12.5, 0.0, 25.0, 37.5, 12.5, 12.5, 0.0],[13, 7.6923076923076925, 30.76923076923077, 15.384615384615385, 30.76923076923077, 7.6923076923076925, 7.6923076923076925, 0.0],[4, 0.0, 50.0, 50.0, 0.0, 0.0, 0.0, 0.0],[3, 0.0, 0.0, 0.0, 33.333333333333336, 33.333333333333336, 33.333333333333336, 0.0],[8, 12.5, 37.5, 25.0, 0.0, 0.0, 25.0, 0.0],[13, 0.0, 7.6923076923076925, 7.6923076923076925, 23.076923076923077, 23.076923076923077, 38.46153846153846, 0.0],[8, 12.5, 50.0, 0.0, 0.0, 25.0, 12.5, 0.0],[7, 14.285714285714286, 42.857142857142854, 28.571428571428573, 14.285714285714286, 0.0, 0.0, 0.0],[14, 35.714285714285715, 14.285714285714286, 14.285714285714286, 0.0, 35.714285714285715, 0.0, 0.0],[12, 50.0, 8.333333333333334, 16.666666666666668, 16.666666666666668, 8.333333333333334, 0.0, 0.0],[10, 10.0, 10.0, 40.0, 30.0, 0.0, 10.0, 0.0],[11, 9.090909090909092, 18.181818181818183, 0.0, 18.181818181818183, 18.181818181818183, 9.090909090909092, 27.272727272727273],[10, 0.0, 40.0, 10.0, 20.0, 20.0, 0.0, 10.0],[8, 37.5, 37.5, 0.0, 0.0, 25.0, 0.0, 0.0],[12, 16.666666666666668, 16.666666666666668, 16.666666666666668, 33.333333333333336, 0.0, 16.666666666666668, 0.0],[9, 11.11111111111111, 33.333333333333336, 22.22222222222222, 0.0, 22.22222222222222, 11.11111111111111, 0.0],[6, 16.666666666666668, 16.666666666666668, 33.333333333333336, 16.666666666666668, 0.0, 16.666666666666668, 0.0],[7, 0.0, 14.285714285714286, 42.857142857142854, 14.285714285714286, 0.0, 0.0, 28.571428571428573],[10, 20.0, 30.0, 30.0, 10.0, 0.0, 10.0, 0.0],[8, 0.0, 37.5, 25.0, 0.0, 25.0, 12.5, 0.0],[11, 9.090909090909092, 0.0, 54.54545454545455, 18.181818181818183, 18.181818181818183, 0.0, 0.0],[6, 0.0, 33.333333333333336, 66.66666666666667, 0.0, 0.0, 0.0, 0.0],[6, 0.0, 33.333333333333336, 33.333333333333336, 16.666666666666668, 16.666666666666668, 0.0, 0.0],[10, 20.0, 20.0, 30.0, 20.0, 0.0, 0.0, 10.0],[10, 20.0, 20.0, 30.0, 20.0, 10.0, 0.0, 0.0],[9, 22.22222222222222, 0.0, 0.0, 55.55555555555556, 22.22222222222222, 0.0, 0.0],[11, 27.272727272727273, 9.090909090909092, 18.181818181818183, 0.0, 18.181818181818183, 9.090909090909092, 18.181818181818183],[10, 40.0, 10.0, 0.0, 10.0, 20.0, 20.0, 0.0],[10, 10.0, 30.0, 10.0, 20.0, 30.0, 0.0, 0.0],[12, 0.0, 8.333333333333334, 16.666666666666668, 41.666666666666664, 16.666666666666668, 16.666666666666668, 0.0],[7, 0.0, 57.142857142857146, 42.857142857142854, 0.0, 0.0, 0.0, 0.0],[11, 0.0, 27.272727272727273, 9.090909090909092, 27.272727272727273, 9.090909090909092, 27.272727272727273, 0.0],[8, 25.0, 37.5, 0.0, 25.0, 0.0, 12.5, 0.0],[9, 0.0, 44.44444444444444, 0.0, 0.0, 22.22222222222222, 11.11111111111111, 22.22222222222222],[11, 18.181818181818183, 27.272727272727273, 9.090909090909092, 18.181818181818183, 9.090909090909092, 9.090909090909092, 9.090909090909092],[11, 0.0, 54.54545454545455, 9.090909090909092, 27.272727272727273, 0.0, 9.090909090909092, 0.0],[4, 25.0, 25.0, 25.0, 25.0, 0.0, 0.0, 0.0],[3, 33.333333333333336, 33.333333333333336, 0.0, 0.0, 0.0, 33.333333333333336, 0.0],[12, 33.333333333333336, 16.666666666666668, 16.666666666666668, 16.666666666666668, 16.666666666666668, 0.0, 0.0],[10, 20.0, 30.0, 40.0, 10.0, 0.0, 0.0, 0.0],[12, 16.666666666666668, 16.666666666666668, 16.666666666666668, 0.0, 33.333333333333336, 16.666666666666668, 0.0],[5, 40.0, 20.0, 20.0, 20.0, 0.0, 0.0, 0.0],[3, 33.333333333333336, 0.0, 0.0, 66.66666666666667, 0.0, 0.0, 0.0],[9, 0.0, 33.333333333333336, 44.44444444444444, 0.0, 11.11111111111111, 11.11111111111111, 0.0]] YMinor = [2, 1, 2, 1, 1, 1, 3, 2, 1, 1, 2, 2, 2, 3, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 1, 1, 2, 2, 1]
x_major = [[15, 13.333333333333334, 26.666666666666668, 46.666666666666664, 13.333333333333334, 0.0, 0.0, 0.0], [13, 15.384615384615385, 38.46153846153846, 7.6923076923076925, 15.384615384615385, 15.384615384615385, 0.0, 7.6923076923076925], [4, 25.0, 0.0, 25.0, 50.0, 0.0, 0.0, 0.0], [10, 20.0, 30.0, 0.0, 0.0, 0.0, 20.0, 30.0], [6, 0.0, 33.333333333333336, 33.333333333333336, 0.0, 33.333333333333336, 0.0, 0.0], [8, 12.5, 37.5, 12.5, 12.5, 25.0, 0.0, 0.0], [12, 0.0, 41.666666666666664, 0.0, 16.666666666666668, 8.333333333333334, 16.666666666666668, 16.666666666666668], [4, 0.0, 0.0, 0.0, 50.0, 0.0, 50.0, 0.0], [11, 36.36363636363637, 36.36363636363637, 18.181818181818183, 9.090909090909092, 0.0, 0.0, 0.0], [9, 22.22222222222222, 22.22222222222222, 33.333333333333336, 0.0, 0.0, 22.22222222222222, 0.0], [11, 18.181818181818183, 9.090909090909092, 18.181818181818183, 9.090909090909092, 18.181818181818183, 27.272727272727273, 0.0], [9, 22.22222222222222, 44.44444444444444, 33.333333333333336, 0.0, 0.0, 0.0, 0.0], [12, 16.666666666666668, 8.333333333333334, 25.0, 41.666666666666664, 8.333333333333334, 0.0, 0.0], [7, 28.571428571428573, 28.571428571428573, 0.0, 0.0, 14.285714285714286, 28.571428571428573, 0.0], [10, 30.0, 10.0, 10.0, 20.0, 10.0, 10.0, 10.0], [7, 14.285714285714286, 14.285714285714286, 28.571428571428573, 14.285714285714286, 28.571428571428573, 0.0, 0.0], [6, 16.666666666666668, 33.333333333333336, 0.0, 16.666666666666668, 0.0, 33.333333333333336, 0.0], [12, 8.333333333333334, 50.0, 16.666666666666668, 8.333333333333334, 16.666666666666668, 0.0, 0.0], [12, 25.0, 41.666666666666664, 16.666666666666668, 16.666666666666668, 0.0, 0.0, 0.0], [7, 28.571428571428573, 0.0, 14.285714285714286, 14.285714285714286, 14.285714285714286, 14.285714285714286, 14.285714285714286], [13, 23.076923076923077, 7.6923076923076925, 30.76923076923077, 0.0, 15.384615384615385, 23.076923076923077, 0.0], [10, 20.0, 30.0, 20.0, 20.0, 10.0, 0.0, 0.0], [10, 10.0, 30.0, 20.0, 30.0, 0.0, 10.0, 0.0], [15, 20.0, 13.333333333333334, 26.666666666666668, 13.333333333333334, 20.0, 6.666666666666667, 0.0], [7, 28.571428571428573, 42.857142857142854, 0.0, 14.285714285714286, 14.285714285714286, 0.0, 0.0], [6, 33.333333333333336, 0.0, 0.0, 33.333333333333336, 0.0, 16.666666666666668, 16.666666666666668], [7, 14.285714285714286, 28.571428571428573, 14.285714285714286, 28.571428571428573, 0.0, 14.285714285714286, 0.0], [6, 16.666666666666668, 33.333333333333336, 16.666666666666668, 16.666666666666668, 0.0, 16.666666666666668, 0.0], [5, 20.0, 20.0, 0.0, 60.0, 0.0, 0.0, 0.0], [13, 0.0, 15.384615384615385, 15.384615384615385, 38.46153846153846, 15.384615384615385, 7.6923076923076925, 7.6923076923076925], [6, 16.666666666666668, 33.333333333333336, 0.0, 0.0, 33.333333333333336, 16.666666666666668, 0.0], [8, 25.0, 25.0, 25.0, 12.5, 0.0, 12.5, 0.0], [7, 28.571428571428573, 28.571428571428573, 14.285714285714286, 14.285714285714286, 0.0, 14.285714285714286, 0.0], [7, 28.571428571428573, 0.0, 42.857142857142854, 28.571428571428573, 0.0, 0.0, 0.0], [9, 33.333333333333336, 11.11111111111111, 11.11111111111111, 11.11111111111111, 22.22222222222222, 11.11111111111111, 0.0], [8, 12.5, 12.5, 50.0, 0.0, 12.5, 12.5, 0.0], [7, 28.571428571428573, 0.0, 0.0, 57.142857142857146, 14.285714285714286, 0.0, 0.0], [10, 0.0, 20.0, 20.0, 10.0, 10.0, 30.0, 10.0], [7, 28.571428571428573, 28.571428571428573, 0.0, 0.0, 14.285714285714286, 28.571428571428573, 0.0], [14, 7.142857142857143, 21.428571428571427, 14.285714285714286, 14.285714285714286, 42.857142857142854, 0.0, 0.0], [8, 12.5, 37.5, 37.5, 0.0, 12.5, 0.0, 0.0], [7, 0.0, 0.0, 28.571428571428573, 0.0, 28.571428571428573, 42.857142857142854, 0.0], [8, 12.5, 12.5, 12.5, 12.5, 25.0, 25.0, 0.0], [7, 14.285714285714286, 14.285714285714286, 14.285714285714286, 42.857142857142854, 14.285714285714286, 0.0, 0.0], [8, 25.0, 25.0, 12.5, 0.0, 12.5, 0.0, 25.0], [13, 30.76923076923077, 15.384615384615385, 15.384615384615385, 15.384615384615385, 15.384615384615385, 7.6923076923076925, 0.0], [7, 28.571428571428573, 14.285714285714286, 14.285714285714286, 0.0, 0.0, 28.571428571428573, 14.285714285714286], [6, 16.666666666666668, 50.0, 16.666666666666668, 0.0, 0.0, 16.666666666666668, 0.0], [8, 25.0, 37.5, 12.5, 0.0, 0.0, 12.5, 12.5], [9, 22.22222222222222, 0.0, 33.333333333333336, 22.22222222222222, 0.0, 0.0, 22.22222222222222], [6, 50.0, 0.0, 33.333333333333336, 0.0, 0.0, 16.666666666666668, 0.0], [9, 0.0, 22.22222222222222, 22.22222222222222, 22.22222222222222, 22.22222222222222, 11.11111111111111, 0.0], [7, 0.0, 28.571428571428573, 14.285714285714286, 28.571428571428573, 0.0, 0.0, 28.571428571428573], [11, 0.0, 27.272727272727273, 9.090909090909092, 18.181818181818183, 27.272727272727273, 9.090909090909092, 9.090909090909092], [13, 15.384615384615385, 23.076923076923077, 15.384615384615385, 7.6923076923076925, 23.076923076923077, 15.384615384615385, 0.0], [9, 22.22222222222222, 44.44444444444444, 11.11111111111111, 22.22222222222222, 0.0, 0.0, 0.0]] y_major = [0, 0, 1, 0, 3, 0, 0, 3, 0, 3, 0, 0, 0, 3, 1, 3, 3, 0, 0, 0, 2, 3, 3, 0, 3, 0, 3, 3, 3, 3, 0, 0, 0, 3, 0, 3, 0, 0, 3, 3, 0, 3, 3, 3, 0, 0, 3, 3, 0, 0, 1, 3, 3, 1, 0, 3] x_minor = [[11, 9.090909090909092, 36.36363636363637, 18.181818181818183, 9.090909090909092, 9.090909090909092, 9.090909090909092, 9.090909090909092], [7, 28.571428571428573, 14.285714285714286, 28.571428571428573, 14.285714285714286, 0.0, 0.0, 14.285714285714286], [5, 20.0, 40.0, 20.0, 20.0, 0.0, 0.0, 0.0], [8, 12.5, 0.0, 25.0, 37.5, 12.5, 12.5, 0.0], [13, 7.6923076923076925, 30.76923076923077, 15.384615384615385, 30.76923076923077, 7.6923076923076925, 7.6923076923076925, 0.0], [4, 0.0, 50.0, 50.0, 0.0, 0.0, 0.0, 0.0], [3, 0.0, 0.0, 0.0, 33.333333333333336, 33.333333333333336, 33.333333333333336, 0.0], [8, 12.5, 37.5, 25.0, 0.0, 0.0, 25.0, 0.0], [13, 0.0, 7.6923076923076925, 7.6923076923076925, 23.076923076923077, 23.076923076923077, 38.46153846153846, 0.0], [8, 12.5, 50.0, 0.0, 0.0, 25.0, 12.5, 0.0], [7, 14.285714285714286, 42.857142857142854, 28.571428571428573, 14.285714285714286, 0.0, 0.0, 0.0], [14, 35.714285714285715, 14.285714285714286, 14.285714285714286, 0.0, 35.714285714285715, 0.0, 0.0], [12, 50.0, 8.333333333333334, 16.666666666666668, 16.666666666666668, 8.333333333333334, 0.0, 0.0], [10, 10.0, 10.0, 40.0, 30.0, 0.0, 10.0, 0.0], [11, 9.090909090909092, 18.181818181818183, 0.0, 18.181818181818183, 18.181818181818183, 9.090909090909092, 27.272727272727273], [10, 0.0, 40.0, 10.0, 20.0, 20.0, 0.0, 10.0], [8, 37.5, 37.5, 0.0, 0.0, 25.0, 0.0, 0.0], [12, 16.666666666666668, 16.666666666666668, 16.666666666666668, 33.333333333333336, 0.0, 16.666666666666668, 0.0], [9, 11.11111111111111, 33.333333333333336, 22.22222222222222, 0.0, 22.22222222222222, 11.11111111111111, 0.0], [6, 16.666666666666668, 16.666666666666668, 33.333333333333336, 16.666666666666668, 0.0, 16.666666666666668, 0.0], [7, 0.0, 14.285714285714286, 42.857142857142854, 14.285714285714286, 0.0, 0.0, 28.571428571428573], [10, 20.0, 30.0, 30.0, 10.0, 0.0, 10.0, 0.0], [8, 0.0, 37.5, 25.0, 0.0, 25.0, 12.5, 0.0], [11, 9.090909090909092, 0.0, 54.54545454545455, 18.181818181818183, 18.181818181818183, 0.0, 0.0], [6, 0.0, 33.333333333333336, 66.66666666666667, 0.0, 0.0, 0.0, 0.0], [6, 0.0, 33.333333333333336, 33.333333333333336, 16.666666666666668, 16.666666666666668, 0.0, 0.0], [10, 20.0, 20.0, 30.0, 20.0, 0.0, 0.0, 10.0], [10, 20.0, 20.0, 30.0, 20.0, 10.0, 0.0, 0.0], [9, 22.22222222222222, 0.0, 0.0, 55.55555555555556, 22.22222222222222, 0.0, 0.0], [11, 27.272727272727273, 9.090909090909092, 18.181818181818183, 0.0, 18.181818181818183, 9.090909090909092, 18.181818181818183], [10, 40.0, 10.0, 0.0, 10.0, 20.0, 20.0, 0.0], [10, 10.0, 30.0, 10.0, 20.0, 30.0, 0.0, 0.0], [12, 0.0, 8.333333333333334, 16.666666666666668, 41.666666666666664, 16.666666666666668, 16.666666666666668, 0.0], [7, 0.0, 57.142857142857146, 42.857142857142854, 0.0, 0.0, 0.0, 0.0], [11, 0.0, 27.272727272727273, 9.090909090909092, 27.272727272727273, 9.090909090909092, 27.272727272727273, 0.0], [8, 25.0, 37.5, 0.0, 25.0, 0.0, 12.5, 0.0], [9, 0.0, 44.44444444444444, 0.0, 0.0, 22.22222222222222, 11.11111111111111, 22.22222222222222], [11, 18.181818181818183, 27.272727272727273, 9.090909090909092, 18.181818181818183, 9.090909090909092, 9.090909090909092, 9.090909090909092], [11, 0.0, 54.54545454545455, 9.090909090909092, 27.272727272727273, 0.0, 9.090909090909092, 0.0], [4, 25.0, 25.0, 25.0, 25.0, 0.0, 0.0, 0.0], [3, 33.333333333333336, 33.333333333333336, 0.0, 0.0, 0.0, 33.333333333333336, 0.0], [12, 33.333333333333336, 16.666666666666668, 16.666666666666668, 16.666666666666668, 16.666666666666668, 0.0, 0.0], [10, 20.0, 30.0, 40.0, 10.0, 0.0, 0.0, 0.0], [12, 16.666666666666668, 16.666666666666668, 16.666666666666668, 0.0, 33.333333333333336, 16.666666666666668, 0.0], [5, 40.0, 20.0, 20.0, 20.0, 0.0, 0.0, 0.0], [3, 33.333333333333336, 0.0, 0.0, 66.66666666666667, 0.0, 0.0, 0.0], [9, 0.0, 33.333333333333336, 44.44444444444444, 0.0, 11.11111111111111, 11.11111111111111, 0.0]] y_minor = [2, 1, 2, 1, 1, 1, 3, 2, 1, 1, 2, 2, 2, 3, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 1, 1, 2, 2, 1]
# Define Functions # Function that handles all litre conversions def litreconv(): print("you have selected Litres") conversion = int(input("input Litres to convert: ")) print(str(conversion) + " Litres") converted = 0.21997 * conversion print(str(round(converted, 4)) + " UK Gallons") converted = conversion / 3.785 print(str(round(converted, 4)) + "US Gallons") # Function that handles all UK Gallon conversions def ukgallonconv(): print("You have selected UK Gallons") conversion = int(input("Input UK Gallons to convert: ")) print(str(conversion) + " UK Gallons") converted = conversion / 0.21997 print(str(round(converted, 4)) + " Litres") converted = conversion * 1.201 print(str(round(converted, 4)) + "US Gallons") # Function that handles all US Gallon conversions def usgallonconv(): print("You have selected US Gallons") conversion = int(input("input US Gallons to convert: ")) print(str(conversion) + " US Gallons") converted = conversion * 3.785 print(str(round(converted, 4)) + " Litres") converted = conversion / 1.201 print(str(round(converted, 4)) + " UK Gallons") # Function that handles Pearsons Square calculation. Note: Tidy variable/input names def pearsonsconv(): pearsontarget = float(input("Please enter your target percentage: ")) print("You entered " + str(pearsontarget)) pearsoninput1 = float(input("Please enter your top left number: ")) print("You entered " + str(pearsoninput1)) pearsoninput2 = float(input("Please enter your bottom left number: ")) print("You entered " + str(pearsoninput2)) if pearsoninput2 > pearsontarget: pearsonsum2 = pearsoninput2 - pearsontarget else: pearsonsum2 = pearsontarget = pearsoninput2 print("Top right: " + str(pearsonsum2)) if pearsoninput1 > pearsontarget: pearsonsum1 = pearsoninput1 - pearsontarget else: pearsonsum1 = pearsontarget - pearsoninput1 print("Bottom right = " + str(pearsonsum1)) pearsonsumtotal = pearsonsum1 + pearsonsum2 print("Total of the two: " + str(pearsonsumtotal)) pearsonsum2 = (pearsonsum2 / pearsonsumtotal) * 100 print("Top right percentage: " + str(pearsonsum2)) pearsonsum1 = (pearsonsum1 / pearsonsumtotal) * 100 print("Bottom right percentage: " + str(pearsonsum1)) # Function that outputs needed amount of Potassium Metabisulphate from desired amount of sulphur dioxide def sulphurdioxideconv(): print("You have selected Potassium Metabisulphate > Sulphur Dioxide") so2=float(input("Please input the required amount of Sulphur Dioxide:")) print("You entered" + str(so2)) so2sum = (so2 / 57) * 100 print("You require " + str(so2sum) + "mg of Potassium Metabisulphate") # Main Loop firstrun = 0 run = 1 # On first open shows instructions. Will be redundant after UI added. while firstrun == 0: print("Welcome to WineConverter.") print("Enter 'List' to see the available conversions, and then either enter the number or the name of the measurement you have.") print("To Quit enter 'Quit' or 'Exit'\nTo see these instructions again enter 'Help'") firstrun = 1 # Main loop, user inputs command to call function while run == 1: command = input("Please enter your command: ") command.lower() if command == "list": print("1. Litres\n2. UK Gallons\n3. US Gallons\n 4. Pearsons Square\n5. Sulphur Dioxide") elif command == "litres" or command == "1": litreconv() elif command == "uk gallons" or command == "2": ukgallonconv() elif command == "us gallons" or command == "3": usgallonconv() elif command == "pearsons" or command == "4": pearsonsconv() elif command =="Sulphur" or command == "5": sulphurdioxideconv() elif command == "exit" or command == "quit": run = 0 else: print("Command not recognised, please enter List to see a full list of commands")
def litreconv(): print('you have selected Litres') conversion = int(input('input Litres to convert: ')) print(str(conversion) + ' Litres') converted = 0.21997 * conversion print(str(round(converted, 4)) + ' UK Gallons') converted = conversion / 3.785 print(str(round(converted, 4)) + 'US Gallons') def ukgallonconv(): print('You have selected UK Gallons') conversion = int(input('Input UK Gallons to convert: ')) print(str(conversion) + ' UK Gallons') converted = conversion / 0.21997 print(str(round(converted, 4)) + ' Litres') converted = conversion * 1.201 print(str(round(converted, 4)) + 'US Gallons') def usgallonconv(): print('You have selected US Gallons') conversion = int(input('input US Gallons to convert: ')) print(str(conversion) + ' US Gallons') converted = conversion * 3.785 print(str(round(converted, 4)) + ' Litres') converted = conversion / 1.201 print(str(round(converted, 4)) + ' UK Gallons') def pearsonsconv(): pearsontarget = float(input('Please enter your target percentage: ')) print('You entered ' + str(pearsontarget)) pearsoninput1 = float(input('Please enter your top left number: ')) print('You entered ' + str(pearsoninput1)) pearsoninput2 = float(input('Please enter your bottom left number: ')) print('You entered ' + str(pearsoninput2)) if pearsoninput2 > pearsontarget: pearsonsum2 = pearsoninput2 - pearsontarget else: pearsonsum2 = pearsontarget = pearsoninput2 print('Top right: ' + str(pearsonsum2)) if pearsoninput1 > pearsontarget: pearsonsum1 = pearsoninput1 - pearsontarget else: pearsonsum1 = pearsontarget - pearsoninput1 print('Bottom right = ' + str(pearsonsum1)) pearsonsumtotal = pearsonsum1 + pearsonsum2 print('Total of the two: ' + str(pearsonsumtotal)) pearsonsum2 = pearsonsum2 / pearsonsumtotal * 100 print('Top right percentage: ' + str(pearsonsum2)) pearsonsum1 = pearsonsum1 / pearsonsumtotal * 100 print('Bottom right percentage: ' + str(pearsonsum1)) def sulphurdioxideconv(): print('You have selected Potassium Metabisulphate > Sulphur Dioxide') so2 = float(input('Please input the required amount of Sulphur Dioxide:')) print('You entered' + str(so2)) so2sum = so2 / 57 * 100 print('You require ' + str(so2sum) + 'mg of Potassium Metabisulphate') firstrun = 0 run = 1 while firstrun == 0: print('Welcome to WineConverter.') print("Enter 'List' to see the available conversions, and then either enter the number or the name of the measurement you have.") print("To Quit enter 'Quit' or 'Exit'\nTo see these instructions again enter 'Help'") firstrun = 1 while run == 1: command = input('Please enter your command: ') command.lower() if command == 'list': print('1. Litres\n2. UK Gallons\n3. US Gallons\n 4. Pearsons Square\n5. Sulphur Dioxide') elif command == 'litres' or command == '1': litreconv() elif command == 'uk gallons' or command == '2': ukgallonconv() elif command == 'us gallons' or command == '3': usgallonconv() elif command == 'pearsons' or command == '4': pearsonsconv() elif command == 'Sulphur' or command == '5': sulphurdioxideconv() elif command == 'exit' or command == 'quit': run = 0 else: print('Command not recognised, please enter List to see a full list of commands')
dff = data df_sk = dff.loc[(dff['scenario']=='ND_NO_SKAVICA')|(dff['scenario']=='ND_SKAVICA')] df_sk['scenario'].replace({"ND_NO_SKAVICA":"No Skavica", "ND_SKAVICA":"With Skavica"}, inplace=True) df_sk1 = df_sk.loc[(df_sk['country']=='Albania')&(df_sk['tech']!='AL-Import')] df_sk1 = df_sk1.groupby(['country','tech','year','scenario']).mean().reset_index() df_sk2 = df_sk.loc[(df_sk['country']=='Albania')&(df_sk['tech']=='AL-Import')] df_sk2 = df_sk2.groupby(['country','tech','year','scenario']).mean().reset_index() df_sk3 = df_sk2.loc[(df_sk2['year']>=2025)&(df_sk2['year']<=2050)] graph_title='Impact of new Skavica dam on annual elec.imports in AL' fig3a = px.bar(df_sk3, x='year', y='value', color='scenario', facet_col='tech', facet_col_wrap=2, barmode='group', labels={"value": "GWh", "tech":"HPP"}, title=graph_title, category_orders={"scenario": ["No Skavica", "With Skavica"]}, facet_col_spacing=0.05, facet_row_spacing=0.05) fig3a.for_each_annotation(lambda a: a.update(text=a.text.split("=")[-1])) fig3a.update_yaxes(range=[1500, 4000]) #setting the y-axis scale to ensure good readability #You can change the image extension to *.png if you want or keep it as pdf (for high resolution) #output_folder = os.path.join('Results_graphics') #os.makedirs(output_folder, exist_ok = True) #pio.write_image(fig, 'Results_graphics/{}.pdf'.format(graph_title)) #fig.show()
dff = data df_sk = dff.loc[(dff['scenario'] == 'ND_NO_SKAVICA') | (dff['scenario'] == 'ND_SKAVICA')] df_sk['scenario'].replace({'ND_NO_SKAVICA': 'No Skavica', 'ND_SKAVICA': 'With Skavica'}, inplace=True) df_sk1 = df_sk.loc[(df_sk['country'] == 'Albania') & (df_sk['tech'] != 'AL-Import')] df_sk1 = df_sk1.groupby(['country', 'tech', 'year', 'scenario']).mean().reset_index() df_sk2 = df_sk.loc[(df_sk['country'] == 'Albania') & (df_sk['tech'] == 'AL-Import')] df_sk2 = df_sk2.groupby(['country', 'tech', 'year', 'scenario']).mean().reset_index() df_sk3 = df_sk2.loc[(df_sk2['year'] >= 2025) & (df_sk2['year'] <= 2050)] graph_title = 'Impact of new Skavica dam on annual elec.imports in AL' fig3a = px.bar(df_sk3, x='year', y='value', color='scenario', facet_col='tech', facet_col_wrap=2, barmode='group', labels={'value': 'GWh', 'tech': 'HPP'}, title=graph_title, category_orders={'scenario': ['No Skavica', 'With Skavica']}, facet_col_spacing=0.05, facet_row_spacing=0.05) fig3a.for_each_annotation(lambda a: a.update(text=a.text.split('=')[-1])) fig3a.update_yaxes(range=[1500, 4000])
""" Module: 'functools' on LEGO EV3 v1.0.0 """ # MCU: sysname=ev3, nodename=ev3, release=('v1.0.0',), version=('0.0.0',), machine=ev3 # Stubber: 1.3.2 def partial(): pass def reduce(): pass def update_wrapper(): pass def wraps(): pass
""" Module: 'functools' on LEGO EV3 v1.0.0 """ def partial(): pass def reduce(): pass def update_wrapper(): pass def wraps(): pass
# ASL ALPHABET, j,Z OMITTED language = { 'letter_a' : [ "http://science.opposingviews.com/DM-Resize/photos.demandstudios.com/getty/article/81/210/78033946.jpg?w=600&h=600&keep_ratio=1", "http://www.lifeprint.com/asl101/signjpegs/a/a.jpg", "http://thumbs.dreamstime.com/x/letter-sign-language-587184.jpg", "http://i.imgur.com/ei3jaNZ.jpg", 'http://imgur.com/dEzAAdf.jpg', 'http://imgur.com/Cq98daW.jpg', "http://i.imgur.com/idEI6pF.jpg", "http://i.imgur.com/AmaKsIu.jpg", 'http://i.imgur.com/pcRSprF.jpg' ], 'letter_b' : [ "https://s3.amazonaws.com/bankstreet_web/media/filer_public/filer_public/2013/03/04/asl_b.jpg", "http://www.wpclipart.com/sign_language/American_ABC_Photos/sign_language_photo_B.png", "http://thumbs.dreamstime.com/z/letter-b-sign-language-587210.jpg", "http://images2.pics4learning.com/catalog/b/b.jpg", "http://www.lifeprint.com/asl101/signjpegs/b/b1.jpg", "http://i.imgur.com/pU4pXE8.jpg", 'http://imgur.com/qbbPAW6.jpg', 'http://imgur.com/XBQ9nXx.jpg', 'http://imgur.com/lqvt8f0.jpg', 'http://i.imgur.com/Dw6FEFS.jpg', 'http://i.imgur.com/F9s68Ks.jpg', 'http://i.imgur.com/AwhYJjn.jpg', 'http://i.imgur.com/cmkzC7d.jpg', 'http://i.imgur.com/tiey392.jpg' ], 'letter_c' : [ "http://images2.pics4learning.com/catalog/c/c.jpg", "http://www.wpclipart.com/sign_language/American_ABC_Photos/sign_language_photo_C.png", 'http://i233.photobucket.com/albums/ee159/lintpicker/30801_9184.jpg', 'http://imgur.com/d3YIDeM.jpg', 'http://www.lifeprint.com/asl101/signjpegs/c/c.jpg', 'http://imgur.com/ZKY6quh.jpg', 'http://imgur.com/5oaD2DA.jpg', 'http://i.imgur.com/Iin7dhC.jpg', 'http://i.imgur.com/4yHKhIg.jpg', 'http://i.imgur.com/98WqyNm.jpg', 'http://i.imgur.com/5vMj1xa.jpg' ], 'letter_d' : [ "http://www.lifeprint.com/asl101/signjpegs/d/d.jpg", "http://images2.pics4learning.com/catalog/d/thumbs/d_thumb.jpg", 'http://users.manchester.edu/Student/SMCarmichael/MyWebpage/MPj03857270000[1]1.jpg', 'http://imgur.com/N8WTUo8.jpg', 'http://imgur.com/U1DTGet.jpg', 'http://i.imgur.com/P6tw9wt.jpg', 'http://i.imgur.com/Ci4c5Dz.jpg', 'http://i.imgur.com/Hbpg93V.jpg' ], 'letter_e' : [ "http://www.lifeprint.com/asl101/signjpegs/e/e.jpg", 'http://images2.pics4learning.com/catalog/e/thumbs/e_thumb.jpg', 'http://www.wtsd.tn.org/kylah_webpage/MPj03857280000%5B1%5D.jpg', 'http://imgur.com/xtKJdhs.jpg', 'http://imgur.com/I8SsKfZ.jpg', 'http://i.imgur.com/vlTE1A2.jpg', 'http://i.imgur.com/vQwuSpI.jpg', 'http://i.imgur.com/bmHkR4g.jpg', 'http://i.imgur.com/N1RjYaJ.jpg', 'http://i.imgur.com/UhYgnPZ.jpg' ], 'letter_f' : [ 'http://www.lifeprint.com/asl101/signjpegs/f/f.jpg', 'https://www.signingsavvy.com/images/words/alphabet/2/f1.jpg', 'http://images2.pics4learning.com/catalog/f/thumbs/f_thumb.jpg', 'http://imgur.com/18mJQcx.jpg', 'http://i.imgur.com/G6C4q8D.jpg', 'http://i.imgur.com/dA5SGV9.jpg', 'http://i.imgur.com/g5xoIpn.jpg', 'http://i.imgur.com/kkFqone.jpg', 'http://i.imgur.com/tu93sTL.jpg', 'http://i.imgur.com/tu93sTL.jpg' ], 'letter_g' : [ 'http://www.lifeprint.com/asl101/signjpegs/g/g1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/g/g2.jpg', 'http://images2.pics4learning.com/catalog/g/thumbs/g_thumb.jpg', 'http://imgur.com/wog08bz.jpg', 'http://i.imgur.com/xsPrfCk.jpg', 'http://i.imgur.com/RQJEDNa.jpg', 'http://i.imgur.com/9NfbVpb.jpg', 'http://i.imgur.com/5fofc5J.jpg', 'http://i.imgur.com/VB1Zb3l.jpg' ], 'letter_h' : [ 'http://www.lifeprint.com/asl101/signjpegs/h/h1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/h/h2.jpg', 'http://www.lifeprint.com/asl101/signjpegs/h/h3.jpg', 'http://images2.pics4learning.com/catalog/h/h.jpg', 'http://imgur.com/CWStAMd.jpg', 'http://imgur.com/LCOuoqr.jpg', 'http://i.imgur.com/O28D9QU.jpg', 'http://i.imgur.com/5M3X0RP.jpg', 'http://i.imgur.com/cWbi2Ul.jpg', 'http://i.imgur.com/719dcYC.jpg', 'http://i.imgur.com/BsqRJGS.jpg' ], 'letter_i' : [ 'http://www.lifeprint.com/asl101/signjpegs/j/i1.jpg', 'http://images2.pics4learning.com/catalog/i/i.jpg', 'http://imgur.com/TbSpe7K.jpg', 'http://i.imgur.com/jeDqEJd.jpg', 'http://i.imgur.com/yRydMLJ.jpg', 'http://i.imgur.com/RlBX7Cw.jpg', 'http://i.imgur.com/lTM5vRg.jpg', 'http://i.imgur.com/Nc3DR34.jpg', 'http://i.imgur.com/s7DeARK.jpg', 'http://i.imgur.com/U4Xf04c.jpg', 'http://i.imgur.com/AWFRgh1.jpg' ], 'letter_k' : [ "http://www.lifeprint.com/asl101/signjpegs/k/k.jpg", "http://www.lifeprint.com/asl101/signjpegs/k/k1.jpg", "http://www.lifeprint.com/asl101/signjpegs/k/k2.jpg", 'http://images2.pics4learning.com/catalog/k/k.jpg', 'http://imgur.com/oth4JHl.jpg', 'http://imgur.com/RX9GheD.jpg' ], 'letter_l' : [ 'http://www.lifeprint.com/asl101/signjpegs/l/l.jpg', 'http://images2.pics4learning.com/catalog/l/l.jpg', 'http://imgur.com/3Wrr83R.jpg', 'http://i.imgur.com/Kk00yJi.jpg', 'http://i.imgur.com/Y3PfW5E.jpg' 'http://i.imgur.com/c4VbfM7.jpg', 'http://i.imgur.com/VgEXOrD.jpg', 'http://i.imgur.com/QK3otVV.jpg', 'http://i.imgur.com/tqy78Tw.jpg', 'http://i.imgur.com/HFcYyWC.jpg', 'http://vignette1.wikia.nocookie.net/glee/images/5/53/L_to_Loser.jpg/revision/latest?cb=20100919121543', 'http://i.imgur.com/Sy3MQh5.jpg' ], 'letter_m' : [ 'http://www.lifeprint.com/asl101/signjpegs/m/m1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/m/m2.jpg', 'http://images2.pics4learning.com/catalog/m/m.jpg', 'http://i.imgur.com/wJ14Xsp.jpg', 'http://i.imgur.com/cH4Ctwz.jpg', 'http://i.imgur.com/eLcC1Hy.jpg', 'http://i.imgur.com/BH3bj3e.jpg', 'http://i.imgur.com/sf3ylPt.jpg', 'http://i.imgur.com/A6CEht0.jpg' ], 'letter_n' : [ 'http://www.lifeprint.com/asl101/signjpegs/n/n1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/n/n2.jpg', 'http://images2.pics4learning.com/catalog/n/n.jpg', 'http://i.imgur.com/pqa8Zyw.jpg', 'http://i.imgur.com/JY0JKp4.jpg', 'http://i.imgur.com/CaOevfe.jpg', 'http://i.imgur.com/zAMaTo6.jpg', 'http://i.imgur.com/phLgLZx.jpg', 'http://i.imgur.com/8YXDFcx.jpg', 'http://i.imgur.com/LB8gklq.jpg' ], 'letter_o':[ 'http://www.lifeprint.com/asl101/signjpegs/o/o1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/o/o2.jpg', 'http://www.lifeprint.com/asl101/signjpegs/o/o3.jpg', 'http://images2.pics4learning.com/catalog/o/o.jpg', 'http://imgur.com/85LJSka.jpg', 'http://i.imgur.com/y6ArfBV.jpg', 'http://i.imgur.com/1SED8NN.jpg', 'http://i.imgur.com/do3X45q.jpg', 'http://i.imgur.com/kNEYY1M.jpg', 'http://i.imgur.com/7GGzriv.jpg', 'http://i.imgur.com/8IrR5L9.jpg', 'http://i.imgur.com/CJ4tKYs.jpg' ], 'letter_p': [ 'http://www.lifeprint.com/asl101/signjpegs/p/p1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/p/p2.jpg', 'http://www.lifeprint.com/asl101/signjpegs/p/p3.jpg', 'http://images2.pics4learning.com/catalog/p/p.jpg', 'http://i.imgur.com/tkDcZMe.jpg', 'http://i.imgur.com/egNs3cW.jpg', 'http://i.imgur.com/pJ4o3yH.jpg', 'http://i.imgur.com/y3KfSeG.jpg', 'http://i.imgur.com/krug936.jpg', 'http://i.imgur.com/jo63UDp.jpg', 'http://i.imgur.com/ZyiAxwd.jpg' ], 'letter_q': [ 'http://www.lifeprint.com/asl101/signjpegs/q/q1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/q/q2.jpg', 'http://images2.pics4learning.com/catalog/q/q.jpg', 'http://imgur.com/jidKKYK.jpg', 'http://i.imgur.com/3eG0iPQ.jpg', 'http://i.imgur.com/RJlOzHO.jpg', 'http://i.imgur.com/kT5qkFL.jpg', 'http://i.imgur.com/La5ytRV.jpg', 'http://i.imgur.com/vM81Zk2.jpg', 'http://i.imgur.com/eKGg70h.jpg', 'http://i.imgur.com/FLEGaaq.jpg', 'http://i.imgur.com/ZV7qQHK.jpg', 'http://i.imgur.com/W6gWT8a.jpg' ], 'letter_r' : [ 'http://www.lifeprint.com/asl101/signjpegs/r/r.jpg', 'http://images2.pics4learning.com/catalog/r/thumbs/r_thumb.jpg', 'http://i.imgur.com/9wwRZDc.jpg', 'http://i.imgur.com/xfGtPRf.jpg', 'http://i.imgur.com/uDojFj2.jpg', 'http://i.imgur.com/T7kJULr.jpg', 'http://i.imgur.com/MIZWPZI.jpg', 'http://i.imgur.com/F4MkT8m.jpg', 'http://i.imgur.com/N6Gx7vl.jpg' ], 'letter_s': [ "http://www.lifeprint.com/asl101/signjpegs/s/s.jpg", 'http://images2.pics4learning.com/catalog/s/thumbs/s_thumb.jpg', 'http://i.imgur.com/rmf5jgR.jpg', 'http://i.imgur.com/P3Zq5Dd.jpg', 'http://i.imgur.com/xClBmxV.jpg', 'http://i.imgur.com/hQjYMPn.jpg', 'http://i.imgur.com/2mX9w8T.jpg', 'http://i.imgur.com/Fa70wX8.jpg' ], 'letter_t' : [ 'http://www.lifeprint.com/asl101/signjpegs/t/t.jpg', 'http://images2.pics4learning.com/catalog/t/thumbs/t_thumb.jpg', 'http://imgur.com/cirlKJB.jpg', 'http://i.imgur.com/nnDEPLf.jpg', 'http://i.imgur.com/HLxur9q.jpg', 'http://i.imgur.com/bljZk3l.jpg', 'http://i.imgur.com/9GUDD82.jpg', 'http://i.imgur.com/KLL2zzt.jpg', 'http://i.imgur.com/vSvZ15A.jpg', 'http://i.imgur.com/jmKPaJz.jpg' ], 'letter_u': [ 'http://www.lifeprint.com/asl101/signjpegs/u/u.jpg', 'http://images2.pics4learning.com/catalog/u/thumbs/u_thumb.jpg', 'http://imgur.com/wgP9cZw.jpg', 'http://i.imgur.com/u9YwhBP.jpg', 'http://i.imgur.com/zUyMaWD.jpg', 'http://i.imgur.com/39rVd1f.jpg', 'http://i.imgur.com/W1SiHte.jpg', 'http://i.imgur.com/zqJ7ziC.jpg', 'http://i.imgur.com/FT9gSS2.jpg', 'http://i.imgur.com/oXrvDE5.jpg', 'http://i.imgur.com/5WOntzk.jpg' ], 'letter_v' : [ 'http://www.lifeprint.com/asl101/signjpegs/v/v.jpg', 'http://images2.pics4learning.com/catalog/v/thumbs/v_thumb.jpg', 'http://imgur.com/nXyOWzj.jpg', 'http://i.imgur.com/69NrFjG.jpg', 'http://i.imgur.com/GPyiPNv.jpg', 'http://i.imgur.com/OkHpWff.jpg', 'http://i.imgur.com/NX2G7JW.jpg', 'http://i.imgur.com/Su0ByBz.jpg', 'http://i.imgur.com/rnO7sVH.jpg', 'http://i.imgur.com/YAtArlj.jpg', 'http://i.imgur.com/xDwSHGg.jpg', 'http://i.imgur.com/skhHAqq.jpg' ], 'letter_w' : [ 'http://www.lifeprint.com/asl101/signjpegs/w/w.jpg', 'http://images2.pics4learning.com/catalog/w/thumbs/w_thumb.jpg', 'http://i.imgur.com/ep9SPS6.jpg', 'http://i.imgur.com/kyhQ5D4.jpg', 'http://i.imgur.com/mHGWgy4.jpg', 'http://i.imgur.com/BQVK36B.jpg', 'http://i.imgur.com/2lPUvlM.jpg', 'http://i.imgur.com/Zs5QqU8.jpg', 'http://i.imgur.com/WfTMaDV.jpg', 'http://i.imgur.com/5pMmYeR.jpg' ], 'letter_x': [ 'http://www.lifeprint.com/asl101/signjpegs/x/x1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/x/x2.jpg', 'http://images2.pics4learning.com/catalog/x/thumbs/x_thumb.jpg', 'http://i.imgur.com/BzGhtvx.jpg', 'http://i.imgur.com/M8oXvMg.jpg', 'http://i.imgur.com/EAGSTO5.jpg', 'http://i.imgur.com/jANf5IK.jpg', 'http://i.imgur.com/BfsrKmH.jpg', 'http://i.imgur.com/KjPCC57.jpg' ], 'letter_y' : [ 'http://www.lifeprint.com/asl101/signjpegs/y/y.jpg', 'http://images2.pics4learning.com/catalog/y/thumbs/y_thumb.jpg', 'http://i.imgur.com/lFCvuYs.jpg', 'http://i.imgur.com/cqsOgCx.jpg', 'http://i.imgur.com/BagarbG.jpg', 'http://i.imgur.com/LVhlWhQ.jpg', 'http://i.imgur.com/uKSmVuv.jpg', 'http://i.imgur.com/QYrdAW3.jpg', 'http://i.imgur.com/5RrMIez.jpg', 'http://i.imgur.com/6nhuW9v.jpg', 'http://i.imgur.com/h1AumoX.jpg', 'http://i.imgur.com/v74QoHw.jpg' ], 'applause' : [ "http://www.churchleaders.com/wp-content/uploads/files/article_images/clap_or_not_937398406.jpg", "http://i.imgur.com/GxvFP6h.jpg", "http://i.imgur.com/LgXOHBL.jpg", "http://i.imgur.com/JKmWCEn.jpg", "http://i.imgur.com/iJkf0st.jpg", "http://i.imgur.com/Dx1EULd.jpg", "https://image.freepik.com/free-photo/cook--cosmetics--clapping--hand_3256176.jpg" ] }
language = {'letter_a': ['http://science.opposingviews.com/DM-Resize/photos.demandstudios.com/getty/article/81/210/78033946.jpg?w=600&h=600&keep_ratio=1', 'http://www.lifeprint.com/asl101/signjpegs/a/a.jpg', 'http://thumbs.dreamstime.com/x/letter-sign-language-587184.jpg', 'http://i.imgur.com/ei3jaNZ.jpg', 'http://imgur.com/dEzAAdf.jpg', 'http://imgur.com/Cq98daW.jpg', 'http://i.imgur.com/idEI6pF.jpg', 'http://i.imgur.com/AmaKsIu.jpg', 'http://i.imgur.com/pcRSprF.jpg'], 'letter_b': ['https://s3.amazonaws.com/bankstreet_web/media/filer_public/filer_public/2013/03/04/asl_b.jpg', 'http://www.wpclipart.com/sign_language/American_ABC_Photos/sign_language_photo_B.png', 'http://thumbs.dreamstime.com/z/letter-b-sign-language-587210.jpg', 'http://images2.pics4learning.com/catalog/b/b.jpg', 'http://www.lifeprint.com/asl101/signjpegs/b/b1.jpg', 'http://i.imgur.com/pU4pXE8.jpg', 'http://imgur.com/qbbPAW6.jpg', 'http://imgur.com/XBQ9nXx.jpg', 'http://imgur.com/lqvt8f0.jpg', 'http://i.imgur.com/Dw6FEFS.jpg', 'http://i.imgur.com/F9s68Ks.jpg', 'http://i.imgur.com/AwhYJjn.jpg', 'http://i.imgur.com/cmkzC7d.jpg', 'http://i.imgur.com/tiey392.jpg'], 'letter_c': ['http://images2.pics4learning.com/catalog/c/c.jpg', 'http://www.wpclipart.com/sign_language/American_ABC_Photos/sign_language_photo_C.png', 'http://i233.photobucket.com/albums/ee159/lintpicker/30801_9184.jpg', 'http://imgur.com/d3YIDeM.jpg', 'http://www.lifeprint.com/asl101/signjpegs/c/c.jpg', 'http://imgur.com/ZKY6quh.jpg', 'http://imgur.com/5oaD2DA.jpg', 'http://i.imgur.com/Iin7dhC.jpg', 'http://i.imgur.com/4yHKhIg.jpg', 'http://i.imgur.com/98WqyNm.jpg', 'http://i.imgur.com/5vMj1xa.jpg'], 'letter_d': ['http://www.lifeprint.com/asl101/signjpegs/d/d.jpg', 'http://images2.pics4learning.com/catalog/d/thumbs/d_thumb.jpg', 'http://users.manchester.edu/Student/SMCarmichael/MyWebpage/MPj03857270000[1]1.jpg', 'http://imgur.com/N8WTUo8.jpg', 'http://imgur.com/U1DTGet.jpg', 'http://i.imgur.com/P6tw9wt.jpg', 'http://i.imgur.com/Ci4c5Dz.jpg', 'http://i.imgur.com/Hbpg93V.jpg'], 'letter_e': ['http://www.lifeprint.com/asl101/signjpegs/e/e.jpg', 'http://images2.pics4learning.com/catalog/e/thumbs/e_thumb.jpg', 'http://www.wtsd.tn.org/kylah_webpage/MPj03857280000%5B1%5D.jpg', 'http://imgur.com/xtKJdhs.jpg', 'http://imgur.com/I8SsKfZ.jpg', 'http://i.imgur.com/vlTE1A2.jpg', 'http://i.imgur.com/vQwuSpI.jpg', 'http://i.imgur.com/bmHkR4g.jpg', 'http://i.imgur.com/N1RjYaJ.jpg', 'http://i.imgur.com/UhYgnPZ.jpg'], 'letter_f': ['http://www.lifeprint.com/asl101/signjpegs/f/f.jpg', 'https://www.signingsavvy.com/images/words/alphabet/2/f1.jpg', 'http://images2.pics4learning.com/catalog/f/thumbs/f_thumb.jpg', 'http://imgur.com/18mJQcx.jpg', 'http://i.imgur.com/G6C4q8D.jpg', 'http://i.imgur.com/dA5SGV9.jpg', 'http://i.imgur.com/g5xoIpn.jpg', 'http://i.imgur.com/kkFqone.jpg', 'http://i.imgur.com/tu93sTL.jpg', 'http://i.imgur.com/tu93sTL.jpg'], 'letter_g': ['http://www.lifeprint.com/asl101/signjpegs/g/g1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/g/g2.jpg', 'http://images2.pics4learning.com/catalog/g/thumbs/g_thumb.jpg', 'http://imgur.com/wog08bz.jpg', 'http://i.imgur.com/xsPrfCk.jpg', 'http://i.imgur.com/RQJEDNa.jpg', 'http://i.imgur.com/9NfbVpb.jpg', 'http://i.imgur.com/5fofc5J.jpg', 'http://i.imgur.com/VB1Zb3l.jpg'], 'letter_h': ['http://www.lifeprint.com/asl101/signjpegs/h/h1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/h/h2.jpg', 'http://www.lifeprint.com/asl101/signjpegs/h/h3.jpg', 'http://images2.pics4learning.com/catalog/h/h.jpg', 'http://imgur.com/CWStAMd.jpg', 'http://imgur.com/LCOuoqr.jpg', 'http://i.imgur.com/O28D9QU.jpg', 'http://i.imgur.com/5M3X0RP.jpg', 'http://i.imgur.com/cWbi2Ul.jpg', 'http://i.imgur.com/719dcYC.jpg', 'http://i.imgur.com/BsqRJGS.jpg'], 'letter_i': ['http://www.lifeprint.com/asl101/signjpegs/j/i1.jpg', 'http://images2.pics4learning.com/catalog/i/i.jpg', 'http://imgur.com/TbSpe7K.jpg', 'http://i.imgur.com/jeDqEJd.jpg', 'http://i.imgur.com/yRydMLJ.jpg', 'http://i.imgur.com/RlBX7Cw.jpg', 'http://i.imgur.com/lTM5vRg.jpg', 'http://i.imgur.com/Nc3DR34.jpg', 'http://i.imgur.com/s7DeARK.jpg', 'http://i.imgur.com/U4Xf04c.jpg', 'http://i.imgur.com/AWFRgh1.jpg'], 'letter_k': ['http://www.lifeprint.com/asl101/signjpegs/k/k.jpg', 'http://www.lifeprint.com/asl101/signjpegs/k/k1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/k/k2.jpg', 'http://images2.pics4learning.com/catalog/k/k.jpg', 'http://imgur.com/oth4JHl.jpg', 'http://imgur.com/RX9GheD.jpg'], 'letter_l': ['http://www.lifeprint.com/asl101/signjpegs/l/l.jpg', 'http://images2.pics4learning.com/catalog/l/l.jpg', 'http://imgur.com/3Wrr83R.jpg', 'http://i.imgur.com/Kk00yJi.jpg', 'http://i.imgur.com/Y3PfW5E.jpghttp://i.imgur.com/c4VbfM7.jpg', 'http://i.imgur.com/VgEXOrD.jpg', 'http://i.imgur.com/QK3otVV.jpg', 'http://i.imgur.com/tqy78Tw.jpg', 'http://i.imgur.com/HFcYyWC.jpg', 'http://vignette1.wikia.nocookie.net/glee/images/5/53/L_to_Loser.jpg/revision/latest?cb=20100919121543', 'http://i.imgur.com/Sy3MQh5.jpg'], 'letter_m': ['http://www.lifeprint.com/asl101/signjpegs/m/m1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/m/m2.jpg', 'http://images2.pics4learning.com/catalog/m/m.jpg', 'http://i.imgur.com/wJ14Xsp.jpg', 'http://i.imgur.com/cH4Ctwz.jpg', 'http://i.imgur.com/eLcC1Hy.jpg', 'http://i.imgur.com/BH3bj3e.jpg', 'http://i.imgur.com/sf3ylPt.jpg', 'http://i.imgur.com/A6CEht0.jpg'], 'letter_n': ['http://www.lifeprint.com/asl101/signjpegs/n/n1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/n/n2.jpg', 'http://images2.pics4learning.com/catalog/n/n.jpg', 'http://i.imgur.com/pqa8Zyw.jpg', 'http://i.imgur.com/JY0JKp4.jpg', 'http://i.imgur.com/CaOevfe.jpg', 'http://i.imgur.com/zAMaTo6.jpg', 'http://i.imgur.com/phLgLZx.jpg', 'http://i.imgur.com/8YXDFcx.jpg', 'http://i.imgur.com/LB8gklq.jpg'], 'letter_o': ['http://www.lifeprint.com/asl101/signjpegs/o/o1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/o/o2.jpg', 'http://www.lifeprint.com/asl101/signjpegs/o/o3.jpg', 'http://images2.pics4learning.com/catalog/o/o.jpg', 'http://imgur.com/85LJSka.jpg', 'http://i.imgur.com/y6ArfBV.jpg', 'http://i.imgur.com/1SED8NN.jpg', 'http://i.imgur.com/do3X45q.jpg', 'http://i.imgur.com/kNEYY1M.jpg', 'http://i.imgur.com/7GGzriv.jpg', 'http://i.imgur.com/8IrR5L9.jpg', 'http://i.imgur.com/CJ4tKYs.jpg'], 'letter_p': ['http://www.lifeprint.com/asl101/signjpegs/p/p1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/p/p2.jpg', 'http://www.lifeprint.com/asl101/signjpegs/p/p3.jpg', 'http://images2.pics4learning.com/catalog/p/p.jpg', 'http://i.imgur.com/tkDcZMe.jpg', 'http://i.imgur.com/egNs3cW.jpg', 'http://i.imgur.com/pJ4o3yH.jpg', 'http://i.imgur.com/y3KfSeG.jpg', 'http://i.imgur.com/krug936.jpg', 'http://i.imgur.com/jo63UDp.jpg', 'http://i.imgur.com/ZyiAxwd.jpg'], 'letter_q': ['http://www.lifeprint.com/asl101/signjpegs/q/q1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/q/q2.jpg', 'http://images2.pics4learning.com/catalog/q/q.jpg', 'http://imgur.com/jidKKYK.jpg', 'http://i.imgur.com/3eG0iPQ.jpg', 'http://i.imgur.com/RJlOzHO.jpg', 'http://i.imgur.com/kT5qkFL.jpg', 'http://i.imgur.com/La5ytRV.jpg', 'http://i.imgur.com/vM81Zk2.jpg', 'http://i.imgur.com/eKGg70h.jpg', 'http://i.imgur.com/FLEGaaq.jpg', 'http://i.imgur.com/ZV7qQHK.jpg', 'http://i.imgur.com/W6gWT8a.jpg'], 'letter_r': ['http://www.lifeprint.com/asl101/signjpegs/r/r.jpg', 'http://images2.pics4learning.com/catalog/r/thumbs/r_thumb.jpg', 'http://i.imgur.com/9wwRZDc.jpg', 'http://i.imgur.com/xfGtPRf.jpg', 'http://i.imgur.com/uDojFj2.jpg', 'http://i.imgur.com/T7kJULr.jpg', 'http://i.imgur.com/MIZWPZI.jpg', 'http://i.imgur.com/F4MkT8m.jpg', 'http://i.imgur.com/N6Gx7vl.jpg'], 'letter_s': ['http://www.lifeprint.com/asl101/signjpegs/s/s.jpg', 'http://images2.pics4learning.com/catalog/s/thumbs/s_thumb.jpg', 'http://i.imgur.com/rmf5jgR.jpg', 'http://i.imgur.com/P3Zq5Dd.jpg', 'http://i.imgur.com/xClBmxV.jpg', 'http://i.imgur.com/hQjYMPn.jpg', 'http://i.imgur.com/2mX9w8T.jpg', 'http://i.imgur.com/Fa70wX8.jpg'], 'letter_t': ['http://www.lifeprint.com/asl101/signjpegs/t/t.jpg', 'http://images2.pics4learning.com/catalog/t/thumbs/t_thumb.jpg', 'http://imgur.com/cirlKJB.jpg', 'http://i.imgur.com/nnDEPLf.jpg', 'http://i.imgur.com/HLxur9q.jpg', 'http://i.imgur.com/bljZk3l.jpg', 'http://i.imgur.com/9GUDD82.jpg', 'http://i.imgur.com/KLL2zzt.jpg', 'http://i.imgur.com/vSvZ15A.jpg', 'http://i.imgur.com/jmKPaJz.jpg'], 'letter_u': ['http://www.lifeprint.com/asl101/signjpegs/u/u.jpg', 'http://images2.pics4learning.com/catalog/u/thumbs/u_thumb.jpg', 'http://imgur.com/wgP9cZw.jpg', 'http://i.imgur.com/u9YwhBP.jpg', 'http://i.imgur.com/zUyMaWD.jpg', 'http://i.imgur.com/39rVd1f.jpg', 'http://i.imgur.com/W1SiHte.jpg', 'http://i.imgur.com/zqJ7ziC.jpg', 'http://i.imgur.com/FT9gSS2.jpg', 'http://i.imgur.com/oXrvDE5.jpg', 'http://i.imgur.com/5WOntzk.jpg'], 'letter_v': ['http://www.lifeprint.com/asl101/signjpegs/v/v.jpg', 'http://images2.pics4learning.com/catalog/v/thumbs/v_thumb.jpg', 'http://imgur.com/nXyOWzj.jpg', 'http://i.imgur.com/69NrFjG.jpg', 'http://i.imgur.com/GPyiPNv.jpg', 'http://i.imgur.com/OkHpWff.jpg', 'http://i.imgur.com/NX2G7JW.jpg', 'http://i.imgur.com/Su0ByBz.jpg', 'http://i.imgur.com/rnO7sVH.jpg', 'http://i.imgur.com/YAtArlj.jpg', 'http://i.imgur.com/xDwSHGg.jpg', 'http://i.imgur.com/skhHAqq.jpg'], 'letter_w': ['http://www.lifeprint.com/asl101/signjpegs/w/w.jpg', 'http://images2.pics4learning.com/catalog/w/thumbs/w_thumb.jpg', 'http://i.imgur.com/ep9SPS6.jpg', 'http://i.imgur.com/kyhQ5D4.jpg', 'http://i.imgur.com/mHGWgy4.jpg', 'http://i.imgur.com/BQVK36B.jpg', 'http://i.imgur.com/2lPUvlM.jpg', 'http://i.imgur.com/Zs5QqU8.jpg', 'http://i.imgur.com/WfTMaDV.jpg', 'http://i.imgur.com/5pMmYeR.jpg'], 'letter_x': ['http://www.lifeprint.com/asl101/signjpegs/x/x1.jpg', 'http://www.lifeprint.com/asl101/signjpegs/x/x2.jpg', 'http://images2.pics4learning.com/catalog/x/thumbs/x_thumb.jpg', 'http://i.imgur.com/BzGhtvx.jpg', 'http://i.imgur.com/M8oXvMg.jpg', 'http://i.imgur.com/EAGSTO5.jpg', 'http://i.imgur.com/jANf5IK.jpg', 'http://i.imgur.com/BfsrKmH.jpg', 'http://i.imgur.com/KjPCC57.jpg'], 'letter_y': ['http://www.lifeprint.com/asl101/signjpegs/y/y.jpg', 'http://images2.pics4learning.com/catalog/y/thumbs/y_thumb.jpg', 'http://i.imgur.com/lFCvuYs.jpg', 'http://i.imgur.com/cqsOgCx.jpg', 'http://i.imgur.com/BagarbG.jpg', 'http://i.imgur.com/LVhlWhQ.jpg', 'http://i.imgur.com/uKSmVuv.jpg', 'http://i.imgur.com/QYrdAW3.jpg', 'http://i.imgur.com/5RrMIez.jpg', 'http://i.imgur.com/6nhuW9v.jpg', 'http://i.imgur.com/h1AumoX.jpg', 'http://i.imgur.com/v74QoHw.jpg'], 'applause': ['http://www.churchleaders.com/wp-content/uploads/files/article_images/clap_or_not_937398406.jpg', 'http://i.imgur.com/GxvFP6h.jpg', 'http://i.imgur.com/LgXOHBL.jpg', 'http://i.imgur.com/JKmWCEn.jpg', 'http://i.imgur.com/iJkf0st.jpg', 'http://i.imgur.com/Dx1EULd.jpg', 'https://image.freepik.com/free-photo/cook--cosmetics--clapping--hand_3256176.jpg']}
#!/usr/bin/python3 '''Day 5 of the 2017 advent of code''' def process_commands(cmds, program_counter): """helper for part 2""" jmp_offset = cmds[program_counter] if jmp_offset > 2: cmds[program_counter] -= 1 else: cmds[program_counter] += 1 return jmp_offset + program_counter def part_one(rows): """Return the answer to part one of this day""" cmds = [int(cmd) for cmd in rows] count = 0 prg_counter = 0 while True: try: offset = cmds[prg_counter] cmds[prg_counter] += 1 prg_counter = prg_counter + offset count += 1 except IndexError: break return count def part_two(rows): """Return the answer to part two of this day""" cmds = [int(cmd) for cmd in rows] count = 0 next_counter = 0 while True: try: next_counter = process_commands(cmds, next_counter) count += 1 except IndexError: break return count if __name__ == "__main__": with open('input', 'r') as file: ROWS = file.readlines() print("Part 1: {}".format(part_one(ROWS))) print("Part 2: {}".format(part_two(ROWS)))
"""Day 5 of the 2017 advent of code""" def process_commands(cmds, program_counter): """helper for part 2""" jmp_offset = cmds[program_counter] if jmp_offset > 2: cmds[program_counter] -= 1 else: cmds[program_counter] += 1 return jmp_offset + program_counter def part_one(rows): """Return the answer to part one of this day""" cmds = [int(cmd) for cmd in rows] count = 0 prg_counter = 0 while True: try: offset = cmds[prg_counter] cmds[prg_counter] += 1 prg_counter = prg_counter + offset count += 1 except IndexError: break return count def part_two(rows): """Return the answer to part two of this day""" cmds = [int(cmd) for cmd in rows] count = 0 next_counter = 0 while True: try: next_counter = process_commands(cmds, next_counter) count += 1 except IndexError: break return count if __name__ == '__main__': with open('input', 'r') as file: rows = file.readlines() print('Part 1: {}'.format(part_one(ROWS))) print('Part 2: {}'.format(part_two(ROWS)))
def get_access_by_username (cursor, username) : try : sql_statement = 'SELECT username,password,active FROM access WHERE username = %s' cursor.execute(sql_statement,(username,)) data = cursor.fetchone() except Exception as ex: print('[ERROR] get_access_by_username : ' + ex.__str__()) return None if data is None : return None return { 'username': data[0], 'password': data[1], 'active': data[2] }
def get_access_by_username(cursor, username): try: sql_statement = 'SELECT username,password,active FROM access WHERE username = %s' cursor.execute(sql_statement, (username,)) data = cursor.fetchone() except Exception as ex: print('[ERROR] get_access_by_username : ' + ex.__str__()) return None if data is None: return None return {'username': data[0], 'password': data[1], 'active': data[2]}
""" cmd.do('create ${1:t4l}, ${2:1lw9};') """ cmd.do('create t4l, 1lw9;') # Description: Duplicate object. # Source: placeHolder
""" cmd.do('create ${1:t4l}, ${2:1lw9};') """ cmd.do('create t4l, 1lw9;')
def misspelled(words): misspelled_words = [] for keys, values in words.items(): if ''.join(values) != keys: misspelled_words.append(keys) return misspelled_words
def misspelled(words): misspelled_words = [] for (keys, values) in words.items(): if ''.join(values) != keys: misspelled_words.append(keys) return misspelled_words
#!/usr/bin/python class VideoData(object): percent_confidence_limit = 25 def __init__(self): # Standard Data self._video_id = None self._title = None self._description = None self._published = None # Metrics self._date_start = None self._date_end = None self._views = None self._monetizedPlaybacks = None self._estimatedRevenue = None self._estimatedMinutesWatched = None self._percent = None self._percent_confidence = None @property def id(self): return self._video_id @id.setter def id(self, value): self._video_id = value @property def title(self): return self._title @title.setter def title(self, value): self._title = value @property def description(self): return self._description @description.setter def description(self, value): self._descrioption = value @property def published(self): return self._published @published.setter def published(self, value): self._published = value @property def date_start(self): return self._date_start @date_start.setter def date_start(self, value): self._date_start = value @property def date_end(self): return self._date_end @date_end.setter def date_end(self, value): self._date_end = value @property def views(self): return self._views @views.setter def views(self, value): self._views = value @property def monetizedPlaybacks(self): return self._monetizedPlaybacks @monetizedPlaybacks.setter def monetizedPlaybacks(self, value): self._monetizedPlaybacks = value @property def estimatedRevenue(self): return self._estimatedRevenue @estimatedRevenue.setter def estimatedRevenue(self, value): self._estimatedRevenue = value @property def estimatedMinutesWatched(self): return self._estimatedMinutesWatched @estimatedMinutesWatched.setter def estimatedMinutesWatched(self, value): self._estimatedMinutesWatched = value @property def percent(self): if self._percent is None and self.views > 0: self._percent = self._monetizedPlaybacks / self._views self._percent_confidence = self._views / \ self.percent_confidence_limit else: self._percent = 0 self._percent_confidence = 0 return self._percent @percent.setter def percent(self, value): return self._percent @property def percent_confidence(self): return self._percent_confidence
class Videodata(object): percent_confidence_limit = 25 def __init__(self): self._video_id = None self._title = None self._description = None self._published = None self._date_start = None self._date_end = None self._views = None self._monetizedPlaybacks = None self._estimatedRevenue = None self._estimatedMinutesWatched = None self._percent = None self._percent_confidence = None @property def id(self): return self._video_id @id.setter def id(self, value): self._video_id = value @property def title(self): return self._title @title.setter def title(self, value): self._title = value @property def description(self): return self._description @description.setter def description(self, value): self._descrioption = value @property def published(self): return self._published @published.setter def published(self, value): self._published = value @property def date_start(self): return self._date_start @date_start.setter def date_start(self, value): self._date_start = value @property def date_end(self): return self._date_end @date_end.setter def date_end(self, value): self._date_end = value @property def views(self): return self._views @views.setter def views(self, value): self._views = value @property def monetized_playbacks(self): return self._monetizedPlaybacks @monetizedPlaybacks.setter def monetized_playbacks(self, value): self._monetizedPlaybacks = value @property def estimated_revenue(self): return self._estimatedRevenue @estimatedRevenue.setter def estimated_revenue(self, value): self._estimatedRevenue = value @property def estimated_minutes_watched(self): return self._estimatedMinutesWatched @estimatedMinutesWatched.setter def estimated_minutes_watched(self, value): self._estimatedMinutesWatched = value @property def percent(self): if self._percent is None and self.views > 0: self._percent = self._monetizedPlaybacks / self._views self._percent_confidence = self._views / self.percent_confidence_limit else: self._percent = 0 self._percent_confidence = 0 return self._percent @percent.setter def percent(self, value): return self._percent @property def percent_confidence(self): return self._percent_confidence
''' Description: exercise: your age Version: 1.0.0.20210113 Author: Arvin Zhao Date: 2021-01-13 09:44:34 Last Editors: Arvin Zhao LastEditTime: 2021-01-13 10:27:55 ''' def check_age(age: int) -> None: ''' Check an age and print what he/she can do regarding the age. Parameters ---------- age : his/her age for checking what he/she can do ''' if age >= 18: print('You can vote.') elif age == 17: print('You can learn how to drive.') elif age == 16: print('You can buy a lottery ticket.') else: print('You can go Trick-or-Treating.') if __name__ == '__main__': while True: age = input('Enter your age: ') if age.isdigit(): check_age(int(age)) break else: print('Error! Invalid input!')
""" Description: exercise: your age Version: 1.0.0.20210113 Author: Arvin Zhao Date: 2021-01-13 09:44:34 Last Editors: Arvin Zhao LastEditTime: 2021-01-13 10:27:55 """ def check_age(age: int) -> None: """ Check an age and print what he/she can do regarding the age. Parameters ---------- age : his/her age for checking what he/she can do """ if age >= 18: print('You can vote.') elif age == 17: print('You can learn how to drive.') elif age == 16: print('You can buy a lottery ticket.') else: print('You can go Trick-or-Treating.') if __name__ == '__main__': while True: age = input('Enter your age: ') if age.isdigit(): check_age(int(age)) break else: print('Error! Invalid input!')
"""Top-level package for pycoview.""" __author__ = """John Gilling""" __email__ = 'suddensleep@gmail.com' __version__ = '0.1.0'
"""Top-level package for pycoview.""" __author__ = 'John Gilling' __email__ = 'suddensleep@gmail.com' __version__ = '0.1.0'
#!/usr/bin/env python3 DOCTL = "/usr/local/bin/doctl" PK_FILE = "/home/ndjuric/.ssh/id_rsa.pub" SWARM_DIR = TAG = "swarm" OVERLAY_NETWORK = "swarmnet" DOCKER_REGISTRY = { 'master': 'private.docker.registry.example.com:5000/master', 'worker': 'private.docker.registry.example.com:5000/worker' } NFS_SERVER = '10.135.69.119' ''' CALL_MAP is a list enumerating methods from the Cloud class the are allowed to be directly executed. ''' CALL_MAP = [ 'build', 'deploy', 'destroy', 'add_worker', 'add_manager', 'ssh_manager', 'logs_master', 'remove_worker', 'remove_manager', 'get_master_container_id' ] SCRIPT_CREATE = "#!/bin/bash\n" SCRIPT_CREATE += "apt-get install -y nfs-common\n" SCRIPT_CREATE += "mkdir /nfs\n" SCRIPT_CREATE += "mount {0}:/nfs /nfs\n".format(NFS_SERVER) SCRIPT_CREATE += "ufw allow 2377/tcp\n" SCRIPT_CREATE += "export " SCRIPT_CREATE += "PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address)\n" SCRIPT_CREATE += "docker swarm init --advertise-addr \"${PUBLIC_IPV4}:2377\"\n" SCRIPT_CREATE += "docker network create --driver overlay {0}\n".format(OVERLAY_NETWORK) SCRIPT_CREATE += "docker service create " SCRIPT_CREATE += "--network swarmnet " SCRIPT_CREATE += "--name master " SCRIPT_CREATE += "--mount type=bind,source=/nfs,target=/nfs {0} \n".format(DOCKER_REGISTRY['master']) SCRIPT_CREATE += "docker service create --network swarmnet --name worker {0}\n".format(DOCKER_REGISTRY['worker']) SCRIPT_CREATE += "docker service scale worker=5\n" SCRIPT_JOIN = "#!/bin/bash\n" SCRIPT_JOIN += "apt-get install -y nfs-common\n" SCRIPT_JOIN += "mkdir /nfs\n" SCRIPT_JOIN += "mount {0}:/nfs /nfs\n".format(NFS_SERVER) SCRIPT_JOIN += "ufw allow 2377/tcp\n" SCRIPT_JOIN += "export " SCRIPT_JOIN += "PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address)\n" SCRIPT_JOIN += "docker swarm join --advertise-addr \"${{PUBLIC_IPV4}}:2377\" --token \"{0}\" \"{1}:2377\"\n"
doctl = '/usr/local/bin/doctl' pk_file = '/home/ndjuric/.ssh/id_rsa.pub' swarm_dir = tag = 'swarm' overlay_network = 'swarmnet' docker_registry = {'master': 'private.docker.registry.example.com:5000/master', 'worker': 'private.docker.registry.example.com:5000/worker'} nfs_server = '10.135.69.119' ' CALL_MAP is a list enumerating methods from the Cloud class the are allowed to be directly executed. ' call_map = ['build', 'deploy', 'destroy', 'add_worker', 'add_manager', 'ssh_manager', 'logs_master', 'remove_worker', 'remove_manager', 'get_master_container_id'] script_create = '#!/bin/bash\n' script_create += 'apt-get install -y nfs-common\n' script_create += 'mkdir /nfs\n' script_create += 'mount {0}:/nfs /nfs\n'.format(NFS_SERVER) script_create += 'ufw allow 2377/tcp\n' script_create += 'export ' script_create += 'PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address)\n' script_create += 'docker swarm init --advertise-addr "${PUBLIC_IPV4}:2377"\n' script_create += 'docker network create --driver overlay {0}\n'.format(OVERLAY_NETWORK) script_create += 'docker service create ' script_create += '--network swarmnet ' script_create += '--name master ' script_create += '--mount type=bind,source=/nfs,target=/nfs {0} \n'.format(DOCKER_REGISTRY['master']) script_create += 'docker service create --network swarmnet --name worker {0}\n'.format(DOCKER_REGISTRY['worker']) script_create += 'docker service scale worker=5\n' script_join = '#!/bin/bash\n' script_join += 'apt-get install -y nfs-common\n' script_join += 'mkdir /nfs\n' script_join += 'mount {0}:/nfs /nfs\n'.format(NFS_SERVER) script_join += 'ufw allow 2377/tcp\n' script_join += 'export ' script_join += 'PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address)\n' script_join += 'docker swarm join --advertise-addr "${{PUBLIC_IPV4}}:2377" --token "{0}" "{1}:2377"\n'
# Filename: BotGlobals.py # Author: mfwass # Date: January 8th, 2017 # # The Legend of Pirates Online Software # Copyright (c) The Legend of Pirates Online. All rights reserved. # # All use of this software is subject to the terms of the revised BSD # license. You should have received a copy of this license along # with this source code in a file named "LICENSE." """ The BotGlobals class will serve as a central location of all global values in the TLOPO Discord Bot project. """ APP_DESCRIPTION_UPSTREAM = "Discord bot by TLOPO. <3 https://github.com/TheLegendofPiratesOnline/discord-bot" APP_DESCRIPTION_FORK = "Dynasty of Persia fork. https://github.com/jamebus/discord-bot" APP_DESCRIPTION = "%s\n%s" % (APP_DESCRIPTION_UPSTREAM, APP_DESCRIPTION_FORK) LOCAL_SETTINGS_FILENAME = 'local_settings.json' SETTINGS_FILENAME = 'settings.json' # API Docs: https://tlopo.com/docs/ API_URLS = { 'news_feed':'https://api.tlopo.com/news/feed/', 'news_notification':'https://api.tlopo.com/news/notification', 'shards':'https://api.tlopo.com/shards', 'system_status':'https://api.tlopo.com/system/status' } BOT_TASKS = { 'task_shards': { 'time': 25.0, 'api_url': API_URLS.get('shards') }, 'task_system_status': { 'time': 25.0, 'api_url': API_URLS.get('system_status') }, 'task_news_feed': { 'time': 25.0, 'api_url': API_URLS.get('news_feed') }, 'task_news_notification': { 'time': 25.0, 'api_url': API_URLS.get('news_notification') } } BASE_CHANNEL_TO_NAME = { '401000000': 'Abassa', '402000000': 'Andaba', '403000000': 'Bequermo', '404000000': 'Cortos', '405000000': 'Exuma', '406000000': 'Fragilles', '407000000': 'Juntos', '408000000': 'Kokojillo', '409000000': 'Levanta', '410000000': 'Nocivo', '411000000': 'Sabada', '412000000': 'Valor' } STATUS_ALIVE_SRV = 1 STATUS_MESSAGE_SRV = 2 STATUS_UPDATE_SRV = 4 STATUS_ERROR_SRV = 8 STATUS_FATAL_SRV = 16 STATUS_UNKNOWN_SRV = 32 SRV_CODE_TO_STATUS = { STATUS_ALIVE_SRV: "STATUS_ALIVE", STATUS_MESSAGE_SRV: "STATUS_MESSAGE", STATUS_UPDATE_SRV: "STATUS_UPDATE", STATUS_ERROR_SRV: "STATUS_ERROR", STATUS_FATAL_SRV: "STATUS_FATAL", STATUS_UNKNOWN_SRV: "STATUS_UNKNOWN" } STATUS_ALIVE_GLOB = 1 STATUS_MESSAGE_GLOB = 2 STATUS_UPDATE_GLOB = 3 STATUS_ERROR_GLOB = 4 STATUS_FATAL_GLOB = 5 STATUS_UNKNOWN_GLOB = 6 GLOB_CODE_TO_STATUS = { STATUS_ALIVE_GLOB: "STATUS_ALIVE", STATUS_MESSAGE_GLOB: "STATUS_MESSAGE", STATUS_UPDATE_GLOB: "STATUS_UPDATE", STATUS_ERROR_GLOB: "STATUS_ERROR", STATUS_FATAL_GLOB: "STATUS_FATAL", STATUS_UNKNOWN_GLOB: "STATUS_UNKNOWN" }
""" The BotGlobals class will serve as a central location of all global values in the TLOPO Discord Bot project. """ app_description_upstream = 'Discord bot by TLOPO. <3 https://github.com/TheLegendofPiratesOnline/discord-bot' app_description_fork = 'Dynasty of Persia fork. https://github.com/jamebus/discord-bot' app_description = '%s\n%s' % (APP_DESCRIPTION_UPSTREAM, APP_DESCRIPTION_FORK) local_settings_filename = 'local_settings.json' settings_filename = 'settings.json' api_urls = {'news_feed': 'https://api.tlopo.com/news/feed/', 'news_notification': 'https://api.tlopo.com/news/notification', 'shards': 'https://api.tlopo.com/shards', 'system_status': 'https://api.tlopo.com/system/status'} bot_tasks = {'task_shards': {'time': 25.0, 'api_url': API_URLS.get('shards')}, 'task_system_status': {'time': 25.0, 'api_url': API_URLS.get('system_status')}, 'task_news_feed': {'time': 25.0, 'api_url': API_URLS.get('news_feed')}, 'task_news_notification': {'time': 25.0, 'api_url': API_URLS.get('news_notification')}} base_channel_to_name = {'401000000': 'Abassa', '402000000': 'Andaba', '403000000': 'Bequermo', '404000000': 'Cortos', '405000000': 'Exuma', '406000000': 'Fragilles', '407000000': 'Juntos', '408000000': 'Kokojillo', '409000000': 'Levanta', '410000000': 'Nocivo', '411000000': 'Sabada', '412000000': 'Valor'} status_alive_srv = 1 status_message_srv = 2 status_update_srv = 4 status_error_srv = 8 status_fatal_srv = 16 status_unknown_srv = 32 srv_code_to_status = {STATUS_ALIVE_SRV: 'STATUS_ALIVE', STATUS_MESSAGE_SRV: 'STATUS_MESSAGE', STATUS_UPDATE_SRV: 'STATUS_UPDATE', STATUS_ERROR_SRV: 'STATUS_ERROR', STATUS_FATAL_SRV: 'STATUS_FATAL', STATUS_UNKNOWN_SRV: 'STATUS_UNKNOWN'} status_alive_glob = 1 status_message_glob = 2 status_update_glob = 3 status_error_glob = 4 status_fatal_glob = 5 status_unknown_glob = 6 glob_code_to_status = {STATUS_ALIVE_GLOB: 'STATUS_ALIVE', STATUS_MESSAGE_GLOB: 'STATUS_MESSAGE', STATUS_UPDATE_GLOB: 'STATUS_UPDATE', STATUS_ERROR_GLOB: 'STATUS_ERROR', STATUS_FATAL_GLOB: 'STATUS_FATAL', STATUS_UNKNOWN_GLOB: 'STATUS_UNKNOWN'}
x = int(input('Enter a number: ')) index = 0 for i in range(1, int(x/2) +1): if x % i == 0: print(i) index += 1 print(x) print(f'There were {index + 1} divisors')
x = int(input('Enter a number: ')) index = 0 for i in range(1, int(x / 2) + 1): if x % i == 0: print(i) index += 1 print(x) print(f'There were {index + 1} divisors')
# CALCULATING THE WORK ON AN OBJECT, GIVEN THE FORCE AND DISPLACEMENT OF THE OBJECT. # creating a function to calculate the work. def calc_work (force, displacement): # arithmetic calculation to determine the work on an object. work = force * displacement work = round(work, 2) # returning the value of work to print as output. return work # code to receive input regarding the values for force and displacement. force = int(input("Enter the amount of force in Newtons please:")) displacement = int(input("Enter the amount of displacement in meters please:")) # code to print the final output which indicates the work on the object in joules. print("The work on the object is:", calc_work(force, displacement),"J")
def calc_work(force, displacement): work = force * displacement work = round(work, 2) return work force = int(input('Enter the amount of force in Newtons please:')) displacement = int(input('Enter the amount of displacement in meters please:')) print('The work on the object is:', calc_work(force, displacement), 'J')
class DiseaseError(Exception): "Base class for disease module exceptions." pass class ParserError(DiseaseError): pass
class Diseaseerror(Exception): """Base class for disease module exceptions.""" pass class Parsererror(DiseaseError): pass
""" Stored values specific to a single test execution. """ test_file = None browser = None browser_definition = None browsers = {} data = None secrets = None description = None settings = None test_dirname = None test_path = None project_name = None project_path = None testdir = None execution_reportdir = None testfile_reportdir = None logger = None tags = [] environment = None # values below correspond to the current running test function test_name = None steps = [] errors = [] test_reportdir = None timers = {}
""" Stored values specific to a single test execution. """ test_file = None browser = None browser_definition = None browsers = {} data = None secrets = None description = None settings = None test_dirname = None test_path = None project_name = None project_path = None testdir = None execution_reportdir = None testfile_reportdir = None logger = None tags = [] environment = None test_name = None steps = [] errors = [] test_reportdir = None timers = {}
class SaveCurrentUser(): def save_model(self, request, obj, form, change): obj.current_user = request.user super().save_model(request, obj, form, change) class SaveCurrentUserAdmin(): def save_model(self, request, obj, form, change): obj.current_user = request.user super().save_model(request, obj, form, change) readonly_fields = [ 'creator', 'created', 'modifier', 'modified' ]
class Savecurrentuser: def save_model(self, request, obj, form, change): obj.current_user = request.user super().save_model(request, obj, form, change) class Savecurrentuseradmin: def save_model(self, request, obj, form, change): obj.current_user = request.user super().save_model(request, obj, form, change) readonly_fields = ['creator', 'created', 'modifier', 'modified']
# CSV related ROW_MOST_RECENT_DAY = 1 # First row with data (i.e row 2) ROW_FIRST_COMPLETE_DAY = 3 # First row with valid data for the 7-day total (i.e row 4) COL_AREA_CODE = 0 COL_AREA_NAME = 1 COL_AREA_TYPE = 2 COL_DATE = 3 COL_TOTAL_DEATHS = 4 COL_HOSPITAL_CASES = 5 COL_NEW_CASES = 6
row_most_recent_day = 1 row_first_complete_day = 3 col_area_code = 0 col_area_name = 1 col_area_type = 2 col_date = 3 col_total_deaths = 4 col_hospital_cases = 5 col_new_cases = 6
# Time: O(n) # Space: O(h) class Solution(object): def widthOfBinaryTree(self, root): """ :type root: TreeNode :rtype: int """ def dfs(node, i, depth, leftmosts): if not node: return 0 if depth >= len(leftmosts): leftmosts.append(i) return max(i-leftmosts[depth]+1, \ dfs(node.left, i*2, depth+1, leftmosts), \ dfs(node.right, i*2+1, depth+1, leftmosts)) leftmosts = [] return dfs(root, 1, 0, leftmosts)
class Solution(object): def width_of_binary_tree(self, root): """ :type root: TreeNode :rtype: int """ def dfs(node, i, depth, leftmosts): if not node: return 0 if depth >= len(leftmosts): leftmosts.append(i) return max(i - leftmosts[depth] + 1, dfs(node.left, i * 2, depth + 1, leftmosts), dfs(node.right, i * 2 + 1, depth + 1, leftmosts)) leftmosts = [] return dfs(root, 1, 0, leftmosts)
class House: """All houses have rooms, a type of roof, and may have a porch.""" def __init__(self): self.__rooms = list() self.__roof = None self.__porch = False def add_room(self, room): self.__rooms.append(room) def set_roof(self, roof): self.__roof = roof def set_porch(self, porch): self.__porch = porch def __str__(self): return 'rooms: ' + str(self.__rooms) + '\nroof: ' + self.__roof + '\nporch: ' + str(self.__porch)
class House: """All houses have rooms, a type of roof, and may have a porch.""" def __init__(self): self.__rooms = list() self.__roof = None self.__porch = False def add_room(self, room): self.__rooms.append(room) def set_roof(self, roof): self.__roof = roof def set_porch(self, porch): self.__porch = porch def __str__(self): return 'rooms: ' + str(self.__rooms) + '\nroof: ' + self.__roof + '\nporch: ' + str(self.__porch)
DEFAULT_AUTOPILOT_CONFIG = { 'region_name': 'YOUR_REGION', 's3_bucket': 'YOUR_S3_BUCKET', 'role_arn': 'YOUR_ROLE_ARN', }
default_autopilot_config = {'region_name': 'YOUR_REGION', 's3_bucket': 'YOUR_S3_BUCKET', 'role_arn': 'YOUR_ROLE_ARN'}
# t = int(input("T:")) list = [] for i in range(0,t): k = input("A B :") list.append(k) print(list) for z in range(0,len(list)): q = str(list[z]) m = q.split(" ") print(int(m[0])+int(m[1]))
t = int(input('T:')) list = [] for i in range(0, t): k = input('A B :') list.append(k) print(list) for z in range(0, len(list)): q = str(list[z]) m = q.split(' ') print(int(m[0]) + int(m[1]))
class BianPlugin(): def ready(self): return True def run(self,core,*params): if len(params) != 4: raise Exception("missing params:"+str(params)) init = "from halo_bian.bian.exceptions import BianException\n\nfrom halo_bian.bian.bian import ActionTerms\n\nfrom botocore.exceptions import ClientError\n\n" imports = params[0] if init not in imports: imports = imports + init base_lib= params[1] base_class_name= params[2] name= params[3] line3 = "" if name.endswith('Activation'): imports = imports + "from " + base_lib + " import " + 'Activation'+base_class_name + "\n\n" line3 = "class " + name + "Mixin(Activation" + base_class_name + "):" + \ "\n\tpass" elif name.endswith('Configuration'): imports = imports + "from " + base_lib + " import " + 'Configuration' + base_class_name + "\n\n" line3 = "class " + name + "Mixin(Configuration" + base_class_name + "):" + \ "\n\tpass" elif name.endswith('Feedback'): imports = imports + "from " + base_lib + " import " + 'Feedback' + base_class_name + "\n\n" line3 = "class " + name + "Mixin(Feedback" + base_class_name + "):" + \ "\n\tpass" elif name.endswith('Initiation'): line3 = "class " + name + "Mixin(" + base_class_name + "):" + \ "\n\tbian_action = ActionTerms.INITIATE" elif name.endswith('Update'): line3 = "class " + name + "Mixin(" + base_class_name + "):" + \ "\n\tbian_action = ActionTerms.UPDATE" elif name.endswith('Control'): line3 = "class " + name + "Mixin(" + base_class_name + "):" + \ "\n\tbian_action = ActionTerms.CONTROL" elif name.endswith('Exchange'): line3 = "class " + name + "Mixin(" + base_class_name + "):" + \ "\n\tbian_action = ActionTerms.EXCHANGE" elif name.endswith('Execution'): line3 = "class " + name + "Mixin(" + base_class_name + "):" + \ "\n\tbian_action = ActionTerms.EXECUTE" elif name.endswith('Requisition'): line3 = "class " + name + "Mixin(" + base_class_name + "):" + \ "\n\tbian_action = ActionTerms.REQUEST" else: line3 = "class " + name + "Mixin(" + base_class_name + "):" + \ "\n\tbian_action = ActionTerms.RETRIEVE" return {"mixin":{"imports":imports,"code":line3}}
class Bianplugin: def ready(self): return True def run(self, core, *params): if len(params) != 4: raise exception('missing params:' + str(params)) init = 'from halo_bian.bian.exceptions import BianException\n\nfrom halo_bian.bian.bian import ActionTerms\n\nfrom botocore.exceptions import ClientError\n\n' imports = params[0] if init not in imports: imports = imports + init base_lib = params[1] base_class_name = params[2] name = params[3] line3 = '' if name.endswith('Activation'): imports = imports + 'from ' + base_lib + ' import ' + 'Activation' + base_class_name + '\n\n' line3 = 'class ' + name + 'Mixin(Activation' + base_class_name + '):' + '\n\tpass' elif name.endswith('Configuration'): imports = imports + 'from ' + base_lib + ' import ' + 'Configuration' + base_class_name + '\n\n' line3 = 'class ' + name + 'Mixin(Configuration' + base_class_name + '):' + '\n\tpass' elif name.endswith('Feedback'): imports = imports + 'from ' + base_lib + ' import ' + 'Feedback' + base_class_name + '\n\n' line3 = 'class ' + name + 'Mixin(Feedback' + base_class_name + '):' + '\n\tpass' elif name.endswith('Initiation'): line3 = 'class ' + name + 'Mixin(' + base_class_name + '):' + '\n\tbian_action = ActionTerms.INITIATE' elif name.endswith('Update'): line3 = 'class ' + name + 'Mixin(' + base_class_name + '):' + '\n\tbian_action = ActionTerms.UPDATE' elif name.endswith('Control'): line3 = 'class ' + name + 'Mixin(' + base_class_name + '):' + '\n\tbian_action = ActionTerms.CONTROL' elif name.endswith('Exchange'): line3 = 'class ' + name + 'Mixin(' + base_class_name + '):' + '\n\tbian_action = ActionTerms.EXCHANGE' elif name.endswith('Execution'): line3 = 'class ' + name + 'Mixin(' + base_class_name + '):' + '\n\tbian_action = ActionTerms.EXECUTE' elif name.endswith('Requisition'): line3 = 'class ' + name + 'Mixin(' + base_class_name + '):' + '\n\tbian_action = ActionTerms.REQUEST' else: line3 = 'class ' + name + 'Mixin(' + base_class_name + '):' + '\n\tbian_action = ActionTerms.RETRIEVE' return {'mixin': {'imports': imports, 'code': line3}}
V,E=map(int,input().split()) edges=[set() for i in range(V)] for i in range(E): a,b=map(int,input().split()) edges[a-1].add(b-1) edges[b-1].add(a-1) for i in range(V): print(len({n for v in edges[i] for n in edges[v] if not n in edges[i] and n!=i}))
(v, e) = map(int, input().split()) edges = [set() for i in range(V)] for i in range(E): (a, b) = map(int, input().split()) edges[a - 1].add(b - 1) edges[b - 1].add(a - 1) for i in range(V): print(len({n for v in edges[i] for n in edges[v] if not n in edges[i] and n != i}))
''' Copyright (C) 2021 Sovrasov V. - All Rights Reserved * You may use, distribute and modify this code under the * terms of the MIT license. * You should have received a copy of the MIT license with * this file. If not visit https://opensource.org/licenses/MIT ''' def flops_to_string(flops, units='GMac', precision=2): if units is None: if flops // 10**9 > 0: return str(round(flops / 10.**9, precision)) + ' GMac' elif flops // 10**6 > 0: return str(round(flops / 10.**6, precision)) + ' MMac' elif flops // 10**3 > 0: return str(round(flops / 10.**3, precision)) + ' KMac' else: return str(flops) + ' Mac' else: if units == 'GMac': return str(round(flops / 10.**9, precision)) + ' ' + units elif units == 'MMac': return str(round(flops / 10.**6, precision)) + ' ' + units elif units == 'KMac': return str(round(flops / 10.**3, precision)) + ' ' + units else: return str(flops) + ' Mac' def params_to_string(params_num, units=None, precision=2): if units is None: if params_num // 10 ** 6 > 0: return str(round(params_num / 10 ** 6, 2)) + ' M' elif params_num // 10 ** 3: return str(round(params_num / 10 ** 3, 2)) + ' k' else: return str(params_num) else: if units == 'M': return str(round(params_num / 10.**6, precision)) + ' ' + units elif units == 'K': return str(round(params_num / 10.**3, precision)) + ' ' + units else: return str(params_num)
""" Copyright (C) 2021 Sovrasov V. - All Rights Reserved * You may use, distribute and modify this code under the * terms of the MIT license. * You should have received a copy of the MIT license with * this file. If not visit https://opensource.org/licenses/MIT """ def flops_to_string(flops, units='GMac', precision=2): if units is None: if flops // 10 ** 9 > 0: return str(round(flops / 10.0 ** 9, precision)) + ' GMac' elif flops // 10 ** 6 > 0: return str(round(flops / 10.0 ** 6, precision)) + ' MMac' elif flops // 10 ** 3 > 0: return str(round(flops / 10.0 ** 3, precision)) + ' KMac' else: return str(flops) + ' Mac' elif units == 'GMac': return str(round(flops / 10.0 ** 9, precision)) + ' ' + units elif units == 'MMac': return str(round(flops / 10.0 ** 6, precision)) + ' ' + units elif units == 'KMac': return str(round(flops / 10.0 ** 3, precision)) + ' ' + units else: return str(flops) + ' Mac' def params_to_string(params_num, units=None, precision=2): if units is None: if params_num // 10 ** 6 > 0: return str(round(params_num / 10 ** 6, 2)) + ' M' elif params_num // 10 ** 3: return str(round(params_num / 10 ** 3, 2)) + ' k' else: return str(params_num) elif units == 'M': return str(round(params_num / 10.0 ** 6, precision)) + ' ' + units elif units == 'K': return str(round(params_num / 10.0 ** 3, precision)) + ' ' + units else: return str(params_num)
a=[12,9,1,3] a1=[12,9,1,3] s=[] z=0 c=0 #expected a=[1,3,12,9] for i in range(len(a)): q=0 while(a1[i]>0): z=a1[i]%10 q=q+z a1[i]=a1[i]//10 s.append(q) print(a) s.sort() print(s)
a = [12, 9, 1, 3] a1 = [12, 9, 1, 3] s = [] z = 0 c = 0 for i in range(len(a)): q = 0 while a1[i] > 0: z = a1[i] % 10 q = q + z a1[i] = a1[i] // 10 s.append(q) print(a) s.sort() print(s)
# host and port for client and tracker HOST = '192.168.43.92' PORT = 9992 # redis key prefixes TRANSACTION_QUEUE_KEY = 'transactions.queue' BLOCK_KEY_PREFIX = 'chain.block.' PREV_HASH_KEY = 'prev_hash' SEND_TRANSACTIONS_QUEUE_KEY = 'send.transactions.queue' TRANSACTIONS_SIGNATURE = 'transactions.signature.' # number of transactions in a block TRANSACTIONS_IN_BLOCK = 1 GAMER_BAWA = 1024
host = '192.168.43.92' port = 9992 transaction_queue_key = 'transactions.queue' block_key_prefix = 'chain.block.' prev_hash_key = 'prev_hash' send_transactions_queue_key = 'send.transactions.queue' transactions_signature = 'transactions.signature.' transactions_in_block = 1 gamer_bawa = 1024
# -*- coding: utf-8 -*- description = 'Monitoring for DNS setup' group = 'basic' tango_base = 'tango://localhost:10000/test/' devices = dict( dns_main_voltages = device('nicos_mlz.emc.devices.janitza_online.VectorInput', description = 'Voltage monitoring', tangodevice = tango_base + 'janitza_dns/voltages', ), dns_main_currents = device('nicos_mlz.emc.devices.janitza_online.VectorInput', description = 'Current monitoring', tangodevice = tango_base + 'janitza_dns/currents', ), dns_main_thd = device('nicos_mlz.emc.devices.janitza_online.VectorInput', description = 'Total harmonic distortion monitoring', tangodevice = tango_base + 'janitza_dns/thd', ), dns_online = device('nicos_mlz.emc.devices.janitza_online.OnlineMonitor', description = 'Combination of all monitoring devices', voltages = 'dns_main_voltages', currents = 'dns_main_currents', thd = 'dns_main_thd', ), )
description = 'Monitoring for DNS setup' group = 'basic' tango_base = 'tango://localhost:10000/test/' devices = dict(dns_main_voltages=device('nicos_mlz.emc.devices.janitza_online.VectorInput', description='Voltage monitoring', tangodevice=tango_base + 'janitza_dns/voltages'), dns_main_currents=device('nicos_mlz.emc.devices.janitza_online.VectorInput', description='Current monitoring', tangodevice=tango_base + 'janitza_dns/currents'), dns_main_thd=device('nicos_mlz.emc.devices.janitza_online.VectorInput', description='Total harmonic distortion monitoring', tangodevice=tango_base + 'janitza_dns/thd'), dns_online=device('nicos_mlz.emc.devices.janitza_online.OnlineMonitor', description='Combination of all monitoring devices', voltages='dns_main_voltages', currents='dns_main_currents', thd='dns_main_thd'))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Author: Nasy @Date: Dec 31. 2016 @email: sy_n@me.com @file: optlib/tools/color_print.py @license: MIT An Excited Python Script """ RESET_COLOR = "\033[0m" COLOR_CODES = { "blue": "\033[1;34m", # blue "green": "\033[1;32m", # green "yellow": "\033[1;33m", # yellow "red": "\033[1;31m", # red "b_red": "\033[1;41m", # background red }
""" @Author: Nasy @Date: Dec 31. 2016 @email: sy_n@me.com @file: optlib/tools/color_print.py @license: MIT An Excited Python Script """ reset_color = '\x1b[0m' color_codes = {'blue': '\x1b[1;34m', 'green': '\x1b[1;32m', 'yellow': '\x1b[1;33m', 'red': '\x1b[1;31m', 'b_red': '\x1b[1;41m'}
# # PySNMP MIB module HPN-ICF-DHCPSNOOP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-DHCPSNOOP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:25:32 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") SingleValueConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint") hpnicfdot1qVlanIndex, = mibBuilder.importSymbols("HPN-ICF-LswVLAN-MIB", "hpnicfdot1qVlanIndex") hpnicfCommon, = mibBuilder.importSymbols("HPN-ICF-OID-MIB", "hpnicfCommon") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") MibIdentifier, TimeTicks, NotificationType, Counter64, Bits, ModuleIdentity, ObjectIdentity, IpAddress, Gauge32, Unsigned32, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "TimeTicks", "NotificationType", "Counter64", "Bits", "ModuleIdentity", "ObjectIdentity", "IpAddress", "Gauge32", "Unsigned32", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "Integer32") TextualConvention, DisplayString, MacAddress, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "MacAddress", "TruthValue") hpnicfDhcpSnoop = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36)) if mibBuilder.loadTexts: hpnicfDhcpSnoop.setLastUpdated('200501140000Z') if mibBuilder.loadTexts: hpnicfDhcpSnoop.setOrganization('') hpnicfDhcpSnoopMibObject = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1)) hpnicfDhcpSnoopEnable = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfDhcpSnoopEnable.setStatus('current') hpnicfDhcpSnoopTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2), ) if mibBuilder.loadTexts: hpnicfDhcpSnoopTable.setStatus('current') hpnicfDhcpSnoopEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1), ).setIndexNames((0, "HPN-ICF-DHCPSNOOP-MIB", "hpnicfDhcpSnoopClientIpAddressType"), (0, "HPN-ICF-DHCPSNOOP-MIB", "hpnicfDhcpSnoopClientIpAddress")) if mibBuilder.loadTexts: hpnicfDhcpSnoopEntry.setStatus('current') hpnicfDhcpSnoopClientIpAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1, 1), InetAddressType().clone('ipv4')) if mibBuilder.loadTexts: hpnicfDhcpSnoopClientIpAddressType.setStatus('current') hpnicfDhcpSnoopClientIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1, 2), InetAddress()) if mibBuilder.loadTexts: hpnicfDhcpSnoopClientIpAddress.setStatus('current') hpnicfDhcpSnoopClientMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1, 3), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfDhcpSnoopClientMacAddress.setStatus('current') hpnicfDhcpSnoopClientProperty = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("static", 1), ("dynamic", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfDhcpSnoopClientProperty.setStatus('current') hpnicfDhcpSnoopClientUnitNum = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfDhcpSnoopClientUnitNum.setStatus('current') hpnicfDhcpSnoopTrustTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 3), ) if mibBuilder.loadTexts: hpnicfDhcpSnoopTrustTable.setStatus('current') hpnicfDhcpSnoopTrustEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: hpnicfDhcpSnoopTrustEntry.setStatus('current') hpnicfDhcpSnoopTrustStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("untrusted", 0), ("trusted", 1))).clone('untrusted')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfDhcpSnoopTrustStatus.setStatus('current') hpnicfDhcpSnoopVlanTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 4), ) if mibBuilder.loadTexts: hpnicfDhcpSnoopVlanTable.setStatus('current') hpnicfDhcpSnoopVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 4, 1), ).setIndexNames((0, "HPN-ICF-DHCPSNOOP-MIB", "hpnicfDhcpSnoopVlanIndex")) if mibBuilder.loadTexts: hpnicfDhcpSnoopVlanEntry.setStatus('current') hpnicfDhcpSnoopVlanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))) if mibBuilder.loadTexts: hpnicfDhcpSnoopVlanIndex.setStatus('current') hpnicfDhcpSnoopVlanEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 4, 1, 2), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfDhcpSnoopVlanEnable.setStatus('current') hpnicfDhcpSnoopTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2)) hpnicfDhcpSnoopTrapsPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 0)) hpnicfDhcpSnoopTrapsObject = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 1)) hpnicfDhcpSnoopSpoofServerMac = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 1, 1), MacAddress()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfDhcpSnoopSpoofServerMac.setStatus('current') hpnicfDhcpSnoopSpoofServerIP = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 1, 2), IpAddress()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfDhcpSnoopSpoofServerIP.setStatus('current') hpnicfDhcpSnoopBindingIP = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 1, 3), IpAddress()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfDhcpSnoopBindingIP.setStatus('current') hpnicfDhcpSnoopBindingMac = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 1, 4), MacAddress()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfDhcpSnoopBindingMac.setStatus('current') hpnicfDhcpSnoopSpoofServerDetected = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 0, 1)).setObjects(("IF-MIB", "ifIndex"), ("HPN-ICF-LswVLAN-MIB", "hpnicfdot1qVlanIndex"), ("HPN-ICF-DHCPSNOOP-MIB", "hpnicfDhcpSnoopSpoofServerMac"), ("HPN-ICF-DHCPSNOOP-MIB", "hpnicfDhcpSnoopSpoofServerIP")) if mibBuilder.loadTexts: hpnicfDhcpSnoopSpoofServerDetected.setStatus('current') hpnicfDhcpSnoopNewBinding = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 0, 2)).setObjects(("HPN-ICF-DHCPSNOOP-MIB", "hpnicfDhcpSnoopBindingIP"), ("HPN-ICF-DHCPSNOOP-MIB", "hpnicfDhcpSnoopBindingMac")) if mibBuilder.loadTexts: hpnicfDhcpSnoopNewBinding.setStatus('current') mibBuilder.exportSymbols("HPN-ICF-DHCPSNOOP-MIB", hpnicfDhcpSnoopTraps=hpnicfDhcpSnoopTraps, hpnicfDhcpSnoopClientMacAddress=hpnicfDhcpSnoopClientMacAddress, hpnicfDhcpSnoopBindingIP=hpnicfDhcpSnoopBindingIP, hpnicfDhcpSnoopVlanEntry=hpnicfDhcpSnoopVlanEntry, hpnicfDhcpSnoopTable=hpnicfDhcpSnoopTable, hpnicfDhcpSnoopClientUnitNum=hpnicfDhcpSnoopClientUnitNum, hpnicfDhcpSnoopEnable=hpnicfDhcpSnoopEnable, hpnicfDhcpSnoopTrapsObject=hpnicfDhcpSnoopTrapsObject, hpnicfDhcpSnoopSpoofServerIP=hpnicfDhcpSnoopSpoofServerIP, hpnicfDhcpSnoopVlanIndex=hpnicfDhcpSnoopVlanIndex, hpnicfDhcpSnoopBindingMac=hpnicfDhcpSnoopBindingMac, PYSNMP_MODULE_ID=hpnicfDhcpSnoop, hpnicfDhcpSnoopTrustStatus=hpnicfDhcpSnoopTrustStatus, hpnicfDhcpSnoop=hpnicfDhcpSnoop, hpnicfDhcpSnoopMibObject=hpnicfDhcpSnoopMibObject, hpnicfDhcpSnoopTrustTable=hpnicfDhcpSnoopTrustTable, hpnicfDhcpSnoopVlanTable=hpnicfDhcpSnoopVlanTable, hpnicfDhcpSnoopClientIpAddressType=hpnicfDhcpSnoopClientIpAddressType, hpnicfDhcpSnoopClientProperty=hpnicfDhcpSnoopClientProperty, hpnicfDhcpSnoopSpoofServerDetected=hpnicfDhcpSnoopSpoofServerDetected, hpnicfDhcpSnoopClientIpAddress=hpnicfDhcpSnoopClientIpAddress, hpnicfDhcpSnoopNewBinding=hpnicfDhcpSnoopNewBinding, hpnicfDhcpSnoopVlanEnable=hpnicfDhcpSnoopVlanEnable, hpnicfDhcpSnoopTrustEntry=hpnicfDhcpSnoopTrustEntry, hpnicfDhcpSnoopEntry=hpnicfDhcpSnoopEntry, hpnicfDhcpSnoopTrapsPrefix=hpnicfDhcpSnoopTrapsPrefix, hpnicfDhcpSnoopSpoofServerMac=hpnicfDhcpSnoopSpoofServerMac)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint') (hpnicfdot1q_vlan_index,) = mibBuilder.importSymbols('HPN-ICF-LswVLAN-MIB', 'hpnicfdot1qVlanIndex') (hpnicf_common,) = mibBuilder.importSymbols('HPN-ICF-OID-MIB', 'hpnicfCommon') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (inet_address_type, inet_address) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressType', 'InetAddress') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (mib_identifier, time_ticks, notification_type, counter64, bits, module_identity, object_identity, ip_address, gauge32, unsigned32, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibIdentifier', 'TimeTicks', 'NotificationType', 'Counter64', 'Bits', 'ModuleIdentity', 'ObjectIdentity', 'IpAddress', 'Gauge32', 'Unsigned32', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'Integer32') (textual_convention, display_string, mac_address, truth_value) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString', 'MacAddress', 'TruthValue') hpnicf_dhcp_snoop = module_identity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36)) if mibBuilder.loadTexts: hpnicfDhcpSnoop.setLastUpdated('200501140000Z') if mibBuilder.loadTexts: hpnicfDhcpSnoop.setOrganization('') hpnicf_dhcp_snoop_mib_object = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1)) hpnicf_dhcp_snoop_enable = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone('disable')).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfDhcpSnoopEnable.setStatus('current') hpnicf_dhcp_snoop_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2)) if mibBuilder.loadTexts: hpnicfDhcpSnoopTable.setStatus('current') hpnicf_dhcp_snoop_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1)).setIndexNames((0, 'HPN-ICF-DHCPSNOOP-MIB', 'hpnicfDhcpSnoopClientIpAddressType'), (0, 'HPN-ICF-DHCPSNOOP-MIB', 'hpnicfDhcpSnoopClientIpAddress')) if mibBuilder.loadTexts: hpnicfDhcpSnoopEntry.setStatus('current') hpnicf_dhcp_snoop_client_ip_address_type = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1, 1), inet_address_type().clone('ipv4')) if mibBuilder.loadTexts: hpnicfDhcpSnoopClientIpAddressType.setStatus('current') hpnicf_dhcp_snoop_client_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1, 2), inet_address()) if mibBuilder.loadTexts: hpnicfDhcpSnoopClientIpAddress.setStatus('current') hpnicf_dhcp_snoop_client_mac_address = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1, 3), mac_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfDhcpSnoopClientMacAddress.setStatus('current') hpnicf_dhcp_snoop_client_property = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('static', 1), ('dynamic', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfDhcpSnoopClientProperty.setStatus('current') hpnicf_dhcp_snoop_client_unit_num = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 2, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfDhcpSnoopClientUnitNum.setStatus('current') hpnicf_dhcp_snoop_trust_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 3)) if mibBuilder.loadTexts: hpnicfDhcpSnoopTrustTable.setStatus('current') hpnicf_dhcp_snoop_trust_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 3, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: hpnicfDhcpSnoopTrustEntry.setStatus('current') hpnicf_dhcp_snoop_trust_status = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 3, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('untrusted', 0), ('trusted', 1))).clone('untrusted')).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfDhcpSnoopTrustStatus.setStatus('current') hpnicf_dhcp_snoop_vlan_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 4)) if mibBuilder.loadTexts: hpnicfDhcpSnoopVlanTable.setStatus('current') hpnicf_dhcp_snoop_vlan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 4, 1)).setIndexNames((0, 'HPN-ICF-DHCPSNOOP-MIB', 'hpnicfDhcpSnoopVlanIndex')) if mibBuilder.loadTexts: hpnicfDhcpSnoopVlanEntry.setStatus('current') hpnicf_dhcp_snoop_vlan_index = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 4, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))) if mibBuilder.loadTexts: hpnicfDhcpSnoopVlanIndex.setStatus('current') hpnicf_dhcp_snoop_vlan_enable = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 1, 4, 1, 2), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfDhcpSnoopVlanEnable.setStatus('current') hpnicf_dhcp_snoop_traps = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2)) hpnicf_dhcp_snoop_traps_prefix = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 0)) hpnicf_dhcp_snoop_traps_object = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 1)) hpnicf_dhcp_snoop_spoof_server_mac = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 1, 1), mac_address()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfDhcpSnoopSpoofServerMac.setStatus('current') hpnicf_dhcp_snoop_spoof_server_ip = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 1, 2), ip_address()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfDhcpSnoopSpoofServerIP.setStatus('current') hpnicf_dhcp_snoop_binding_ip = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 1, 3), ip_address()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfDhcpSnoopBindingIP.setStatus('current') hpnicf_dhcp_snoop_binding_mac = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 1, 4), mac_address()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfDhcpSnoopBindingMac.setStatus('current') hpnicf_dhcp_snoop_spoof_server_detected = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 0, 1)).setObjects(('IF-MIB', 'ifIndex'), ('HPN-ICF-LswVLAN-MIB', 'hpnicfdot1qVlanIndex'), ('HPN-ICF-DHCPSNOOP-MIB', 'hpnicfDhcpSnoopSpoofServerMac'), ('HPN-ICF-DHCPSNOOP-MIB', 'hpnicfDhcpSnoopSpoofServerIP')) if mibBuilder.loadTexts: hpnicfDhcpSnoopSpoofServerDetected.setStatus('current') hpnicf_dhcp_snoop_new_binding = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 36, 2, 0, 2)).setObjects(('HPN-ICF-DHCPSNOOP-MIB', 'hpnicfDhcpSnoopBindingIP'), ('HPN-ICF-DHCPSNOOP-MIB', 'hpnicfDhcpSnoopBindingMac')) if mibBuilder.loadTexts: hpnicfDhcpSnoopNewBinding.setStatus('current') mibBuilder.exportSymbols('HPN-ICF-DHCPSNOOP-MIB', hpnicfDhcpSnoopTraps=hpnicfDhcpSnoopTraps, hpnicfDhcpSnoopClientMacAddress=hpnicfDhcpSnoopClientMacAddress, hpnicfDhcpSnoopBindingIP=hpnicfDhcpSnoopBindingIP, hpnicfDhcpSnoopVlanEntry=hpnicfDhcpSnoopVlanEntry, hpnicfDhcpSnoopTable=hpnicfDhcpSnoopTable, hpnicfDhcpSnoopClientUnitNum=hpnicfDhcpSnoopClientUnitNum, hpnicfDhcpSnoopEnable=hpnicfDhcpSnoopEnable, hpnicfDhcpSnoopTrapsObject=hpnicfDhcpSnoopTrapsObject, hpnicfDhcpSnoopSpoofServerIP=hpnicfDhcpSnoopSpoofServerIP, hpnicfDhcpSnoopVlanIndex=hpnicfDhcpSnoopVlanIndex, hpnicfDhcpSnoopBindingMac=hpnicfDhcpSnoopBindingMac, PYSNMP_MODULE_ID=hpnicfDhcpSnoop, hpnicfDhcpSnoopTrustStatus=hpnicfDhcpSnoopTrustStatus, hpnicfDhcpSnoop=hpnicfDhcpSnoop, hpnicfDhcpSnoopMibObject=hpnicfDhcpSnoopMibObject, hpnicfDhcpSnoopTrustTable=hpnicfDhcpSnoopTrustTable, hpnicfDhcpSnoopVlanTable=hpnicfDhcpSnoopVlanTable, hpnicfDhcpSnoopClientIpAddressType=hpnicfDhcpSnoopClientIpAddressType, hpnicfDhcpSnoopClientProperty=hpnicfDhcpSnoopClientProperty, hpnicfDhcpSnoopSpoofServerDetected=hpnicfDhcpSnoopSpoofServerDetected, hpnicfDhcpSnoopClientIpAddress=hpnicfDhcpSnoopClientIpAddress, hpnicfDhcpSnoopNewBinding=hpnicfDhcpSnoopNewBinding, hpnicfDhcpSnoopVlanEnable=hpnicfDhcpSnoopVlanEnable, hpnicfDhcpSnoopTrustEntry=hpnicfDhcpSnoopTrustEntry, hpnicfDhcpSnoopEntry=hpnicfDhcpSnoopEntry, hpnicfDhcpSnoopTrapsPrefix=hpnicfDhcpSnoopTrapsPrefix, hpnicfDhcpSnoopSpoofServerMac=hpnicfDhcpSnoopSpoofServerMac)
## HTML lists ## CHECKBOX_TOGGLES = [ "accelerometer", "gps", "calls", "texts", "wifi", "bluetooth", "power_state", "proximity", "gyro", "magnetometer", "devicemotion", "ambient_audio", "reachability", "allow_upload_over_cellular_data", "use_anonymized_hashing", "use_gps_fuzzing", "call_clinician_button_enabled", "call_research_assistant_button_enabled" ] TIMER_VALUES = [ "accelerometer_off_duration_seconds", "accelerometer_on_duration_seconds", "bluetooth_on_duration_seconds", "bluetooth_total_duration_seconds", "bluetooth_global_offset_seconds", "check_for_new_surveys_frequency_seconds", "create_new_data_files_frequency_seconds", "gps_off_duration_seconds", "gps_on_duration_seconds", "seconds_before_auto_logout", "upload_data_files_frequency_seconds", "voice_recording_max_time_length_seconds", "wifi_log_frequency_seconds", "gyro_off_duration_seconds", "gyro_on_duration_seconds", "magnetometer_off_duration_seconds", "magnetometer_on_duration_seconds", "devicemotion_off_duration_seconds", "devicemotion_on_duration_seconds" ]
checkbox_toggles = ['accelerometer', 'gps', 'calls', 'texts', 'wifi', 'bluetooth', 'power_state', 'proximity', 'gyro', 'magnetometer', 'devicemotion', 'ambient_audio', 'reachability', 'allow_upload_over_cellular_data', 'use_anonymized_hashing', 'use_gps_fuzzing', 'call_clinician_button_enabled', 'call_research_assistant_button_enabled'] timer_values = ['accelerometer_off_duration_seconds', 'accelerometer_on_duration_seconds', 'bluetooth_on_duration_seconds', 'bluetooth_total_duration_seconds', 'bluetooth_global_offset_seconds', 'check_for_new_surveys_frequency_seconds', 'create_new_data_files_frequency_seconds', 'gps_off_duration_seconds', 'gps_on_duration_seconds', 'seconds_before_auto_logout', 'upload_data_files_frequency_seconds', 'voice_recording_max_time_length_seconds', 'wifi_log_frequency_seconds', 'gyro_off_duration_seconds', 'gyro_on_duration_seconds', 'magnetometer_off_duration_seconds', 'magnetometer_on_duration_seconds', 'devicemotion_off_duration_seconds', 'devicemotion_on_duration_seconds']
# Comments allow for programers to write reminders or create a better understanding of the code and program city_name = "St. Potatosburg" # The amount of people living in the city of St. Potatosburg: city_pop = 340000
city_name = 'St. Potatosburg' city_pop = 340000
# Script to generate translation and rotation specializations of placed volumes, rotation = [0x1B1, 0x18E, 0x076, 0x16A, 0x155, 0x0AD, 0x0DC, 0x0E3, 0x11B, 0x0A1, 0x10A, 0x046, 0x062, 0x054, 0x111, 0x200] translation = ["translation::kGeneric", "translation::kIdentity"] header_string = """\ /// @file TransformationSpecializations.icc /// @author Script generated. #ifndef VECGEOM_NO_SPECIALIZATION """ specialization_string = """\ if (trans_code == {:s} && rot_code == {:#05x}) {{ return VolumeType::template Create<{:s}, {:#05x}>( logical_volume, transformation, #ifdef VECCORE_CUDA id, copy_no, child_id, #endif placement); }} """ generic_string = """\ #endif // No specialization return VolumeType::template Create<translation::kGeneric, rotation::kGeneric>( logical_volume, transformation, #ifdef VECCORE_CUDA id, copy_no, child_id, #endif placement);\ """ output_file = open("../VecGeom/management/TransformationSpecializations.icc", "w") output_file.write(header_string) for r in rotation: for t in translation: output_file.write(specialization_string.format(t, r, t, r)) output_file.write(generic_string) output_file.close()
rotation = [433, 398, 118, 362, 341, 173, 220, 227, 283, 161, 266, 70, 98, 84, 273, 512] translation = ['translation::kGeneric', 'translation::kIdentity'] header_string = '/// @file TransformationSpecializations.icc\n/// @author Script generated.\n\n#ifndef VECGEOM_NO_SPECIALIZATION\n' specialization_string = ' if (trans_code == {:s} && rot_code == {:#05x}) {{\n return VolumeType::template Create<{:s}, {:#05x}>(\n logical_volume, transformation,\n#ifdef VECCORE_CUDA\n id, copy_no, child_id,\n#endif\n placement);\n }}\n' generic_string = '#endif // No specialization\n\n return VolumeType::template Create<translation::kGeneric, rotation::kGeneric>(\n logical_volume, transformation,\n#ifdef VECCORE_CUDA\n id, copy_no, child_id,\n#endif\n placement);' output_file = open('../VecGeom/management/TransformationSpecializations.icc', 'w') output_file.write(header_string) for r in rotation: for t in translation: output_file.write(specialization_string.format(t, r, t, r)) output_file.write(generic_string) output_file.close()
class Solution: def dropNegatives(self, A): j = 0 newlist = [] for i in range(len(A)): if A[i] > 0: newlist.append(A[i]) return newlist def firstMissingPositive(self, nums: List[int]) -> int: A = self.dropNegatives(nums) if len(A)==0: return 1 if len(A)==1: return 1 if A[0] >= 2 else 2 else: n = len(A) for i in range(n): item = abs(A[i]) if item <= n: A[item-1] = -1 * abs(A[item-1]) res = len(A) + 1 for i in range(n): if A[i] > 0: return i+1 return res
class Solution: def drop_negatives(self, A): j = 0 newlist = [] for i in range(len(A)): if A[i] > 0: newlist.append(A[i]) return newlist def first_missing_positive(self, nums: List[int]) -> int: a = self.dropNegatives(nums) if len(A) == 0: return 1 if len(A) == 1: return 1 if A[0] >= 2 else 2 else: n = len(A) for i in range(n): item = abs(A[i]) if item <= n: A[item - 1] = -1 * abs(A[item - 1]) res = len(A) + 1 for i in range(n): if A[i] > 0: return i + 1 return res
def group_weekly(df, date_col): weekly = df.copy() weekly['week'] = weekly[date_col].dt.isocalendar().week weekly['year'] = weekly[date_col].dt.isocalendar().year weekly['year_week'] = weekly['year'].astype(str) + "-" + weekly['week'].astype(str) weekly = weekly.groupby('year_week').sum() weekly.drop(['week', 'year'], axis=1, inplace=True) weekly.reset_index(inplace=True) return weekly
def group_weekly(df, date_col): weekly = df.copy() weekly['week'] = weekly[date_col].dt.isocalendar().week weekly['year'] = weekly[date_col].dt.isocalendar().year weekly['year_week'] = weekly['year'].astype(str) + '-' + weekly['week'].astype(str) weekly = weekly.groupby('year_week').sum() weekly.drop(['week', 'year'], axis=1, inplace=True) weekly.reset_index(inplace=True) return weekly
# coding:utf-8 workers = 4 threads = 4 bind = '0.0.0.0:5000' worker_class = 'eventlet' # 'gevent' worker_connections = 2000 pidfile = 'gunicorn.pid' accesslog = './logs/gunicorn_acess.log' errorlog = './logs/gunicorn_error.log' loglevel = 'info' reload = True
workers = 4 threads = 4 bind = '0.0.0.0:5000' worker_class = 'eventlet' worker_connections = 2000 pidfile = 'gunicorn.pid' accesslog = './logs/gunicorn_acess.log' errorlog = './logs/gunicorn_error.log' loglevel = 'info' reload = True
seed_csv = """ id,name,some_date 1,Easton,1981-05-20T06:46:51 2,Lillian,1978-09-03T18:10:33 3,Jeremiah,1982-03-11T03:59:51 4,Nolan,1976-05-06T20:21:35 """.lstrip() model_sql = """ select * from {{ ref('seed') }} """ profile_yml = """ version: 2 models: - name: materialization columns: - name: id tests: - unique - not_null - name: name tests: - not_null """
seed_csv = '\nid,name,some_date\n1,Easton,1981-05-20T06:46:51\n2,Lillian,1978-09-03T18:10:33\n3,Jeremiah,1982-03-11T03:59:51\n4,Nolan,1976-05-06T20:21:35\n'.lstrip() model_sql = "\nselect * from {{ ref('seed') }}\n" profile_yml = '\nversion: 2\nmodels:\n - name: materialization\n columns:\n - name: id\n tests:\n - unique\n - not_null\n - name: name\n tests:\n - not_null\n'