content
stringlengths 7
1.05M
| fixed_cases
stringlengths 1
1.28M
|
---|---|
class Source:
'''
this is a class that defines the source objects
'''
def __init__(self,id,name,url,description):
self.id = id
self.name = name
self.url = url
self.description = description
|
class Source:
"""
this is a class that defines the source objects
"""
def __init__(self, id, name, url, description):
self.id = id
self.name = name
self.url = url
self.description = description
|
# -*- coding: utf-8 -*-
def production_volume(dataset, default=None):
"""Get production volume of reference product exchange.
Returns ``default`` (default value is ``None``) if no or multiple
reference products, or if reference product doesn't have a production
volume amount."""
exchanges = [x for x in dataset['exchanges']
if x['type'] == 'reference product']
if len(exchanges) != 1:
return default
else:
try:
return exchanges[0]['production volume']['amount']
except KeyError:
return default
def original_production_volume(dataset, default=None):
"""Get original (i.e. before activity link subtractions) production volume of reference product exchange.
Returns ``default`` (default value is ``None``) if no or multiple
reference products, or if reference product doesn't have a production
volume amount."""
exchanges = [x for x in dataset['exchanges']
if x['type'] == 'reference product']
if len(exchanges) != 1:
return default
try:
pv = exchanges[0]['production volume']
except KeyError:
return default
if 'original amount' in pv:
return pv['original amount']
elif 'amount' in pv:
return pv['amount']
else:
return default
def reference_products_as_string(dataset):
"""Get all reference products as a string separated by ``'|'``.
Return ``'None found'`` if no reference products were found."""
exchanges = sorted([exc['name']
for exc in dataset['exchanges']
if exc['type'] == 'reference product'])
if not exchanges:
return "None found"
else:
return "|".join(exchanges)
|
def production_volume(dataset, default=None):
"""Get production volume of reference product exchange.
Returns ``default`` (default value is ``None``) if no or multiple
reference products, or if reference product doesn't have a production
volume amount."""
exchanges = [x for x in dataset['exchanges'] if x['type'] == 'reference product']
if len(exchanges) != 1:
return default
else:
try:
return exchanges[0]['production volume']['amount']
except KeyError:
return default
def original_production_volume(dataset, default=None):
"""Get original (i.e. before activity link subtractions) production volume of reference product exchange.
Returns ``default`` (default value is ``None``) if no or multiple
reference products, or if reference product doesn't have a production
volume amount."""
exchanges = [x for x in dataset['exchanges'] if x['type'] == 'reference product']
if len(exchanges) != 1:
return default
try:
pv = exchanges[0]['production volume']
except KeyError:
return default
if 'original amount' in pv:
return pv['original amount']
elif 'amount' in pv:
return pv['amount']
else:
return default
def reference_products_as_string(dataset):
"""Get all reference products as a string separated by ``'|'``.
Return ``'None found'`` if no reference products were found."""
exchanges = sorted([exc['name'] for exc in dataset['exchanges'] if exc['type'] == 'reference product'])
if not exchanges:
return 'None found'
else:
return '|'.join(exchanges)
|
# Warning : Keep this file private
# replace the values of the variables with yours
ckey = 'SaMpLe-C0nSuMeR-Key'
csecret = 'Y0uR-C0nSuMeR-SecRet'
atoken = 'Y0Ur-@cCeSs-T0Ken'
asecret = 'Y0uR-@cCesS-SeCrEt'
|
ckey = 'SaMpLe-C0nSuMeR-Key'
csecret = 'Y0uR-C0nSuMeR-SecRet'
atoken = 'Y0Ur-@cCeSs-T0Ken'
asecret = 'Y0uR-@cCesS-SeCrEt'
|
def filtering_results(results, book_type, number):
"""
results = list of dictionnary
Filter the results to getspecific type trade / issue
include omnibus and compendium in trades
and number
Based on comic title
"""
assert book_type in ["trade", "issue", None] , "Choose between 'trade' or 'issue' or leave blank (compendium and omnibus are trades)"
type_filtered_holder = []
number_filtered_holder = []# Will hold the new entries after filtering step
# FIRST GET EITHER ISSUE OR PAPERBACK ADD TYPE
paperback_signs = ["vol", "vol.", "volume", "tpb", 'pb',"tp", "paperback" ,"omnibus", "compendium", "hc", "hardcover", "graphic novel", "softcover"]
issue_signs = ["#"]
for book in results:
if any(x in book["title"].lower() for x in issue_signs):
book["type"] = "issue"
elif any(x in book["title"].lower() for x in paperback_signs):
book["type"] = "trade"
else:
book["type"] = "unknown (assume trade)"
if book_type: # NOT NONE
for book in results:
if book["type"] == book_type or book["type"] == "unknown (assume trade)":
type_filtered_holder.append(book)
else:
type_filtered_holder = results
if number:
for book in type_filtered_holder:
if "{}".format(number) in book["title"] or "0{}".format(number) in book["title"]:
number_filtered_holder.append(book)
else:
number_filtered_holder = type_filtered_holder
# PUT CHEAPER FIRST
number_filtered_holder = sorted(number_filtered_holder, key=lambda k: k['price'])
return number_filtered_holder
|
def filtering_results(results, book_type, number):
"""
results = list of dictionnary
Filter the results to getspecific type trade / issue
include omnibus and compendium in trades
and number
Based on comic title
"""
assert book_type in ['trade', 'issue', None], "Choose between 'trade' or 'issue' or leave blank (compendium and omnibus are trades)"
type_filtered_holder = []
number_filtered_holder = []
paperback_signs = ['vol', 'vol.', 'volume', 'tpb', 'pb', 'tp', 'paperback', 'omnibus', 'compendium', 'hc', 'hardcover', 'graphic novel', 'softcover']
issue_signs = ['#']
for book in results:
if any((x in book['title'].lower() for x in issue_signs)):
book['type'] = 'issue'
elif any((x in book['title'].lower() for x in paperback_signs)):
book['type'] = 'trade'
else:
book['type'] = 'unknown (assume trade)'
if book_type:
for book in results:
if book['type'] == book_type or book['type'] == 'unknown (assume trade)':
type_filtered_holder.append(book)
else:
type_filtered_holder = results
if number:
for book in type_filtered_holder:
if '{}'.format(number) in book['title'] or '0{}'.format(number) in book['title']:
number_filtered_holder.append(book)
else:
number_filtered_holder = type_filtered_holder
number_filtered_holder = sorted(number_filtered_holder, key=lambda k: k['price'])
return number_filtered_holder
|
def shallow_copy(x):
return type(x)(x)
class ToggleFilter(object):
"""
This class provides a "sticky" filter, that works by "toggling" items of the original database on and off.
"""
def __init__(self, db_ref, show_by_default=True):
"""
Instantiate a ToggleFilter object
:parameters:
db_ref : iterable
an iterable object (i.e. list, set etc) that would serve as the reference db of the instance.
Changes in that object will affect the output of ToggleFilter instance.
show_by_default: bool
decide if by default all the items are "on", i.e. these items will be presented if no other
toggling occurred.
default value : **True**
"""
self._data = db_ref
self._toggle_db = set()
self._filter_method = filter
self.__set_initial_state(show_by_default)
def reset (self):
"""
Toggles off all the items
"""
self._toggle_db = set()
def toggle_item(self, item_key):
"""
Toggle a single item in/out.
:parameters:
item_key :
an item the by its value the filter can decide to toggle or not.
Example: int, str and so on.
:return:
+ **True** if item toggled **into** the filtered items
+ **False** if item toggled **out from** the filtered items
:raises:
+ KeyError, in case if item key is not part of the toggled list and not part of the referenced db.
"""
if item_key in self._toggle_db:
self._toggle_db.remove(item_key)
return False
elif item_key in self._data:
self._toggle_db.add(item_key)
return True
else:
raise KeyError("Provided item key isn't a key of the referenced data structure.")
def toggle_items(self, *args):
"""
Toggle multiple items in/out with a single call. Each item will be ha.
:parameters:
args : iterable
an iterable object containing all item keys to be toggled in/out
:return:
+ **True** if all toggled items were toggled **into** the filtered items
+ **False** if at least one of the items was toggled **out from** the filtered items
:raises:
+ KeyError, in case if ont of the item keys was not part of the toggled list and not part of the referenced db.
"""
# in python 3, 'map' returns an iterator, so wrapping with 'list' call creates same effect for both python 2 and 3
return all(list(map(self.toggle_item, args)))
def filter_items(self):
"""
Filters the pointed database by showing only the items mapped at toggle_db set.
:returns:
Filtered data of the original object.
"""
return self._filter_method(self.__toggle_filter, self._data)
# private methods
def __set_initial_state(self, show_by_default):
try:
_ = (x for x in self._data)
if isinstance(self._data, dict):
self._filter_method = ToggleFilter.dict_filter
if show_by_default:
self._toggle_db = set(self._data.keys())
return
elif isinstance(self._data, list):
self._filter_method = ToggleFilter.list_filter
elif isinstance(self._data, set):
self._filter_method = ToggleFilter.set_filter
elif isinstance(self._data, tuple):
self._filter_method = ToggleFilter.tuple_filter
if show_by_default:
self._toggle_db = set(shallow_copy(self._data)) # assuming all relevant data with unique identifier
return
except TypeError:
raise TypeError("provided data object is not iterable")
def __toggle_filter(self, x):
return (x in self._toggle_db)
# static utility methods
@staticmethod
def dict_filter(function, iterable):
assert isinstance(iterable, dict)
return {k: v
for k,v in iterable.items()
if function(k)}
@staticmethod
def list_filter(function, iterable):
# in python 3, filter returns an iterator, so wrapping with list creates same effect for both python 2 and 3
return list(filter(function, iterable))
@staticmethod
def set_filter(function, iterable):
return {x
for x in iterable
if function(x)}
@staticmethod
def tuple_filter(function, iterable):
return tuple(filter(function, iterable))
if __name__ == "__main__":
pass
|
def shallow_copy(x):
return type(x)(x)
class Togglefilter(object):
"""
This class provides a "sticky" filter, that works by "toggling" items of the original database on and off.
"""
def __init__(self, db_ref, show_by_default=True):
"""
Instantiate a ToggleFilter object
:parameters:
db_ref : iterable
an iterable object (i.e. list, set etc) that would serve as the reference db of the instance.
Changes in that object will affect the output of ToggleFilter instance.
show_by_default: bool
decide if by default all the items are "on", i.e. these items will be presented if no other
toggling occurred.
default value : **True**
"""
self._data = db_ref
self._toggle_db = set()
self._filter_method = filter
self.__set_initial_state(show_by_default)
def reset(self):
"""
Toggles off all the items
"""
self._toggle_db = set()
def toggle_item(self, item_key):
"""
Toggle a single item in/out.
:parameters:
item_key :
an item the by its value the filter can decide to toggle or not.
Example: int, str and so on.
:return:
+ **True** if item toggled **into** the filtered items
+ **False** if item toggled **out from** the filtered items
:raises:
+ KeyError, in case if item key is not part of the toggled list and not part of the referenced db.
"""
if item_key in self._toggle_db:
self._toggle_db.remove(item_key)
return False
elif item_key in self._data:
self._toggle_db.add(item_key)
return True
else:
raise key_error("Provided item key isn't a key of the referenced data structure.")
def toggle_items(self, *args):
"""
Toggle multiple items in/out with a single call. Each item will be ha.
:parameters:
args : iterable
an iterable object containing all item keys to be toggled in/out
:return:
+ **True** if all toggled items were toggled **into** the filtered items
+ **False** if at least one of the items was toggled **out from** the filtered items
:raises:
+ KeyError, in case if ont of the item keys was not part of the toggled list and not part of the referenced db.
"""
return all(list(map(self.toggle_item, args)))
def filter_items(self):
"""
Filters the pointed database by showing only the items mapped at toggle_db set.
:returns:
Filtered data of the original object.
"""
return self._filter_method(self.__toggle_filter, self._data)
def __set_initial_state(self, show_by_default):
try:
_ = (x for x in self._data)
if isinstance(self._data, dict):
self._filter_method = ToggleFilter.dict_filter
if show_by_default:
self._toggle_db = set(self._data.keys())
return
elif isinstance(self._data, list):
self._filter_method = ToggleFilter.list_filter
elif isinstance(self._data, set):
self._filter_method = ToggleFilter.set_filter
elif isinstance(self._data, tuple):
self._filter_method = ToggleFilter.tuple_filter
if show_by_default:
self._toggle_db = set(shallow_copy(self._data))
return
except TypeError:
raise type_error('provided data object is not iterable')
def __toggle_filter(self, x):
return x in self._toggle_db
@staticmethod
def dict_filter(function, iterable):
assert isinstance(iterable, dict)
return {k: v for (k, v) in iterable.items() if function(k)}
@staticmethod
def list_filter(function, iterable):
return list(filter(function, iterable))
@staticmethod
def set_filter(function, iterable):
return {x for x in iterable if function(x)}
@staticmethod
def tuple_filter(function, iterable):
return tuple(filter(function, iterable))
if __name__ == '__main__':
pass
|
"""
Specializer to support generating Python libraries from swig sources.
"""
load("@fbcode_macros//build_defs/lib/swig:lang_converter_info.bzl", "LangConverterInfo")
load(
"@fbcode_macros//build_defs/lib:python_typing.bzl",
"gen_typing_config",
"get_typing_config_target",
)
load("@fbcode_macros//build_defs/lib:src_and_dep_helpers.bzl", "src_and_dep_helpers")
load("@fbcode_macros//build_defs/lib:visibility.bzl", "get_visibility")
load("@fbcode_macros//build_defs:cpp_python_extension.bzl", "cpp_python_extension")
load(
"@fbsource//tools/build_defs:fb_native_wrapper.bzl",
"fb_native",
)
def _get_lang():
return "py"
def _get_lang_opt():
return "-python"
def _get_lang_flags(java_package = None, **kwargs):
_ignore = java_package
_ignore = kwargs
return [
"-threads",
"-safecstrings",
"-classic",
]
def _get_generated_sources(module):
src = module + ".py"
return {src: src}
def _get_language_rule(
base_path,
name,
module,
hdr,
src,
gen_srcs,
cpp_deps,
deps,
py_base_module = None,
visibility = None,
**kwargs):
_ignore = base_path
_ignore = hdr
_ignore = kwargs
# Build the C/C++ python extension from the generated C/C++ sources.
cpp_python_extension(
name = name + "-ext",
srcs = [src],
base_module = py_base_module,
module_name = "_" + module,
# Generated code uses a lot of shadowing, so disable GCC warnings
# related to this.
compiler_specific_flags = {
"gcc": [
"-Wno-shadow",
"-Wno-shadow-local",
"-Wno-shadow-compatible-local",
],
},
# This is pretty gross. We format the deps just to get
# re-parsed by the C/C++ converter. Long-term, it'd be
# be nice to support a better API in the converters to
# handle higher-leverl objects, but for now we're stuck
# doing this to re-use other converters.
deps = src_and_dep_helpers.format_deps([d for d in cpp_deps if d.repo == None]),
external_deps = [
(d.repo, d.base_path, None, d.name)
for d in cpp_deps
if d.repo != None
],
)
# Generate the wrapping python library.
out_deps = []
out_deps.extend(deps)
out_deps.append(":" + name + "-ext")
attrs = {}
attrs["name"] = name
attrs["visibility"] = get_visibility(visibility, name)
attrs["srcs"] = gen_srcs
attrs["deps"] = out_deps
if py_base_module != None:
attrs["base_module"] = py_base_module
# At some point swig targets should also include typing Options
# For now we just need an empty directory.
if get_typing_config_target():
gen_typing_config(name)
fb_native.python_library(**attrs)
return []
python_converter = LangConverterInfo(
get_lang = _get_lang,
get_lang_opt = _get_lang_opt,
get_lang_flags = _get_lang_flags,
get_generated_sources = _get_generated_sources,
get_language_rule = _get_language_rule,
)
|
"""
Specializer to support generating Python libraries from swig sources.
"""
load('@fbcode_macros//build_defs/lib/swig:lang_converter_info.bzl', 'LangConverterInfo')
load('@fbcode_macros//build_defs/lib:python_typing.bzl', 'gen_typing_config', 'get_typing_config_target')
load('@fbcode_macros//build_defs/lib:src_and_dep_helpers.bzl', 'src_and_dep_helpers')
load('@fbcode_macros//build_defs/lib:visibility.bzl', 'get_visibility')
load('@fbcode_macros//build_defs:cpp_python_extension.bzl', 'cpp_python_extension')
load('@fbsource//tools/build_defs:fb_native_wrapper.bzl', 'fb_native')
def _get_lang():
return 'py'
def _get_lang_opt():
return '-python'
def _get_lang_flags(java_package=None, **kwargs):
_ignore = java_package
_ignore = kwargs
return ['-threads', '-safecstrings', '-classic']
def _get_generated_sources(module):
src = module + '.py'
return {src: src}
def _get_language_rule(base_path, name, module, hdr, src, gen_srcs, cpp_deps, deps, py_base_module=None, visibility=None, **kwargs):
_ignore = base_path
_ignore = hdr
_ignore = kwargs
cpp_python_extension(name=name + '-ext', srcs=[src], base_module=py_base_module, module_name='_' + module, compiler_specific_flags={'gcc': ['-Wno-shadow', '-Wno-shadow-local', '-Wno-shadow-compatible-local']}, deps=src_and_dep_helpers.format_deps([d for d in cpp_deps if d.repo == None]), external_deps=[(d.repo, d.base_path, None, d.name) for d in cpp_deps if d.repo != None])
out_deps = []
out_deps.extend(deps)
out_deps.append(':' + name + '-ext')
attrs = {}
attrs['name'] = name
attrs['visibility'] = get_visibility(visibility, name)
attrs['srcs'] = gen_srcs
attrs['deps'] = out_deps
if py_base_module != None:
attrs['base_module'] = py_base_module
if get_typing_config_target():
gen_typing_config(name)
fb_native.python_library(**attrs)
return []
python_converter = lang_converter_info(get_lang=_get_lang, get_lang_opt=_get_lang_opt, get_lang_flags=_get_lang_flags, get_generated_sources=_get_generated_sources, get_language_rule=_get_language_rule)
|
def main():
def expand(code,times):
return times * code
def expandString(code):
lbi = 0
rbi = 0
for i in range(len(code)):
if(code[i] == "["):
lbi = i
if(code[i] == "]"):
rbi = i
break
count = 1
while code[lbi-count].isdigit():
if(count == 1):
mStr = code[lbi-count]
else:
mStr = code[lbi-count] + mStr
count += 1
multiplier = int(mStr)
code_inside = code[lbi + 1:rbi]
code = code[0:lbi - len(mStr)] + expand(code_inside,multiplier) + code[rbi+1:]
if("[" not in code):
return code
else:
return expandString(code)
coded = input()
a = (expandString(coded))
print(a)
main()
|
def main():
def expand(code, times):
return times * code
def expand_string(code):
lbi = 0
rbi = 0
for i in range(len(code)):
if code[i] == '[':
lbi = i
if code[i] == ']':
rbi = i
break
count = 1
while code[lbi - count].isdigit():
if count == 1:
m_str = code[lbi - count]
else:
m_str = code[lbi - count] + mStr
count += 1
multiplier = int(mStr)
code_inside = code[lbi + 1:rbi]
code = code[0:lbi - len(mStr)] + expand(code_inside, multiplier) + code[rbi + 1:]
if '[' not in code:
return code
else:
return expand_string(code)
coded = input()
a = expand_string(coded)
print(a)
main()
|
class MyDictSubclass(dict):
def __init__(self):
dict.__init__(self)
self.var1 = 10
self['in_dct'] = 20
def __str__(self):
ret = []
for key, val in sorted(self.items()):
ret.append('%s: %s' % (key, val))
ret.append('self.var1: %s' % (self.var1,))
return '{' + '; '.join(ret) + '}'
__repr__ = __str__
class MyListSubclass(list):
def __init__(self):
list.__init__(self)
self.var1 = 11
self.append('a')
self.append('b')
def __str__(self):
ret = []
for obj in self:
ret.append(repr(obj))
ret.append('self.var1: %s' % (self.var1,))
return '[' + ', '.join(ret) + ']'
__repr__ = __str__
class MySetSubclass(set):
def __init__(self):
set.__init__(self)
self.var1 = 12
self.add('a')
def __str__(self):
ret = []
for obj in sorted(self):
ret.append(repr(obj))
ret.append('self.var1: %s' % (self.var1,))
return 'set([' + ', '.join(ret) + '])'
__repr__ = __str__
class MyTupleSubclass(tuple):
def __new__ (cls):
return super(MyTupleSubclass, cls).__new__(cls, tuple(['a', 1]))
def __init__(self):
self.var1 = 13
def __str__(self):
ret = []
for obj in self:
ret.append(repr(obj))
ret.append('self.var1: %s' % (self.var1,))
return 'tuple(' + ', '.join(ret) + ')'
__repr__ = __str__
def Call():
variable_for_test_1 = MyListSubclass()
variable_for_test_2 = MySetSubclass()
variable_for_test_3 = MyDictSubclass()
variable_for_test_4 = MyTupleSubclass()
all_vars_set = True # Break here
if __name__ == '__main__':
Call()
print('TEST SUCEEDED!')
|
class Mydictsubclass(dict):
def __init__(self):
dict.__init__(self)
self.var1 = 10
self['in_dct'] = 20
def __str__(self):
ret = []
for (key, val) in sorted(self.items()):
ret.append('%s: %s' % (key, val))
ret.append('self.var1: %s' % (self.var1,))
return '{' + '; '.join(ret) + '}'
__repr__ = __str__
class Mylistsubclass(list):
def __init__(self):
list.__init__(self)
self.var1 = 11
self.append('a')
self.append('b')
def __str__(self):
ret = []
for obj in self:
ret.append(repr(obj))
ret.append('self.var1: %s' % (self.var1,))
return '[' + ', '.join(ret) + ']'
__repr__ = __str__
class Mysetsubclass(set):
def __init__(self):
set.__init__(self)
self.var1 = 12
self.add('a')
def __str__(self):
ret = []
for obj in sorted(self):
ret.append(repr(obj))
ret.append('self.var1: %s' % (self.var1,))
return 'set([' + ', '.join(ret) + '])'
__repr__ = __str__
class Mytuplesubclass(tuple):
def __new__(cls):
return super(MyTupleSubclass, cls).__new__(cls, tuple(['a', 1]))
def __init__(self):
self.var1 = 13
def __str__(self):
ret = []
for obj in self:
ret.append(repr(obj))
ret.append('self.var1: %s' % (self.var1,))
return 'tuple(' + ', '.join(ret) + ')'
__repr__ = __str__
def call():
variable_for_test_1 = my_list_subclass()
variable_for_test_2 = my_set_subclass()
variable_for_test_3 = my_dict_subclass()
variable_for_test_4 = my_tuple_subclass()
all_vars_set = True
if __name__ == '__main__':
call()
print('TEST SUCEEDED!')
|
class MessageParsingError(Exception):
"""Message format is not compliant with the wire format"""
def __init__(self, message: str, error: Exception = None):
self.error = error
self.message = message
class SchemaParsingError(Exception):
"""Error while parsing a JSON schema descriptor."""
class InvalidWriterStream(Exception):
"""Error while writing to the stream buffer."""
class DecodingError(Exception):
"""Error while decoding the avro binary."""
class EncodingError(Exception):
"""Error while encoding data in to avro binary."""
|
class Messageparsingerror(Exception):
"""Message format is not compliant with the wire format"""
def __init__(self, message: str, error: Exception=None):
self.error = error
self.message = message
class Schemaparsingerror(Exception):
"""Error while parsing a JSON schema descriptor."""
class Invalidwriterstream(Exception):
"""Error while writing to the stream buffer."""
class Decodingerror(Exception):
"""Error while decoding the avro binary."""
class Encodingerror(Exception):
"""Error while encoding data in to avro binary."""
|
class QueryFileHandler:
@staticmethod
def load_queries(file_name: str):
file = open(file_name, 'r')
query = file.read()
file.close()
query_list = [s and s.strip() for s in query.split(';')]
return list(filter(None, query_list))
|
class Queryfilehandler:
@staticmethod
def load_queries(file_name: str):
file = open(file_name, 'r')
query = file.read()
file.close()
query_list = [s and s.strip() for s in query.split(';')]
return list(filter(None, query_list))
|
K = int(input())
result = 0
for A in range(1, K + 1):
for B in range(1, K + 1):
if A * B > K:
break
result += K // (A * B)
print(result)
|
k = int(input())
result = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
if A * B > K:
break
result += K // (A * B)
print(result)
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
class ToscaGraph(object):
'''Graph of Tosca Node Templates.'''
def __init__(self, nodetemplates):
self.nodetemplates = nodetemplates
self.vertices = {}
self._create()
def _create_vertex(self, node):
if node not in self.vertices:
self.vertices[node.name] = node
def _create_edge(self, node1, node2, relationship):
if node1 not in self.vertices:
self._create_vertex(node1)
self.vertices[node1.name].related[node2] = relationship
def vertex(self, node):
if node in self.vertices:
return self.vertices[node]
def __iter__(self):
return iter(self.vertices.values())
def _create(self):
for node in self.nodetemplates:
for relTpl, req, reqDef in node.relationships:
for tpl in self.nodetemplates:
if tpl.name == relTpl.target.name:
self._create_edge(node, tpl, relTpl.type_definition)
self._create_vertex(node)
|
class Toscagraph(object):
"""Graph of Tosca Node Templates."""
def __init__(self, nodetemplates):
self.nodetemplates = nodetemplates
self.vertices = {}
self._create()
def _create_vertex(self, node):
if node not in self.vertices:
self.vertices[node.name] = node
def _create_edge(self, node1, node2, relationship):
if node1 not in self.vertices:
self._create_vertex(node1)
self.vertices[node1.name].related[node2] = relationship
def vertex(self, node):
if node in self.vertices:
return self.vertices[node]
def __iter__(self):
return iter(self.vertices.values())
def _create(self):
for node in self.nodetemplates:
for (rel_tpl, req, req_def) in node.relationships:
for tpl in self.nodetemplates:
if tpl.name == relTpl.target.name:
self._create_edge(node, tpl, relTpl.type_definition)
self._create_vertex(node)
|
"""
Simple module for calculating and displaying the time an algorithm for
a given Euler problem took to run
Author: Miguel Rentes
"""
def elapsed_time(elapsed):
"""
Computes the amount of time spent by the algorithm and outputs the time
"""
hours = int(elapsed / 3600) # hours
minutes = int((elapsed % 3600) / 60) # minutes
seconds = int(elapsed) % 60 # seconds
milliseconds = int((elapsed - int(elapsed)) * 1000) # milliseconds
print('time:', elapsed, 's ~', hours, 'hour,', minutes, 'min,', seconds, 's,', milliseconds, 'ms')
|
"""
Simple module for calculating and displaying the time an algorithm for
a given Euler problem took to run
Author: Miguel Rentes
"""
def elapsed_time(elapsed):
"""
Computes the amount of time spent by the algorithm and outputs the time
"""
hours = int(elapsed / 3600)
minutes = int(elapsed % 3600 / 60)
seconds = int(elapsed) % 60
milliseconds = int((elapsed - int(elapsed)) * 1000)
print('time:', elapsed, 's ~', hours, 'hour,', minutes, 'min,', seconds, 's,', milliseconds, 'ms')
|
# import requests
# from bs4 import BeautifulSoup
# with open('file:///home/shubham/fridaybeautifulsoup.html','r')
# def table(a,b):
# if a==1 :
# return 1
# return b*table(a-1,b)
# print(table(10,5))
# def pow(n) :
# if n==1 :
# return 2**n
# return 2*pow(n-1)
# # print(pow(3))
# def n(a) :
# if a==0 :
# return 0
# # print(a)
# n(a-1)
# print((a*5))
# print(n(10))
# print(100*("string\n\n"))
# print()
d=""
# for i in (a.split(",")
# for i in a :
# if i.isalpha() :
# d=d+i
# print(d)
# for i in (a.split(",")) :
# d=d+i
# print(type(d))
a=['saikira','bhopland','petland','bhatland']
f=[]
for i in a[::-1] :
f.append(i[::-1])
print(f)
|
d = ''
a = ['saikira', 'bhopland', 'petland', 'bhatland']
f = []
for i in a[::-1]:
f.append(i[::-1])
print(f)
|
class NetworkException(Exception):
pass
class SecretException(Exception):
pass
|
class Networkexception(Exception):
pass
class Secretexception(Exception):
pass
|
# -*- coding: utf-8 -*-
"""
A sample of kay settings.
:Copyright: (c) 2009 Accense Technology, Inc.
Takashi Matsuo <[email protected]>,
All rights reserved.
:license: BSD, see LICENSE for more details.
"""
DEBUG = False
ROOT_URL_MODULE = 'kay.tests.globalurls'
INSTALLED_APPS = (
'kay.tests',
)
APP_MOUNT_POINTS = {
'kay.tests': '/',
}
# You can remove following settings if unnecessary.
CONTEXT_PROCESSORS = (
'kay.context_processors.request',
'kay.context_processors.url_functions',
'kay.context_processors.media_url',
)
MIDDLEWARE_CLASSES = (
'kay.ext.appstats.middleware.AppStatsMiddleware',
)
|
"""
A sample of kay settings.
:Copyright: (c) 2009 Accense Technology, Inc.
Takashi Matsuo <[email protected]>,
All rights reserved.
:license: BSD, see LICENSE for more details.
"""
debug = False
root_url_module = 'kay.tests.globalurls'
installed_apps = ('kay.tests',)
app_mount_points = {'kay.tests': '/'}
context_processors = ('kay.context_processors.request', 'kay.context_processors.url_functions', 'kay.context_processors.media_url')
middleware_classes = ('kay.ext.appstats.middleware.AppStatsMiddleware',)
|
# -*- coding: utf-8 -*-
"""
@author:XuMing([email protected])
@description:
"""
class NgramUtil(object):
@staticmethod
def unigrams(words):
"""
Input: a list of words, e.g., ["I", "am", "Denny"]
Output: a list of unigram
"""
assert type(words) == list
return words
@staticmethod
def bigrams(words, join_string, skip=0):
"""
Input: a list of words, e.g., ["I", "am", "Denny"]
Output: a list of bigram, e.g., ["I_am", "am_Denny"]
"""
assert type(words) == list
L = len(words)
if L > 1:
lst = []
for i in range(L - 1):
for k in range(1, skip + 2):
if i + k < L:
lst.append(join_string.join([words[i], words[i + k]]))
else:
# set it as unigram
lst = NgramUtil.unigrams(words)
return lst
@staticmethod
def trigrams(words, join_string, skip=0):
"""
Input: a list of words, e.g., ["I", "am", "Denny"]
Output: a list of trigram, e.g., ["I_am_Denny"]
"""
assert type(words) == list
L = len(words)
if L > 2:
lst = []
for i in range(L - 2):
for k1 in range(1, skip + 2):
for k2 in range(1, skip + 2):
if i + k1 < L and i + k1 + k2 < L:
lst.append(join_string.join([words[i], words[i + k1], words[i + k1 + k2]]))
else:
# set it as bigram
lst = NgramUtil.bigrams(words, join_string, skip)
return lst
@staticmethod
def fourgrams(words, join_string):
"""
Input: a list of words, e.g., ["I", "am", "Denny", "boy"]
Output: a list of trigram, e.g., ["I_am_Denny_boy"]
"""
assert type(words) == list
L = len(words)
if L > 3:
lst = []
for i in range(L - 3):
lst.append(join_string.join([words[i], words[i + 1], words[i + 2], words[i + 3]]))
else:
# set it as trigram
lst = NgramUtil.trigrams(words, join_string)
return lst
@staticmethod
def uniterms(words):
return NgramUtil.unigrams(words)
@staticmethod
def biterms(words, join_string):
"""
Input: a list of words, e.g., ["I", "am", "Denny", "boy"]
Output: a list of biterm, e.g., ["I_am", "I_Denny", "I_boy", "am_Denny", "am_boy", "Denny_boy"]
"""
assert type(words) == list
L = len(words)
if L > 1:
lst = []
for i in range(L - 1):
for j in range(i + 1, L):
lst.append(join_string.join([words[i], words[j]]))
else:
# set it as uniterm
lst = NgramUtil.uniterms(words)
return lst
@staticmethod
def triterms(words, join_string):
"""
Input: a list of words, e.g., ["I", "am", "Denny", "boy"]
Output: a list of triterm, e.g., ["I_am_Denny", "I_am_boy", "I_Denny_boy", "am_Denny_boy"]
"""
assert type(words) == list
L = len(words)
if L > 2:
lst = []
for i in range(L - 2):
for j in range(i + 1, L - 1):
for k in range(j + 1, L):
lst.append(join_string.join([words[i], words[j], words[k]]))
else:
# set it as biterm
lst = NgramUtil.biterms(words, join_string)
return lst
@staticmethod
def fourterms(words, join_string):
"""
Input: a list of words, e.g., ["I", "am", "Denny", "boy", "ha"]
Output: a list of fourterm, e.g., ["I_am_Denny_boy", "I_am_Denny_ha", "I_am_boy_ha", "I_Denny_boy_ha", "am_Denny_boy_ha"]
"""
assert type(words) == list
L = len(words)
if L > 3:
lst = []
for i in range(L - 3):
for j in range(i + 1, L - 2):
for k in range(j + 1, L - 1):
for l in range(k + 1, L):
lst.append(join_string.join([words[i], words[j], words[k], words[l]]))
else:
# set it as triterm
lst = NgramUtil.triterms(words, join_string)
return lst
@staticmethod
def ngrams(words, ngram, join_string=" "):
"""
wrapper for ngram
"""
ngram = int(ngram)
if ngram == 1:
return NgramUtil.unigrams(words)
elif ngram == 2:
return NgramUtil.bigrams(words, join_string)
elif ngram == 3:
return NgramUtil.trigrams(words, join_string)
elif ngram == 4:
return NgramUtil.fourgrams(words, join_string)
elif ngram == 12:
unigram = NgramUtil.unigrams(words)
bigram = [x for x in NgramUtil.bigrams(words, join_string) if len(x.split(join_string)) == 2]
return unigram + bigram
elif ngram == 123:
unigram = NgramUtil.unigrams(words)
bigram = [x for x in NgramUtil.bigrams(words, join_string) if len(x.split(join_string)) == 2]
trigram = [x for x in NgramUtil.trigrams(words, join_string) if len(x.split(join_string)) == 3]
return unigram + bigram + trigram
elif ngram == 1234:
unigram = NgramUtil.unigrams(words)
bigram = [x for x in NgramUtil.bigrams(words, join_string) if len(x.split(join_string)) == 2]
trigram = [x for x in NgramUtil.trigrams(words, join_string) if len(x.split(join_string)) == 3]
fourgram = [x for x in NgramUtil.fourgrams(words, join_string) if len(x.split(join_string)) == 4]
return unigram + bigram + trigram + fourgram
@staticmethod
def nterms(words, nterm, join_string=" "):
"""wrapper for nterm"""
if nterm == 1:
return NgramUtil.uniterms(words)
elif nterm == 2:
return NgramUtil.biterms(words, join_string)
elif nterm == 3:
return NgramUtil.triterms(words, join_string)
elif nterm == 4:
return NgramUtil.fourterms(words, join_string)
|
"""
@author:XuMing([email protected])
@description:
"""
class Ngramutil(object):
@staticmethod
def unigrams(words):
"""
Input: a list of words, e.g., ["I", "am", "Denny"]
Output: a list of unigram
"""
assert type(words) == list
return words
@staticmethod
def bigrams(words, join_string, skip=0):
"""
Input: a list of words, e.g., ["I", "am", "Denny"]
Output: a list of bigram, e.g., ["I_am", "am_Denny"]
"""
assert type(words) == list
l = len(words)
if L > 1:
lst = []
for i in range(L - 1):
for k in range(1, skip + 2):
if i + k < L:
lst.append(join_string.join([words[i], words[i + k]]))
else:
lst = NgramUtil.unigrams(words)
return lst
@staticmethod
def trigrams(words, join_string, skip=0):
"""
Input: a list of words, e.g., ["I", "am", "Denny"]
Output: a list of trigram, e.g., ["I_am_Denny"]
"""
assert type(words) == list
l = len(words)
if L > 2:
lst = []
for i in range(L - 2):
for k1 in range(1, skip + 2):
for k2 in range(1, skip + 2):
if i + k1 < L and i + k1 + k2 < L:
lst.append(join_string.join([words[i], words[i + k1], words[i + k1 + k2]]))
else:
lst = NgramUtil.bigrams(words, join_string, skip)
return lst
@staticmethod
def fourgrams(words, join_string):
"""
Input: a list of words, e.g., ["I", "am", "Denny", "boy"]
Output: a list of trigram, e.g., ["I_am_Denny_boy"]
"""
assert type(words) == list
l = len(words)
if L > 3:
lst = []
for i in range(L - 3):
lst.append(join_string.join([words[i], words[i + 1], words[i + 2], words[i + 3]]))
else:
lst = NgramUtil.trigrams(words, join_string)
return lst
@staticmethod
def uniterms(words):
return NgramUtil.unigrams(words)
@staticmethod
def biterms(words, join_string):
"""
Input: a list of words, e.g., ["I", "am", "Denny", "boy"]
Output: a list of biterm, e.g., ["I_am", "I_Denny", "I_boy", "am_Denny", "am_boy", "Denny_boy"]
"""
assert type(words) == list
l = len(words)
if L > 1:
lst = []
for i in range(L - 1):
for j in range(i + 1, L):
lst.append(join_string.join([words[i], words[j]]))
else:
lst = NgramUtil.uniterms(words)
return lst
@staticmethod
def triterms(words, join_string):
"""
Input: a list of words, e.g., ["I", "am", "Denny", "boy"]
Output: a list of triterm, e.g., ["I_am_Denny", "I_am_boy", "I_Denny_boy", "am_Denny_boy"]
"""
assert type(words) == list
l = len(words)
if L > 2:
lst = []
for i in range(L - 2):
for j in range(i + 1, L - 1):
for k in range(j + 1, L):
lst.append(join_string.join([words[i], words[j], words[k]]))
else:
lst = NgramUtil.biterms(words, join_string)
return lst
@staticmethod
def fourterms(words, join_string):
"""
Input: a list of words, e.g., ["I", "am", "Denny", "boy", "ha"]
Output: a list of fourterm, e.g., ["I_am_Denny_boy", "I_am_Denny_ha", "I_am_boy_ha", "I_Denny_boy_ha", "am_Denny_boy_ha"]
"""
assert type(words) == list
l = len(words)
if L > 3:
lst = []
for i in range(L - 3):
for j in range(i + 1, L - 2):
for k in range(j + 1, L - 1):
for l in range(k + 1, L):
lst.append(join_string.join([words[i], words[j], words[k], words[l]]))
else:
lst = NgramUtil.triterms(words, join_string)
return lst
@staticmethod
def ngrams(words, ngram, join_string=' '):
"""
wrapper for ngram
"""
ngram = int(ngram)
if ngram == 1:
return NgramUtil.unigrams(words)
elif ngram == 2:
return NgramUtil.bigrams(words, join_string)
elif ngram == 3:
return NgramUtil.trigrams(words, join_string)
elif ngram == 4:
return NgramUtil.fourgrams(words, join_string)
elif ngram == 12:
unigram = NgramUtil.unigrams(words)
bigram = [x for x in NgramUtil.bigrams(words, join_string) if len(x.split(join_string)) == 2]
return unigram + bigram
elif ngram == 123:
unigram = NgramUtil.unigrams(words)
bigram = [x for x in NgramUtil.bigrams(words, join_string) if len(x.split(join_string)) == 2]
trigram = [x for x in NgramUtil.trigrams(words, join_string) if len(x.split(join_string)) == 3]
return unigram + bigram + trigram
elif ngram == 1234:
unigram = NgramUtil.unigrams(words)
bigram = [x for x in NgramUtil.bigrams(words, join_string) if len(x.split(join_string)) == 2]
trigram = [x for x in NgramUtil.trigrams(words, join_string) if len(x.split(join_string)) == 3]
fourgram = [x for x in NgramUtil.fourgrams(words, join_string) if len(x.split(join_string)) == 4]
return unigram + bigram + trigram + fourgram
@staticmethod
def nterms(words, nterm, join_string=' '):
"""wrapper for nterm"""
if nterm == 1:
return NgramUtil.uniterms(words)
elif nterm == 2:
return NgramUtil.biterms(words, join_string)
elif nterm == 3:
return NgramUtil.triterms(words, join_string)
elif nterm == 4:
return NgramUtil.fourterms(words, join_string)
|
st=input("Enter the binary string\n")
l=len(st)
a=[]
for i in range(l-1,-1,-1):
if a==[]:
a.append(st[i])
else:
p=a.pop()
if st[i] != p:
a.append(p)
a.append(st[i])
if len(a)==0:
print(-1)
else:
for i in range(len(a)):
print(a.pop(),end="")
|
st = input('Enter the binary string\n')
l = len(st)
a = []
for i in range(l - 1, -1, -1):
if a == []:
a.append(st[i])
else:
p = a.pop()
if st[i] != p:
a.append(p)
a.append(st[i])
if len(a) == 0:
print(-1)
else:
for i in range(len(a)):
print(a.pop(), end='')
|
# Project Euler #6: Sum square difference
n = 1
s = 0
s2 = 0
while n <= 100:
s += n
s2 += n * n
n += 1
print(s * s - s2)
|
n = 1
s = 0
s2 = 0
while n <= 100:
s += n
s2 += n * n
n += 1
print(s * s - s2)
|
# https://www.hackerrank.com/challenges/ctci-queue-using-two-stacks/problem
class MyQueue(object):
def __init__(self):
self.one = []
self.two = []
def peek(self): return self.two[-1]
def pop(self): return self.two.pop()
def put(self, value): self.one.append(value)
def check(self):
if not len(self.two):
while self.one: self.two.append(self.one.pop())
queue = MyQueue()
t = int(input())
for line in range(t):
values = map(int, input().split())
values = list(values)
queue.check()
if values[0] == 1:
queue.put(values[1])
elif values[0] == 2:
queue.pop()
else:
print(queue.peek())
|
class Myqueue(object):
def __init__(self):
self.one = []
self.two = []
def peek(self):
return self.two[-1]
def pop(self):
return self.two.pop()
def put(self, value):
self.one.append(value)
def check(self):
if not len(self.two):
while self.one:
self.two.append(self.one.pop())
queue = my_queue()
t = int(input())
for line in range(t):
values = map(int, input().split())
values = list(values)
queue.check()
if values[0] == 1:
queue.put(values[1])
elif values[0] == 2:
queue.pop()
else:
print(queue.peek())
|
line = input()
while not line == "Stop":
print(line)
line = input()
|
line = input()
while not line == 'Stop':
print(line)
line = input()
|
# coding=utf-8
class App:
DEBUG = False
TESTING = False
|
class App:
debug = False
testing = False
|
total_cost = input("Enter the cost of your dream house: ")
total_cost = float(total_cost)
annual_salary = input("Enter your annual income: ")
annual_salary = float(annual_salary)
portion_saved = input("Enter the percent of your income you will save: ")
if portion_saved.find("%") or portion_saved.startswith("%") :
portion_saved = portion_saved.replace("%", "")
if float(portion_saved) >= 1 :
portion_saved = float(portion_saved)
portion_saved /= 100
portion_down_payment = 0.25
r = 0.04
current_savings = 0.0
down_payment = total_cost * portion_down_payment
monthly_salary = annual_salary/12
months = 0
while current_savings < down_payment :
current_savings += current_savings*(r/12)
current_savings += monthly_salary*portion_saved
months += 1
print("It will take", months, "months to save enough money for the down payment.")
|
total_cost = input('Enter the cost of your dream house: ')
total_cost = float(total_cost)
annual_salary = input('Enter your annual income: ')
annual_salary = float(annual_salary)
portion_saved = input('Enter the percent of your income you will save: ')
if portion_saved.find('%') or portion_saved.startswith('%'):
portion_saved = portion_saved.replace('%', '')
if float(portion_saved) >= 1:
portion_saved = float(portion_saved)
portion_saved /= 100
portion_down_payment = 0.25
r = 0.04
current_savings = 0.0
down_payment = total_cost * portion_down_payment
monthly_salary = annual_salary / 12
months = 0
while current_savings < down_payment:
current_savings += current_savings * (r / 12)
current_savings += monthly_salary * portion_saved
months += 1
print('It will take', months, 'months to save enough money for the down payment.')
|
def metade(p):
r = p / 2
return r
def dobro(p):
r = p * 2
return r
def aumentar(p, taxa):
r = p + ((p * taxa) / 100)
return r
def diminuir(p, taxa):
r = p - ((p * taxa) / 100)
return r
|
def metade(p):
r = p / 2
return r
def dobro(p):
r = p * 2
return r
def aumentar(p, taxa):
r = p + p * taxa / 100
return r
def diminuir(p, taxa):
r = p - p * taxa / 100
return r
|
# Copyright (c) 2019 The Bazel Utils Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This function is taken from
# LICENSE: BSD
# URL: https://github.com/RobotLocomotion/drake/blob/47987499486349ba47ece6f30519aaf8f868bbe9/tools/skylark/drake_cc.bzl
# Modificiation:
# - Modify comment: linux -> elsewhere
def dsym_command(name):
"""Returns the command to produce .dSYM on macOS, or a no-op on elsewhere."""
return select({
"@com_chokobole_bazel_utils//:apple_debug": (
"dsymutil -f $(location :" + name + ") -o $@ 2> /dev/null"
),
"//conditions:default": (
"touch $@"
),
})
def dsym(
name,
tags = ["dsym"],
visibility = ["//visibility:private"],
**kwargs):
native.genrule(
name = name + "_dsym",
srcs = [":" + name],
outs = [name + ".dSYM"],
output_to_bindir = 1,
tags = tags,
visibility = visibility,
cmd = dsym_command(name),
**kwargs
)
|
def dsym_command(name):
"""Returns the command to produce .dSYM on macOS, or a no-op on elsewhere."""
return select({'@com_chokobole_bazel_utils//:apple_debug': 'dsymutil -f $(location :' + name + ') -o $@ 2> /dev/null', '//conditions:default': 'touch $@'})
def dsym(name, tags=['dsym'], visibility=['//visibility:private'], **kwargs):
native.genrule(name=name + '_dsym', srcs=[':' + name], outs=[name + '.dSYM'], output_to_bindir=1, tags=tags, visibility=visibility, cmd=dsym_command(name), **kwargs)
|
"""
You're given a string consisting solely of (, ), and *. * can represent either a (, ),
or an empty string. Determine whether the parentheses are balanced.
For example, (()* and (*) are balanced. )*( is not balanced.
"""
def is_balanced(text: str) -> bool:
size = len(text)
index = 0
stack = []
while index < size:
if text[index] == "(":
stack.append("(")
elif text[index] == ")":
if stack and stack[-1] == "(":
stack.pop()
else:
return False
index += 1
return not stack
def balanced_parentheses(text: str, index: int = 0) -> bool:
"""
each * can be one of "", ")", "("
"""
if not text:
return True
if index < len(text):
if text[index] == "*":
before = text[:index]
after = text[index + 1 :]
return (
balanced_parentheses(before + after, index)
or balanced_parentheses(before + ")" + after, index + 1)
or balanced_parentheses(before + "(" + after, index + 1)
)
else:
return balanced_parentheses(text, index + 1)
else:
return is_balanced(text)
if __name__ == "__main__":
assert balanced_parentheses("(()*") is True
assert balanced_parentheses("(()*))") is True
assert balanced_parentheses("(()*)") is True
assert balanced_parentheses("(*)") is True
assert balanced_parentheses(")*(") is False
|
"""
You're given a string consisting solely of (, ), and *. * can represent either a (, ),
or an empty string. Determine whether the parentheses are balanced.
For example, (()* and (*) are balanced. )*( is not balanced.
"""
def is_balanced(text: str) -> bool:
size = len(text)
index = 0
stack = []
while index < size:
if text[index] == '(':
stack.append('(')
elif text[index] == ')':
if stack and stack[-1] == '(':
stack.pop()
else:
return False
index += 1
return not stack
def balanced_parentheses(text: str, index: int=0) -> bool:
"""
each * can be one of "", ")", "("
"""
if not text:
return True
if index < len(text):
if text[index] == '*':
before = text[:index]
after = text[index + 1:]
return balanced_parentheses(before + after, index) or balanced_parentheses(before + ')' + after, index + 1) or balanced_parentheses(before + '(' + after, index + 1)
else:
return balanced_parentheses(text, index + 1)
else:
return is_balanced(text)
if __name__ == '__main__':
assert balanced_parentheses('(()*') is True
assert balanced_parentheses('(()*))') is True
assert balanced_parentheses('(()*)') is True
assert balanced_parentheses('(*)') is True
assert balanced_parentheses(')*(') is False
|
# Copyright 2009-2017 Ram Rachum.
# This program is distributed under the MIT license.
class ReasonedBool:
'''
A variation on `bool` that also gives a `.reason`.
This is useful when you want to say "This is False because... (reason.)"
Unfortunately this class is not a subclass of `bool`, since Python doesn't
allow subclassing `bool`.
'''
def __init__(self, value, reason=None):
'''
Construct the `ReasonedBool`.
`reason` is the reason *why* it has a value of `True` or `False`. It is
usually a string, but is allowed to be of any type.
'''
self.value = bool(value)
self.reason = reason
def __repr__(self):
if self.reason is not None:
return f'<{self.value} because {repr(self.reason)}>'
else: # self.reason is None
return f'<{self.value} with no reason>'
def __eq__(self, other):
return bool(self) == other
def __hash__(self):
return hash(bool(self))
def __neq__(self, other):
return not self.__eq__(other)
def __bool__(self):
return self.value
|
class Reasonedbool:
"""
A variation on `bool` that also gives a `.reason`.
This is useful when you want to say "This is False because... (reason.)"
Unfortunately this class is not a subclass of `bool`, since Python doesn't
allow subclassing `bool`.
"""
def __init__(self, value, reason=None):
"""
Construct the `ReasonedBool`.
`reason` is the reason *why* it has a value of `True` or `False`. It is
usually a string, but is allowed to be of any type.
"""
self.value = bool(value)
self.reason = reason
def __repr__(self):
if self.reason is not None:
return f'<{self.value} because {repr(self.reason)}>'
else:
return f'<{self.value} with no reason>'
def __eq__(self, other):
return bool(self) == other
def __hash__(self):
return hash(bool(self))
def __neq__(self, other):
return not self.__eq__(other)
def __bool__(self):
return self.value
|
form = 'form.signin'
form_username = 'form.signin [name="session[username_or_email]"]'
form_password = 'form.signin [name="session[password]"]'
form_phone = '#challenge_response'
def login(browser, username, password):
browser.fill(form_username, username)
# For some reason filling of the password is flaky and needs to be
# repeated until the input really gets the value set
while not browser.value(form_password):
browser.fill(form_password, password)
browser.submit(form)
def verify_phone(browser, phone=None):
if browser.is_visible(form_phone):
if phone:
browser.fill(form_phone, phone)
browser.submit(form_phone)
else:
raise Exception('TweetDeck login prompted for phone '
'number, but none was provided')
|
form = 'form.signin'
form_username = 'form.signin [name="session[username_or_email]"]'
form_password = 'form.signin [name="session[password]"]'
form_phone = '#challenge_response'
def login(browser, username, password):
browser.fill(form_username, username)
while not browser.value(form_password):
browser.fill(form_password, password)
browser.submit(form)
def verify_phone(browser, phone=None):
if browser.is_visible(form_phone):
if phone:
browser.fill(form_phone, phone)
browser.submit(form_phone)
else:
raise exception('TweetDeck login prompted for phone number, but none was provided')
|
while True:
try:
n = int(input())
if ((n >= 0 and n < 90) or n == 360):
print('Bom Dia!!')
elif (n >=90 and n < 180):
print('Boa Tarde!!')
elif (n >= 180 and n < 270):
print('Boa Noite!!')
elif (n >= 270 and n < 360):
print('De Madrugada!!')
except EOFError:
break
|
while True:
try:
n = int(input())
if n >= 0 and n < 90 or n == 360:
print('Bom Dia!!')
elif n >= 90 and n < 180:
print('Boa Tarde!!')
elif n >= 180 and n < 270:
print('Boa Noite!!')
elif n >= 270 and n < 360:
print('De Madrugada!!')
except EOFError:
break
|
class PytraitError(RuntimeError):
pass
class DisallowedInitError(PytraitError):
pass
class NonMethodAttrError(PytraitError):
pass
class MultipleImplementationError(PytraitError):
pass
class InheritanceError(PytraitError):
pass
class NamingConventionError(PytraitError):
pass
|
class Pytraiterror(RuntimeError):
pass
class Disallowediniterror(PytraitError):
pass
class Nonmethodattrerror(PytraitError):
pass
class Multipleimplementationerror(PytraitError):
pass
class Inheritanceerror(PytraitError):
pass
class Namingconventionerror(PytraitError):
pass
|
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"URL": "00_downloading_pdfs.ipynb",
"PDF_PATH": "00_downloading_pdfs.ipynb",
"identify_links_for_pdfs": "00_downloading_pdfs.ipynb",
"download_file": "00_downloading_pdfs.ipynb",
"collect_multiple_files": "00_downloading_pdfs.ipynb",
"get_ix": "01_parsing_roll_call_votes.ipynb",
"useful_string": "01_parsing_roll_call_votes.ipynb",
"SummaryParser": "01_parsing_roll_call_votes.ipynb",
"VotesParser": "01_parsing_roll_call_votes.ipynb",
"get_all_issues": "01_parsing_roll_call_votes.ipynb"}
modules = ["download.py",
"parse.py"]
doc_url = "https://eschmidt42.github.io/eu_parliament/"
git_url = "https://github.com/eschmidt42/eu_parliament/tree/master/"
def custom_doc_links(name): return None
|
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'URL': '00_downloading_pdfs.ipynb', 'PDF_PATH': '00_downloading_pdfs.ipynb', 'identify_links_for_pdfs': '00_downloading_pdfs.ipynb', 'download_file': '00_downloading_pdfs.ipynb', 'collect_multiple_files': '00_downloading_pdfs.ipynb', 'get_ix': '01_parsing_roll_call_votes.ipynb', 'useful_string': '01_parsing_roll_call_votes.ipynb', 'SummaryParser': '01_parsing_roll_call_votes.ipynb', 'VotesParser': '01_parsing_roll_call_votes.ipynb', 'get_all_issues': '01_parsing_roll_call_votes.ipynb'}
modules = ['download.py', 'parse.py']
doc_url = 'https://eschmidt42.github.io/eu_parliament/'
git_url = 'https://github.com/eschmidt42/eu_parliament/tree/master/'
def custom_doc_links(name):
return None
|
SD_COMMENT="This is for local development"
SHELTERLUV_SECRET_TOKEN=""
APP_SECRET_KEY="ASKASK"
JWT_SECRET="JWTSECRET"
POSTGRES_PASSWORD="thispasswordisverysecure"
BASEUSER_PW="basepw"
BASEEDITOR_PW="editorpw"
BASEADMIN_PW="basepw"
DROPBOX_APP="DBAPPPW"
|
sd_comment = 'This is for local development'
shelterluv_secret_token = ''
app_secret_key = 'ASKASK'
jwt_secret = 'JWTSECRET'
postgres_password = 'thispasswordisverysecure'
baseuser_pw = 'basepw'
baseeditor_pw = 'editorpw'
baseadmin_pw = 'basepw'
dropbox_app = 'DBAPPPW'
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
'''
def _jupyter_server_extension_paths():
return [{
'module':'nbtemplate'
}];
def _jupyter_nbextension_paths():
return [
dict(
section='notebook',
src='static', # path is relative to `nbtemplate` directory
dest='nbtemplate', # directory in `nbextension/` namespace
require='nbtemplate/main' # _also_ in `nbextension/` namespace
),
dict(
section='notebook',
src='static',
dest='nbtemplate',
require='nbtemplate/templateSelector'
),
dict(
section='notebook',
src='static',
dest='nbtemplate',
require='nbtemplate/blockSelector'
)
];
def load_jupyter_server_extension(nbapp):
nbapp.log.info('Loaded nbtemplate!');
|
"""
"""
def _jupyter_server_extension_paths():
return [{'module': 'nbtemplate'}]
def _jupyter_nbextension_paths():
return [dict(section='notebook', src='static', dest='nbtemplate', require='nbtemplate/main'), dict(section='notebook', src='static', dest='nbtemplate', require='nbtemplate/templateSelector'), dict(section='notebook', src='static', dest='nbtemplate', require='nbtemplate/blockSelector')]
def load_jupyter_server_extension(nbapp):
nbapp.log.info('Loaded nbtemplate!')
|
def loadLinux_X86_64bit(visibility=None):
native.new_local_repository(
name = "system_include_x86_64_linux",
path = "/usr/include",
build_file_content = """
cc_library(
name = "soundcard",
hdrs = ["soundcard.h"],
visibility = ["//visibility:public"],
)
cc_library(
name = "ioctl",
hdrs = ["ioctl.h"],
visibility = ["//visibility:public"],
)
cc_library(
name = "types",
hdrs = ["types.h"],
visibility = ["//visibility:public"],
)
cc_library(
name = "fcntl",
hdrs = ["fcntl.h"],
visibility = ["//visibility:public"],
)"""
)
|
def load_linux_x86_64bit(visibility=None):
native.new_local_repository(name='system_include_x86_64_linux', path='/usr/include', build_file_content='\ncc_library(\n name = "soundcard",\n hdrs = ["soundcard.h"],\n visibility = ["//visibility:public"],\n)\ncc_library(\n name = "ioctl",\n hdrs = ["ioctl.h"],\n visibility = ["//visibility:public"],\n)\ncc_library(\n name = "types",\n hdrs = ["types.h"],\n visibility = ["//visibility:public"],\n)\ncc_library(\n name = "fcntl",\n hdrs = ["fcntl.h"],\n visibility = ["//visibility:public"],\n)')
|
"""
PERIODS
"""
numPeriods = 180
"""
STOPS
"""
numStations = 13
station_names = (
"Hamburg Hbf", # 0
"Landwehr", # 1
"Hasselbrook", # 2
"Wansbeker Chaussee*", # 3
"Friedrichsberg*", # 4
"Barmbek*", # 5
"Alte Woehr (Stadtpark)", # 6
"Ruebenkamp (City Nord)", # 7
"Ohlsdorf*", # 8
"Kornweg", # 9
"Hoheneichen", # 10
"Wellingsbuettel", # 11
"Poppenbuettel*", # 12
)
numStops = 26
stops_position = (
(0, 0), # Stop 0
(2, 0), # Stop 1
(3, 0), # Stop 2
(4, 0), # Stop 3
(5, 0), # Stop 4
(6, 0), # Stop 5
(7, 0), # Stop 6
(8, 0), # Stop 7
(9, 0), # Stop 8
(11, 0), # Stop 9
(13, 0), # Stop 10
(14, 0), # Stop 11
(15, 0), # Stop 12
(15, 1), # Stop 13
(15, 1), # Stop 14
(13, 1), # Stop 15
(12, 1), # Stop 16
(11, 1), # Stop 17
(10, 1), # Stop 18
(9, 1), # Stop 19
(8, 1), # Stop 20
(7, 1), # Stop 21
(6, 1), # Stop 22
(4, 1), # Stop 23
(2, 1), # Stop 24
(1, 1), # Stop 25
)
stops_distance = (
(0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 0
(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 1
(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 2
(0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 3
(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 4
(0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 5
(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 6
(0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 7
(0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 8
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 9
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 10
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 11
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 12
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 13
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 14
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 15
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 16
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), # Stop 17
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0), # Stop 18
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0), # Stop 19
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0), # Stop 20
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), # Stop 21
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), # Stop 22
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0), # Stop 23
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2), # Stop 24
(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # Stop 25
)
station_start = 0
"""
TRAMS
"""
numTrams = 18
tram_capacity = 514
tram_capacity_cargo = 304
tram_capacity_min_passenger = 208
tram_capacity_min_cargo = 0
tram_speed = 1
tram_headway = 1
tram_min_service = 1
tram_max_service = 10
min_time_next_tram = 0.333
tram_travel_deviation = 0.167
"""
PASSENGERS
"""
passenger_set = "pas-20210422-1717-int1"
passenger_service_time_board = 0.0145
passenger_service_time_alight = 0.0145
"""
CARGO
"""
numCargo = 70
cargo_size = 4
cargo_station_destination = (
8, # 0
4, # 1
8, # 2
5, # 3
8, # 4
3, # 5
4, # 6
5, # 7
3, # 8
12, # 9
12, # 10
5, # 11
5, # 12
3, # 13
4, # 14
5, # 15
5, # 16
8, # 17
5, # 18
5, # 19
8, # 20
5, # 21
12, # 22
8, # 23
4, # 24
5, # 25
8, # 26
5, # 27
12, # 28
3, # 29
4, # 30
12, # 31
12, # 32
4, # 33
3, # 34
4, # 35
12, # 36
12, # 37
5, # 38
12, # 39
3, # 40
5, # 41
5, # 42
4, # 43
4, # 44
3, # 45
12, # 46
5, # 47
8, # 48
3, # 49
5, # 50
3, # 51
8, # 52
12, # 53
4, # 54
8, # 55
8, # 56
3, # 57
3, # 58
12, # 59
8, # 60
3, # 61
3, # 62
8, # 63
4, # 64
12, # 65
12, # 66
5, # 67
3, # 68
4, # 69
)
cargo_release = (
2, # 0
3, # 1
3, # 2
5, # 3
6, # 4
6, # 5
7, # 6
8, # 7
8, # 8
9, # 9
9, # 10
10, # 11
12, # 12
13, # 13
14, # 14
15, # 15
16, # 16
17, # 17
18, # 18
21, # 19
22, # 20
24, # 21
25, # 22
26, # 23
27, # 24
28, # 25
28, # 26
30, # 27
32, # 28
33, # 29
33, # 30
34, # 31
35, # 32
37, # 33
37, # 34
37, # 35
37, # 36
38, # 37
39, # 38
41, # 39
41, # 40
43, # 41
44, # 42
45, # 43
46, # 44
46, # 45
47, # 46
48, # 47
49, # 48
49, # 49
51, # 50
55, # 51
56, # 52
57, # 53
61, # 54
61, # 55
61, # 56
62, # 57
64, # 58
64, # 59
65, # 60
65, # 61
66, # 62
66, # 63
67, # 64
70, # 65
70, # 66
71, # 67
71, # 68
72, # 69
)
cargo_station_deadline = (
33, # 0
119, # 1
119, # 2
176, # 3
123, # 4
59, # 5
72, # 6
171, # 7
18, # 8
90, # 9
175, # 10
142, # 11
88, # 12
84, # 13
105, # 14
170, # 15
155, # 16
156, # 17
140, # 18
173, # 19
123, # 20
126, # 21
91, # 22
36, # 23
87, # 24
127, # 25
144, # 26
134, # 27
141, # 28
163, # 29
101, # 30
108, # 31
144, # 32
47, # 33
162, # 34
76, # 35
175, # 36
97, # 37
87, # 38
164, # 39
114, # 40
143, # 41
142, # 42
55, # 43
56, # 44
56, # 45
57, # 46
118, # 47
160, # 48
59, # 49
112, # 50
168, # 51
170, # 52
139, # 53
71, # 54
71, # 55
71, # 56
82, # 57
135, # 58
90, # 59
109, # 60
161, # 61
151, # 62
128, # 63
77, # 64
80, # 65
169, # 66
97, # 67
129, # 68
99, # 69
)
cargo_max_delay = 3
cargo_service_time_load = 0.3333333333333333
cargo_service_time_unload = 0.25
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 8991598675325360468762009371570610170
#index for seed sequence child
child_seed_index = (
0, # 0
)
"""
Results from timetabling
"""
scheme = "SI"
method = "timetabling_closed"
passengerData = "0-rep"
downstream_cargo = False
delivery_optional = False
assignment_method = "timetabling_closed"
operating = (
False, # 0
False, # 1
False, # 2
False, # 3
True, # 4
True, # 5
True, # 6
True, # 7
True, # 8
True, # 9
True, # 10
True, # 11
True, # 12
True, # 13
True, # 14
True, # 15
True, # 16
True, # 17
)
tram_tour = (
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 0
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 1
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 2
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 3
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 4
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 5
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 6
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 7
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 8
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 9
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 10
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 11
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 12
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 13
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 14
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 15
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 16
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), # 17
)
tram_time_arrival = (
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 0
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 1
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 2
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 3
(0.0, 3.0, 5.0, 8.0, 10.0, 12.0, 14.0, 16.0, 18.0, 21.0, 24.0, 26.0, 28.0, 30.0, 32.0, 40.0, 43.0, 46.0, 50.0, 52.0, 54.0, 58.0, 60.0, 64.0, 70.0, 80.0), # 4
(2.0, 11.0, 13.0, 15.0, 17.0, 19.0, 22.0, 24.0, 27.0, 30.0, 33.0, 35.0, 37.0, 39.0, 41.0, 48.0, 60.0, 66.0, 71.0, 82.0, 84.0, 86.0, 88.0, 90.0, 92.0, 95.0), # 5
(17.0, 29.0, 31.0, 33.0, 35.0, 37.0, 39.0, 41.0, 43.0, 46.0, 52.0, 54.0, 61.0, 64.0, 72.0, 74.0, 77.0, 80.0, 82.0, 84.0, 86.0, 88.0, 90.0, 92.0, 94.0, 97.0), # 6
(33.0, 40.0, 42.0, 44.0, 46.0, 48.0, 50.0, 52.0, 56.0, 59.0, 64.0, 67.0, 69.0, 72.0, 74.0, 76.0, 79.0, 82.0, 84.0, 86.0, 88.0, 90.0, 92.0, 94.0, 96.0, 99.0), # 7
(39.0, 48.0, 50.0, 52.0, 54.0, 56.0, 58.0, 60.0, 62.0, 65.0, 68.0, 70.0, 72.0, 74.0, 77.0, 79.0, 82.0, 85.0, 87.0, 89.0, 91.0, 93.0, 95.0, 97.0, 99.0, 102.0), # 8
(47.0, 50.0, 52.0, 54.0, 56.0, 58.0, 60.0, 62.0, 64.0, 67.0, 70.0, 72.0, 74.0, 77.0, 79.0, 81.0, 84.0, 87.0, 89.0, 91.0, 93.0, 95.0, 97.0, 99.0, 101.0, 104.0), # 9
(49.0, 52.0, 56.0, 59.0, 64.0, 66.0, 68.0, 70.0, 72.0, 75.0, 78.0, 80.0, 82.0, 84.0, 86.0, 88.0, 91.0, 94.0, 96.0, 98.0, 100.0, 102.0, 105.0, 107.0, 109.0, 112.0), # 10
(53.0, 64.0, 66.0, 68.0, 70.0, 72.0, 74.0, 76.0, 78.0, 81.0, 84.0, 86.0, 88.0, 90.0, 92.0, 94.0, 97.0, 103.0, 105.0, 107.0, 109.0, 120.0, 131.0, 142.0, 145.0, 157.0), # 11
(63.0, 67.0, 69.0, 71.0, 73.0, 75.0, 77.0, 79.0, 81.0, 84.0, 87.0, 89.0, 91.0, 94.0, 96.0, 107.0, 113.0, 123.0, 127.0, 133.0, 138.0, 144.0, 151.0, 162.0, 164.0, 168.0), # 12
(66.0, 70.0, 72.0, 74.0, 76.0, 78.0, 80.0, 82.0, 84.0, 87.0, 90.0, 92.0, 95.0, 97.0, 108.0, 113.0, 122.0, 133.0, 136.0, 138.0, 149.0, 153.0, 162.0, 164.0, 167.0, 170.0), # 13
(69.0, 73.0, 75.0, 77.0, 79.0, 81.0, 83.0, 85.0, 87.0, 90.0, 93.0, 95.0, 97.0, 108.0, 113.0, 122.0, 132.0, 137.0, 142.0, 153.0, 155.0, 163.0, 165.0, 167.0, 169.0, 172.0), # 14
(72.0, 75.0, 77.0, 79.0, 81.0, 83.0, 85.0, 87.0, 89.0, 94.0, 97.0, 99.0, 109.0, 115.0, 126.0, 135.0, 145.0, 157.0, 159.0, 161.0, 163.0, 165.0, 167.0, 169.0, 171.0, 174.0), # 15
(74.0, 77.0, 79.0, 81.0, 83.0, 91.0, 95.0, 97.0, 99.0, 102.0, 114.0, 125.0, 136.0, 138.0, 147.0, 152.0, 156.0, 159.0, 161.0, 163.0, 165.0, 167.0, 169.0, 171.0, 173.0, 176.0), # 16
(76.0, 85.0, 87.0, 89.0, 91.0, 97.0, 100.0, 102.0, 113.0, 125.0, 133.0, 138.0, 148.0, 150.0, 152.0, 155.0, 158.0, 161.0, 163.0, 165.0, 167.0, 169.0, 171.0, 173.0, 175.0, 178.0), # 17
)
tram_time_departure = (
(-0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.0, -0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.0, -0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.0, -0.0), # 0
(-0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0), # 1
(-0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0), # 2
(-0.0, -0.0, -0.0, -0.0, 0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0), # 3
(1.0, 4.0, 7.0, 9.0, 11.0, 13.0, 15.0, 17.0, 19.0, 22.0, 25.0, 27.0, 29.0, 31.0, 39.0, 41.0, 44.0, 49.0, 51.0, 53.0, 57.0, 59.0, 63.0, 69.0, 78.0, 81.0), # 4
(9.0, 12.0, 14.0, 16.0, 18.0, 21.0, 23.0, 26.0, 28.0, 31.0, 34.0, 36.0, 38.0, 40.0, 47.0, 58.0, 64.0, 70.0, 81.0, 83.0, 85.0, 87.0, 89.0, 91.0, 93.0, 96.0), # 5
(27.0, 30.0, 32.0, 34.0, 36.0, 38.0, 40.0, 42.0, 44.0, 50.0, 53.0, 60.0, 63.0, 71.0, 73.0, 75.0, 78.0, 81.0, 83.0, 85.0, 87.0, 89.0, 91.0, 93.0, 95.0, 98.0), # 6
(38.0, 41.0, 43.0, 45.0, 47.0, 49.0, 51.0, 55.0, 57.0, 62.0, 66.0, 68.0, 71.0, 73.0, 75.0, 77.0, 80.0, 83.0, 85.0, 87.0, 89.0, 91.0, 93.0, 95.0, 97.0, 101.0), # 7
(46.0, 49.0, 51.0, 53.0, 55.0, 57.0, 59.0, 61.0, 63.0, 66.0, 69.0, 71.0, 73.0, 76.0, 78.0, 80.0, 83.0, 86.0, 88.0, 90.0, 92.0, 94.0, 96.0, 98.0, 100.0, 103.0), # 8
(48.0, 51.0, 53.0, 55.0, 57.0, 59.0, 61.0, 63.0, 65.0, 68.0, 71.0, 73.0, 76.0, 78.0, 80.0, 82.0, 85.0, 88.0, 90.0, 92.0, 94.0, 96.0, 98.0, 100.0, 102.0, 105.0), # 9
(50.0, 55.0, 58.0, 63.0, 65.0, 67.0, 69.0, 71.0, 73.0, 76.0, 79.0, 81.0, 83.0, 85.0, 87.0, 89.0, 92.0, 95.0, 97.0, 99.0, 101.0, 104.0, 106.0, 108.0, 110.0, 113.0), # 10
(62.0, 65.0, 67.0, 69.0, 71.0, 73.0, 75.0, 77.0, 79.0, 82.0, 85.0, 87.0, 89.0, 91.0, 93.0, 95.0, 101.0, 104.0, 106.0, 108.0, 119.0, 130.0, 141.0, 144.0, 155.0, 162.0), # 11
(65.0, 68.0, 70.0, 72.0, 74.0, 76.0, 78.0, 80.0, 82.0, 85.0, 88.0, 90.0, 93.0, 95.0, 106.0, 111.0, 121.0, 126.0, 132.0, 137.0, 143.0, 150.0, 161.0, 163.0, 166.0, 169.0), # 12
(68.0, 71.0, 73.0, 75.0, 77.0, 79.0, 81.0, 83.0, 85.0, 88.0, 91.0, 94.0, 96.0, 107.0, 112.0, 120.0, 131.0, 135.0, 137.0, 148.0, 152.0, 161.0, 163.0, 166.0, 168.0, 171.0), # 13
(71.0, 74.0, 76.0, 78.0, 80.0, 82.0, 84.0, 86.0, 88.0, 91.0, 94.0, 96.0, 107.0, 112.0, 121.0, 130.0, 135.0, 141.0, 152.0, 154.0, 162.0, 164.0, 166.0, 168.0, 170.0, 173.0), # 14
(73.0, 76.0, 78.0, 80.0, 82.0, 84.0, 86.0, 88.0, 92.0, 95.0, 98.0, 108.0, 114.0, 125.0, 134.0, 143.0, 155.0, 158.0, 160.0, 162.0, 164.0, 166.0, 168.0, 170.0, 172.0, 175.0), # 15
(75.0, 78.0, 80.0, 82.0, 90.0, 94.0, 96.0, 98.0, 100.0, 112.0, 124.0, 135.0, 137.0, 146.0, 151.0, 154.0, 157.0, 160.0, 162.0, 164.0, 166.0, 168.0, 170.0, 172.0, 174.0, 177.0), # 16
(83.0, 86.0, 88.0, 90.0, 96.0, 99.0, 101.0, 112.0, 123.0, 131.0, 137.0, 147.0, 149.0, 151.0, 154.0, 156.0, 159.0, 162.0, 164.0, 166.0, 168.0, 170.0, 172.0, 174.0, 176.0, 179.0), # 17
)
cargo_tram_assignment = (
5, # 0
5, # 1
7, # 2
5, # 3
7, # 4
5, # 5
7, # 6
5, # 7
5, # 8
7, # 9
7, # 10
7, # 11
7, # 12
6, # 13
8, # 14
8, # 15
6, # 16
6, # 17
6, # 18
6, # 19
7, # 20
6, # 21
6, # 22
6, # 23
11, # 24
7, # 25
8, # 26
8, # 27
7, # 28
8, # 29
7, # 30
14, # 31
11, # 32
7, # 33
8, # 34
7, # 35
7, # 36
10, # 37
11, # 38
17, # 39
8, # 40
11, # 41
8, # 42
8, # 43
9, # 44
9, # 45
9, # 46
11, # 47
11, # 48
10, # 49
12, # 50
12, # 51
11, # 52
11, # 53
11, # 54
11, # 55
11, # 56
12, # 57
12, # 58
12, # 59
13, # 60
13, # 61
13, # 62
13, # 63
13, # 64
14, # 65
16, # 66
17, # 67
17, # 68
17, # 69
)
|
"""
PERIODS
"""
num_periods = 180
'\nSTOPS\n'
num_stations = 13
station_names = ('Hamburg Hbf', 'Landwehr', 'Hasselbrook', 'Wansbeker Chaussee*', 'Friedrichsberg*', 'Barmbek*', 'Alte Woehr (Stadtpark)', 'Ruebenkamp (City Nord)', 'Ohlsdorf*', 'Kornweg', 'Hoheneichen', 'Wellingsbuettel', 'Poppenbuettel*')
num_stops = 26
stops_position = ((0, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0), (7, 0), (8, 0), (9, 0), (11, 0), (13, 0), (14, 0), (15, 0), (15, 1), (15, 1), (13, 1), (12, 1), (11, 1), (10, 1), (9, 1), (8, 1), (7, 1), (6, 1), (4, 1), (2, 1), (1, 1))
stops_distance = ((0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2), (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
station_start = 0
'\nTRAMS\n'
num_trams = 18
tram_capacity = 514
tram_capacity_cargo = 304
tram_capacity_min_passenger = 208
tram_capacity_min_cargo = 0
tram_speed = 1
tram_headway = 1
tram_min_service = 1
tram_max_service = 10
min_time_next_tram = 0.333
tram_travel_deviation = 0.167
'\nPASSENGERS\n'
passenger_set = 'pas-20210422-1717-int1'
passenger_service_time_board = 0.0145
passenger_service_time_alight = 0.0145
'\nCARGO\n'
num_cargo = 70
cargo_size = 4
cargo_station_destination = (8, 4, 8, 5, 8, 3, 4, 5, 3, 12, 12, 5, 5, 3, 4, 5, 5, 8, 5, 5, 8, 5, 12, 8, 4, 5, 8, 5, 12, 3, 4, 12, 12, 4, 3, 4, 12, 12, 5, 12, 3, 5, 5, 4, 4, 3, 12, 5, 8, 3, 5, 3, 8, 12, 4, 8, 8, 3, 3, 12, 8, 3, 3, 8, 4, 12, 12, 5, 3, 4)
cargo_release = (2, 3, 3, 5, 6, 6, 7, 8, 8, 9, 9, 10, 12, 13, 14, 15, 16, 17, 18, 21, 22, 24, 25, 26, 27, 28, 28, 30, 32, 33, 33, 34, 35, 37, 37, 37, 37, 38, 39, 41, 41, 43, 44, 45, 46, 46, 47, 48, 49, 49, 51, 55, 56, 57, 61, 61, 61, 62, 64, 64, 65, 65, 66, 66, 67, 70, 70, 71, 71, 72)
cargo_station_deadline = (33, 119, 119, 176, 123, 59, 72, 171, 18, 90, 175, 142, 88, 84, 105, 170, 155, 156, 140, 173, 123, 126, 91, 36, 87, 127, 144, 134, 141, 163, 101, 108, 144, 47, 162, 76, 175, 97, 87, 164, 114, 143, 142, 55, 56, 56, 57, 118, 160, 59, 112, 168, 170, 139, 71, 71, 71, 82, 135, 90, 109, 161, 151, 128, 77, 80, 169, 97, 129, 99)
cargo_max_delay = 3
cargo_service_time_load = 0.3333333333333333
cargo_service_time_unload = 0.25
'\nparameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html\n'
entropy = 8991598675325360468762009371570610170
child_seed_index = (0,)
'\nResults from timetabling\n'
scheme = 'SI'
method = 'timetabling_closed'
passenger_data = '0-rep'
downstream_cargo = False
delivery_optional = False
assignment_method = 'timetabling_closed'
operating = (False, False, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True)
tram_tour = ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25))
tram_time_arrival = ((0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (0.0, 3.0, 5.0, 8.0, 10.0, 12.0, 14.0, 16.0, 18.0, 21.0, 24.0, 26.0, 28.0, 30.0, 32.0, 40.0, 43.0, 46.0, 50.0, 52.0, 54.0, 58.0, 60.0, 64.0, 70.0, 80.0), (2.0, 11.0, 13.0, 15.0, 17.0, 19.0, 22.0, 24.0, 27.0, 30.0, 33.0, 35.0, 37.0, 39.0, 41.0, 48.0, 60.0, 66.0, 71.0, 82.0, 84.0, 86.0, 88.0, 90.0, 92.0, 95.0), (17.0, 29.0, 31.0, 33.0, 35.0, 37.0, 39.0, 41.0, 43.0, 46.0, 52.0, 54.0, 61.0, 64.0, 72.0, 74.0, 77.0, 80.0, 82.0, 84.0, 86.0, 88.0, 90.0, 92.0, 94.0, 97.0), (33.0, 40.0, 42.0, 44.0, 46.0, 48.0, 50.0, 52.0, 56.0, 59.0, 64.0, 67.0, 69.0, 72.0, 74.0, 76.0, 79.0, 82.0, 84.0, 86.0, 88.0, 90.0, 92.0, 94.0, 96.0, 99.0), (39.0, 48.0, 50.0, 52.0, 54.0, 56.0, 58.0, 60.0, 62.0, 65.0, 68.0, 70.0, 72.0, 74.0, 77.0, 79.0, 82.0, 85.0, 87.0, 89.0, 91.0, 93.0, 95.0, 97.0, 99.0, 102.0), (47.0, 50.0, 52.0, 54.0, 56.0, 58.0, 60.0, 62.0, 64.0, 67.0, 70.0, 72.0, 74.0, 77.0, 79.0, 81.0, 84.0, 87.0, 89.0, 91.0, 93.0, 95.0, 97.0, 99.0, 101.0, 104.0), (49.0, 52.0, 56.0, 59.0, 64.0, 66.0, 68.0, 70.0, 72.0, 75.0, 78.0, 80.0, 82.0, 84.0, 86.0, 88.0, 91.0, 94.0, 96.0, 98.0, 100.0, 102.0, 105.0, 107.0, 109.0, 112.0), (53.0, 64.0, 66.0, 68.0, 70.0, 72.0, 74.0, 76.0, 78.0, 81.0, 84.0, 86.0, 88.0, 90.0, 92.0, 94.0, 97.0, 103.0, 105.0, 107.0, 109.0, 120.0, 131.0, 142.0, 145.0, 157.0), (63.0, 67.0, 69.0, 71.0, 73.0, 75.0, 77.0, 79.0, 81.0, 84.0, 87.0, 89.0, 91.0, 94.0, 96.0, 107.0, 113.0, 123.0, 127.0, 133.0, 138.0, 144.0, 151.0, 162.0, 164.0, 168.0), (66.0, 70.0, 72.0, 74.0, 76.0, 78.0, 80.0, 82.0, 84.0, 87.0, 90.0, 92.0, 95.0, 97.0, 108.0, 113.0, 122.0, 133.0, 136.0, 138.0, 149.0, 153.0, 162.0, 164.0, 167.0, 170.0), (69.0, 73.0, 75.0, 77.0, 79.0, 81.0, 83.0, 85.0, 87.0, 90.0, 93.0, 95.0, 97.0, 108.0, 113.0, 122.0, 132.0, 137.0, 142.0, 153.0, 155.0, 163.0, 165.0, 167.0, 169.0, 172.0), (72.0, 75.0, 77.0, 79.0, 81.0, 83.0, 85.0, 87.0, 89.0, 94.0, 97.0, 99.0, 109.0, 115.0, 126.0, 135.0, 145.0, 157.0, 159.0, 161.0, 163.0, 165.0, 167.0, 169.0, 171.0, 174.0), (74.0, 77.0, 79.0, 81.0, 83.0, 91.0, 95.0, 97.0, 99.0, 102.0, 114.0, 125.0, 136.0, 138.0, 147.0, 152.0, 156.0, 159.0, 161.0, 163.0, 165.0, 167.0, 169.0, 171.0, 173.0, 176.0), (76.0, 85.0, 87.0, 89.0, 91.0, 97.0, 100.0, 102.0, 113.0, 125.0, 133.0, 138.0, 148.0, 150.0, 152.0, 155.0, 158.0, 161.0, 163.0, 165.0, 167.0, 169.0, 171.0, 173.0, 175.0, 178.0))
tram_time_departure = ((-0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.0, -0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.0, -0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.0, -0.0), (-0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0), (-0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0), (-0.0, -0.0, -0.0, -0.0, 0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0), (1.0, 4.0, 7.0, 9.0, 11.0, 13.0, 15.0, 17.0, 19.0, 22.0, 25.0, 27.0, 29.0, 31.0, 39.0, 41.0, 44.0, 49.0, 51.0, 53.0, 57.0, 59.0, 63.0, 69.0, 78.0, 81.0), (9.0, 12.0, 14.0, 16.0, 18.0, 21.0, 23.0, 26.0, 28.0, 31.0, 34.0, 36.0, 38.0, 40.0, 47.0, 58.0, 64.0, 70.0, 81.0, 83.0, 85.0, 87.0, 89.0, 91.0, 93.0, 96.0), (27.0, 30.0, 32.0, 34.0, 36.0, 38.0, 40.0, 42.0, 44.0, 50.0, 53.0, 60.0, 63.0, 71.0, 73.0, 75.0, 78.0, 81.0, 83.0, 85.0, 87.0, 89.0, 91.0, 93.0, 95.0, 98.0), (38.0, 41.0, 43.0, 45.0, 47.0, 49.0, 51.0, 55.0, 57.0, 62.0, 66.0, 68.0, 71.0, 73.0, 75.0, 77.0, 80.0, 83.0, 85.0, 87.0, 89.0, 91.0, 93.0, 95.0, 97.0, 101.0), (46.0, 49.0, 51.0, 53.0, 55.0, 57.0, 59.0, 61.0, 63.0, 66.0, 69.0, 71.0, 73.0, 76.0, 78.0, 80.0, 83.0, 86.0, 88.0, 90.0, 92.0, 94.0, 96.0, 98.0, 100.0, 103.0), (48.0, 51.0, 53.0, 55.0, 57.0, 59.0, 61.0, 63.0, 65.0, 68.0, 71.0, 73.0, 76.0, 78.0, 80.0, 82.0, 85.0, 88.0, 90.0, 92.0, 94.0, 96.0, 98.0, 100.0, 102.0, 105.0), (50.0, 55.0, 58.0, 63.0, 65.0, 67.0, 69.0, 71.0, 73.0, 76.0, 79.0, 81.0, 83.0, 85.0, 87.0, 89.0, 92.0, 95.0, 97.0, 99.0, 101.0, 104.0, 106.0, 108.0, 110.0, 113.0), (62.0, 65.0, 67.0, 69.0, 71.0, 73.0, 75.0, 77.0, 79.0, 82.0, 85.0, 87.0, 89.0, 91.0, 93.0, 95.0, 101.0, 104.0, 106.0, 108.0, 119.0, 130.0, 141.0, 144.0, 155.0, 162.0), (65.0, 68.0, 70.0, 72.0, 74.0, 76.0, 78.0, 80.0, 82.0, 85.0, 88.0, 90.0, 93.0, 95.0, 106.0, 111.0, 121.0, 126.0, 132.0, 137.0, 143.0, 150.0, 161.0, 163.0, 166.0, 169.0), (68.0, 71.0, 73.0, 75.0, 77.0, 79.0, 81.0, 83.0, 85.0, 88.0, 91.0, 94.0, 96.0, 107.0, 112.0, 120.0, 131.0, 135.0, 137.0, 148.0, 152.0, 161.0, 163.0, 166.0, 168.0, 171.0), (71.0, 74.0, 76.0, 78.0, 80.0, 82.0, 84.0, 86.0, 88.0, 91.0, 94.0, 96.0, 107.0, 112.0, 121.0, 130.0, 135.0, 141.0, 152.0, 154.0, 162.0, 164.0, 166.0, 168.0, 170.0, 173.0), (73.0, 76.0, 78.0, 80.0, 82.0, 84.0, 86.0, 88.0, 92.0, 95.0, 98.0, 108.0, 114.0, 125.0, 134.0, 143.0, 155.0, 158.0, 160.0, 162.0, 164.0, 166.0, 168.0, 170.0, 172.0, 175.0), (75.0, 78.0, 80.0, 82.0, 90.0, 94.0, 96.0, 98.0, 100.0, 112.0, 124.0, 135.0, 137.0, 146.0, 151.0, 154.0, 157.0, 160.0, 162.0, 164.0, 166.0, 168.0, 170.0, 172.0, 174.0, 177.0), (83.0, 86.0, 88.0, 90.0, 96.0, 99.0, 101.0, 112.0, 123.0, 131.0, 137.0, 147.0, 149.0, 151.0, 154.0, 156.0, 159.0, 162.0, 164.0, 166.0, 168.0, 170.0, 172.0, 174.0, 176.0, 179.0))
cargo_tram_assignment = (5, 5, 7, 5, 7, 5, 7, 5, 5, 7, 7, 7, 7, 6, 8, 8, 6, 6, 6, 6, 7, 6, 6, 6, 11, 7, 8, 8, 7, 8, 7, 14, 11, 7, 8, 7, 7, 10, 11, 17, 8, 11, 8, 8, 9, 9, 9, 11, 11, 10, 12, 12, 11, 11, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 13, 14, 16, 17, 17, 17)
|
S = input()
T = input()
i = 0
for s, t in zip(S, T):
if s!=t:
i += 1
print(i)
|
s = input()
t = input()
i = 0
for (s, t) in zip(S, T):
if s != t:
i += 1
print(i)
|
# Soccer field easy
soccer_easy_gate_pose_dicts = [ { 'orientation': { 'w_val': 1.0,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.0},
'position': { 'x_val': 0.0,
'y_val': 2.0,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.9659256935119629,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.2588196396827698},
'position': { 'x_val': 1.5999999046325684,
'y_val': 10.800000190734863,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.8660249710083008,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.5000007152557373},
'position': { 'x_val': 8.887084007263184,
'y_val': 18.478761672973633,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.7071061134338379,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.7071074843406677},
'position': { 'x_val': 18.74375343322754,
'y_val': 22.20650863647461,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.7071061134338379,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.7071074843406677},
'position': { 'x_val': 30.04375457763672,
'y_val': 22.20648956298828,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.4999988079071045,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.8660261034965515},
'position': { 'x_val': 39.04375457763672,
'y_val': 19.206478118896484,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.17364656925201416,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.9848079681396484},
'position': { 'x_val': 45.74375534057617,
'y_val': 11.706478118896484,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 1.8477439880371094e-06,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 1.0},
'position': { 'x_val': 45.74375534057617,
'y_val': 2.2064781188964844,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.5000025629997253,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.8660238981246948},
'position': { 'x_val': 40.343753814697266,
'y_val': -4.793521404266357,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.7071094512939453,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.7071040272712708},
'position': { 'x_val': 30.74375343322754,
'y_val': -7.893521785736084,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.7071094512939453,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.7071040272712708},
'position': { 'x_val': 18.54375457763672,
'y_val': -7.893521785736084,
'z_val': 2.0199999809265137}}, { 'orientation': { 'w_val': 0.8191542029380798,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.5735733509063721},
'position': { 'x_val': 9.543754577636719,
'y_val': -5.093521595001221,
'z_val': 2.0199999809265137}}]
soccer_medium_gate_pose_dicts = [ { 'orientation': { 'w_val': 0.5735755562782288,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.8191526532173157},
'position': { 'x_val': 10.388415336608887,
'y_val': 80.77406311035156,
'z_val': -43.57999801635742}}, { 'orientation': { 'w_val': 0.34201890230178833,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.939693033695221},
'position': { 'x_val': 18.11046600341797,
'y_val': 76.26078033447266,
'z_val': -43.57999801635742}}, { 'orientation': { 'w_val': 0.1736472249031067,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.9848079085350037},
'position': { 'x_val': 25.433794021606445,
'y_val': 66.28687286376953,
'z_val': -43.57999801635742}}, { 'orientation': { 'w_val': 0.17364656925201416,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.9848079681396484},
'position': { 'x_val': 30.065513610839844,
'y_val': 56.549530029296875,
'z_val': -43.57999801635742}}, { 'orientation': { 'w_val': 2.562999725341797e-06,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 1.0},
'position': { 'x_val': 32.30064392089844,
'y_val': 45.6310920715332,
'z_val': -43.87999725341797}}, { 'orientation': { 'w_val': 0.7071093916893005,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.7071041464805603},
'position': { 'x_val': 26.503353118896484,
'y_val': 38.19984436035156,
'z_val': -43.37999725341797}}, { 'orientation': { 'w_val': 0.7660470008850098,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.642784595489502},
'position': { 'x_val': 3.264113664627075,
'y_val': 37.569061279296875,
'z_val': -43.57999801635742}}, { 'orientation': { 'w_val': 0.9848085641860962,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.17364364862442017},
'position': { 'x_val': -16.862957000732422,
'y_val': 45.41843795776367,
'z_val': -46.57999801635742}}, { 'orientation': { 'w_val': 0.9848069548606873,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.17365287244319916},
'position': { 'x_val': -15.493884086608887,
'y_val': 63.18687438964844,
'z_val': -52.07999801635742}}, { 'orientation': { 'w_val': 0.8191484212875366,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.5735815763473511},
'position': { 'x_val': -6.320737361907959,
'y_val': 78.21236419677734,
'z_val': -55.779998779296875}}, { 'orientation': { 'w_val': 0.8191484212875366,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.5735815763473511},
'position': { 'x_val': 5.143640041351318,
'y_val': 82.38504791259766,
'z_val': -55.779998779296875}}, { 'orientation': { 'w_val': 0.7071030139923096,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.7071105241775513},
'position': { 'x_val': 14.558510780334473,
'y_val': 84.4320297241211,
'z_val': -55.18000030517578}}, { 'orientation': { 'w_val': 0.7071030139923096,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.7071105241775513},
'position': { 'x_val': 23.858510971069336,
'y_val': 82.83203125,
'z_val': -32.07999801635742}}, { 'orientation': { 'w_val': 0.3420146107673645,
'x_val': 0.0,
'y_val': -0.0,
'z_val': -0.9396945834159851},
'position': { 'x_val': 38.25851058959961,
'y_val': 78.13202667236328,
'z_val': -31.3799991607666}}, { 'orientation': { 'w_val': 6.258487701416016e-06,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 1.0},
'position': { 'x_val': 51.058509826660156,
'y_val': 52.13203048706055,
'z_val': -25.8799991607666}}, { 'orientation': { 'w_val': 0.3420267701148987,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.9396902322769165},
'position': { 'x_val': 44.95851135253906,
'y_val': 38.932029724121094,
'z_val': -25.8799991607666}}, { 'orientation': { 'w_val': 0.7071123123168945,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.7071012258529663},
'position': { 'x_val': 25.958515167236328,
'y_val': 26.33203125,
'z_val': -19.8799991607666}}, { 'orientation': { 'w_val': 0.7071123123168945,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.7071012258529663},
'position': { 'x_val': 11.658514976501465,
'y_val': 26.33203125,
'z_val': -12.779999732971191}}, { 'orientation': { 'w_val': 0.5735827684402466,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.8191476464271545},
'position': { 'x_val': -10.141484260559082,
'y_val': 22.632030487060547,
'z_val': -6.37999963760376}}, { 'orientation': { 'w_val': 0.5000063180923462,
'x_val': -0.0,
'y_val': 0.0,
'z_val': 0.8660216927528381},
'position': { 'x_val': -24.641483306884766,
'y_val': 9.132031440734863,
'z_val': 2.119999885559082}}]
|
soccer_easy_gate_pose_dicts = [{'orientation': {'w_val': 1.0, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.0}, 'position': {'x_val': 0.0, 'y_val': 2.0, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.9659256935119629, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.2588196396827698}, 'position': {'x_val': 1.5999999046325684, 'y_val': 10.800000190734863, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.8660249710083008, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.5000007152557373}, 'position': {'x_val': 8.887084007263184, 'y_val': 18.478761672973633, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.7071061134338379, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.7071074843406677}, 'position': {'x_val': 18.74375343322754, 'y_val': 22.20650863647461, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.7071061134338379, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.7071074843406677}, 'position': {'x_val': 30.04375457763672, 'y_val': 22.20648956298828, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.4999988079071045, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.8660261034965515}, 'position': {'x_val': 39.04375457763672, 'y_val': 19.206478118896484, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.17364656925201416, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.9848079681396484}, 'position': {'x_val': 45.74375534057617, 'y_val': 11.706478118896484, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 1.8477439880371094e-06, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 1.0}, 'position': {'x_val': 45.74375534057617, 'y_val': 2.2064781188964844, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.5000025629997253, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.8660238981246948}, 'position': {'x_val': 40.343753814697266, 'y_val': -4.793521404266357, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.7071094512939453, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.7071040272712708}, 'position': {'x_val': 30.74375343322754, 'y_val': -7.893521785736084, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.7071094512939453, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.7071040272712708}, 'position': {'x_val': 18.54375457763672, 'y_val': -7.893521785736084, 'z_val': 2.0199999809265137}}, {'orientation': {'w_val': 0.8191542029380798, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.5735733509063721}, 'position': {'x_val': 9.543754577636719, 'y_val': -5.093521595001221, 'z_val': 2.0199999809265137}}]
soccer_medium_gate_pose_dicts = [{'orientation': {'w_val': 0.5735755562782288, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.8191526532173157}, 'position': {'x_val': 10.388415336608887, 'y_val': 80.77406311035156, 'z_val': -43.57999801635742}}, {'orientation': {'w_val': 0.34201890230178833, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.939693033695221}, 'position': {'x_val': 18.11046600341797, 'y_val': 76.26078033447266, 'z_val': -43.57999801635742}}, {'orientation': {'w_val': 0.1736472249031067, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.9848079085350037}, 'position': {'x_val': 25.433794021606445, 'y_val': 66.28687286376953, 'z_val': -43.57999801635742}}, {'orientation': {'w_val': 0.17364656925201416, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.9848079681396484}, 'position': {'x_val': 30.065513610839844, 'y_val': 56.549530029296875, 'z_val': -43.57999801635742}}, {'orientation': {'w_val': 2.562999725341797e-06, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 1.0}, 'position': {'x_val': 32.30064392089844, 'y_val': 45.6310920715332, 'z_val': -43.87999725341797}}, {'orientation': {'w_val': 0.7071093916893005, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.7071041464805603}, 'position': {'x_val': 26.503353118896484, 'y_val': 38.19984436035156, 'z_val': -43.37999725341797}}, {'orientation': {'w_val': 0.7660470008850098, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.642784595489502}, 'position': {'x_val': 3.264113664627075, 'y_val': 37.569061279296875, 'z_val': -43.57999801635742}}, {'orientation': {'w_val': 0.9848085641860962, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.17364364862442017}, 'position': {'x_val': -16.862957000732422, 'y_val': 45.41843795776367, 'z_val': -46.57999801635742}}, {'orientation': {'w_val': 0.9848069548606873, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.17365287244319916}, 'position': {'x_val': -15.493884086608887, 'y_val': 63.18687438964844, 'z_val': -52.07999801635742}}, {'orientation': {'w_val': 0.8191484212875366, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.5735815763473511}, 'position': {'x_val': -6.320737361907959, 'y_val': 78.21236419677734, 'z_val': -55.779998779296875}}, {'orientation': {'w_val': 0.8191484212875366, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.5735815763473511}, 'position': {'x_val': 5.143640041351318, 'y_val': 82.38504791259766, 'z_val': -55.779998779296875}}, {'orientation': {'w_val': 0.7071030139923096, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.7071105241775513}, 'position': {'x_val': 14.558510780334473, 'y_val': 84.4320297241211, 'z_val': -55.18000030517578}}, {'orientation': {'w_val': 0.7071030139923096, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.7071105241775513}, 'position': {'x_val': 23.858510971069336, 'y_val': 82.83203125, 'z_val': -32.07999801635742}}, {'orientation': {'w_val': 0.3420146107673645, 'x_val': 0.0, 'y_val': -0.0, 'z_val': -0.9396945834159851}, 'position': {'x_val': 38.25851058959961, 'y_val': 78.13202667236328, 'z_val': -31.3799991607666}}, {'orientation': {'w_val': 6.258487701416016e-06, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 1.0}, 'position': {'x_val': 51.058509826660156, 'y_val': 52.13203048706055, 'z_val': -25.8799991607666}}, {'orientation': {'w_val': 0.3420267701148987, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.9396902322769165}, 'position': {'x_val': 44.95851135253906, 'y_val': 38.932029724121094, 'z_val': -25.8799991607666}}, {'orientation': {'w_val': 0.7071123123168945, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.7071012258529663}, 'position': {'x_val': 25.958515167236328, 'y_val': 26.33203125, 'z_val': -19.8799991607666}}, {'orientation': {'w_val': 0.7071123123168945, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.7071012258529663}, 'position': {'x_val': 11.658514976501465, 'y_val': 26.33203125, 'z_val': -12.779999732971191}}, {'orientation': {'w_val': 0.5735827684402466, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.8191476464271545}, 'position': {'x_val': -10.141484260559082, 'y_val': 22.632030487060547, 'z_val': -6.37999963760376}}, {'orientation': {'w_val': 0.5000063180923462, 'x_val': -0.0, 'y_val': 0.0, 'z_val': 0.8660216927528381}, 'position': {'x_val': -24.641483306884766, 'y_val': 9.132031440734863, 'z_val': 2.119999885559082}}]
|
print ('WELCOME TO THE COLLATZ SEQUENCER: ALWAYS NUMBER 1')
print ('ENTER YOUR NUMBER AND PREPARE TO GET SEQUENCED')
numberToSequence = input()
def tryCollatz(numberToSequence):
collatzCalled = False
while(collatzCalled == False):
try:
numberToSequence = int(numberToSequence)
collatz(numberToSequence)
collatzCalled = True
except:
print ('Error: Value input must be an INTEGER')
numberToSequence = input()
def collatz(numberToSequence):
while numberToSequence != 1:
if numberToSequence % 2 == 0:
numberToSequence = numberToSequence // 2
print (numberToSequence)
elif numberToSequence % 2 == 1:
numberToSequence = 3 * numberToSequence + 1
print (numberToSequence)
tryCollatz(numberToSequence)
|
print('WELCOME TO THE COLLATZ SEQUENCER: ALWAYS NUMBER 1')
print('ENTER YOUR NUMBER AND PREPARE TO GET SEQUENCED')
number_to_sequence = input()
def try_collatz(numberToSequence):
collatz_called = False
while collatzCalled == False:
try:
number_to_sequence = int(numberToSequence)
collatz(numberToSequence)
collatz_called = True
except:
print('Error: Value input must be an INTEGER')
number_to_sequence = input()
def collatz(numberToSequence):
while numberToSequence != 1:
if numberToSequence % 2 == 0:
number_to_sequence = numberToSequence // 2
print(numberToSequence)
elif numberToSequence % 2 == 1:
number_to_sequence = 3 * numberToSequence + 1
print(numberToSequence)
try_collatz(numberToSequence)
|
class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def example():
# Computer 2 + 3 * 0.1
code = [
('const', 2),
('const', 3),
('const', 0.1),
('mul',),
('add',),
]
m = Machine()
|
class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def example():
code = [('const', 2), ('const', 3), ('const', 0.1), ('mul',), ('add',)]
m = machine()
|
def formulUygula(derece, liste):
mat = []
xDeg = 0
for i in range(derece + 1):
mat1 = []
for j in range(derece + 1):
gecici = 0
for k in range(1, len(liste) + 1):
gecici += k ** xDeg
mat1.append(gecici)
xDeg += 1
mat.append(mat1)
xDeg -= derece
mat2 = []
for i in range(derece + 1):
gecici = 0
for j in range(len(liste)):
gecici += liste[j] * (j + 1) ** i
mat2.append(gecici)
for i in range(derece + 1):
gecici1 = mat[i][i]
for j in range(i + 1, derece + 1):
ort = gecici1 / mat[j][i]
mat2[j] = mat2[j] * ort - mat2[i]
for k in range(derece + 1):
mat[j][k] = mat[j][k] * ort - mat[i][k]
for i in range(derece, -1, -1):
gecici1 = mat[i][i]
for j in range(i - 1, -1, -1):
ort = gecici1 / mat[j][i]
mat2[j] = mat2[j] * ort - mat2[i]
for k in range(derece + 1):
mat[j][k] = mat[j][k] * ort - mat[i][k]
for i in range(derece + 1):
mat2[i] = mat2[i] / mat[i][i]
yDeg = 0
for i in range(len(liste)):
yDeg += liste[i]
yDeg = yDeg / len(liste)
stn = 0
str = 0
for i in range(len(liste)):
xDeg = liste[i]
stn += (liste[i] - yDeg) ** 2
for j in range(len(mat2)):
xDeg -= mat2[j] * (i + 1) ** j
xDeg = xDeg ** 2
str += xDeg
a = ((stn - str) / stn) ** (1 / 2)
return mat2, a
def katsayi(r1, r2, r3, r4, r5, r6, dosya2):
dosya2.write("<----------------------------------------->\n")
dosya2.write("r1 = " + str(r1) + " r2 = " + str(r2) + " r 3 = " + str(r3) + "r4 = " + str(r4) + " r5 = " + str(
r5) + " r6 = " + str(r6) + "\n")
dizi = [r1, r2, r3, r4, r5, r6]
for i in range(len(dizi)):
if dizi[i] == max(dizi):
dosya2.write("r=" + str(dizi[i]) + " " + str(i + 1) + ".\n")
def katsayiHes(pol1, pol2, pol3, pol4, pol5, pol6, dosya2, a1, a2):
dosya2.write(" \n" + " \n" + " \n" + "polinomlarin katsayilari " + str(a1) + " ---- " + str(a2) + " \n")
a1 = a1 + 10
a2 = a2 + 10
dosya2.write("1.dereceden katsayilar \nk1 = " + str(pol1[0]) + " k1 = " + str(pol1[1]) + "\n")
dosya2.write(
"2.dereceden katsayilar \nk0 = " + str(pol2[0]) + " k1 = " + str(pol2[1]) + " k2 =" + str(pol2[2]) + "\n")
dosya2.write("3.dereceden katsayilar \nk0 = " + str(pol3[0]) + " k1 = " + str(pol3[1]) + " k2 =" + str(
pol3[2]) + " k3 = " + str(pol3[3]) + "\n")
dosya2.write("4.dereceden katsayilar \nk0 = " + str(pol4[0]) + " k1 = " + str(pol4[1]) + " k2 =" + str(
pol4[2]) + " k3 = " + str(pol4[3]) + " k4 = " + str(pol4[4]) + "\n")
dosya2.write("5.dereceden katsayilar \nk0 = " + str(pol5[0]) + " k1 = " + str(pol5[1]) + " k2 =" + str(
pol5[2]) + " k3 = " + str(pol5[3]) + " k4 = " + str(pol5[4]) + " k5 = " + str(pol5[5]) + "\n")
dosya2.write("6.dereceden katsayilar \nk0 = " + str(pol6[0]) + " k1 = " + str(pol6[1]) + " k2 =" + str(
pol6[2]) + " k3 = " + str(pol6[3]) + " k4 = " + str(pol6[4]) + " k5 = " + str(pol6[5]) + " k6 = " + str(
pol6[6]) + "\n")
return a1,a2
a1=1
a2=10
dosya = open("veriler.txt", "r")
liste = dosya.readlines()
for i in range(len(liste)):
liste[i] = int(liste[i])
pol_1, r1 = formulUygula(1, liste)
pol_2, r2 = formulUygula(2, liste)
pol_3, r3 = formulUygula(3, liste)
pol_4, r4 = formulUygula(4, liste)
pol_5, r5 = formulUygula(5, liste)
pol_6, r6 = formulUygula(6, liste)
dosya.close()
dosya2 = open("sonuc.txt", "w")
a1,a2=katsayiHes(pol_1, pol_2, pol_3, pol_4, pol_5, pol_6, dosya2, a1, a2)
katsayi(r1, r2, r3, r4, r5, r6, dosya2)
for i in range(len(liste) // 10):
onlu = []
for j in range(10):
onlu.append(liste[10 * i + j])
pol_1, r1 = formulUygula(1, onlu)
pol_2, r2 = formulUygula(2, onlu)
pol_3, r3 = formulUygula(3, onlu)
pol_4, r4 = formulUygula(4, onlu)
pol_5, r5 = formulUygula(5, onlu)
pol_6, r6 = formulUygula(6, onlu)
a1,a2=katsayiHes(pol_1, pol_2, pol_3, pol_4, pol_5, pol_6, dosya2, a1, a2)
katsayi(r1, r2, r3, r4, r5, r6, dosya2)
dosya2.close()
|
def formul_uygula(derece, liste):
mat = []
x_deg = 0
for i in range(derece + 1):
mat1 = []
for j in range(derece + 1):
gecici = 0
for k in range(1, len(liste) + 1):
gecici += k ** xDeg
mat1.append(gecici)
x_deg += 1
mat.append(mat1)
x_deg -= derece
mat2 = []
for i in range(derece + 1):
gecici = 0
for j in range(len(liste)):
gecici += liste[j] * (j + 1) ** i
mat2.append(gecici)
for i in range(derece + 1):
gecici1 = mat[i][i]
for j in range(i + 1, derece + 1):
ort = gecici1 / mat[j][i]
mat2[j] = mat2[j] * ort - mat2[i]
for k in range(derece + 1):
mat[j][k] = mat[j][k] * ort - mat[i][k]
for i in range(derece, -1, -1):
gecici1 = mat[i][i]
for j in range(i - 1, -1, -1):
ort = gecici1 / mat[j][i]
mat2[j] = mat2[j] * ort - mat2[i]
for k in range(derece + 1):
mat[j][k] = mat[j][k] * ort - mat[i][k]
for i in range(derece + 1):
mat2[i] = mat2[i] / mat[i][i]
y_deg = 0
for i in range(len(liste)):
y_deg += liste[i]
y_deg = yDeg / len(liste)
stn = 0
str = 0
for i in range(len(liste)):
x_deg = liste[i]
stn += (liste[i] - yDeg) ** 2
for j in range(len(mat2)):
x_deg -= mat2[j] * (i + 1) ** j
x_deg = xDeg ** 2
str += xDeg
a = ((stn - str) / stn) ** (1 / 2)
return (mat2, a)
def katsayi(r1, r2, r3, r4, r5, r6, dosya2):
dosya2.write('<----------------------------------------->\n')
dosya2.write('r1 = ' + str(r1) + ' r2 = ' + str(r2) + ' r 3 = ' + str(r3) + 'r4 = ' + str(r4) + ' r5 = ' + str(r5) + ' r6 = ' + str(r6) + '\n')
dizi = [r1, r2, r3, r4, r5, r6]
for i in range(len(dizi)):
if dizi[i] == max(dizi):
dosya2.write('r=' + str(dizi[i]) + ' ' + str(i + 1) + '.\n')
def katsayi_hes(pol1, pol2, pol3, pol4, pol5, pol6, dosya2, a1, a2):
dosya2.write(' \n' + ' \n' + ' \n' + 'polinomlarin katsayilari ' + str(a1) + ' ---- ' + str(a2) + ' \n')
a1 = a1 + 10
a2 = a2 + 10
dosya2.write('1.dereceden katsayilar \nk1 = ' + str(pol1[0]) + ' k1 = ' + str(pol1[1]) + '\n')
dosya2.write('2.dereceden katsayilar \nk0 = ' + str(pol2[0]) + ' k1 = ' + str(pol2[1]) + ' k2 =' + str(pol2[2]) + '\n')
dosya2.write('3.dereceden katsayilar \nk0 = ' + str(pol3[0]) + ' k1 = ' + str(pol3[1]) + ' k2 =' + str(pol3[2]) + ' k3 = ' + str(pol3[3]) + '\n')
dosya2.write('4.dereceden katsayilar \nk0 = ' + str(pol4[0]) + ' k1 = ' + str(pol4[1]) + ' k2 =' + str(pol4[2]) + ' k3 = ' + str(pol4[3]) + ' k4 = ' + str(pol4[4]) + '\n')
dosya2.write('5.dereceden katsayilar \nk0 = ' + str(pol5[0]) + ' k1 = ' + str(pol5[1]) + ' k2 =' + str(pol5[2]) + ' k3 = ' + str(pol5[3]) + ' k4 = ' + str(pol5[4]) + ' k5 = ' + str(pol5[5]) + '\n')
dosya2.write('6.dereceden katsayilar \nk0 = ' + str(pol6[0]) + ' k1 = ' + str(pol6[1]) + ' k2 =' + str(pol6[2]) + ' k3 = ' + str(pol6[3]) + ' k4 = ' + str(pol6[4]) + ' k5 = ' + str(pol6[5]) + ' k6 = ' + str(pol6[6]) + '\n')
return (a1, a2)
a1 = 1
a2 = 10
dosya = open('veriler.txt', 'r')
liste = dosya.readlines()
for i in range(len(liste)):
liste[i] = int(liste[i])
(pol_1, r1) = formul_uygula(1, liste)
(pol_2, r2) = formul_uygula(2, liste)
(pol_3, r3) = formul_uygula(3, liste)
(pol_4, r4) = formul_uygula(4, liste)
(pol_5, r5) = formul_uygula(5, liste)
(pol_6, r6) = formul_uygula(6, liste)
dosya.close()
dosya2 = open('sonuc.txt', 'w')
(a1, a2) = katsayi_hes(pol_1, pol_2, pol_3, pol_4, pol_5, pol_6, dosya2, a1, a2)
katsayi(r1, r2, r3, r4, r5, r6, dosya2)
for i in range(len(liste) // 10):
onlu = []
for j in range(10):
onlu.append(liste[10 * i + j])
(pol_1, r1) = formul_uygula(1, onlu)
(pol_2, r2) = formul_uygula(2, onlu)
(pol_3, r3) = formul_uygula(3, onlu)
(pol_4, r4) = formul_uygula(4, onlu)
(pol_5, r5) = formul_uygula(5, onlu)
(pol_6, r6) = formul_uygula(6, onlu)
(a1, a2) = katsayi_hes(pol_1, pol_2, pol_3, pol_4, pol_5, pol_6, dosya2, a1, a2)
katsayi(r1, r2, r3, r4, r5, r6, dosya2)
dosya2.close()
|
# TODO: un-subclass dict in favor of something more explicit, once all regular
# dict-like access has been factored out into methods
class LineManager(dict):
"""
Manages multiple release lines/families as well as related config state.
"""
def __init__(self, app):
"""
Initialize new line manager dict.
:param app: The core Sphinx app object. Mostly used for config.
"""
super(LineManager, self).__init__()
self.app = app
@property
def config(self):
"""
Return Sphinx config object.
"""
return self.app.config
def add_family(self, major_number):
"""
Expand to a new release line with given ``major_number``.
This will flesh out mandatory buckets like ``unreleased_bugfix`` and do
other necessary bookkeeping.
"""
# Normally, we have separate buckets for bugfixes vs features
keys = ["unreleased_bugfix", "unreleased_feature"]
# But unstable prehistorical releases roll all up into just
# 'unreleased'
if major_number == 0 and self.config.releases_unstable_prehistory:
keys = ["unreleased"]
# Either way, the buckets default to an empty list
self[major_number] = {key: [] for key in keys}
@property
def unstable_prehistory(self):
"""
Returns True if 'unstable prehistory' behavior should be applied.
Specifically, checks config & whether any non-0.x releases exist.
"""
return self.config.releases_unstable_prehistory and not self.has_stable_releases
@property
def stable_families(self):
"""
Returns release family numbers which aren't 0 (i.e. prehistory).
"""
return [x for x in self if x != 0]
@property
def has_stable_releases(self):
"""
Returns whether stable (post-0.x) releases seem to exist.
"""
nonzeroes = self.stable_families
# Nothing but 0.x releases -> yup we're prehistory
if not nonzeroes:
return False
# Presumably, if there's >1 major family besides 0.x, we're at least
# one release into the 1.0 (or w/e) line.
if len(nonzeroes) > 1:
return True
# If there's only one, we may still be in the space before its N.0.0 as
# well; we can check by testing for existence of bugfix buckets
return any(x for x in self[nonzeroes[0]] if not x.startswith("unreleased"))
|
class Linemanager(dict):
"""
Manages multiple release lines/families as well as related config state.
"""
def __init__(self, app):
"""
Initialize new line manager dict.
:param app: The core Sphinx app object. Mostly used for config.
"""
super(LineManager, self).__init__()
self.app = app
@property
def config(self):
"""
Return Sphinx config object.
"""
return self.app.config
def add_family(self, major_number):
"""
Expand to a new release line with given ``major_number``.
This will flesh out mandatory buckets like ``unreleased_bugfix`` and do
other necessary bookkeeping.
"""
keys = ['unreleased_bugfix', 'unreleased_feature']
if major_number == 0 and self.config.releases_unstable_prehistory:
keys = ['unreleased']
self[major_number] = {key: [] for key in keys}
@property
def unstable_prehistory(self):
"""
Returns True if 'unstable prehistory' behavior should be applied.
Specifically, checks config & whether any non-0.x releases exist.
"""
return self.config.releases_unstable_prehistory and (not self.has_stable_releases)
@property
def stable_families(self):
"""
Returns release family numbers which aren't 0 (i.e. prehistory).
"""
return [x for x in self if x != 0]
@property
def has_stable_releases(self):
"""
Returns whether stable (post-0.x) releases seem to exist.
"""
nonzeroes = self.stable_families
if not nonzeroes:
return False
if len(nonzeroes) > 1:
return True
return any((x for x in self[nonzeroes[0]] if not x.startswith('unreleased')))
|
def LeiaDinheiro(msg):
valido = False
while not valido:
mens = str(input(msg)).replace(',', '.')
if mens.isalpha() or mens.strip() == '':
print("\033[31mERRO! tente algo valido\033[m")
else:
valido = True
return float(mens)
|
def leia_dinheiro(msg):
valido = False
while not valido:
mens = str(input(msg)).replace(',', '.')
if mens.isalpha() or mens.strip() == '':
print('\x1b[31mERRO! tente algo valido\x1b[m')
else:
valido = True
return float(mens)
|
"""
Problem 5 - https://adventofcode.com/2021/day/5
Part 1 -
Given a list of lines on a 2D graph, find the number of integral points where at least 2 horizontal or vertical
lines intersect
Part 2 -
Given the same set up, find the number of integral points where at least 2 horizontal, vertical, or diagonal
lines intersect
"""
# Set up the input
with open('input-05.txt', 'r') as file:
vents = file.readlines()
# Solution to part 1
def solve_1(vent_map, dimension):
# Assume the ocean_floor is a dimension x dimension grid
ocean_floor = [[0 for i in range(dimension)] for j in range(dimension)]
for vent in vent_map:
coords = vent.split('->')
start = coords[0].split(',')
end = coords[1].split(',')
if int(start[0]) != int(end[0]) and int(start[1]) != int(end[1]):
continue
if int(start[0]) == int(end[0]):
# Same x coordinate => row changes, column remains the same
start_row, end_row = int(start[1]), int(end[1])
if start_row > end_row:
start_row, end_row = end_row, start_row
for i in range(start_row, end_row + 1):
ocean_floor[i][int(start[0])] += 1
elif int(start[1]) == int(end[1]):
# Same y coordinate => column changes, row remains the same
start_column, end_column = int(start[0]), int(end[0])
if start_column > end_column:
start_column, end_column = end_column, start_column
for i in range(start_column, end_column + 1):
ocean_floor[int(start[1])][i] += 1
dangerous_vents = 0
for row in ocean_floor:
for cell in row:
if cell >= 2:
dangerous_vents += 1
return dangerous_vents, ocean_floor
ans, _ = solve_1(vents, 10)
print(ans)
# Answer was 7414
# Define helper functions
def get_diagonal_points(start_x, start_y, end_x, end_y):
"""
Returns a list of tuples that contains diagonal points from one point to another
:param start_x:
:param start_y:
:param end_x:
:param end_y:
:return:
"""
points = []
y_inc = 1
if int(start_x) > int(end_x):
start_x, start_y, end_x, end_y = end_x, end_y, start_x, start_y
if start_y > end_y:
y_inc = -1
while start_x <= end_x:
points.append((start_x, start_y))
start_x += 1
start_y += y_inc
return points
def get_points_from_line(line):
"""
Returns a list of points on a vertical or horizontal line. Returns an empty list otherwise
:param line:
:return:
"""
coords = line.split('->')
start = list(map(lambda x: int(x), coords[0].split(',')))
end = list(map(lambda x: int(x), coords[1].split(',')))
points = []
if start[0] == end[0]:
if start[1] > end[1]:
start, end = end, start
row = start[1]
while row <= end[1]:
points.append((start[0], row))
row += 1
elif start[1] == end[1]:
if start[0] > end[0]:
start, end = end, start
col = start[0]
while col <= end[0]:
points.append((col, start[1]))
col += 1
elif start[0] != end[0]:
slope = (int(start[1]) - int(end[1])) / (int(start[0]) - int(end[0]))
if abs(slope) == 1:
points = get_diagonal_points(start[0], start[1], end[0], end[1])
return points
def update_ocean_floor(points, ocean_floor):
"""
Updates all the given points on the ocean floor and increments their value by 1
:param points:
:param ocean_floor:
:return:
"""
for point in points:
ocean_floor[point[0]][point[1]] += 1
return ocean_floor
# Solution to part 2
def solve_2(vent_map, dimension):
ocean_floor = [[0 for i in range(dimension)] for j in range(dimension)]
# Also consider lines at 45 degrees
for vent in vent_map:
points = get_points_from_line(vent)
update_ocean_floor(points, ocean_floor)
dangerous_vents = 0
for row in ocean_floor:
for cell in row:
if cell >= 2:
dangerous_vents += 1
return dangerous_vents
ans = solve_2(vents, 1000)
print(ans)
# Answer was 19676
|
"""
Problem 5 - https://adventofcode.com/2021/day/5
Part 1 -
Given a list of lines on a 2D graph, find the number of integral points where at least 2 horizontal or vertical
lines intersect
Part 2 -
Given the same set up, find the number of integral points where at least 2 horizontal, vertical, or diagonal
lines intersect
"""
with open('input-05.txt', 'r') as file:
vents = file.readlines()
def solve_1(vent_map, dimension):
ocean_floor = [[0 for i in range(dimension)] for j in range(dimension)]
for vent in vent_map:
coords = vent.split('->')
start = coords[0].split(',')
end = coords[1].split(',')
if int(start[0]) != int(end[0]) and int(start[1]) != int(end[1]):
continue
if int(start[0]) == int(end[0]):
(start_row, end_row) = (int(start[1]), int(end[1]))
if start_row > end_row:
(start_row, end_row) = (end_row, start_row)
for i in range(start_row, end_row + 1):
ocean_floor[i][int(start[0])] += 1
elif int(start[1]) == int(end[1]):
(start_column, end_column) = (int(start[0]), int(end[0]))
if start_column > end_column:
(start_column, end_column) = (end_column, start_column)
for i in range(start_column, end_column + 1):
ocean_floor[int(start[1])][i] += 1
dangerous_vents = 0
for row in ocean_floor:
for cell in row:
if cell >= 2:
dangerous_vents += 1
return (dangerous_vents, ocean_floor)
(ans, _) = solve_1(vents, 10)
print(ans)
def get_diagonal_points(start_x, start_y, end_x, end_y):
"""
Returns a list of tuples that contains diagonal points from one point to another
:param start_x:
:param start_y:
:param end_x:
:param end_y:
:return:
"""
points = []
y_inc = 1
if int(start_x) > int(end_x):
(start_x, start_y, end_x, end_y) = (end_x, end_y, start_x, start_y)
if start_y > end_y:
y_inc = -1
while start_x <= end_x:
points.append((start_x, start_y))
start_x += 1
start_y += y_inc
return points
def get_points_from_line(line):
"""
Returns a list of points on a vertical or horizontal line. Returns an empty list otherwise
:param line:
:return:
"""
coords = line.split('->')
start = list(map(lambda x: int(x), coords[0].split(',')))
end = list(map(lambda x: int(x), coords[1].split(',')))
points = []
if start[0] == end[0]:
if start[1] > end[1]:
(start, end) = (end, start)
row = start[1]
while row <= end[1]:
points.append((start[0], row))
row += 1
elif start[1] == end[1]:
if start[0] > end[0]:
(start, end) = (end, start)
col = start[0]
while col <= end[0]:
points.append((col, start[1]))
col += 1
elif start[0] != end[0]:
slope = (int(start[1]) - int(end[1])) / (int(start[0]) - int(end[0]))
if abs(slope) == 1:
points = get_diagonal_points(start[0], start[1], end[0], end[1])
return points
def update_ocean_floor(points, ocean_floor):
"""
Updates all the given points on the ocean floor and increments their value by 1
:param points:
:param ocean_floor:
:return:
"""
for point in points:
ocean_floor[point[0]][point[1]] += 1
return ocean_floor
def solve_2(vent_map, dimension):
ocean_floor = [[0 for i in range(dimension)] for j in range(dimension)]
for vent in vent_map:
points = get_points_from_line(vent)
update_ocean_floor(points, ocean_floor)
dangerous_vents = 0
for row in ocean_floor:
for cell in row:
if cell >= 2:
dangerous_vents += 1
return dangerous_vents
ans = solve_2(vents, 1000)
print(ans)
|
#
# PySNMP MIB module AT-DS3-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AT-DS3-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:13:43 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")
ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint")
DisplayStringUnsized, modules = mibBuilder.importSymbols("AT-SMI-MIB", "DisplayStringUnsized", "modules")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Counter32, ModuleIdentity, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, MibIdentifier, NotificationType, Counter64, iso, ObjectIdentity, Integer32, Unsigned32, Bits, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "ModuleIdentity", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "MibIdentifier", "NotificationType", "Counter64", "iso", "ObjectIdentity", "Integer32", "Unsigned32", "Bits", "Gauge32")
TruthValue, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "DisplayString", "TextualConvention")
ds3 = ModuleIdentity((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109))
ds3.setRevisions(('2006-06-28 12:22',))
if mibBuilder.loadTexts: ds3.setLastUpdated('200606281222Z')
if mibBuilder.loadTexts: ds3.setOrganization('Allied Telesis, Inc')
ds3TrapTable = MibTable((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1), )
if mibBuilder.loadTexts: ds3TrapTable.setStatus('current')
ds3TrapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: ds3TrapEntry.setStatus('current')
ds3TcaTrapEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ds3TcaTrapEnable.setStatus('current')
ds3TrapError = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=NamedValues(("ds3NoError", 1), ("ds3PES", 2), ("ds3PSES", 3), ("ds3SEFs", 4), ("ds3UAS", 5), ("ds3LCVs", 6), ("ds3PCVs", 7), ("ds3LESs", 8), ("ds3CCVs", 9), ("ds3CESs", 10), ("ds3CSESs", 11))).clone('ds3NoError')).setMaxAccess("readonly")
if mibBuilder.loadTexts: ds3TrapError.setStatus('current')
ds3TrapLoc = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("ds3NoLoc", 1), ("ds3Near", 2), ("ds3Far", 3))).clone('ds3NoLoc')).setMaxAccess("readonly")
if mibBuilder.loadTexts: ds3TrapLoc.setStatus('current')
ds3TrapInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("ds3NoInt", 1), ("ds3Fifteen", 2), ("ds3Twentyfour", 3))).clone('ds3NoInt')).setMaxAccess("readonly")
if mibBuilder.loadTexts: ds3TrapInterval.setStatus('current')
ds3Traps = MibIdentifier((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 0))
tcaTrap = NotificationType((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 0, 1)).setObjects(("AT-DS3-MIB", "ds3TrapError"), ("AT-DS3-MIB", "ds3TrapLoc"), ("AT-DS3-MIB", "ds3TrapInterval"))
if mibBuilder.loadTexts: tcaTrap.setStatus('current')
mibBuilder.exportSymbols("AT-DS3-MIB", ds3TrapTable=ds3TrapTable, PYSNMP_MODULE_ID=ds3, tcaTrap=tcaTrap, ds3Traps=ds3Traps, ds3=ds3, ds3TrapInterval=ds3TrapInterval, ds3TrapLoc=ds3TrapLoc, ds3TrapEntry=ds3TrapEntry, ds3TrapError=ds3TrapError, ds3TcaTrapEnable=ds3TcaTrapEnable)
|
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint')
(display_string_unsized, modules) = mibBuilder.importSymbols('AT-SMI-MIB', 'DisplayStringUnsized', 'modules')
(if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(counter32, module_identity, time_ticks, mib_scalar, mib_table, mib_table_row, mib_table_column, ip_address, mib_identifier, notification_type, counter64, iso, object_identity, integer32, unsigned32, bits, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'ModuleIdentity', 'TimeTicks', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'IpAddress', 'MibIdentifier', 'NotificationType', 'Counter64', 'iso', 'ObjectIdentity', 'Integer32', 'Unsigned32', 'Bits', 'Gauge32')
(truth_value, display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'DisplayString', 'TextualConvention')
ds3 = module_identity((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109))
ds3.setRevisions(('2006-06-28 12:22',))
if mibBuilder.loadTexts:
ds3.setLastUpdated('200606281222Z')
if mibBuilder.loadTexts:
ds3.setOrganization('Allied Telesis, Inc')
ds3_trap_table = mib_table((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1))
if mibBuilder.loadTexts:
ds3TrapTable.setStatus('current')
ds3_trap_entry = mib_table_row((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
ds3TrapEntry.setStatus('current')
ds3_tca_trap_enable = mib_table_column((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ds3TcaTrapEnable.setStatus('current')
ds3_trap_error = mib_table_column((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=named_values(('ds3NoError', 1), ('ds3PES', 2), ('ds3PSES', 3), ('ds3SEFs', 4), ('ds3UAS', 5), ('ds3LCVs', 6), ('ds3PCVs', 7), ('ds3LESs', 8), ('ds3CCVs', 9), ('ds3CESs', 10), ('ds3CSESs', 11))).clone('ds3NoError')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ds3TrapError.setStatus('current')
ds3_trap_loc = mib_table_column((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('ds3NoLoc', 1), ('ds3Near', 2), ('ds3Far', 3))).clone('ds3NoLoc')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ds3TrapLoc.setStatus('current')
ds3_trap_interval = mib_table_column((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('ds3NoInt', 1), ('ds3Fifteen', 2), ('ds3Twentyfour', 3))).clone('ds3NoInt')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ds3TrapInterval.setStatus('current')
ds3_traps = mib_identifier((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 0))
tca_trap = notification_type((1, 3, 6, 1, 4, 1, 207, 8, 4, 4, 4, 109, 0, 1)).setObjects(('AT-DS3-MIB', 'ds3TrapError'), ('AT-DS3-MIB', 'ds3TrapLoc'), ('AT-DS3-MIB', 'ds3TrapInterval'))
if mibBuilder.loadTexts:
tcaTrap.setStatus('current')
mibBuilder.exportSymbols('AT-DS3-MIB', ds3TrapTable=ds3TrapTable, PYSNMP_MODULE_ID=ds3, tcaTrap=tcaTrap, ds3Traps=ds3Traps, ds3=ds3, ds3TrapInterval=ds3TrapInterval, ds3TrapLoc=ds3TrapLoc, ds3TrapEntry=ds3TrapEntry, ds3TrapError=ds3TrapError, ds3TcaTrapEnable=ds3TcaTrapEnable)
|
# closures
def make_averagr():
series = []
def averager(new_value):
series.append(new_value) # free variable
total = sum(series) / len(series)
return total
return averager
# print(locals())
av = make_averagr()
print(av(10))
print(av(11))
print(av.__code__.co_varnames)
# ('new_value', 'total')
print(av.__code__.co_freevars)
# ('series',)
# print(type(av.__code__))
print(av.__closure__, type(av.__closure__))
print(av.__closure__[0].cell_contents, type(av.__closure__))
# The nonlocal Declaration
count = 1000
total = 10000
def make_Averager():
count = 0
total = 0
def averager(new_value):
# count = count + 1 which is local scope and undefined hence add non local
# global count, total
nonlocal count, total
count += 1
print(total)
print(count)
total += new_value
return total / count
return averager
# UnboundLocalError: local variable 'count' referenced before assignment
#
av1 = make_Averager()
print(av1(100))
|
def make_averagr():
series = []
def averager(new_value):
series.append(new_value)
total = sum(series) / len(series)
return total
return averager
av = make_averagr()
print(av(10))
print(av(11))
print(av.__code__.co_varnames)
print(av.__code__.co_freevars)
print(av.__closure__, type(av.__closure__))
print(av.__closure__[0].cell_contents, type(av.__closure__))
count = 1000
total = 10000
def make__averager():
count = 0
total = 0
def averager(new_value):
nonlocal count, total
count += 1
print(total)
print(count)
total += new_value
return total / count
return averager
av1 = make__averager()
print(av1(100))
|
# Public Key
PK = "fubotong"
# Push request actively
PUSH = 0
# Secret Key
SK = "(*^%]@XUNLEI`12f&^"
# procotol type
HTTP = 1
ED2K = 2
BT = 3
TASK_SERVER = "http://open.lixian.vip.xunlei.com/download_to_clouds"
#TASK_SERVER = "http://t33093.sandai.net:8028/download_to_clouds"
CREATE_SERVER = "%s/create" % TASK_SERVER
CREATE_BT_SERVER = "%s/create_bt" % TASK_SERVER
CREATE_ED2K_SERVER = "%s/create_ed2k" % TASK_SERVER
QUERY_SERVER = "%s/query" % TASK_SERVER
UPLOAD_BT_SERVER = "%s/upload_torrent" % TASK_SERVER
QUERY_BT_SERVER = "%s/torrent_info" % TASK_SERVER
#NEW_URL_SERVER = "http://180.97.151.98:80"
NEW_URL_SERVER = "http://gdl.lixian.vip.xunlei.com"
# using gen new url
MID = 666
AK = "9:0:999:0"
THRESHOLD = 150
SRCID = 6
VERNO = 1
UI = 'hzfubotong'
FID_LEN = 64
FID_DECODED_LEN = FID_LEN / 4 * 3
# define error code
OFFLINE_TIMEOUT = -1
OFFLINE_HTTP_ERROR = -2
OFFLINE_STATUS_ERROR = -3
OFFLINE_DOWNLOAD_ERROR = -4
OFFLINE_GENURL_ERROR = -5
OFFLINE_UNKNOWN_ERROR = -6
#pk fubotong
#appkey hzfubotong
#sk (*^%]@XUNLEI`12f&^
#ak 9:0:999:0
|
pk = 'fubotong'
push = 0
sk = '(*^%]@XUNLEI`12f&^'
http = 1
ed2_k = 2
bt = 3
task_server = 'http://open.lixian.vip.xunlei.com/download_to_clouds'
create_server = '%s/create' % TASK_SERVER
create_bt_server = '%s/create_bt' % TASK_SERVER
create_ed2_k_server = '%s/create_ed2k' % TASK_SERVER
query_server = '%s/query' % TASK_SERVER
upload_bt_server = '%s/upload_torrent' % TASK_SERVER
query_bt_server = '%s/torrent_info' % TASK_SERVER
new_url_server = 'http://gdl.lixian.vip.xunlei.com'
mid = 666
ak = '9:0:999:0'
threshold = 150
srcid = 6
verno = 1
ui = 'hzfubotong'
fid_len = 64
fid_decoded_len = FID_LEN / 4 * 3
offline_timeout = -1
offline_http_error = -2
offline_status_error = -3
offline_download_error = -4
offline_genurl_error = -5
offline_unknown_error = -6
|
def kth_common_divisor(a, b, k):
min_ = min(a, b)
divisors = []
for i in range(1, min_+1):
if a % i == 0 and b % i == 0:
divisors.append(i)
return divisors[-k]
if __name__ == "__main__":
a, b, k = map(int, input().split())
print(kth_common_divisor(a, b, k))
|
def kth_common_divisor(a, b, k):
min_ = min(a, b)
divisors = []
for i in range(1, min_ + 1):
if a % i == 0 and b % i == 0:
divisors.append(i)
return divisors[-k]
if __name__ == '__main__':
(a, b, k) = map(int, input().split())
print(kth_common_divisor(a, b, k))
|
"""
SYSTEM_PARAMETERS
"""
EPSILON = 1E-12
#DEFAULT_STREAM_SIZE = 2**24
DEFAULT_STREAM_SIZE = 2**12
DEFAULT_BUFFER_SIZE_FOR_STREAM = DEFAULT_STREAM_SIZE / 4
|
"""
SYSTEM_PARAMETERS
"""
epsilon = 1e-12
default_stream_size = 2 ** 12
default_buffer_size_for_stream = DEFAULT_STREAM_SIZE / 4
|
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
class Foo:
def __init__(self, arg1: str, arg2: int) -> None:
self.arg1 = arg1
self.arg2 = arg2
|
class Foo:
def __init__(self, arg1: str, arg2: int) -> None:
self.arg1 = arg1
self.arg2 = arg2
|
class Solution:
def sequentialDigits(self, low: int, high: int) -> List[int]:
nlow, nhigh = len(str(low)), len(str(high))
s = '123456789'
result = []
for n in range(nlow, nhigh+1):
for i in range(9-n+1):
num = int(s[i:i+n])
if num < low: continue
if num > high: break
result.append(num)
return result
|
class Solution:
def sequential_digits(self, low: int, high: int) -> List[int]:
(nlow, nhigh) = (len(str(low)), len(str(high)))
s = '123456789'
result = []
for n in range(nlow, nhigh + 1):
for i in range(9 - n + 1):
num = int(s[i:i + n])
if num < low:
continue
if num > high:
break
result.append(num)
return result
|
"""
This module defines a utility interface called WMInterface
which defines a standard interface for adding and removing things from working memory
"""
class WMInterface(object):
""" An interface standardizing how to add/remove items from working memory """
def __init__(self):
self.added = False
def is_added(self):
""" Returns true if the wme is currently in soar's working memory """
return self.added
def add_to_wm(self, parent_id):
""" Creates a structure in working memory rooted at the given parent_id """
if self.added:
self._remove_from_wm_impl()
self._add_to_wm_impl(parent_id)
self.added = True
def update_wm(self, parent_id = None):
""" Updates the structure in Soar's working memory
It will also add it to wm if parent_id is not None """
if self.added:
self._update_wm_impl()
elif parent_id:
self._add_to_wm_impl(parent_id)
self.added = True
def remove_from_wm(self):
""" Removes the structure from Soar's working memory """
if not self.added:
return
self._remove_from_wm_impl()
self.added = False
### Internal Methods - To be implemented by derived classes
def _add_to_wm_impl(self, parent_id):
""" Method to implement in derived class - add to working memory """
pass
def _update_wm_impl(self):
""" Method to implement in derived class - update working memory """
pass
def _remove_from_wm_impl(self):
""" Method to implement in derived class - remove from working memory """
pass
|
"""
This module defines a utility interface called WMInterface
which defines a standard interface for adding and removing things from working memory
"""
class Wminterface(object):
""" An interface standardizing how to add/remove items from working memory """
def __init__(self):
self.added = False
def is_added(self):
""" Returns true if the wme is currently in soar's working memory """
return self.added
def add_to_wm(self, parent_id):
""" Creates a structure in working memory rooted at the given parent_id """
if self.added:
self._remove_from_wm_impl()
self._add_to_wm_impl(parent_id)
self.added = True
def update_wm(self, parent_id=None):
""" Updates the structure in Soar's working memory
It will also add it to wm if parent_id is not None """
if self.added:
self._update_wm_impl()
elif parent_id:
self._add_to_wm_impl(parent_id)
self.added = True
def remove_from_wm(self):
""" Removes the structure from Soar's working memory """
if not self.added:
return
self._remove_from_wm_impl()
self.added = False
def _add_to_wm_impl(self, parent_id):
""" Method to implement in derived class - add to working memory """
pass
def _update_wm_impl(self):
""" Method to implement in derived class - update working memory """
pass
def _remove_from_wm_impl(self):
""" Method to implement in derived class - remove from working memory """
pass
|
no = int(input('How many Natural Numbers do You Want?? '))
output = 0
i = 0
while i <= no:
output = output + i*i
i += 1
print(output)
|
no = int(input('How many Natural Numbers do You Want?? '))
output = 0
i = 0
while i <= no:
output = output + i * i
i += 1
print(output)
|
class Log():
def log(self,text):
pass
def force_p(self,text):
print(text)
class Print(Log):
def log(self,text):
print(text)
class NoLog(Log) :
def log(self,text):
pass
class MessageLog(Log):
def set_channel(self,channel):
self.channel = channel
async def log(self,text):
await self.channel.send(text)
|
class Log:
def log(self, text):
pass
def force_p(self, text):
print(text)
class Print(Log):
def log(self, text):
print(text)
class Nolog(Log):
def log(self, text):
pass
class Messagelog(Log):
def set_channel(self, channel):
self.channel = channel
async def log(self, text):
await self.channel.send(text)
|
class Solution(object):
def update(self, board, row, col):
living = 0
for i in range(max(row-1, 0), min(row+2, len(board))):
for j in range(max(col-1, 0), min(col+2, len(board[0]))):
living += board[i][j] & 1
if living == 3 or (living == 4 and board[row][col]):
board[row][col]+=2
def gameOfLife(self, board):
for row in range(len(board)):
for col in range(len(board[row])):
self.update(board, row, col)
for row in range(len(board)):
for col in range(len(board[row])):
board[row][col] >>= 1
a = Solution()
b = [
[0,1,0],
[0,0,1],
[1,1,1],
[0,0,0]
]
a.gameOfLife(b)
print(b)
|
class Solution(object):
def update(self, board, row, col):
living = 0
for i in range(max(row - 1, 0), min(row + 2, len(board))):
for j in range(max(col - 1, 0), min(col + 2, len(board[0]))):
living += board[i][j] & 1
if living == 3 or (living == 4 and board[row][col]):
board[row][col] += 2
def game_of_life(self, board):
for row in range(len(board)):
for col in range(len(board[row])):
self.update(board, row, col)
for row in range(len(board)):
for col in range(len(board[row])):
board[row][col] >>= 1
a = solution()
b = [[0, 1, 0], [0, 0, 1], [1, 1, 1], [0, 0, 0]]
a.gameOfLife(b)
print(b)
|
__all__ = ["State"]
class State:
def __init__(self, value: str):
self.value = value
def __eq__(self, other):
if not isinstance(other, State):
return False
else:
return self.value == other.value
def __hash__(self):
return hash(self.value)
|
__all__ = ['State']
class State:
def __init__(self, value: str):
self.value = value
def __eq__(self, other):
if not isinstance(other, State):
return False
else:
return self.value == other.value
def __hash__(self):
return hash(self.value)
|
counts = {
"FAMILY|ID": 3,
"PARTICIPANT|ID": 3,
"BIOSPECIMEN|ID": 3,
"GENOMIC_FILE|URL_LIST": 3,
}
validation = {}
|
counts = {'FAMILY|ID': 3, 'PARTICIPANT|ID': 3, 'BIOSPECIMEN|ID': 3, 'GENOMIC_FILE|URL_LIST': 3}
validation = {}
|
# Create a global variable.
my_value = 10
# The show_value function prints
# the value of the global variable.
def show_value():
print(my_value)
# Call the show_value function
show_value()
|
my_value = 10
def show_value():
print(my_value)
show_value()
|
headers = 'id,text,filename__v,format__v,size__v,charsize,pages__v'
id_ = '31011'
text = """Investigational Product Accountability Log
"""
filename__v = 'foo.docx'
format__v = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
size__v = '16290'
charsize = '768'
pages__v = '1'
row = ','.join([id_, repr(text), filename__v, format__v, size__v, charsize, pages__v])
PAYLOAD = headers + '\n' + row
|
headers = 'id,text,filename__v,format__v,size__v,charsize,pages__v'
id_ = '31011'
text = 'Investigational Product Accountability Log\n\n\n'
filename__v = 'foo.docx'
format__v = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
size__v = '16290'
charsize = '768'
pages__v = '1'
row = ','.join([id_, repr(text), filename__v, format__v, size__v, charsize, pages__v])
payload = headers + '\n' + row
|
N = int(input())
h = N // 3600 % 24
min = N % 3600 // 60
sec = N % 60
print(h, '%02d' % (min), '%02d' % (sec), sep=':')
|
n = int(input())
h = N // 3600 % 24
min = N % 3600 // 60
sec = N % 60
print(h, '%02d' % min, '%02d' % sec, sep=':')
|
"""
Implementation of an edge, as used in graphs
"""
################################################################################
# #
# Undirected #
# #
################################################################################
class UndirectedEdge(object):
def __init__(self, vertices, attrs=None):
self._vertices = frozenset(vertices)
self._attrs = attrs or {}
self._is_self_edge = vertices[0] == vertices[1]
def __repr__(self):
vertices = (tuple(self._vertices) if not self._is_self_edge else
tuple(self._vertices) * 2)
return "Edge(%s, %s)" % (vertices[0], vertices[1])
def __str__(self):
vertices = (tuple(self._vertices) if not self._is_self_edge else
tuple(self._vertices) * 2)
return "E(%s, %s)" % (str(vertices[0]), str(vertices[1]))
def __eq__(self, other):
return self._vertices == other.vertices
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return hash(self._vertices)
@property
def vertices(self):
return self._vertices
@property
def attrs(self):
return self._attrs
@property
def is_self_edge(self):
return self._is_self_edge
def get(self, attr):
""" Get an attribute """
return self._attrs.get(attr)
def set(self, attr, value):
""" Set an attribute """
self._attrs[attr] = value
def has_attr(self, attr):
""" Check if an attribute exists """
return attr in self._attrs
def del_attr(self, attr):
""" Delete an attribute """
del self._attrs[attr]
################################################################################
# #
# Directed #
# #
################################################################################
class DirectedEdge(object):
def __init__(self, vertices, attrs=None):
self._v_from = vertices[0]
self._v_to = vertices[1]
self._attrs = attrs or {}
def __repr__(self):
return "Edge(%s, %s)" % (self._v_from, self._v_to)
def __str__(self):
return "E(%s, %s)" % (str(self._v_from), str(self._v_to))
def __eq__(self, other):
return (self._v_from, self._v_to) == (other.v_from, other.v_to)
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return hash((self._v_from, self._v_to))
@property
def v_from(self):
return self._v_from
@property
def v_to(self):
return self._v_to
@property
def attrs(self):
return self._attrs
def get(self, attr):
""" Get an attribute """
return self._attrs.get(attr)
def set(self, attr, value):
""" Set an attribute """
self._attrs[attr] = value
def has_attr(self, attr):
""" Check if an attribute exists """
return attr in self._attrs
def del_attr(self, attr):
""" Delete an attribute """
del self._attrs[attr]
|
"""
Implementation of an edge, as used in graphs
"""
class Undirectededge(object):
def __init__(self, vertices, attrs=None):
self._vertices = frozenset(vertices)
self._attrs = attrs or {}
self._is_self_edge = vertices[0] == vertices[1]
def __repr__(self):
vertices = tuple(self._vertices) if not self._is_self_edge else tuple(self._vertices) * 2
return 'Edge(%s, %s)' % (vertices[0], vertices[1])
def __str__(self):
vertices = tuple(self._vertices) if not self._is_self_edge else tuple(self._vertices) * 2
return 'E(%s, %s)' % (str(vertices[0]), str(vertices[1]))
def __eq__(self, other):
return self._vertices == other.vertices
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return hash(self._vertices)
@property
def vertices(self):
return self._vertices
@property
def attrs(self):
return self._attrs
@property
def is_self_edge(self):
return self._is_self_edge
def get(self, attr):
""" Get an attribute """
return self._attrs.get(attr)
def set(self, attr, value):
""" Set an attribute """
self._attrs[attr] = value
def has_attr(self, attr):
""" Check if an attribute exists """
return attr in self._attrs
def del_attr(self, attr):
""" Delete an attribute """
del self._attrs[attr]
class Directededge(object):
def __init__(self, vertices, attrs=None):
self._v_from = vertices[0]
self._v_to = vertices[1]
self._attrs = attrs or {}
def __repr__(self):
return 'Edge(%s, %s)' % (self._v_from, self._v_to)
def __str__(self):
return 'E(%s, %s)' % (str(self._v_from), str(self._v_to))
def __eq__(self, other):
return (self._v_from, self._v_to) == (other.v_from, other.v_to)
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return hash((self._v_from, self._v_to))
@property
def v_from(self):
return self._v_from
@property
def v_to(self):
return self._v_to
@property
def attrs(self):
return self._attrs
def get(self, attr):
""" Get an attribute """
return self._attrs.get(attr)
def set(self, attr, value):
""" Set an attribute """
self._attrs[attr] = value
def has_attr(self, attr):
""" Check if an attribute exists """
return attr in self._attrs
def del_attr(self, attr):
""" Delete an attribute """
del self._attrs[attr]
|
#
# PySNMP MIB module CTRON-SFPS-PATH-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SFPS-PATH-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:31:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection")
sfpsPathAPI, sfpsSwitchPathStats, sfpsStaticPath, sfpsPathMaskObj, sfpsChassisRIPPath, sfpsSwitchPathAPI, sfpsSwitchPath, sfpsISPSwitchPath = mibBuilder.importSymbols("CTRON-SFPS-INCLUDE-MIB", "sfpsPathAPI", "sfpsSwitchPathStats", "sfpsStaticPath", "sfpsPathMaskObj", "sfpsChassisRIPPath", "sfpsSwitchPathAPI", "sfpsSwitchPath", "sfpsISPSwitchPath")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Integer32, iso, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, TimeTicks, Bits, Unsigned32, ModuleIdentity, Gauge32, MibIdentifier, IpAddress, ObjectIdentity, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "iso", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "TimeTicks", "Bits", "Unsigned32", "ModuleIdentity", "Gauge32", "MibIdentifier", "IpAddress", "ObjectIdentity", "Counter32")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
class SfpsAddress(OctetString):
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(6, 6)
fixedLength = 6
class HexInteger(Integer32):
pass
sfpsServiceCenterPathTable = MibTable((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1), )
if mibBuilder.loadTexts: sfpsServiceCenterPathTable.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathTable.setDescription('This table gives path semantics to call processing.')
sfpsServiceCenterPathEntry = MibTableRow((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1), ).setIndexNames((0, "CTRON-SFPS-PATH-MIB", "sfpsServiceCenterPathHashLeaf"))
if mibBuilder.loadTexts: sfpsServiceCenterPathEntry.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathEntry.setDescription('Each entry contains the configuration of the Path Entry.')
sfpsServiceCenterPathHashLeaf = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 1), HexInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathHashLeaf.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathHashLeaf.setDescription('Server hash, part of instance key.')
sfpsServiceCenterPathMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathMetric.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathMetric.setDescription('Defines order servers are called low to high.')
sfpsServiceCenterPathName = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathName.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathName.setDescription('Server name.')
sfpsServiceCenterPathOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("kStatusRunning", 1), ("kStatusHalted", 2), ("kStatusPending", 3), ("kStatusFaulted", 4), ("kStatusNotStarted", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathOperStatus.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathOperStatus.setDescription('Operational state of entry.')
sfpsServiceCenterPathAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("disable", 2), ("enable", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsServiceCenterPathAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathAdminStatus.setDescription('Administrative State of Entry.')
sfpsServiceCenterPathStatusTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 6), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathStatusTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathStatusTime.setDescription('Time Tick of last operStatus change.')
sfpsServiceCenterPathRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathRequests.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathRequests.setDescription('Requests made to server.')
sfpsServiceCenterPathResponses = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsServiceCenterPathResponses.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsServiceCenterPathResponses.setDescription('GOOD replies by server.')
sfpsPathAPIVerb = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("other", 1), ("add", 2), ("delete", 3), ("uplink", 4), ("downlink", 5), ("diameter", 6), ("flood-add", 7), ("flood-delete", 8), ("force-idle-traffic", 9), ("remove-traffic-cnx", 10)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIVerb.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIVerb.setDescription('')
sfpsPathAPISwitchMac = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 2), SfpsAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPISwitchMac.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPISwitchMac.setDescription('')
sfpsPathAPIPortName = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIPortName.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIPortName.setDescription('')
sfpsPathAPICost = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPICost.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPICost.setDescription('')
sfpsPathAPIHop = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 5), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIHop.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIHop.setDescription('')
sfpsPathAPIID = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 6), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIID.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIID.setDescription('')
sfpsPathAPIInPort = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 7), SfpsAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIInPort.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIInPort.setDescription('')
sfpsPathAPISrcMac = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 8), SfpsAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPISrcMac.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPISrcMac.setDescription('')
sfpsPathAPIDstMac = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 9), SfpsAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathAPIDstMac.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathAPIDstMac.setDescription('')
sfpsStaticPathTable = MibTable((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1), )
if mibBuilder.loadTexts: sfpsStaticPathTable.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathTable.setDescription('')
sfpsStaticPathEntry = MibTableRow((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1), ).setIndexNames((0, "CTRON-SFPS-PATH-MIB", "sfpsStaticPathPort"))
if mibBuilder.loadTexts: sfpsStaticPathEntry.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathEntry.setDescription('')
sfpsStaticPathPort = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsStaticPathPort.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathPort.setDescription('')
sfpsStaticPathFloodEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3))).clone(namedValues=NamedValues(("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsStaticPathFloodEnabled.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathFloodEnabled.setDescription('')
sfpsStaticPathUplinkEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3))).clone(namedValues=NamedValues(("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsStaticPathUplinkEnabled.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathUplinkEnabled.setDescription('')
sfpsStaticPathDownlinkEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3))).clone(namedValues=NamedValues(("disabled", 2), ("enabled", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsStaticPathDownlinkEnabled.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsStaticPathDownlinkEnabled.setDescription('')
sfpsPathMaskObjLogPortMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjLogPortMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjLogPortMask.setDescription('')
sfpsPathMaskObjPhysPortMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjPhysPortMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPhysPortMask.setDescription('')
sfpsPathMaskObjLogResolveMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjLogResolveMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjLogResolveMask.setDescription('')
sfpsPathMaskObjLogFloodNoINB = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjLogFloodNoINB.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjLogFloodNoINB.setDescription('')
sfpsPathMaskObjPhysResolveMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjPhysResolveMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPhysResolveMask.setDescription('')
sfpsPathMaskObjPhysFloodNoINB = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjPhysFloodNoINB.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPhysFloodNoINB.setDescription('')
sfpsPathMaskObjOldLogPortMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjOldLogPortMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjOldLogPortMask.setDescription('')
sfpsPathMaskObjPathChangeEvent = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 8), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathMaskObjPathChangeEvent.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPathChangeEvent.setDescription('')
sfpsPathMaskObjPathChangeCounter = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjPathChangeCounter.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPathChangeCounter.setDescription('')
sfpsPathMaskObjLastChangeTime = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 10), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjLastChangeTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjLastChangeTime.setDescription('')
sfpsPathMaskObjPathCounterReset = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 11), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsPathMaskObjPathCounterReset.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPathCounterReset.setDescription('')
sfpsPathMaskObjIsolatedSwitchMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 12), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjIsolatedSwitchMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjIsolatedSwitchMask.setDescription('')
sfpsPathMaskObjPyhsIsolatedSwitchMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 13), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjPyhsIsolatedSwitchMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjPyhsIsolatedSwitchMask.setDescription('')
sfpsPathMaskObjLogDownlinkMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 14), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjLogDownlinkMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjLogDownlinkMask.setDescription('')
sfpsPathMaskObjCoreUplinkMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 15), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjCoreUplinkMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjCoreUplinkMask.setDescription('')
sfpsPathMaskObjOverrideFloodMask = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 1))).clone(namedValues=NamedValues(("disable", 2), ("enable", 1)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsPathMaskObjOverrideFloodMask.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsPathMaskObjOverrideFloodMask.setDescription('')
sfpsSwitchPathStatsNumEntries = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsNumEntries.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsNumEntries.setDescription('')
sfpsSwitchPathStatsMaxEntries = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsMaxEntries.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsMaxEntries.setDescription('')
sfpsSwitchPathStatsTableSize = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsTableSize.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsTableSize.setDescription('')
sfpsSwitchPathStatsMemUsage = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsMemUsage.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsMemUsage.setDescription('')
sfpsSwitchPathStatsActiveLocal = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsActiveLocal.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsActiveLocal.setDescription('')
sfpsSwitchPathStatsActiveRemote = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsActiveRemote.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsActiveRemote.setDescription('')
sfpsSwitchPathStatsStaticRemote = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsStaticRemote.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsStaticRemote.setDescription('')
sfpsSwitchPathStatsDeadLocal = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsDeadLocal.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsDeadLocal.setDescription('')
sfpsSwitchPathStatsDeadRemote = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsDeadRemote.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsDeadRemote.setDescription('')
sfpsSwitchPathStatsReapReady = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapReady.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapReady.setDescription('')
sfpsSwitchPathStatsReapAt = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapAt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapAt.setDescription('')
sfpsSwitchPathStatsReapCount = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapCount.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsReapCount.setDescription('')
sfpsSwitchPathStatsPathReq = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathReq.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathReq.setDescription('')
sfpsSwitchPathStatsPathAck = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathAck.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathAck.setDescription('')
sfpsSwitchPathStatsPathNak = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 15), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathNak.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathNak.setDescription('')
sfpsSwitchPathStatsPathUnk = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 16), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathUnk.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsPathUnk.setDescription('')
sfpsSwitchPathStatsLocateReq = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 17), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateReq.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateReq.setDescription('')
sfpsSwitchPathStatsLocateAck = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 18), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateAck.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateAck.setDescription('')
sfpsSwitchPathStatsLocateNak = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 19), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateNak.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateNak.setDescription('')
sfpsSwitchPathStatsLocateUnk = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 20), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateUnk.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsLocateUnk.setDescription('')
sfpsSwitchPathStatsSndDblBack = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 21), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsSndDblBack.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsSndDblBack.setDescription('')
sfpsSwitchPathStatsRcdDblBack = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 22), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathStatsRcdDblBack.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathStatsRcdDblBack.setDescription('')
sfpsSwitchPathAPIVerb = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("other", 1), ("addFind", 2), ("lose", 3), ("delete", 4), ("clearTable", 5), ("resetStats", 6), ("setReapAt", 7), ("setMaxRcvDblBck", 8)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsSwitchPathAPIVerb.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathAPIVerb.setDescription('')
sfpsSwitchPathAPIPort = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsSwitchPathAPIPort.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathAPIPort.setDescription('')
sfpsSwitchPathAPIBaseMAC = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 3), SfpsAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsSwitchPathAPIBaseMAC.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathAPIBaseMAC.setDescription('')
sfpsSwitchPathAPIReapAt = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsSwitchPathAPIReapAt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathAPIReapAt.setDescription('')
sfpsSwitchPathAPIMaxRcvDblBack = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 5), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sfpsSwitchPathAPIMaxRcvDblBack.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathAPIMaxRcvDblBack.setDescription('')
sfpsSwitchPathTable = MibTable((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3), )
if mibBuilder.loadTexts: sfpsSwitchPathTable.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTable.setDescription('')
sfpsSwitchPathTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1), ).setIndexNames((0, "CTRON-SFPS-PATH-MIB", "sfpsSwitchPathTableSwitchMAC"), (0, "CTRON-SFPS-PATH-MIB", "sfpsSwitchPathTablePort"))
if mibBuilder.loadTexts: sfpsSwitchPathTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableEntry.setDescription('.')
sfpsSwitchPathTableSwitchMAC = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 1), SfpsAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableSwitchMAC.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableSwitchMAC.setDescription('')
sfpsSwitchPathTablePort = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTablePort.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTablePort.setDescription('')
sfpsSwitchPathTableIsActive = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableIsActive.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableIsActive.setDescription('')
sfpsSwitchPathTableIsStatic = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableIsStatic.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableIsStatic.setDescription('')
sfpsSwitchPathTableIsLocal = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableIsLocal.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableIsLocal.setDescription('')
sfpsSwitchPathTableRefCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableRefCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableRefCnt.setDescription('')
sfpsSwitchPathTableRefTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 7), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableRefTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableRefTime.setDescription('')
sfpsSwitchPathTableFoundCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableFoundCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableFoundCnt.setDescription('')
sfpsSwitchPathTableFoundTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 9), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableFoundTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableFoundTime.setDescription('')
sfpsSwitchPathTableLostCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableLostCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableLostCnt.setDescription('')
sfpsSwitchPathTableLostTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 11), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableLostTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableLostTime.setDescription('')
sfpsSwitchPathTableSrcDblBackCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableSrcDblBackCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableSrcDblBackCnt.setDescription('')
sfpsSwitchPathTableSrcDblBackTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 13), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableSrcDblBackTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableSrcDblBackTime.setDescription('')
sfpsSwitchPathTableRcvDblBackCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableRcvDblBackCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableRcvDblBackCnt.setDescription('')
sfpsSwitchPathTableRcvDblBackTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 15), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableRcvDblBackTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableRcvDblBackTime.setDescription('')
sfpsSwitchPathTableDirReapCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 16), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableDirReapCnt.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableDirReapCnt.setDescription('')
sfpsSwitchPathTableDirReapTime = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 17), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsSwitchPathTableDirReapTime.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsSwitchPathTableDirReapTime.setDescription('')
sfpsChassisRIPPathNumInTable = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsChassisRIPPathNumInTable.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsChassisRIPPathNumInTable.setDescription('')
sfpsChassisRIPPathNumRequests = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsChassisRIPPathNumRequests.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsChassisRIPPathNumRequests.setDescription('')
sfpsChassisRIPPathNumReplyAck = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsChassisRIPPathNumReplyAck.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsChassisRIPPathNumReplyAck.setDescription('')
sfpsChassisRIPPathNumReplyUnk = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sfpsChassisRIPPathNumReplyUnk.setStatus('mandatory')
if mibBuilder.loadTexts: sfpsChassisRIPPathNumReplyUnk.setDescription('')
mibBuilder.exportSymbols("CTRON-SFPS-PATH-MIB", sfpsStaticPathTable=sfpsStaticPathTable, sfpsSwitchPathTableSrcDblBackTime=sfpsSwitchPathTableSrcDblBackTime, sfpsStaticPathDownlinkEnabled=sfpsStaticPathDownlinkEnabled, sfpsPathAPISwitchMac=sfpsPathAPISwitchMac, sfpsSwitchPathAPIVerb=sfpsSwitchPathAPIVerb, sfpsSwitchPathStatsDeadRemote=sfpsSwitchPathStatsDeadRemote, sfpsPathMaskObjCoreUplinkMask=sfpsPathMaskObjCoreUplinkMask, sfpsSwitchPathTableEntry=sfpsSwitchPathTableEntry, sfpsSwitchPathTableRefTime=sfpsSwitchPathTableRefTime, sfpsSwitchPathStatsReapCount=sfpsSwitchPathStatsReapCount, HexInteger=HexInteger, sfpsChassisRIPPathNumReplyUnk=sfpsChassisRIPPathNumReplyUnk, sfpsPathMaskObjLastChangeTime=sfpsPathMaskObjLastChangeTime, sfpsSwitchPathStatsLocateNak=sfpsSwitchPathStatsLocateNak, sfpsPathMaskObjPyhsIsolatedSwitchMask=sfpsPathMaskObjPyhsIsolatedSwitchMask, sfpsSwitchPathTableLostTime=sfpsSwitchPathTableLostTime, sfpsSwitchPathStatsPathNak=sfpsSwitchPathStatsPathNak, sfpsSwitchPathTableRcvDblBackTime=sfpsSwitchPathTableRcvDblBackTime, sfpsPathAPICost=sfpsPathAPICost, sfpsPathAPISrcMac=sfpsPathAPISrcMac, sfpsSwitchPathAPIBaseMAC=sfpsSwitchPathAPIBaseMAC, sfpsSwitchPathTableSrcDblBackCnt=sfpsSwitchPathTableSrcDblBackCnt, sfpsServiceCenterPathName=sfpsServiceCenterPathName, sfpsChassisRIPPathNumRequests=sfpsChassisRIPPathNumRequests, sfpsSwitchPathTable=sfpsSwitchPathTable, sfpsStaticPathFloodEnabled=sfpsStaticPathFloodEnabled, sfpsPathAPIID=sfpsPathAPIID, sfpsSwitchPathStatsRcdDblBack=sfpsSwitchPathStatsRcdDblBack, sfpsStaticPathPort=sfpsStaticPathPort, sfpsSwitchPathStatsActiveRemote=sfpsSwitchPathStatsActiveRemote, sfpsServiceCenterPathOperStatus=sfpsServiceCenterPathOperStatus, sfpsSwitchPathTableFoundCnt=sfpsSwitchPathTableFoundCnt, sfpsPathMaskObjPhysFloodNoINB=sfpsPathMaskObjPhysFloodNoINB, sfpsSwitchPathStatsLocateAck=sfpsSwitchPathStatsLocateAck, sfpsServiceCenterPathResponses=sfpsServiceCenterPathResponses, sfpsServiceCenterPathAdminStatus=sfpsServiceCenterPathAdminStatus, sfpsStaticPathEntry=sfpsStaticPathEntry, sfpsSwitchPathAPIPort=sfpsSwitchPathAPIPort, sfpsStaticPathUplinkEnabled=sfpsStaticPathUplinkEnabled, sfpsSwitchPathStatsMaxEntries=sfpsSwitchPathStatsMaxEntries, sfpsSwitchPathTableDirReapTime=sfpsSwitchPathTableDirReapTime, sfpsChassisRIPPathNumInTable=sfpsChassisRIPPathNumInTable, SfpsAddress=SfpsAddress, sfpsPathAPIInPort=sfpsPathAPIInPort, sfpsSwitchPathStatsReapAt=sfpsSwitchPathStatsReapAt, sfpsPathMaskObjPathChangeCounter=sfpsPathMaskObjPathChangeCounter, sfpsPathMaskObjOverrideFloodMask=sfpsPathMaskObjOverrideFloodMask, sfpsPathAPIVerb=sfpsPathAPIVerb, sfpsSwitchPathTableDirReapCnt=sfpsSwitchPathTableDirReapCnt, sfpsSwitchPathStatsMemUsage=sfpsSwitchPathStatsMemUsage, sfpsServiceCenterPathStatusTime=sfpsServiceCenterPathStatusTime, sfpsSwitchPathStatsLocateReq=sfpsSwitchPathStatsLocateReq, sfpsSwitchPathAPIReapAt=sfpsSwitchPathAPIReapAt, sfpsPathMaskObjLogFloodNoINB=sfpsPathMaskObjLogFloodNoINB, sfpsSwitchPathStatsPathReq=sfpsSwitchPathStatsPathReq, sfpsSwitchPathStatsActiveLocal=sfpsSwitchPathStatsActiveLocal, sfpsSwitchPathTableIsActive=sfpsSwitchPathTableIsActive, sfpsPathMaskObjLogPortMask=sfpsPathMaskObjLogPortMask, sfpsSwitchPathStatsTableSize=sfpsSwitchPathStatsTableSize, sfpsPathMaskObjPathChangeEvent=sfpsPathMaskObjPathChangeEvent, sfpsSwitchPathStatsDeadLocal=sfpsSwitchPathStatsDeadLocal, sfpsChassisRIPPathNumReplyAck=sfpsChassisRIPPathNumReplyAck, sfpsPathAPIPortName=sfpsPathAPIPortName, sfpsSwitchPathTableIsLocal=sfpsSwitchPathTableIsLocal, sfpsPathMaskObjLogDownlinkMask=sfpsPathMaskObjLogDownlinkMask, sfpsSwitchPathStatsStaticRemote=sfpsSwitchPathStatsStaticRemote, sfpsSwitchPathStatsPathUnk=sfpsSwitchPathStatsPathUnk, sfpsSwitchPathTableRefCnt=sfpsSwitchPathTableRefCnt, sfpsPathAPIHop=sfpsPathAPIHop, sfpsSwitchPathTableSwitchMAC=sfpsSwitchPathTableSwitchMAC, sfpsServiceCenterPathRequests=sfpsServiceCenterPathRequests, sfpsSwitchPathTableLostCnt=sfpsSwitchPathTableLostCnt, sfpsSwitchPathTableRcvDblBackCnt=sfpsSwitchPathTableRcvDblBackCnt, sfpsServiceCenterPathHashLeaf=sfpsServiceCenterPathHashLeaf, sfpsSwitchPathTableIsStatic=sfpsSwitchPathTableIsStatic, sfpsPathMaskObjPhysPortMask=sfpsPathMaskObjPhysPortMask, sfpsPathMaskObjLogResolveMask=sfpsPathMaskObjLogResolveMask, sfpsSwitchPathTablePort=sfpsSwitchPathTablePort, sfpsSwitchPathStatsNumEntries=sfpsSwitchPathStatsNumEntries, sfpsSwitchPathStatsLocateUnk=sfpsSwitchPathStatsLocateUnk, sfpsServiceCenterPathEntry=sfpsServiceCenterPathEntry, sfpsSwitchPathStatsSndDblBack=sfpsSwitchPathStatsSndDblBack, sfpsSwitchPathStatsPathAck=sfpsSwitchPathStatsPathAck, sfpsServiceCenterPathTable=sfpsServiceCenterPathTable, sfpsSwitchPathAPIMaxRcvDblBack=sfpsSwitchPathAPIMaxRcvDblBack, sfpsPathAPIDstMac=sfpsPathAPIDstMac, sfpsPathMaskObjPathCounterReset=sfpsPathMaskObjPathCounterReset, sfpsPathMaskObjOldLogPortMask=sfpsPathMaskObjOldLogPortMask, sfpsPathMaskObjIsolatedSwitchMask=sfpsPathMaskObjIsolatedSwitchMask, sfpsServiceCenterPathMetric=sfpsServiceCenterPathMetric, sfpsPathMaskObjPhysResolveMask=sfpsPathMaskObjPhysResolveMask, sfpsSwitchPathTableFoundTime=sfpsSwitchPathTableFoundTime, sfpsSwitchPathStatsReapReady=sfpsSwitchPathStatsReapReady)
|
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, value_range_constraint, single_value_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection')
(sfps_path_api, sfps_switch_path_stats, sfps_static_path, sfps_path_mask_obj, sfps_chassis_rip_path, sfps_switch_path_api, sfps_switch_path, sfps_isp_switch_path) = mibBuilder.importSymbols('CTRON-SFPS-INCLUDE-MIB', 'sfpsPathAPI', 'sfpsSwitchPathStats', 'sfpsStaticPath', 'sfpsPathMaskObj', 'sfpsChassisRIPPath', 'sfpsSwitchPathAPI', 'sfpsSwitchPath', 'sfpsISPSwitchPath')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(integer32, iso, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, time_ticks, bits, unsigned32, module_identity, gauge32, mib_identifier, ip_address, object_identity, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'iso', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'TimeTicks', 'Bits', 'Unsigned32', 'ModuleIdentity', 'Gauge32', 'MibIdentifier', 'IpAddress', 'ObjectIdentity', 'Counter32')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
class Sfpsaddress(OctetString):
subtype_spec = OctetString.subtypeSpec + value_size_constraint(6, 6)
fixed_length = 6
class Hexinteger(Integer32):
pass
sfps_service_center_path_table = mib_table((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1))
if mibBuilder.loadTexts:
sfpsServiceCenterPathTable.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsServiceCenterPathTable.setDescription('This table gives path semantics to call processing.')
sfps_service_center_path_entry = mib_table_row((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1)).setIndexNames((0, 'CTRON-SFPS-PATH-MIB', 'sfpsServiceCenterPathHashLeaf'))
if mibBuilder.loadTexts:
sfpsServiceCenterPathEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsServiceCenterPathEntry.setDescription('Each entry contains the configuration of the Path Entry.')
sfps_service_center_path_hash_leaf = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 1), hex_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsServiceCenterPathHashLeaf.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsServiceCenterPathHashLeaf.setDescription('Server hash, part of instance key.')
sfps_service_center_path_metric = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsServiceCenterPathMetric.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsServiceCenterPathMetric.setDescription('Defines order servers are called low to high.')
sfps_service_center_path_name = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 3), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsServiceCenterPathName.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsServiceCenterPathName.setDescription('Server name.')
sfps_service_center_path_oper_status = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('kStatusRunning', 1), ('kStatusHalted', 2), ('kStatusPending', 3), ('kStatusFaulted', 4), ('kStatusNotStarted', 5)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsServiceCenterPathOperStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsServiceCenterPathOperStatus.setDescription('Operational state of entry.')
sfps_service_center_path_admin_status = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('disable', 2), ('enable', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsServiceCenterPathAdminStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsServiceCenterPathAdminStatus.setDescription('Administrative State of Entry.')
sfps_service_center_path_status_time = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 6), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsServiceCenterPathStatusTime.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsServiceCenterPathStatusTime.setDescription('Time Tick of last operStatus change.')
sfps_service_center_path_requests = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsServiceCenterPathRequests.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsServiceCenterPathRequests.setDescription('Requests made to server.')
sfps_service_center_path_responses = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 1, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsServiceCenterPathResponses.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsServiceCenterPathResponses.setDescription('GOOD replies by server.')
sfps_path_api_verb = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=named_values(('other', 1), ('add', 2), ('delete', 3), ('uplink', 4), ('downlink', 5), ('diameter', 6), ('flood-add', 7), ('flood-delete', 8), ('force-idle-traffic', 9), ('remove-traffic-cnx', 10)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsPathAPIVerb.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathAPIVerb.setDescription('')
sfps_path_api_switch_mac = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 2), sfps_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsPathAPISwitchMac.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathAPISwitchMac.setDescription('')
sfps_path_api_port_name = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 3), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsPathAPIPortName.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathAPIPortName.setDescription('')
sfps_path_api_cost = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 4), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsPathAPICost.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathAPICost.setDescription('')
sfps_path_api_hop = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 5), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsPathAPIHop.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathAPIHop.setDescription('')
sfps_path_apiid = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 6), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsPathAPIID.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathAPIID.setDescription('')
sfps_path_api_in_port = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 7), sfps_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsPathAPIInPort.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathAPIInPort.setDescription('')
sfps_path_api_src_mac = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 8), sfps_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsPathAPISrcMac.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathAPISrcMac.setDescription('')
sfps_path_api_dst_mac = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 3, 9), sfps_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsPathAPIDstMac.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathAPIDstMac.setDescription('')
sfps_static_path_table = mib_table((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1))
if mibBuilder.loadTexts:
sfpsStaticPathTable.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsStaticPathTable.setDescription('')
sfps_static_path_entry = mib_table_row((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1)).setIndexNames((0, 'CTRON-SFPS-PATH-MIB', 'sfpsStaticPathPort'))
if mibBuilder.loadTexts:
sfpsStaticPathEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsStaticPathEntry.setDescription('')
sfps_static_path_port = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsStaticPathPort.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsStaticPathPort.setDescription('')
sfps_static_path_flood_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(2, 3))).clone(namedValues=named_values(('disabled', 2), ('enabled', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsStaticPathFloodEnabled.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsStaticPathFloodEnabled.setDescription('')
sfps_static_path_uplink_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(2, 3))).clone(namedValues=named_values(('disabled', 2), ('enabled', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsStaticPathUplinkEnabled.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsStaticPathUplinkEnabled.setDescription('')
sfps_static_path_downlink_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 4, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(2, 3))).clone(namedValues=named_values(('disabled', 2), ('enabled', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsStaticPathDownlinkEnabled.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsStaticPathDownlinkEnabled.setDescription('')
sfps_path_mask_obj_log_port_mask = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 1), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjLogPortMask.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjLogPortMask.setDescription('')
sfps_path_mask_obj_phys_port_mask = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjPhysPortMask.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjPhysPortMask.setDescription('')
sfps_path_mask_obj_log_resolve_mask = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 3), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjLogResolveMask.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjLogResolveMask.setDescription('')
sfps_path_mask_obj_log_flood_no_inb = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 4), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjLogFloodNoINB.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjLogFloodNoINB.setDescription('')
sfps_path_mask_obj_phys_resolve_mask = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 5), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjPhysResolveMask.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjPhysResolveMask.setDescription('')
sfps_path_mask_obj_phys_flood_no_inb = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 6), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjPhysFloodNoINB.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjPhysFloodNoINB.setDescription('')
sfps_path_mask_obj_old_log_port_mask = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 7), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjOldLogPortMask.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjOldLogPortMask.setDescription('')
sfps_path_mask_obj_path_change_event = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 8), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsPathMaskObjPathChangeEvent.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjPathChangeEvent.setDescription('')
sfps_path_mask_obj_path_change_counter = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjPathChangeCounter.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjPathChangeCounter.setDescription('')
sfps_path_mask_obj_last_change_time = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 10), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjLastChangeTime.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjLastChangeTime.setDescription('')
sfps_path_mask_obj_path_counter_reset = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 11), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsPathMaskObjPathCounterReset.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjPathCounterReset.setDescription('')
sfps_path_mask_obj_isolated_switch_mask = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 12), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjIsolatedSwitchMask.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjIsolatedSwitchMask.setDescription('')
sfps_path_mask_obj_pyhs_isolated_switch_mask = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 13), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjPyhsIsolatedSwitchMask.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjPyhsIsolatedSwitchMask.setDescription('')
sfps_path_mask_obj_log_downlink_mask = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 14), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjLogDownlinkMask.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjLogDownlinkMask.setDescription('')
sfps_path_mask_obj_core_uplink_mask = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 15), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjCoreUplinkMask.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjCoreUplinkMask.setDescription('')
sfps_path_mask_obj_override_flood_mask = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 5, 16), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(2, 1))).clone(namedValues=named_values(('disable', 2), ('enable', 1)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsPathMaskObjOverrideFloodMask.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsPathMaskObjOverrideFloodMask.setDescription('')
sfps_switch_path_stats_num_entries = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsNumEntries.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsNumEntries.setDescription('')
sfps_switch_path_stats_max_entries = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsMaxEntries.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsMaxEntries.setDescription('')
sfps_switch_path_stats_table_size = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsTableSize.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsTableSize.setDescription('')
sfps_switch_path_stats_mem_usage = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsMemUsage.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsMemUsage.setDescription('')
sfps_switch_path_stats_active_local = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsActiveLocal.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsActiveLocal.setDescription('')
sfps_switch_path_stats_active_remote = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsActiveRemote.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsActiveRemote.setDescription('')
sfps_switch_path_stats_static_remote = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsStaticRemote.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsStaticRemote.setDescription('')
sfps_switch_path_stats_dead_local = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsDeadLocal.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsDeadLocal.setDescription('')
sfps_switch_path_stats_dead_remote = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsDeadRemote.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsDeadRemote.setDescription('')
sfps_switch_path_stats_reap_ready = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 10), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsReapReady.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsReapReady.setDescription('')
sfps_switch_path_stats_reap_at = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 11), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsReapAt.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsReapAt.setDescription('')
sfps_switch_path_stats_reap_count = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 12), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsReapCount.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsReapCount.setDescription('')
sfps_switch_path_stats_path_req = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 13), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsPathReq.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsPathReq.setDescription('')
sfps_switch_path_stats_path_ack = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 14), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsPathAck.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsPathAck.setDescription('')
sfps_switch_path_stats_path_nak = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 15), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsPathNak.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsPathNak.setDescription('')
sfps_switch_path_stats_path_unk = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 16), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsPathUnk.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsPathUnk.setDescription('')
sfps_switch_path_stats_locate_req = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 17), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsLocateReq.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsLocateReq.setDescription('')
sfps_switch_path_stats_locate_ack = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 18), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsLocateAck.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsLocateAck.setDescription('')
sfps_switch_path_stats_locate_nak = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 19), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsLocateNak.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsLocateNak.setDescription('')
sfps_switch_path_stats_locate_unk = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 20), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsLocateUnk.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsLocateUnk.setDescription('')
sfps_switch_path_stats_snd_dbl_back = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 21), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsSndDblBack.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsSndDblBack.setDescription('')
sfps_switch_path_stats_rcd_dbl_back = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 1, 22), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsRcdDblBack.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathStatsRcdDblBack.setDescription('')
sfps_switch_path_api_verb = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('other', 1), ('addFind', 2), ('lose', 3), ('delete', 4), ('clearTable', 5), ('resetStats', 6), ('setReapAt', 7), ('setMaxRcvDblBck', 8)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsSwitchPathAPIVerb.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathAPIVerb.setDescription('')
sfps_switch_path_api_port = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 2), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsSwitchPathAPIPort.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathAPIPort.setDescription('')
sfps_switch_path_api_base_mac = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 3), sfps_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsSwitchPathAPIBaseMAC.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathAPIBaseMAC.setDescription('')
sfps_switch_path_api_reap_at = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 4), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsSwitchPathAPIReapAt.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathAPIReapAt.setDescription('')
sfps_switch_path_api_max_rcv_dbl_back = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 2, 5), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sfpsSwitchPathAPIMaxRcvDblBack.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathAPIMaxRcvDblBack.setDescription('')
sfps_switch_path_table = mib_table((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3))
if mibBuilder.loadTexts:
sfpsSwitchPathTable.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTable.setDescription('')
sfps_switch_path_table_entry = mib_table_row((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1)).setIndexNames((0, 'CTRON-SFPS-PATH-MIB', 'sfpsSwitchPathTableSwitchMAC'), (0, 'CTRON-SFPS-PATH-MIB', 'sfpsSwitchPathTablePort'))
if mibBuilder.loadTexts:
sfpsSwitchPathTableEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableEntry.setDescription('.')
sfps_switch_path_table_switch_mac = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 1), sfps_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableSwitchMAC.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableSwitchMAC.setDescription('')
sfps_switch_path_table_port = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTablePort.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTablePort.setDescription('')
sfps_switch_path_table_is_active = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableIsActive.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableIsActive.setDescription('')
sfps_switch_path_table_is_static = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableIsStatic.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableIsStatic.setDescription('')
sfps_switch_path_table_is_local = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableIsLocal.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableIsLocal.setDescription('')
sfps_switch_path_table_ref_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableRefCnt.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableRefCnt.setDescription('')
sfps_switch_path_table_ref_time = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 7), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableRefTime.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableRefTime.setDescription('')
sfps_switch_path_table_found_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableFoundCnt.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableFoundCnt.setDescription('')
sfps_switch_path_table_found_time = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 9), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableFoundTime.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableFoundTime.setDescription('')
sfps_switch_path_table_lost_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 10), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableLostCnt.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableLostCnt.setDescription('')
sfps_switch_path_table_lost_time = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 11), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableLostTime.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableLostTime.setDescription('')
sfps_switch_path_table_src_dbl_back_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 12), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableSrcDblBackCnt.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableSrcDblBackCnt.setDescription('')
sfps_switch_path_table_src_dbl_back_time = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 13), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableSrcDblBackTime.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableSrcDblBackTime.setDescription('')
sfps_switch_path_table_rcv_dbl_back_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 14), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableRcvDblBackCnt.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableRcvDblBackCnt.setDescription('')
sfps_switch_path_table_rcv_dbl_back_time = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 15), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableRcvDblBackTime.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableRcvDblBackTime.setDescription('')
sfps_switch_path_table_dir_reap_cnt = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 16), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableDirReapCnt.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableDirReapCnt.setDescription('')
sfps_switch_path_table_dir_reap_time = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 7, 2, 3, 1, 17), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsSwitchPathTableDirReapTime.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsSwitchPathTableDirReapTime.setDescription('')
sfps_chassis_rip_path_num_in_table = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsChassisRIPPathNumInTable.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsChassisRIPPathNumInTable.setDescription('')
sfps_chassis_rip_path_num_requests = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsChassisRIPPathNumRequests.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsChassisRIPPathNumRequests.setDescription('')
sfps_chassis_rip_path_num_reply_ack = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsChassisRIPPathNumReplyAck.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsChassisRIPPathNumReplyAck.setDescription('')
sfps_chassis_rip_path_num_reply_unk = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 4, 2, 2, 2, 4, 5, 12, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sfpsChassisRIPPathNumReplyUnk.setStatus('mandatory')
if mibBuilder.loadTexts:
sfpsChassisRIPPathNumReplyUnk.setDescription('')
mibBuilder.exportSymbols('CTRON-SFPS-PATH-MIB', sfpsStaticPathTable=sfpsStaticPathTable, sfpsSwitchPathTableSrcDblBackTime=sfpsSwitchPathTableSrcDblBackTime, sfpsStaticPathDownlinkEnabled=sfpsStaticPathDownlinkEnabled, sfpsPathAPISwitchMac=sfpsPathAPISwitchMac, sfpsSwitchPathAPIVerb=sfpsSwitchPathAPIVerb, sfpsSwitchPathStatsDeadRemote=sfpsSwitchPathStatsDeadRemote, sfpsPathMaskObjCoreUplinkMask=sfpsPathMaskObjCoreUplinkMask, sfpsSwitchPathTableEntry=sfpsSwitchPathTableEntry, sfpsSwitchPathTableRefTime=sfpsSwitchPathTableRefTime, sfpsSwitchPathStatsReapCount=sfpsSwitchPathStatsReapCount, HexInteger=HexInteger, sfpsChassisRIPPathNumReplyUnk=sfpsChassisRIPPathNumReplyUnk, sfpsPathMaskObjLastChangeTime=sfpsPathMaskObjLastChangeTime, sfpsSwitchPathStatsLocateNak=sfpsSwitchPathStatsLocateNak, sfpsPathMaskObjPyhsIsolatedSwitchMask=sfpsPathMaskObjPyhsIsolatedSwitchMask, sfpsSwitchPathTableLostTime=sfpsSwitchPathTableLostTime, sfpsSwitchPathStatsPathNak=sfpsSwitchPathStatsPathNak, sfpsSwitchPathTableRcvDblBackTime=sfpsSwitchPathTableRcvDblBackTime, sfpsPathAPICost=sfpsPathAPICost, sfpsPathAPISrcMac=sfpsPathAPISrcMac, sfpsSwitchPathAPIBaseMAC=sfpsSwitchPathAPIBaseMAC, sfpsSwitchPathTableSrcDblBackCnt=sfpsSwitchPathTableSrcDblBackCnt, sfpsServiceCenterPathName=sfpsServiceCenterPathName, sfpsChassisRIPPathNumRequests=sfpsChassisRIPPathNumRequests, sfpsSwitchPathTable=sfpsSwitchPathTable, sfpsStaticPathFloodEnabled=sfpsStaticPathFloodEnabled, sfpsPathAPIID=sfpsPathAPIID, sfpsSwitchPathStatsRcdDblBack=sfpsSwitchPathStatsRcdDblBack, sfpsStaticPathPort=sfpsStaticPathPort, sfpsSwitchPathStatsActiveRemote=sfpsSwitchPathStatsActiveRemote, sfpsServiceCenterPathOperStatus=sfpsServiceCenterPathOperStatus, sfpsSwitchPathTableFoundCnt=sfpsSwitchPathTableFoundCnt, sfpsPathMaskObjPhysFloodNoINB=sfpsPathMaskObjPhysFloodNoINB, sfpsSwitchPathStatsLocateAck=sfpsSwitchPathStatsLocateAck, sfpsServiceCenterPathResponses=sfpsServiceCenterPathResponses, sfpsServiceCenterPathAdminStatus=sfpsServiceCenterPathAdminStatus, sfpsStaticPathEntry=sfpsStaticPathEntry, sfpsSwitchPathAPIPort=sfpsSwitchPathAPIPort, sfpsStaticPathUplinkEnabled=sfpsStaticPathUplinkEnabled, sfpsSwitchPathStatsMaxEntries=sfpsSwitchPathStatsMaxEntries, sfpsSwitchPathTableDirReapTime=sfpsSwitchPathTableDirReapTime, sfpsChassisRIPPathNumInTable=sfpsChassisRIPPathNumInTable, SfpsAddress=SfpsAddress, sfpsPathAPIInPort=sfpsPathAPIInPort, sfpsSwitchPathStatsReapAt=sfpsSwitchPathStatsReapAt, sfpsPathMaskObjPathChangeCounter=sfpsPathMaskObjPathChangeCounter, sfpsPathMaskObjOverrideFloodMask=sfpsPathMaskObjOverrideFloodMask, sfpsPathAPIVerb=sfpsPathAPIVerb, sfpsSwitchPathTableDirReapCnt=sfpsSwitchPathTableDirReapCnt, sfpsSwitchPathStatsMemUsage=sfpsSwitchPathStatsMemUsage, sfpsServiceCenterPathStatusTime=sfpsServiceCenterPathStatusTime, sfpsSwitchPathStatsLocateReq=sfpsSwitchPathStatsLocateReq, sfpsSwitchPathAPIReapAt=sfpsSwitchPathAPIReapAt, sfpsPathMaskObjLogFloodNoINB=sfpsPathMaskObjLogFloodNoINB, sfpsSwitchPathStatsPathReq=sfpsSwitchPathStatsPathReq, sfpsSwitchPathStatsActiveLocal=sfpsSwitchPathStatsActiveLocal, sfpsSwitchPathTableIsActive=sfpsSwitchPathTableIsActive, sfpsPathMaskObjLogPortMask=sfpsPathMaskObjLogPortMask, sfpsSwitchPathStatsTableSize=sfpsSwitchPathStatsTableSize, sfpsPathMaskObjPathChangeEvent=sfpsPathMaskObjPathChangeEvent, sfpsSwitchPathStatsDeadLocal=sfpsSwitchPathStatsDeadLocal, sfpsChassisRIPPathNumReplyAck=sfpsChassisRIPPathNumReplyAck, sfpsPathAPIPortName=sfpsPathAPIPortName, sfpsSwitchPathTableIsLocal=sfpsSwitchPathTableIsLocal, sfpsPathMaskObjLogDownlinkMask=sfpsPathMaskObjLogDownlinkMask, sfpsSwitchPathStatsStaticRemote=sfpsSwitchPathStatsStaticRemote, sfpsSwitchPathStatsPathUnk=sfpsSwitchPathStatsPathUnk, sfpsSwitchPathTableRefCnt=sfpsSwitchPathTableRefCnt, sfpsPathAPIHop=sfpsPathAPIHop, sfpsSwitchPathTableSwitchMAC=sfpsSwitchPathTableSwitchMAC, sfpsServiceCenterPathRequests=sfpsServiceCenterPathRequests, sfpsSwitchPathTableLostCnt=sfpsSwitchPathTableLostCnt, sfpsSwitchPathTableRcvDblBackCnt=sfpsSwitchPathTableRcvDblBackCnt, sfpsServiceCenterPathHashLeaf=sfpsServiceCenterPathHashLeaf, sfpsSwitchPathTableIsStatic=sfpsSwitchPathTableIsStatic, sfpsPathMaskObjPhysPortMask=sfpsPathMaskObjPhysPortMask, sfpsPathMaskObjLogResolveMask=sfpsPathMaskObjLogResolveMask, sfpsSwitchPathTablePort=sfpsSwitchPathTablePort, sfpsSwitchPathStatsNumEntries=sfpsSwitchPathStatsNumEntries, sfpsSwitchPathStatsLocateUnk=sfpsSwitchPathStatsLocateUnk, sfpsServiceCenterPathEntry=sfpsServiceCenterPathEntry, sfpsSwitchPathStatsSndDblBack=sfpsSwitchPathStatsSndDblBack, sfpsSwitchPathStatsPathAck=sfpsSwitchPathStatsPathAck, sfpsServiceCenterPathTable=sfpsServiceCenterPathTable, sfpsSwitchPathAPIMaxRcvDblBack=sfpsSwitchPathAPIMaxRcvDblBack, sfpsPathAPIDstMac=sfpsPathAPIDstMac, sfpsPathMaskObjPathCounterReset=sfpsPathMaskObjPathCounterReset, sfpsPathMaskObjOldLogPortMask=sfpsPathMaskObjOldLogPortMask, sfpsPathMaskObjIsolatedSwitchMask=sfpsPathMaskObjIsolatedSwitchMask, sfpsServiceCenterPathMetric=sfpsServiceCenterPathMetric, sfpsPathMaskObjPhysResolveMask=sfpsPathMaskObjPhysResolveMask, sfpsSwitchPathTableFoundTime=sfpsSwitchPathTableFoundTime, sfpsSwitchPathStatsReapReady=sfpsSwitchPathStatsReapReady)
|
spec = {
'name' : "a 4-node liberty cluster",
# 'external network name' : "exnet3",
'keypair' : "openstack_rsa",
'controller' : "r720",
'dns' : "10.30.65.200",
'credentials' : { 'user' : "nic", 'password' : "nic", 'project' : "nic" },
'Networks' : [
# { 'name' : "liberty" , "start": "192.168.0.2", "end": "192.168.0.254", "subnet" :" 192.168.0.0/24", "gateway": "192.168.0.1" },
{ 'name' : "liberty-dataplane" , "subnet" :" 172.16.0.0/24" },
{ 'name' : "liberty-provider" , "subnet" :" 172.16.1.0/24","start": "172.16.1.3", "end": "172.16.1.127", "gateway": "172.16.1.1" },
],
# Hint: list explicity required external IPs first to avoid them being claimed by hosts that don't care...
'Hosts' : [
{ 'name' : "liberty-controller" , 'image' : "centos1602" , 'flavor':"m1.large" , 'net' : [ ("routed-net" , "liberty-controller"), ] },
{ 'name' : "liberty-network" , 'image' : "centos1602" , 'flavor':"m1.xlarge" , 'net' : [ ("routed-net" ,"liberty-network"), ("liberty-dataplane"), ("liberty-provider","*") ] },
{ 'name' : "liberty-compute1" , 'image' : "centos1602" , 'flavor':"m1.xlarge" , 'net' : [ ("routed-net" ,"liberty-compute1"), ("liberty-dataplane"), ("liberty-provider","*") ] },
{ 'name' : "liberty-compute2" , 'image' : "centos1602" , 'flavor':"m1.xlarge" , 'net' : [ ("routed-net" ,"liberty-compute2"), ("liberty-dataplane"), ("liberty-provider","*") ] },
{ 'name' : "liberty-compute3" , 'image' : "centos1602" , 'flavor':"m1.xlarge" , 'net' : [ ("routed-net" ,"liberty-compute3"), ("liberty-dataplane"), ("liberty-provider","*") ] },
{ 'name' : "liberty-cloudify" , 'image' : "centos1602" , 'flavor':"m1.medium" , 'net' : [ ("routed-net" , "liberty-cloudify"), ("liberty-provider","*") ] },
]
}
|
spec = {'name': 'a 4-node liberty cluster', 'keypair': 'openstack_rsa', 'controller': 'r720', 'dns': '10.30.65.200', 'credentials': {'user': 'nic', 'password': 'nic', 'project': 'nic'}, 'Networks': [{'name': 'liberty-dataplane', 'subnet': ' 172.16.0.0/24'}, {'name': 'liberty-provider', 'subnet': ' 172.16.1.0/24', 'start': '172.16.1.3', 'end': '172.16.1.127', 'gateway': '172.16.1.1'}], 'Hosts': [{'name': 'liberty-controller', 'image': 'centos1602', 'flavor': 'm1.large', 'net': [('routed-net', 'liberty-controller')]}, {'name': 'liberty-network', 'image': 'centos1602', 'flavor': 'm1.xlarge', 'net': [('routed-net', 'liberty-network'), 'liberty-dataplane', ('liberty-provider', '*')]}, {'name': 'liberty-compute1', 'image': 'centos1602', 'flavor': 'm1.xlarge', 'net': [('routed-net', 'liberty-compute1'), 'liberty-dataplane', ('liberty-provider', '*')]}, {'name': 'liberty-compute2', 'image': 'centos1602', 'flavor': 'm1.xlarge', 'net': [('routed-net', 'liberty-compute2'), 'liberty-dataplane', ('liberty-provider', '*')]}, {'name': 'liberty-compute3', 'image': 'centos1602', 'flavor': 'm1.xlarge', 'net': [('routed-net', 'liberty-compute3'), 'liberty-dataplane', ('liberty-provider', '*')]}, {'name': 'liberty-cloudify', 'image': 'centos1602', 'flavor': 'm1.medium', 'net': [('routed-net', 'liberty-cloudify'), ('liberty-provider', '*')]}]}
|
COM_SLEEP = 0x00
COM_QUIT = 0x01
COM_INIT_DB = 0x02
COM_QUERY = 0x03
COM_FIELD_LIST = 0x04
COM_CREATE_DB = 0x05
COM_DROP_DB = 0x06
COM_REFRESH = 0x07
COM_SHUTDOWN = 0x08
COM_STATISTICS = 0x09
COM_PROCESS_INFO = 0x0a
COM_CONNECT = 0x0b
COM_PROCESS_KILL = 0x0c
COM_DEBUG = 0x0d
COM_PING = 0x0e
COM_TIME = 0x0f
COM_DELAYED_INSERT = 0x10
COM_CHANGE_USER = 0x11
COM_BINLOG_DUMP = 0x12
COM_TABLE_DUMP = 0x13
COM_CONNECT_OUT = 0x14
COM_REGISTER_SLAVE = 0x15
COM_STMT_PREPARE = 0x16
COM_STMT_EXECUTE = 0x17
COM_STMT_SEND_LONG_DATA = 0x18
COM_STMT_CLOSE = 0x19
COM_STMT_RESET = 0x1a
COM_SET_OPTION = 0x1b
COM_STMT_FETCH = 0x1c
COM_DAEMON = 0x1d
COM_BINLOG_DUMP_GTID = 0x1e
COM_END = 0x1f
local_vars = locals()
def com_type_name(val):
for _var in local_vars:
if "COM_" in _var:
if local_vars[_var] == val:
return _var
|
com_sleep = 0
com_quit = 1
com_init_db = 2
com_query = 3
com_field_list = 4
com_create_db = 5
com_drop_db = 6
com_refresh = 7
com_shutdown = 8
com_statistics = 9
com_process_info = 10
com_connect = 11
com_process_kill = 12
com_debug = 13
com_ping = 14
com_time = 15
com_delayed_insert = 16
com_change_user = 17
com_binlog_dump = 18
com_table_dump = 19
com_connect_out = 20
com_register_slave = 21
com_stmt_prepare = 22
com_stmt_execute = 23
com_stmt_send_long_data = 24
com_stmt_close = 25
com_stmt_reset = 26
com_set_option = 27
com_stmt_fetch = 28
com_daemon = 29
com_binlog_dump_gtid = 30
com_end = 31
local_vars = locals()
def com_type_name(val):
for _var in local_vars:
if 'COM_' in _var:
if local_vars[_var] == val:
return _var
|
name, age = "Sharwan27", 16
username = "Sharwan27"
print ('Hello!')
print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
|
(name, age) = ('Sharwan27', 16)
username = 'Sharwan27'
print('Hello!')
print('Name: {}\nAge: {}\nUsername: {}'.format(name, age, username))
|
# count = 10
# while count>0:
# print("Sandip")
# count-=1
# name="Sandip"
# for char in name:
# print(char)
# for item in name:
# print(item, end=" ")
# print("")
# print("My name is",name)
# print("My name is",name,sep="=")
# for item in range(5):
# print(item,end=" ")
# print("")
# for item in range(1,11,2):
# print(item,end=" ")
# print()
# for i in range(2,11):
# for j in range(1,11):
# print(i,'X',j,'=',(i*j))
# print()
# for i in range(1,6):
# if(i==4):
# continue
# print(i)
#String
name = "Sandip Dhakal!"
lenth=len(name)
# print(str(lenth)+" Sabd")
# print(name[lenth-1])
# name = name+'Sand'
# name="Prajwol "*2
# print(name)
# name[0]="T" this is not permisible as string is immuatable collection
# print(name[7:])
# print(name[:7])
# print(name[::2])
# print(name[::-1])
# print(name[5:2:-1])
# print(name[5::-2])
print("Wo'w'")
print('Wo"w"')
print('Wo\'w\'')
print('San\\dip\\')
print("sand\ndip")
print("sand\tdip")
print("sand\bdip")
check = "H" not in name
print(check)
print(type(check))
|
name = 'Sandip Dhakal!'
lenth = len(name)
print("Wo'w'")
print('Wo"w"')
print("Wo'w'")
print('San\\dip\\')
print('sand\ndip')
print('sand\tdip')
print('sand\x08dip')
check = 'H' not in name
print(check)
print(type(check))
|
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Helper functions to expand "make" variables of form $(VAR)
"""
def expand_variables(ctx, s, outs = [], output_dir = False, attribute_name = "args"):
"""This function is the same as ctx.expand_make_variables with the additional
genrule-like substitutions of:
- $@: The output file if it is a single file. Else triggers a build error.
- $(@D): The output directory. If there is only one file name in outs,
this expands to the directory containing that file. If there are multiple files,
this instead expands to the package's root directory in the bin tree,
even if all generated files belong to the same subdirectory!
- $(RULEDIR): The output directory of the rule, that is, the directory
corresponding to the name of the package containing the rule under the bin tree.
See https://docs.bazel.build/versions/main/be/general.html#genrule.cmd and
https://docs.bazel.build/versions/main/be/make-variables.html#predefined_genrule_variables
for more information of how these special variables are expanded.
"""
rule_dir = [f for f in [
ctx.bin_dir.path,
ctx.label.workspace_root,
ctx.label.package,
] if f]
additional_substitutions = {}
if output_dir:
if s.find("$@") != -1 or s.find("$(@)") != -1:
fail("""$@ substitution may only be used with output_dir=False.
Upgrading rules_nodejs? Maybe you need to switch from $@ to $(@D)
See https://github.com/bazelbuild/rules_nodejs/releases/tag/0.42.0""")
# We'll write into a newly created directory named after the rule
output_dir = [f for f in [
ctx.bin_dir.path,
ctx.label.workspace_root,
ctx.label.package,
ctx.label.name,
] if f]
else:
if s.find("$@") != -1 or s.find("$(@)") != -1:
if len(outs) > 1:
fail("""$@ substitution may only be used with a single out
Upgrading rules_nodejs? Maybe you need to switch from $@ to $(RULEDIR)
See https://github.com/bazelbuild/rules_nodejs/releases/tag/0.42.0""")
if len(outs) == 1:
additional_substitutions["@"] = outs[0].path
output_dir = outs[0].dirname.split("/")
else:
output_dir = rule_dir[:]
# The list comprehension removes empty segments like if we are in the root package
additional_substitutions["@D"] = "/".join([o for o in output_dir if o])
additional_substitutions["RULEDIR"] = "/".join([o for o in rule_dir if o])
return ctx.expand_make_variables(attribute_name, s, additional_substitutions)
|
"""Helper functions to expand "make" variables of form $(VAR)
"""
def expand_variables(ctx, s, outs=[], output_dir=False, attribute_name='args'):
"""This function is the same as ctx.expand_make_variables with the additional
genrule-like substitutions of:
- $@: The output file if it is a single file. Else triggers a build error.
- $(@D): The output directory. If there is only one file name in outs,
this expands to the directory containing that file. If there are multiple files,
this instead expands to the package's root directory in the bin tree,
even if all generated files belong to the same subdirectory!
- $(RULEDIR): The output directory of the rule, that is, the directory
corresponding to the name of the package containing the rule under the bin tree.
See https://docs.bazel.build/versions/main/be/general.html#genrule.cmd and
https://docs.bazel.build/versions/main/be/make-variables.html#predefined_genrule_variables
for more information of how these special variables are expanded.
"""
rule_dir = [f for f in [ctx.bin_dir.path, ctx.label.workspace_root, ctx.label.package] if f]
additional_substitutions = {}
if output_dir:
if s.find('$@') != -1 or s.find('$(@)') != -1:
fail('$@ substitution may only be used with output_dir=False.\n Upgrading rules_nodejs? Maybe you need to switch from $@ to $(@D)\n See https://github.com/bazelbuild/rules_nodejs/releases/tag/0.42.0')
output_dir = [f for f in [ctx.bin_dir.path, ctx.label.workspace_root, ctx.label.package, ctx.label.name] if f]
else:
if s.find('$@') != -1 or s.find('$(@)') != -1:
if len(outs) > 1:
fail('$@ substitution may only be used with a single out\n Upgrading rules_nodejs? Maybe you need to switch from $@ to $(RULEDIR)\n See https://github.com/bazelbuild/rules_nodejs/releases/tag/0.42.0')
if len(outs) == 1:
additional_substitutions['@'] = outs[0].path
output_dir = outs[0].dirname.split('/')
else:
output_dir = rule_dir[:]
additional_substitutions['@D'] = '/'.join([o for o in output_dir if o])
additional_substitutions['RULEDIR'] = '/'.join([o for o in rule_dir if o])
return ctx.expand_make_variables(attribute_name, s, additional_substitutions)
|
def potencia(base, inicio=1, fin=10):
while inicio < fin:
resul=base**inicio
yield resul
inicio=inicio+1
print(list(potencia(3,1,50)))
|
def potencia(base, inicio=1, fin=10):
while inicio < fin:
resul = base ** inicio
yield resul
inicio = inicio + 1
print(list(potencia(3, 1, 50)))
|
class CFApiException(Exception):
"""Base exception for all custom exceptions raise by the cfapi module."""
class InvalidIdentifierException(CFApiException, ValueError):
"""Raised when trying to load data from an invalid URL (probably because the
data doesn't exist or isn't public)."""
class InvalidURL(CFApiException, ValueError):
"""Raised when typing to load a data using a given URL, but the URL isn't a
valid one."""
|
class Cfapiexception(Exception):
"""Base exception for all custom exceptions raise by the cfapi module."""
class Invalididentifierexception(CFApiException, ValueError):
"""Raised when trying to load data from an invalid URL (probably because the
data doesn't exist or isn't public)."""
class Invalidurl(CFApiException, ValueError):
"""Raised when typing to load a data using a given URL, but the URL isn't a
valid one."""
|
N_L = input().split()
Number_lights = int(N_L[0])
Length = int(N_L[1])
time = 0
last_distance = 0
for x in range(Number_lights):
information = input().split()
time += int(information[0]) - last_distance
remainder = time % (int(information[1]) + int(information[2]))
if remainder < int(information[1]):
time += int(information[1]) - remainder
last_distance = int(information[0])
time += Length - last_distance
print(time)
|
n_l = input().split()
number_lights = int(N_L[0])
length = int(N_L[1])
time = 0
last_distance = 0
for x in range(Number_lights):
information = input().split()
time += int(information[0]) - last_distance
remainder = time % (int(information[1]) + int(information[2]))
if remainder < int(information[1]):
time += int(information[1]) - remainder
last_distance = int(information[0])
time += Length - last_distance
print(time)
|
PATH_TO_STANFORD_CORENLP = '/local/cfwelch/stanford-corenlp-full-2018-02-27/*'
NUM_SPLITS = 1
TRAIN_SIZE = 0.67 # two thirds of the total data
# Define entity types here
# Each type must have a list of identifiers that do not contain the '_' token
# Example of an annotation:
#
# Kathe Halverson was the only aspect of EECS 555 Parallel Computing that I liked
# <instructor
# name=Kathe Halverson
# sentiment=positive>
# <class
# id=555
# name=Parallel Computing
# sentiment=negative>
ENT_TYPES = {'instructor': ['name'], \
'class': ['name', 'department', 'id'] \
}
# Shortcut for checking ids
ALL_IDS = list(set([i for j in ENT_TYPES for i in ENT_TYPES[j]]))
|
path_to_stanford_corenlp = '/local/cfwelch/stanford-corenlp-full-2018-02-27/*'
num_splits = 1
train_size = 0.67
ent_types = {'instructor': ['name'], 'class': ['name', 'department', 'id']}
all_ids = list(set([i for j in ENT_TYPES for i in ENT_TYPES[j]]))
|
# -*- coding: utf-8 -*-
"""DSM 5 SYNO.DSM.Network data."""
DSM_5_DSM_NETWORK = {
"data": {
"dns": ["192.168.1.1"],
"gateway": "192.168.1.1",
"hostname": "HOME-NAS",
"interfaces": [
{
"id": "eth0",
"ip": [{"address": "192.168.1.10", "netmask": "255.255.255.0"}],
"mac": "XX-XX-XX-XX-XX-XX",
"type": "lan",
}
],
"workgroup": "WORKGROUP",
},
"success": True,
}
|
"""DSM 5 SYNO.DSM.Network data."""
dsm_5_dsm_network = {'data': {'dns': ['192.168.1.1'], 'gateway': '192.168.1.1', 'hostname': 'HOME-NAS', 'interfaces': [{'id': 'eth0', 'ip': [{'address': '192.168.1.10', 'netmask': '255.255.255.0'}], 'mac': 'XX-XX-XX-XX-XX-XX', 'type': 'lan'}], 'workgroup': 'WORKGROUP'}, 'success': True}
|
#!/usr/bin/env python
#===================================================================================
#description : Methods for features exploration =
#author : Shashi Narayan, shashi.narayan(at){ed.ac.uk,loria.fr,gmail.com})=
#date : Created in 2014, Later revised in April 2016. =
#version : 0.1 =
#===================================================================================
class Feature_Nov27:
def get_split_feature(self, split_tuple, parent_sentence, children_sentence_list, boxer_graph):
# Calculating iLength
#iLength = boxer_graph.calculate_iLength(parent_sentence, children_sentence_list)
# Get split tuple pattern
split_pattern = boxer_graph.get_pattern_4_split_candidate(split_tuple)
#split_feature = split_pattern+"_"+str(iLength)
split_feature = split_pattern
return split_feature
def get_drop_ood_feature(self, ood_node, nodeset, main_sent_dict, boxer_graph):
ood_word = boxer_graph.extract_oodword(ood_node, main_sent_dict)
ood_position = boxer_graph.nodes[ood_node]["positions"][0] # length of positions is one
span = boxer_graph.extract_span_min_max(nodeset)
boundaryVal = "false"
if ood_position <= span[0] or ood_position >= span[1]:
boundaryVal = "true"
drop_ood_feature = ood_word+"_"+boundaryVal
return drop_ood_feature
def get_drop_rel_feature(self, rel_node, nodeset, main_sent_dict, boxer_graph):
rel_word = boxer_graph.relations[rel_node]["predicates"]
rel_span = boxer_graph.extract_span_for_nodeset_with_rel(rel_node, nodeset)
drop_rel_feature = rel_word+"_"
if len(rel_span) <= 2:
drop_rel_feature += "0-2"
elif len(rel_span) <= 5:
drop_rel_feature += "2-5"
elif len(rel_span) <= 10:
drop_rel_feature += "5-10"
elif len(rel_span) <= 15:
drop_rel_feature += "10-15"
else:
drop_rel_feature += "gt15"
return drop_rel_feature
def get_drop_mod_feature(self, mod_cand, main_sent_dict, boxer_graph):
mod_pos = int(mod_cand[0])
mod_word = main_sent_dict[mod_pos][0]
#mod_node = mod_cand[1]
drop_mod_feature = mod_word
return drop_mod_feature
class Feature_Init:
def get_split_feature(self, split_tuple, parent_sentence, children_sentence_list, boxer_graph):
# Calculating iLength
iLength = boxer_graph.calculate_iLength(parent_sentence, children_sentence_list)
# Get split tuple pattern
split_pattern = boxer_graph.get_pattern_4_split_candidate(split_tuple)
split_feature = split_pattern+"_"+str(iLength)
return split_feature
def get_drop_ood_feature(self, ood_node, nodeset, main_sent_dict, boxer_graph):
ood_word = boxer_graph.extract_oodword(ood_node, main_sent_dict)
ood_position = boxer_graph.nodes[ood_node]["positions"][0] # length of positions is one
span = boxer_graph.extract_span_min_max(nodeset)
boundaryVal = "false"
if ood_position <= span[0] or ood_position >= span[1]:
boundaryVal = "true"
drop_ood_feature = ood_word+"_"+boundaryVal
return drop_ood_feature
def get_drop_rel_feature(self, rel_node, nodeset, main_sent_dict, boxer_graph):
rel_word = boxer_graph.relations[rel_node]["predicates"]
rel_span = boxer_graph.extract_span_for_nodeset_with_rel(rel_node, nodeset)
drop_rel_feature = rel_word+"_"+str(len(rel_span))
return drop_rel_feature
def get_drop_mod_feature(self, mod_cand, main_sent_dict, boxer_graph):
mod_pos = int(mod_cand[0])
mod_word = main_sent_dict[mod_pos][0]
#mod_node = mod_cand[1]
drop_mod_feature = mod_word
return drop_mod_feature
|
class Feature_Nov27:
def get_split_feature(self, split_tuple, parent_sentence, children_sentence_list, boxer_graph):
split_pattern = boxer_graph.get_pattern_4_split_candidate(split_tuple)
split_feature = split_pattern
return split_feature
def get_drop_ood_feature(self, ood_node, nodeset, main_sent_dict, boxer_graph):
ood_word = boxer_graph.extract_oodword(ood_node, main_sent_dict)
ood_position = boxer_graph.nodes[ood_node]['positions'][0]
span = boxer_graph.extract_span_min_max(nodeset)
boundary_val = 'false'
if ood_position <= span[0] or ood_position >= span[1]:
boundary_val = 'true'
drop_ood_feature = ood_word + '_' + boundaryVal
return drop_ood_feature
def get_drop_rel_feature(self, rel_node, nodeset, main_sent_dict, boxer_graph):
rel_word = boxer_graph.relations[rel_node]['predicates']
rel_span = boxer_graph.extract_span_for_nodeset_with_rel(rel_node, nodeset)
drop_rel_feature = rel_word + '_'
if len(rel_span) <= 2:
drop_rel_feature += '0-2'
elif len(rel_span) <= 5:
drop_rel_feature += '2-5'
elif len(rel_span) <= 10:
drop_rel_feature += '5-10'
elif len(rel_span) <= 15:
drop_rel_feature += '10-15'
else:
drop_rel_feature += 'gt15'
return drop_rel_feature
def get_drop_mod_feature(self, mod_cand, main_sent_dict, boxer_graph):
mod_pos = int(mod_cand[0])
mod_word = main_sent_dict[mod_pos][0]
drop_mod_feature = mod_word
return drop_mod_feature
class Feature_Init:
def get_split_feature(self, split_tuple, parent_sentence, children_sentence_list, boxer_graph):
i_length = boxer_graph.calculate_iLength(parent_sentence, children_sentence_list)
split_pattern = boxer_graph.get_pattern_4_split_candidate(split_tuple)
split_feature = split_pattern + '_' + str(iLength)
return split_feature
def get_drop_ood_feature(self, ood_node, nodeset, main_sent_dict, boxer_graph):
ood_word = boxer_graph.extract_oodword(ood_node, main_sent_dict)
ood_position = boxer_graph.nodes[ood_node]['positions'][0]
span = boxer_graph.extract_span_min_max(nodeset)
boundary_val = 'false'
if ood_position <= span[0] or ood_position >= span[1]:
boundary_val = 'true'
drop_ood_feature = ood_word + '_' + boundaryVal
return drop_ood_feature
def get_drop_rel_feature(self, rel_node, nodeset, main_sent_dict, boxer_graph):
rel_word = boxer_graph.relations[rel_node]['predicates']
rel_span = boxer_graph.extract_span_for_nodeset_with_rel(rel_node, nodeset)
drop_rel_feature = rel_word + '_' + str(len(rel_span))
return drop_rel_feature
def get_drop_mod_feature(self, mod_cand, main_sent_dict, boxer_graph):
mod_pos = int(mod_cand[0])
mod_word = main_sent_dict[mod_pos][0]
drop_mod_feature = mod_word
return drop_mod_feature
|
"""
The :py:mod:`.io` module provides functions which can be used to parse external
data formats used by Psephology.
"""
def parse_result_line(line):
"""Take a line consisting of a constituency name and vote count, party id
pairs all separated by commas and return the constituency name and a list of
results as a pair. The results list consists of vote-count party name pairs.
To handle constituencies whose names include a comma, the parse considers
count, party pairs *from the right* and stops when it reaches a vote count
which is not an integer.
"""
items = line.strip().split(',')
results = []
# If there is more to parse, there should be at least the constituency name,
# a vote count and a party id, i.e. more than two values
while len(items) > 2:
party_id = items.pop()
count_str = items.pop()
try:
count = int(count_str.strip())
except ValueError:
items.extend([count_str, party_id])
break
results.append((count, party_id.strip()))
# The remaining items are assumed to be to be the constituency name. Note we
# need to reverse the results in order to preserve the order we were given.
return ','.join(items), results[::-1]
|
"""
The :py:mod:`.io` module provides functions which can be used to parse external
data formats used by Psephology.
"""
def parse_result_line(line):
"""Take a line consisting of a constituency name and vote count, party id
pairs all separated by commas and return the constituency name and a list of
results as a pair. The results list consists of vote-count party name pairs.
To handle constituencies whose names include a comma, the parse considers
count, party pairs *from the right* and stops when it reaches a vote count
which is not an integer.
"""
items = line.strip().split(',')
results = []
while len(items) > 2:
party_id = items.pop()
count_str = items.pop()
try:
count = int(count_str.strip())
except ValueError:
items.extend([count_str, party_id])
break
results.append((count, party_id.strip()))
return (','.join(items), results[::-1])
|
n = int(input())
while(n > 0):
n -= 1
a, b = input().split()
if(len(a) < len(b)):
print('nao encaixa')
else:
if(a[len(a)-len(b)::] == b):
print('encaixa')
else:
print('nao encaixa')
|
n = int(input())
while n > 0:
n -= 1
(a, b) = input().split()
if len(a) < len(b):
print('nao encaixa')
elif a[len(a) - len(b):] == b:
print('encaixa')
else:
print('nao encaixa')
|
#1) Multiples of 3 and 5
#If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
#Find the sum of all the multiples of 3 or 5 below 1000.
# Solution A
def multiples(n):
num = 1
while num < n:
if num % 3 == 0 or num % 5 == 0:
yield num
num += 1
sum(multiples(1000))
# Solution B
sum([x for x in range(1000) if x % 3 == 0 or x % 5 == 0])
|
def multiples(n):
num = 1
while num < n:
if num % 3 == 0 or num % 5 == 0:
yield num
num += 1
sum(multiples(1000))
sum([x for x in range(1000) if x % 3 == 0 or x % 5 == 0])
|
""" Advent of Code, 2020: Day 07, a """
with open(__file__[:-5] + "_input") as f:
inputs = [line.strip() for line in f]
bags = dict()
def search(bag):
""" Recursively search bags """
if bag not in bags:
return False
return any(b == "shiny gold" or search(b) for b in bags[bag])
def run():
""" Read inputs into a dictionary for recursive searching """
for line in inputs:
# Strip the trailing "." and split
container, rest = line[:-1].split(" contain ")
# Strip the trailing " bags"
container = container[:-5]
contained = []
for bag in rest.split(", "):
if bag[:2] != "no":
# Strip the leading number and the trailing "bags" or " bag"
contained.append(bag[2:-4].strip())
bags[container] = contained
return sum(1 if search(bag) else 0 for bag in bags)
if __name__ == "__main__":
print(run())
|
""" Advent of Code, 2020: Day 07, a """
with open(__file__[:-5] + '_input') as f:
inputs = [line.strip() for line in f]
bags = dict()
def search(bag):
""" Recursively search bags """
if bag not in bags:
return False
return any((b == 'shiny gold' or search(b) for b in bags[bag]))
def run():
""" Read inputs into a dictionary for recursive searching """
for line in inputs:
(container, rest) = line[:-1].split(' contain ')
container = container[:-5]
contained = []
for bag in rest.split(', '):
if bag[:2] != 'no':
contained.append(bag[2:-4].strip())
bags[container] = contained
return sum((1 if search(bag) else 0 for bag in bags))
if __name__ == '__main__':
print(run())
|
class Kettle(object):
def __init__(self, make, price):
self.make = make
self.price = price
self.on = False
kenwood = Kettle("kenwood", 8.99)
print(kenwood.make)
print(kenwood.price)
kenwood.price = 12.75
print(kenwood.price)
hamilton = Kettle("hamilton", 14.00)
print(hamilton.price)
|
class Kettle(object):
def __init__(self, make, price):
self.make = make
self.price = price
self.on = False
kenwood = kettle('kenwood', 8.99)
print(kenwood.make)
print(kenwood.price)
kenwood.price = 12.75
print(kenwood.price)
hamilton = kettle('hamilton', 14.0)
print(hamilton.price)
|
# Font: https://realpython.com/python-recursion/
#Traverse a Nested List Recursively
names = [
"Adam",
[
"Bob",
[
"Chet",
"Cat",
],
"Barb",
"Bert"
],
"Alex",
[
"Bea",
"Bill"
],
"Ann"
]
print(len(names))
for index, item in enumerate(names):
print(index, item)
def count_leaf_items(item_list):
"""Recursively counts and returns the
number of leaf items in a (potentially
nested) list.
"""
print(f"List: {item_list}")
count = 0
for item in item_list:
if isinstance(item, list):
print("Encountered sublist")
count += count_leaf_items(item)
else:
print(f"Counted leaf item \"{item}\"")
count += 1
print(f"-> Returning count {count}")
return count
|
names = ['Adam', ['Bob', ['Chet', 'Cat'], 'Barb', 'Bert'], 'Alex', ['Bea', 'Bill'], 'Ann']
print(len(names))
for (index, item) in enumerate(names):
print(index, item)
def count_leaf_items(item_list):
"""Recursively counts and returns the
number of leaf items in a (potentially
nested) list.
"""
print(f'List: {item_list}')
count = 0
for item in item_list:
if isinstance(item, list):
print('Encountered sublist')
count += count_leaf_items(item)
else:
print(f'Counted leaf item "{item}"')
count += 1
print(f'-> Returning count {count}')
return count
|
#
# CodeFragment
# |
# +-- Ann
# | |
# | +-- LeaderAnn
# | +-- TrailerAnn
# |
# +-- NonAnn
# |
# +-- AnnCodeRegion
#
# -----------------------------------------
class CodeFragment:
def __init__(self):
"""Instantiate a code fragment"""
self.id = "None"
pass
# -----------------------------------------
class Ann(CodeFragment):
def __init__(self, code, line_no, indent_size):
"""Instantiate an annotation"""
CodeFragment.__init__(self)
self.code = code
self.line_no = line_no
self.indent_size = indent_size
# -----------------------------------------
class LeaderAnn(Ann):
def __init__(
self,
code,
line_no,
indent_size,
mod_name,
mod_name_line_no,
mod_code,
mod_code_line_no,
):
Ann.__init__(self, code, line_no, indent_size)
self.mod_name = mod_name
self.mod_name_line_no = mod_name_line_no
self.mod_code = mod_code
self.mod_code_line_no = mod_code_line_no
self.id = mod_name
# -----------------------------------------
class TrailerAnn(Ann):
def __init__(self, code, line_no, indent_size):
"""Instantiate a trailer annotation"""
Ann.__init__(self, code, line_no, indent_size)
# -----------------------------------------
class NonAnn(CodeFragment):
def __init__(self, code, line_no, indent_size):
"""Instantiate a non-annotation"""
CodeFragment.__init__(self)
self.code = code
self.line_no = line_no
self.indent_size = indent_size
# -----------------------------------------
class AnnCodeRegion(CodeFragment):
def __init__(self, leader_ann, cfrags, trailer_ann):
"""Instantiate an annotated code region"""
CodeFragment.__init__(self)
self.leader_ann = leader_ann
self.cfrags = cfrags
self.trailer_ann = trailer_ann
self.id = leader_ann
|
class Codefragment:
def __init__(self):
"""Instantiate a code fragment"""
self.id = 'None'
pass
class Ann(CodeFragment):
def __init__(self, code, line_no, indent_size):
"""Instantiate an annotation"""
CodeFragment.__init__(self)
self.code = code
self.line_no = line_no
self.indent_size = indent_size
class Leaderann(Ann):
def __init__(self, code, line_no, indent_size, mod_name, mod_name_line_no, mod_code, mod_code_line_no):
Ann.__init__(self, code, line_no, indent_size)
self.mod_name = mod_name
self.mod_name_line_no = mod_name_line_no
self.mod_code = mod_code
self.mod_code_line_no = mod_code_line_no
self.id = mod_name
class Trailerann(Ann):
def __init__(self, code, line_no, indent_size):
"""Instantiate a trailer annotation"""
Ann.__init__(self, code, line_no, indent_size)
class Nonann(CodeFragment):
def __init__(self, code, line_no, indent_size):
"""Instantiate a non-annotation"""
CodeFragment.__init__(self)
self.code = code
self.line_no = line_no
self.indent_size = indent_size
class Anncoderegion(CodeFragment):
def __init__(self, leader_ann, cfrags, trailer_ann):
"""Instantiate an annotated code region"""
CodeFragment.__init__(self)
self.leader_ann = leader_ann
self.cfrags = cfrags
self.trailer_ann = trailer_ann
self.id = leader_ann
|
HAND1 = """
Full Tilt Poker Game #33286946295: MiniFTOPS Main Event (255707037), Table 179 - NL Hold'em - 10/20 - 19:26:50 CET - 2013/09/22 [13:26:50 ET - 2013/09/22]
Seat 1: Popp1987 (13,587)
Seat 2: Luckytobgood (10,110)
Seat 3: FatalRevange (9,970)
Seat 4: IgaziFerfi (10,000)
Seat 5: egis25 (6,873)
Seat 6: gamblie (9,880)
Seat 7: idanuTz1 (10,180)
Seat 8: PtheProphet (9,930)
Seat 9: JohnyyR (9,840)
gamblie posts the small blind of 10
idanuTz1 posts the big blind of 20
The button is in seat #5
*** HOLE CARDS ***
Dealt to IgaziFerfi [9d Ks]
PtheProphet has 15 seconds left to act
PtheProphet folds
JohnyyR raises to 40
Popp1987 has 15 seconds left to act
Popp1987 folds
Luckytobgood folds
FatalRevange raises to 100
IgaziFerfi folds
egis25 folds
gamblie folds
idanuTz1 folds
JohnyyR has 15 seconds left to act
JohnyyR calls 60
*** FLOP *** [8h 4h Tc] (Total Pot: 230, 2 Players)
JohnyyR checks
FatalRevange has 15 seconds left to act
FatalRevange bets 120
JohnyyR folds
Uncalled bet of 120 returned to FatalRevange
FatalRevange mucks
FatalRevange wins the pot (230)
*** SUMMARY ***
Total pot 230 | Rake 0
Board: [8h 4h Tc]
Seat 1: Popp1987 didn't bet (folded)
Seat 2: Luckytobgood didn't bet (folded)
Seat 3: FatalRevange collected (230), mucked
Seat 4: IgaziFerfi didn't bet (folded)
Seat 5: egis25 (button) didn't bet (folded)
Seat 6: gamblie (small blind) folded before the Flop
Seat 7: idanuTz1 (big blind) folded before the Flop
Seat 8: PtheProphet didn't bet (folded)
Seat 9: JohnyyR folded on the Flop
"""
TURBO_SNG = """\
Full Tilt Poker Game #34374264321: $10 Sit & Go (Turbo) (268569961), Table 1 - NL Hold'em - 15/30 - 11:57:01 CET - 2014/06/29 [05:57:01 ET - 2014/06/29]
Seat 1: snake 422 (1,500)
Seat 2: IgaziFerfi (1,500)
Seat 3: MixaOne (1,500)
Seat 4: BokkaBlake (1,500)
Seat 5: Sajiee (1,500)
Seat 6: AzzzJJ (1,500)
snake 422 posts the small blind of 15
IgaziFerfi posts the big blind of 30
The button is in seat #6
*** HOLE CARDS ***
Dealt to IgaziFerfi [2h 5d]
MixaOne calls 30
BokkaBlake folds
Sajiee folds
AzzzJJ raises to 90
snake 422 folds
IgaziFerfi folds
MixaOne calls 60
*** FLOP *** [6s 9c 3d] (Total Pot: 225, 2 Players)
MixaOne bets 30
AzzzJJ raises to 120
MixaOne folds
Uncalled bet of 90 returned to AzzzJJ
AzzzJJ mucks
AzzzJJ wins the pot (285)
*** SUMMARY ***
Total pot 285 | Rake 0
Board: [6s 9c 3d]
Seat 1: snake 422 (small blind) folded before the Flop
Seat 2: IgaziFerfi (big blind) folded before the Flop
Seat 3: MixaOne folded on the Flop
Seat 4: BokkaBlake didn't bet (folded)
Seat 5: Sajiee didn't bet (folded)
Seat 6: AzzzJJ (button) collected (285), mucked
"""
|
hand1 = "\nFull Tilt Poker Game #33286946295: MiniFTOPS Main Event (255707037), Table 179 - NL Hold'em - 10/20 - 19:26:50 CET - 2013/09/22 [13:26:50 ET - 2013/09/22]\nSeat 1: Popp1987 (13,587)\nSeat 2: Luckytobgood (10,110)\nSeat 3: FatalRevange (9,970)\nSeat 4: IgaziFerfi (10,000)\nSeat 5: egis25 (6,873)\nSeat 6: gamblie (9,880)\nSeat 7: idanuTz1 (10,180)\nSeat 8: PtheProphet (9,930)\nSeat 9: JohnyyR (9,840)\ngamblie posts the small blind of 10\nidanuTz1 posts the big blind of 20\nThe button is in seat #5\n*** HOLE CARDS ***\nDealt to IgaziFerfi [9d Ks]\nPtheProphet has 15 seconds left to act\nPtheProphet folds\nJohnyyR raises to 40\nPopp1987 has 15 seconds left to act\nPopp1987 folds\nLuckytobgood folds\nFatalRevange raises to 100\nIgaziFerfi folds\negis25 folds\ngamblie folds\nidanuTz1 folds\nJohnyyR has 15 seconds left to act\nJohnyyR calls 60\n*** FLOP *** [8h 4h Tc] (Total Pot: 230, 2 Players)\nJohnyyR checks\nFatalRevange has 15 seconds left to act\nFatalRevange bets 120\nJohnyyR folds\nUncalled bet of 120 returned to FatalRevange\nFatalRevange mucks\nFatalRevange wins the pot (230)\n*** SUMMARY ***\nTotal pot 230 | Rake 0\nBoard: [8h 4h Tc]\nSeat 1: Popp1987 didn't bet (folded)\nSeat 2: Luckytobgood didn't bet (folded)\nSeat 3: FatalRevange collected (230), mucked\nSeat 4: IgaziFerfi didn't bet (folded)\nSeat 5: egis25 (button) didn't bet (folded)\nSeat 6: gamblie (small blind) folded before the Flop\nSeat 7: idanuTz1 (big blind) folded before the Flop\nSeat 8: PtheProphet didn't bet (folded)\nSeat 9: JohnyyR folded on the Flop\n"
turbo_sng = "Full Tilt Poker Game #34374264321: $10 Sit & Go (Turbo) (268569961), Table 1 - NL Hold'em - 15/30 - 11:57:01 CET - 2014/06/29 [05:57:01 ET - 2014/06/29]\nSeat 1: snake 422 (1,500)\nSeat 2: IgaziFerfi (1,500)\nSeat 3: MixaOne (1,500)\nSeat 4: BokkaBlake (1,500)\nSeat 5: Sajiee (1,500)\nSeat 6: AzzzJJ (1,500)\nsnake 422 posts the small blind of 15\nIgaziFerfi posts the big blind of 30\nThe button is in seat #6\n*** HOLE CARDS ***\nDealt to IgaziFerfi [2h 5d]\nMixaOne calls 30\nBokkaBlake folds\nSajiee folds\nAzzzJJ raises to 90\nsnake 422 folds\nIgaziFerfi folds\nMixaOne calls 60\n*** FLOP *** [6s 9c 3d] (Total Pot: 225, 2 Players)\nMixaOne bets 30\nAzzzJJ raises to 120\nMixaOne folds\nUncalled bet of 90 returned to AzzzJJ\nAzzzJJ mucks\nAzzzJJ wins the pot (285)\n*** SUMMARY ***\nTotal pot 285 | Rake 0\nBoard: [6s 9c 3d]\nSeat 1: snake 422 (small blind) folded before the Flop\nSeat 2: IgaziFerfi (big blind) folded before the Flop\nSeat 3: MixaOne folded on the Flop\nSeat 4: BokkaBlake didn't bet (folded)\nSeat 5: Sajiee didn't bet (folded)\nSeat 6: AzzzJJ (button) collected (285), mucked\n"
|
# Calculate paycheck
xh = input("Enter Hors: ")
xr = input("Enter Rate: ")
xp = float(xh) * float(xr)
print("Pay:", xp)
|
xh = input('Enter Hors: ')
xr = input('Enter Rate: ')
xp = float(xh) * float(xr)
print('Pay:', xp)
|
input_s = ['3[abc]4[ab]c', '2[3[a]b]c']
# if '[' not in comp[l+1:r]:
# return int(comp[0:l]) * comp[l+1:r]
a = '10[a]b'
b = '2[2[3[a]b]c]'
c = '3[abc]4[ab]c'
def findnth(haystack, needle, n):
parts= haystack.split(needle, n+1)
if len(parts)<=n+1:
return -1
return len(haystack)-len(parts[-1])-len(needle)
def decomp(comp):
l = comp.find('[')
r = comp.find(']')
mul =int(comp[0:l])
# Find how left brackets many are in between
extra_l = comp[l+1:r].count('[')
if extra_l == 0:
return mul * comp[l+1:r] + comp[r+1:]
else:
# Find the nth right bracket
nth_idx = findnth(comp, ']', extra_l)
subset = comp[l+1: nth_idx]
new_set = comp[:l+1] + decomp(subset) + comp[nth_idx:]
return decomp(new_set)
def splitter(comp):
comp_list = []
alt = 0
last_cut = 0
new_alt = 0
for idx, char in enumerate(comp):
if char == '[':
alt += 1
risen = True
if char == ']':
alt -= 1
if alt == 0 and idx != 0 and risen:
comp_list.append(comp[last_cut:idx+1])
last_cut = idx+1
risen = False
return comp_list
for comp in splitter(c):
print(decomp(comp), end='')
|
input_s = ['3[abc]4[ab]c', '2[3[a]b]c']
a = '10[a]b'
b = '2[2[3[a]b]c]'
c = '3[abc]4[ab]c'
def findnth(haystack, needle, n):
parts = haystack.split(needle, n + 1)
if len(parts) <= n + 1:
return -1
return len(haystack) - len(parts[-1]) - len(needle)
def decomp(comp):
l = comp.find('[')
r = comp.find(']')
mul = int(comp[0:l])
extra_l = comp[l + 1:r].count('[')
if extra_l == 0:
return mul * comp[l + 1:r] + comp[r + 1:]
else:
nth_idx = findnth(comp, ']', extra_l)
subset = comp[l + 1:nth_idx]
new_set = comp[:l + 1] + decomp(subset) + comp[nth_idx:]
return decomp(new_set)
def splitter(comp):
comp_list = []
alt = 0
last_cut = 0
new_alt = 0
for (idx, char) in enumerate(comp):
if char == '[':
alt += 1
risen = True
if char == ']':
alt -= 1
if alt == 0 and idx != 0 and risen:
comp_list.append(comp[last_cut:idx + 1])
last_cut = idx + 1
risen = False
return comp_list
for comp in splitter(c):
print(decomp(comp), end='')
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'shen.bas'
__time__ = '2018-02-03'
"""
|
"""
__title__ = ''
__author__ = 'shen.bas'
__time__ = '2018-02-03'
"""
|
class CodegenError(Exception):
pass
class NoOperationProvidedError(CodegenError):
pass
class NoOperationNameProvidedError(CodegenError):
pass
class MultipleOperationsProvidedError(CodegenError):
pass
|
class Codegenerror(Exception):
pass
class Nooperationprovidederror(CodegenError):
pass
class Nooperationnameprovidederror(CodegenError):
pass
class Multipleoperationsprovidederror(CodegenError):
pass
|
# coding: utf-8
class Item(object):
def __init__(self, name, price, description, image_url, major, minor, priority):
self.name = name
self.price = price
self.description = description
self.image_url = image_url
self.minor = minor
self.major = major
self.priority = priority
def to_dict(self):
return {
"name": self.name,
"price": self.price,
"description": self.description,
"image_url": self.image_url,
"minor": self.minor,
"major": self.major,
"priority": self.priority,
}
@classmethod
def from_dict(cls, json_data):
name = json_data["name"]
price = int(json_data["price"])
description = json_data["description"]
image_url = json_data["image_url"]
minor = int(json_data["minor"])
major = int(json_data["major"])
priority = int(json_data["priority"])
return cls(name, price, description, image_url, major, minor, priority)
|
class Item(object):
def __init__(self, name, price, description, image_url, major, minor, priority):
self.name = name
self.price = price
self.description = description
self.image_url = image_url
self.minor = minor
self.major = major
self.priority = priority
def to_dict(self):
return {'name': self.name, 'price': self.price, 'description': self.description, 'image_url': self.image_url, 'minor': self.minor, 'major': self.major, 'priority': self.priority}
@classmethod
def from_dict(cls, json_data):
name = json_data['name']
price = int(json_data['price'])
description = json_data['description']
image_url = json_data['image_url']
minor = int(json_data['minor'])
major = int(json_data['major'])
priority = int(json_data['priority'])
return cls(name, price, description, image_url, major, minor, priority)
|
# class and object (oops concept)
class class_8:
print()
name = 'amar'
# class class_9:
# name = 'rahul'
# age = 23
# def welcome(self):
# print("welcome to teckat")
# # a = class_9() # create object of class abc
# # b = class_8()
# # c = class_9()
# # # print(abc.name) # accessing attribute through class
# # print(a.name) # accessing through object of the class
# # print(b.name)
# # print(c.age)
# a = class_9()
# a.welcome()
# constructor __init__
# class student:
# def __init__(self, name, age):
# print("hello")
# self.name = name
# self.age = age
# def modify_name(self, name):
# self.name = name
# a = student('amar', 12)
# print("before modifying", a.name, a.age)
# a.modify_name('john')
# print("after modifying", a.name, a.age)
class student:
def __init__(self):
self.name = ''
self.age = 0
def input_details(self):
self.name = input('Enter name')
self.num1 = int(input('Enter 1st marks'))
self.num2 = int(input('Enter 2nd marks'))
def add(self):
self.total = self.num1+self.num2
def print_details(self):
print("name = ", self.name)
print("totla marks = ", self.total)
a = student()
a.input_details()
a.add()
a.print_details()
# special attributes
# 1. getattr()
# accessing attributes usin getattr()
print("name (getattr) = ", getattr(a, 'name'))
# 2. hasattr()
print("hasattr(age) = ", hasattr(a, 'age'))
print("hasattr(salary) = ", hasattr(a, 'salary'))
# 3. setattr()
setattr(a, 'name', 'amar')
print("setattr(name=amar) = ", a.name)
# 4. delattr()
delattr(a, 'name')
print("delattr(name) = ", a.name)
|
class Class_8:
print()
name = 'amar'
class Student:
def __init__(self):
self.name = ''
self.age = 0
def input_details(self):
self.name = input('Enter name')
self.num1 = int(input('Enter 1st marks'))
self.num2 = int(input('Enter 2nd marks'))
def add(self):
self.total = self.num1 + self.num2
def print_details(self):
print('name = ', self.name)
print('totla marks = ', self.total)
a = student()
a.input_details()
a.add()
a.print_details()
print('name (getattr) = ', getattr(a, 'name'))
print('hasattr(age) = ', hasattr(a, 'age'))
print('hasattr(salary) = ', hasattr(a, 'salary'))
setattr(a, 'name', 'amar')
print('setattr(name=amar) = ', a.name)
delattr(a, 'name')
print('delattr(name) = ', a.name)
|
with open('iso_list/valid_list.txt') as i:
names = i.readlines()
with open('iso_list/valid.prediction') as i:
p = i.readlines()
out = open('iso_list/valid_prediction.txt', 'w')
assert len(names) == len(p)
for i, n in enumerate(names):
n = n[:-1]
result = n + ' ' + p[i]
out.write(result)
|
with open('iso_list/valid_list.txt') as i:
names = i.readlines()
with open('iso_list/valid.prediction') as i:
p = i.readlines()
out = open('iso_list/valid_prediction.txt', 'w')
assert len(names) == len(p)
for (i, n) in enumerate(names):
n = n[:-1]
result = n + ' ' + p[i]
out.write(result)
|
# '''
# Linked List hash table key/value pair
# '''
class LinkedPair:
def __init__(self, key, value):
self.key = key
self.value = value
self.next = None
# '''
# Resizing hash table
# '''
class HashTable:
def __init__(self, capacity):
self.capacity = capacity
self.storage = [None] * capacity
# '''
# Research and implement the djb2 hash function
# '''
def hash(string, max):
hash = 5381
for char in string:
hash = ((hash << 5) + hash) + ord(char)
return hash % max
# '''
# Fill this in.
# Hint: Used the LL handle collisions
# '''
def hash_table_insert(hash_table, key, value):
index = hash(key, len(hash_table.storage))
current_pair = hash_table.storage[index]
last_pair = None
while current_pair is not None and current_pair.key != key:
last_pair = current_pair
current_pair = last_pair.next
if current_pair is not None:
current_pair.value = value
else:
new_pair = LinkedPair(key, value)
new_pair.next = hash_table.storage[index]
hash_table.storage[index] = new_pair
# '''
# Fill this in.
# If you try to remove a value that isn't there, print a warning.
# '''
def hash_table_remove(hash_table, key):
index = hash(key, len(hash_table.storage))
current_pair = hash_table.storage[index]
last_pair = None
while current_pair is not None and current_pair.key != key:
last_pair = current_pair
current_pair = last_pair.next
if current_pair is None:
print("ERROR: Unable to remove entry with key " + key)
else:
if last_pair is None: # Removing the first element in the LL
hash_table.storage[index] = current_pair.next
else:
last_pair.next = current_pair.next
# '''
# Fill this in.
# Should return None if the key is not found.
# '''
def hash_table_retrieve(hash_table, key):
index = hash(key, len(hash_table.storage))
current_pair = hash_table.storage[index]
while current_pair is not None:
if(current_pair.key == key):
return current_pair.value
current_pair = current_pair.next
# '''
# Fill this in
# '''
def hash_table_resize(hash_table):
new_hash_table = HashTable(2 * len(hash_table.storage))
current_pair = None
for i in range(len(hash_table.storage)):
current_pair = hash_table.storage[i]
while current_pair is not None:
hash_table_insert(new_hash_table,
current_pair.key,
current_pair.value)
current_pair = current_pair.next
return new_hash_table
|
class Linkedpair:
def __init__(self, key, value):
self.key = key
self.value = value
self.next = None
class Hashtable:
def __init__(self, capacity):
self.capacity = capacity
self.storage = [None] * capacity
def hash(string, max):
hash = 5381
for char in string:
hash = (hash << 5) + hash + ord(char)
return hash % max
def hash_table_insert(hash_table, key, value):
index = hash(key, len(hash_table.storage))
current_pair = hash_table.storage[index]
last_pair = None
while current_pair is not None and current_pair.key != key:
last_pair = current_pair
current_pair = last_pair.next
if current_pair is not None:
current_pair.value = value
else:
new_pair = linked_pair(key, value)
new_pair.next = hash_table.storage[index]
hash_table.storage[index] = new_pair
def hash_table_remove(hash_table, key):
index = hash(key, len(hash_table.storage))
current_pair = hash_table.storage[index]
last_pair = None
while current_pair is not None and current_pair.key != key:
last_pair = current_pair
current_pair = last_pair.next
if current_pair is None:
print('ERROR: Unable to remove entry with key ' + key)
elif last_pair is None:
hash_table.storage[index] = current_pair.next
else:
last_pair.next = current_pair.next
def hash_table_retrieve(hash_table, key):
index = hash(key, len(hash_table.storage))
current_pair = hash_table.storage[index]
while current_pair is not None:
if current_pair.key == key:
return current_pair.value
current_pair = current_pair.next
def hash_table_resize(hash_table):
new_hash_table = hash_table(2 * len(hash_table.storage))
current_pair = None
for i in range(len(hash_table.storage)):
current_pair = hash_table.storage[i]
while current_pair is not None:
hash_table_insert(new_hash_table, current_pair.key, current_pair.value)
current_pair = current_pair.next
return new_hash_table
|
class Solution:
def plusOne(self, digits):
i = len(digits) - 1
while i >= 0:
if digits[i] == 9:
digits[i] = 0
i = i - 1
else:
digits[i] += 1
break
if i == -1 and digits[0] == 0:
digits.append(1)
return reversed(digits)
return digits
|
class Solution:
def plus_one(self, digits):
i = len(digits) - 1
while i >= 0:
if digits[i] == 9:
digits[i] = 0
i = i - 1
else:
digits[i] += 1
break
if i == -1 and digits[0] == 0:
digits.append(1)
return reversed(digits)
return digits
|
class A:
name="Default"
def __init__(self, n = None):
self.name = n
print(self.name)
def m(self):
print("m of A called")
class B(A):
# def m(self):
# print("m of B called")
pass
class C(A):
def m(self):
print("m of C called")
class D(B, C):
def __init__(self):
self.objB = B()
self.objC = C()
def m(self):
self.objB.m()
# def m1(self, name):
# self.objB.m()
# print(name)
def m1(self, name=None, number=None):
self.objB.m()
print(name, number)
# x = D()
# x.m()
# x.m1("Teo")
# x.m1("Nhan", 20)
a = A("Teo")
print(A.name)
print(a.name)
print(D.mro())
|
class A:
name = 'Default'
def __init__(self, n=None):
self.name = n
print(self.name)
def m(self):
print('m of A called')
class B(A):
pass
class C(A):
def m(self):
print('m of C called')
class D(B, C):
def __init__(self):
self.objB = b()
self.objC = c()
def m(self):
self.objB.m()
def m1(self, name=None, number=None):
self.objB.m()
print(name, number)
a = a('Teo')
print(A.name)
print(a.name)
print(D.mro())
|
"""
Copyright (c) 2015 Frank Lamar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE."""
#This script creats a simple shooping list
shopping_list = []
print("What should we pick up at the store?")
print("Enter 'Done' to stop adding items.")
while True:
new_item = input("> ")
if new_item == 'DONE' 'Done' or 'done':
break
shopping_list.append(new_item)
print("Added List has {} items.".format(len(shopping_list)))
continue
print("Here is your shopping_list: ")
for item in shopping_list:
print(item)
|
"""
Copyright (c) 2015 Frank Lamar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE."""
shopping_list = []
print('What should we pick up at the store?')
print("Enter 'Done' to stop adding items.")
while True:
new_item = input('> ')
if new_item == 'DONEDone' or 'done':
break
shopping_list.append(new_item)
print('Added List has {} items.'.format(len(shopping_list)))
continue
print('Here is your shopping_list: ')
for item in shopping_list:
print(item)
|
'''
Created on 1.12.2016
@author: Darren
''''''
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7, 6, 5 ]
]
"
'''
|
"""
Created on 1.12.2016
@author: Darren
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7, 6, 5 ]
]
"
"""
|
command = '/usr/bin/gunicorn'
pythonpath = '/opt/netbox/netbox'
bind = '0.0.0.0:{{ .Values.service.internalPort }}'
workers = 3
errorlog = '-'
accesslog = '-'
capture_output = False
loglevel = 'debug'
|
command = '/usr/bin/gunicorn'
pythonpath = '/opt/netbox/netbox'
bind = '0.0.0.0:{{ .Values.service.internalPort }}'
workers = 3
errorlog = '-'
accesslog = '-'
capture_output = False
loglevel = 'debug'
|
if __name__ == '__main__':
n, x = map(int, input().split())
sheet = []
[sheet.append(map(float, input().split())) for i in range(x)]
for i in zip(*sheet):
print(sum(i)/len(i))
|
if __name__ == '__main__':
(n, x) = map(int, input().split())
sheet = []
[sheet.append(map(float, input().split())) for i in range(x)]
for i in zip(*sheet):
print(sum(i) / len(i))
|
class ListaProduto(object):
lista_produtos = [
{
"id":1,
"nome":"pao sete graos"
},
{
"id":2,
"nome":"pao original"
},
{
"id":3,
"nome":"pao integral"
},
{
"id":4,
"nome":"pao light"
},
{
"id":5,
"nome":"pao recheado"
},
{
"id":6,
"nome":"pao doce"
},
{
"id":7,
"nome":"pao sem casca"
},
{
"id":8,
"nome":"pao caseiro"
}
]
|
class Listaproduto(object):
lista_produtos = [{'id': 1, 'nome': 'pao sete graos'}, {'id': 2, 'nome': 'pao original'}, {'id': 3, 'nome': 'pao integral'}, {'id': 4, 'nome': 'pao light'}, {'id': 5, 'nome': 'pao recheado'}, {'id': 6, 'nome': 'pao doce'}, {'id': 7, 'nome': 'pao sem casca'}, {'id': 8, 'nome': 'pao caseiro'}]
|
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 24 19:59:10 2021
@author: sshir
"""
def rec(df, item_col, user_col, user, user_rating_col, avg_rating_col, sep=None):
'''
Recommending items for a specific existing user based on user rating
and average rating per item. Returns only the items which are not consumed
by the user. If there is only one such item present then returns empty DataFrame.
Parameters
----------
df : Pandas DataFrame
Entire or part of DataFrame that containe the remaining below mentioned parameters.
item_col : str
Column name that contains the item.
user_col : str
Column name that contains user ID. Values in the column must be of dtype int
user : int
ID of the user for whom we need to recommend items.
user_rating_col : str
Column name that contains user ratings.
avg_rating_col : str
Column name that contains average rating of each item.
sep : str [',', '/', '|'], optional
Delimiter to use for genre column. For example: if genre column comtains multiple
genres lile Drama, Action, Comedy or Drama / Action / Comedy. Default value is None
Returns
-------
Pandas DataFrame
Comma-seperated values containig recommended items for user with user_id
and item details
'''
df_copy = df.copy()
if sep != None:
df_copy[item_col] = df_copy[item_col].apply(lambda x: x.split(sep)[0].strip())
user_details = df_copy[df_copy[user_col] == user]
user_details = user_details[user_details[item_col]==user_details[item_col].value_counts().index[0]]
#find the maximum of rating
user_max_rating = max(user_details[user_rating_col])
#fetching the max rated genre by the user
for i in user_details.index:
user_ratings = user_details[user_details.index == i][user_rating_col].values[0]
if user_ratings == user_max_rating:
index = (user_details[user_details.index == i][user_rating_col] == user_max_rating).index[0]
liked_item = user_details[user_details.index==index][item_col].values[0]
#recommendation based on highly rated items by the genre that is max rated by the user
rec = df_copy[df_copy[item_col] == liked_item].sort_values(avg_rating_col, ascending=False)
#removing the items already watched by the user
rec.drop_duplicates(avg_rating_col, inplace=True, keep='last')
for i in user_details.index:
if i in rec.index:
rec.drop(i, inplace=True)
return rec.head(5)
|
"""
Created on Sat Apr 24 19:59:10 2021
@author: sshir
"""
def rec(df, item_col, user_col, user, user_rating_col, avg_rating_col, sep=None):
"""
Recommending items for a specific existing user based on user rating
and average rating per item. Returns only the items which are not consumed
by the user. If there is only one such item present then returns empty DataFrame.
Parameters
----------
df : Pandas DataFrame
Entire or part of DataFrame that containe the remaining below mentioned parameters.
item_col : str
Column name that contains the item.
user_col : str
Column name that contains user ID. Values in the column must be of dtype int
user : int
ID of the user for whom we need to recommend items.
user_rating_col : str
Column name that contains user ratings.
avg_rating_col : str
Column name that contains average rating of each item.
sep : str [',', '/', '|'], optional
Delimiter to use for genre column. For example: if genre column comtains multiple
genres lile Drama, Action, Comedy or Drama / Action / Comedy. Default value is None
Returns
-------
Pandas DataFrame
Comma-seperated values containig recommended items for user with user_id
and item details
"""
df_copy = df.copy()
if sep != None:
df_copy[item_col] = df_copy[item_col].apply(lambda x: x.split(sep)[0].strip())
user_details = df_copy[df_copy[user_col] == user]
user_details = user_details[user_details[item_col] == user_details[item_col].value_counts().index[0]]
user_max_rating = max(user_details[user_rating_col])
for i in user_details.index:
user_ratings = user_details[user_details.index == i][user_rating_col].values[0]
if user_ratings == user_max_rating:
index = (user_details[user_details.index == i][user_rating_col] == user_max_rating).index[0]
liked_item = user_details[user_details.index == index][item_col].values[0]
rec = df_copy[df_copy[item_col] == liked_item].sort_values(avg_rating_col, ascending=False)
rec.drop_duplicates(avg_rating_col, inplace=True, keep='last')
for i in user_details.index:
if i in rec.index:
rec.drop(i, inplace=True)
return rec.head(5)
|
apiAttachAvailable = u'\u0648\u0627\u062c\u0647\u0629 \u0628\u0631\u0645\u062c\u0629 \u0627\u0644\u062a\u0637\u0628\u064a\u0642 (API) \u0645\u062a\u0627\u062d\u0629'
apiAttachNotAvailable = u'\u063a\u064a\u0631 \u0645\u062a\u0627\u062d'
apiAttachPendingAuthorization = u'\u062a\u0639\u0644\u064a\u0642 \u0627\u0644\u062a\u0635\u0631\u064a\u062d'
apiAttachRefused = u'\u0631\u0641\u0636'
apiAttachSuccess = u'\u0646\u062c\u0627\u062d'
apiAttachUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
budDeletedFriend = u'\u062a\u0645 \u062d\u0630\u0641\u0647 \u0645\u0646 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0623\u0635\u062f\u0642\u0627\u0621'
budFriend = u'\u0635\u062f\u064a\u0642'
budNeverBeenFriend = u'\u0644\u0645 \u064a\u0648\u062c\u062f \u0645\u0637\u0644\u0642\u064b\u0627 \u0641\u064a \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0623\u0635\u062f\u0642\u0627\u0621'
budPendingAuthorization = u'\u062a\u0639\u0644\u064a\u0642 \u0627\u0644\u062a\u0635\u0631\u064a\u062d'
budUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cfrBlockedByRecipient = u'\u062a\u0645 \u062d\u0638\u0631 \u0627\u0644\u0645\u0643\u0627\u0644\u0645\u0629 \u0628\u0648\u0627\u0633\u0637\u0629 \u0627\u0644\u0645\u0633\u062a\u0644\u0645'
cfrMiscError = u'\u062e\u0637\u0623 \u0645\u062a\u0646\u0648\u0639'
cfrNoCommonCodec = u'\u0628\u0631\u0646\u0627\u0645\u062c \u062a\u0634\u0641\u064a\u0631 \u063a\u064a\u0631 \u0634\u0627\u0626\u0639'
cfrNoProxyFound = u'\u0644\u0645 \u064a\u062a\u0645 \u0627\u0644\u0639\u062b\u0648\u0631 \u0639\u0644\u0649 \u0628\u0631\u0648\u0643\u0633\u064a'
cfrNotAuthorizedByRecipient = u'\u0644\u0645 \u064a\u062a\u0645 \u0645\u0646\u062d \u062a\u0635\u0631\u064a\u062d \u0644\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u0627\u0644\u062d\u0627\u0644\u064a \u0628\u0648\u0627\u0633\u0637\u0629 \u0627\u0644\u0645\u0633\u062a\u0644\u0645'
cfrRecipientNotFriend = u'\u0627\u0644\u0645\u0633\u062a\u0644\u0645 \u0644\u064a\u0633 \u0635\u062f\u064a\u0642\u064b\u0627'
cfrRemoteDeviceError = u'\u0645\u0634\u0643\u0644\u0629 \u0641\u064a \u062c\u0647\u0627\u0632 \u0627\u0644\u0635\u0648\u062a \u0627\u0644\u0628\u0639\u064a\u062f'
cfrSessionTerminated = u'\u0627\u0646\u062a\u0647\u0627\u0621 \u0627\u0644\u062c\u0644\u0633\u0629'
cfrSoundIOError = u'\u062e\u0637\u0623 \u0641\u064a \u0625\u062f\u062e\u0627\u0644/\u0625\u062e\u0631\u0627\u062c \u0627\u0644\u0635\u0648\u062a'
cfrSoundRecordingError = u'\u062e\u0637\u0623 \u0641\u064a \u062a\u0633\u062c\u064a\u0644 \u0627\u0644\u0635\u0648\u062a'
cfrUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cfrUserDoesNotExist = u'\u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645/\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 \u063a\u064a\u0631 \u0645\u0648\u062c\u0648\u062f'
cfrUserIsOffline = u'\u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644\u0629 \u0623\u0648 \u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644'
chsAllCalls = u'\u062d\u0648\u0627\u0631 \u0642\u062f\u064a\u0645'
chsDialog = u'\u062d\u0648\u0627\u0631'
chsIncomingCalls = u'\u064a\u062c\u0628 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629 \u0639\u0644\u0649 \u0627\u0644\u0645\u062d\u0627\u062f\u062b\u0629 \u0627\u0644\u062c\u0645\u0627\u0639\u064a\u0629'
chsLegacyDialog = u'\u062d\u0648\u0627\u0631 \u0642\u062f\u064a\u0645'
chsMissedCalls = u'\u062d\u0648\u0627\u0631'
chsMultiNeedAccept = u'\u064a\u062c\u0628 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629 \u0639\u0644\u0649 \u0627\u0644\u0645\u062d\u0627\u062f\u062b\u0629 \u0627\u0644\u062c\u0645\u0627\u0639\u064a\u0629'
chsMultiSubscribed = u'\u062a\u0645 \u0627\u0644\u0627\u0634\u062a\u0631\u0627\u0643 \u0641\u064a \u0627\u0644\u0645\u062d\u0627\u062f\u062b\u0629 \u0627\u0644\u062c\u0645\u0627\u0639\u064a\u0629'
chsOutgoingCalls = u'\u062a\u0645 \u0627\u0644\u0627\u0634\u062a\u0631\u0627\u0643 \u0641\u064a \u0627\u0644\u0645\u062d\u0627\u062f\u062b\u0629 \u0627\u0644\u062c\u0645\u0627\u0639\u064a\u0629'
chsUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
chsUnsubscribed = u'\u062a\u0645 \u0625\u0644\u063a\u0627\u0621 \u0627\u0644\u0627\u0634\u062a\u0631\u0627\u0643'
clsBusy = u'\u0645\u0634\u063a\u0648\u0644'
clsCancelled = u'\u0623\u0644\u063a\u064a'
clsEarlyMedia = u'\u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0648\u0633\u0627\u0626\u0637 (Early Media)'
clsFailed = u'\u0639\u0641\u0648\u0627\u064b\u060c \u062a\u0639\u0630\u0651\u0631\u062a \u0639\u0645\u0644\u064a\u0629 \u0627\u0644\u0627\u062a\u0651\u0635\u0627\u0644!'
clsFinished = u'\u0627\u0646\u062a\u0647\u0649'
clsInProgress = u'\u062c\u0627\u0631\u064a \u0627\u0644\u0627\u062a\u0635\u0627\u0644'
clsLocalHold = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0642\u064a\u062f \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631 \u0645\u0646 \u0637\u0631\u0641\u064a'
clsMissed = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0644\u0645 \u064a\u064f\u0631\u062f \u0639\u0644\u064a\u0647\u0627'
clsOnHold = u'\u0642\u064a\u062f \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631'
clsRefused = u'\u0631\u0641\u0636'
clsRemoteHold = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0642\u064a\u062f \u0627\u0644\u0627\u0646\u062a\u0638\u0627\u0631 \u0645\u0646 \u0627\u0644\u0637\u0631\u0641 \u0627\u0644\u062b\u0627\u0646\u064a'
clsRinging = u'\u0627\u0644\u0627\u062a\u0635\u0627\u0644'
clsRouting = u'\u062a\u0648\u062c\u064a\u0647'
clsTransferred = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
clsTransferring = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
clsUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
clsUnplaced = u'\u0644\u0645 \u064a\u0648\u0636\u0639 \u0645\u0637\u0644\u0642\u064b\u0627'
clsVoicemailBufferingGreeting = u'\u062a\u062e\u0632\u064a\u0646 \u0627\u0644\u062a\u062d\u064a\u0629'
clsVoicemailCancelled = u'\u062a\u0645 \u0625\u0644\u063a\u0627\u0621 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0635\u0648\u062a\u064a'
clsVoicemailFailed = u'\u0641\u0634\u0644 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0635\u0648\u062a\u064a'
clsVoicemailPlayingGreeting = u'\u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u062a\u062d\u064a\u0629'
clsVoicemailRecording = u'\u062a\u0633\u062c\u064a\u0644 \u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a'
clsVoicemailSent = u'\u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0628\u0631\u064a\u062f \u0627\u0644\u0635\u0648\u062a\u064a'
clsVoicemailUploading = u'\u0625\u064a\u062f\u0627\u0639 \u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a'
cltIncomingP2P = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0646\u0638\u064a\u0631 \u0625\u0644\u0649 \u0646\u0638\u064a\u0631 \u0648\u0627\u0631\u062f\u0629'
cltIncomingPSTN = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0647\u0627\u062a\u0641\u064a\u0629 \u0648\u0627\u0631\u062f\u0629'
cltOutgoingP2P = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0646\u0638\u064a\u0631 \u0625\u0644\u0649 \u0646\u0638\u064a\u0631 \u0635\u0627\u062f\u0631\u0629'
cltOutgoingPSTN = u'\u0645\u0643\u0627\u0644\u0645\u0629 \u0647\u0627\u062a\u0641\u064a\u0629 \u0635\u0627\u062f\u0631\u0629'
cltUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cmeAddedMembers = u'\u0627\u0644\u0623\u0639\u0636\u0627\u0621 \u0627\u0644\u0645\u0636\u0627\u0641\u0629'
cmeCreatedChatWith = u'\u0623\u0646\u0634\u0623 \u0645\u062d\u0627\u062f\u062b\u0629 \u0645\u0639'
cmeEmoted = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cmeLeft = u'\u063a\u0627\u062f\u0631'
cmeSaid = u'\u0642\u0627\u0644'
cmeSawMembers = u'\u0627\u0644\u0623\u0639\u0636\u0627\u0621 \u0627\u0644\u0645\u0634\u0627\u0647\u064e\u062f\u0648\u0646'
cmeSetTopic = u'\u062a\u0639\u064a\u064a\u0646 \u0645\u0648\u0636\u0648\u0639'
cmeUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cmsRead = u'\u0642\u0631\u0627\u0621\u0629'
cmsReceived = u'\u0645\u064f\u0633\u062a\u064e\u0644\u0645'
cmsSending = u'\u062c\u0627\u0631\u064a \u0627\u0644\u0625\u0631\u0633\u0627\u0644...'
cmsSent = u'\u0645\u064f\u0631\u0633\u064e\u0644'
cmsUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
conConnecting = u'\u062c\u0627\u0631\u064a \u0627\u0644\u062a\u0648\u0635\u064a\u0644'
conOffline = u'\u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644'
conOnline = u'\u0645\u062a\u0635\u0644'
conPausing = u'\u0625\u064a\u0642\u0627\u0641 \u0645\u0624\u0642\u062a'
conUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cusAway = u'\u0628\u0627\u0644\u062e\u0627\u0631\u062c'
cusDoNotDisturb = u'\u0645\u0645\u0646\u0648\u0639 \u0627\u0644\u0625\u0632\u0639\u0627\u062c'
cusInvisible = u'\u0645\u062e\u0641\u064a'
cusLoggedOut = u'\u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644'
cusNotAvailable = u'\u063a\u064a\u0631 \u0645\u062a\u0627\u062d'
cusOffline = u'\u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644'
cusOnline = u'\u0645\u062a\u0635\u0644'
cusSkypeMe = u'Skype Me'
cusUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
cvsBothEnabled = u'\u0625\u0631\u0633\u0627\u0644 \u0648\u0627\u0633\u062a\u0644\u0627\u0645 \u0627\u0644\u0641\u064a\u062f\u064a\u0648'
cvsNone = u'\u0644\u0627 \u064a\u0648\u062c\u062f \u0641\u064a\u062f\u064a\u0648'
cvsReceiveEnabled = u'\u0627\u0633\u062a\u0644\u0627\u0645 \u0627\u0644\u0641\u064a\u062f\u064a\u0648'
cvsSendEnabled = u'\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0641\u064a\u062f\u064a\u0648'
cvsUnknown = u''
grpAllFriends = u'\u0643\u0627\u0641\u0629 \u0627\u0644\u0623\u0635\u062f\u0642\u0627\u0621'
grpAllUsers = u'\u0643\u0627\u0641\u0629 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645\u064a\u0646'
grpCustomGroup = u'\u0645\u062e\u0635\u0635'
grpOnlineFriends = u'\u0627\u0644\u0623\u0635\u062f\u0642\u0627\u0621 \u0627\u0644\u0645\u062a\u0635\u0644\u0648\u0646'
grpPendingAuthorizationFriends = u'\u062a\u0639\u0644\u064a\u0642 \u0627\u0644\u062a\u0635\u0631\u064a\u062d'
grpProposedSharedGroup = u'Proposed Shared Group'
grpRecentlyContactedUsers = u'\u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645\u0648\u0646 \u0627\u0644\u0645\u062a\u0635\u0644\u0648\u0646 \u062d\u062f\u064a\u062b\u064b\u0627'
grpSharedGroup = u'Shared Group'
grpSkypeFriends = u'\u0623\u0635\u062f\u0642\u0627\u0621 Skype'
grpSkypeOutFriends = u'\u0623\u0635\u062f\u0642\u0627\u0621 SkypeOut'
grpUngroupedFriends = u'\u0627\u0644\u0623\u0635\u062f\u0642\u0627\u0621 \u063a\u064a\u0631 \u0627\u0644\u0645\u062c\u0645\u0639\u064a\u0646'
grpUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
grpUsersAuthorizedByMe = u'\u0645\u0635\u0631\u062d \u0628\u0648\u0627\u0633\u0637\u062a\u064a'
grpUsersBlockedByMe = u'\u0645\u062d\u0638\u0648\u0631 \u0628\u0648\u0627\u0633\u0637\u062a\u064a'
grpUsersWaitingMyAuthorization = u'\u0641\u064a \u0627\u0646\u062a\u0638\u0627\u0631 \u0627\u0644\u062a\u0635\u0631\u064a\u062d \u0627\u0644\u062e\u0627\u0635 \u0628\u064a'
leaAddDeclined = u'\u062a\u0645 \u0631\u0641\u0636 \u0627\u0644\u0625\u0636\u0627\u0641\u0629'
leaAddedNotAuthorized = u'\u064a\u062c\u0628 \u0645\u0646\u062d \u062a\u0635\u0631\u064a\u062d \u0644\u0644\u0634\u062e\u0635 \u0627\u0644\u0645\u0636\u0627\u0641'
leaAdderNotFriend = u'\u0627\u0644\u0634\u062e\u0635 \u0627\u0644\u0645\u0636\u064a\u0641 \u064a\u062c\u0628 \u0623\u0646 \u064a\u0643\u0648\u0646 \u0635\u062f\u064a\u0642\u064b\u0627'
leaUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
leaUnsubscribe = u'\u062a\u0645 \u0625\u0644\u063a\u0627\u0621 \u0627\u0644\u0627\u0634\u062a\u0631\u0627\u0643'
leaUserIncapable = u'\u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u063a\u064a\u0631 \u0645\u0624\u0647\u0644'
leaUserNotFound = u'\u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645 \u063a\u064a\u0631 \u0645\u0648\u062c\u0648\u062f'
olsAway = u'\u0628\u0627\u0644\u062e\u0627\u0631\u062c'
olsDoNotDisturb = u'\u0645\u0645\u0646\u0648\u0639 \u0627\u0644\u0625\u0632\u0639\u0627\u062c'
olsNotAvailable = u'\u063a\u064a\u0631 \u0645\u062a\u0627\u062d'
olsOffline = u'\u063a\u064a\u0631 \u0645\u062a\u0651\u0635\u0644'
olsOnline = u'\u0645\u062a\u0635\u0644'
olsSkypeMe = u'Skype Me'
olsSkypeOut = u'SkypeOut'
olsUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
smsMessageStatusComposing = u'Composing'
smsMessageStatusDelivered = u'Delivered'
smsMessageStatusFailed = u'Failed'
smsMessageStatusRead = u'Read'
smsMessageStatusReceived = u'Received'
smsMessageStatusSendingToServer = u'Sending to Server'
smsMessageStatusSentToServer = u'Sent to Server'
smsMessageStatusSomeTargetsFailed = u'Some Targets Failed'
smsMessageStatusUnknown = u'Unknown'
smsMessageTypeCCRequest = u'Confirmation Code Request'
smsMessageTypeCCSubmit = u'Confirmation Code Submit'
smsMessageTypeIncoming = u'Incoming'
smsMessageTypeOutgoing = u'Outgoing'
smsMessageTypeUnknown = u'Unknown'
smsTargetStatusAcceptable = u'Acceptable'
smsTargetStatusAnalyzing = u'Analyzing'
smsTargetStatusDeliveryFailed = u'Delivery Failed'
smsTargetStatusDeliveryPending = u'Delivery Pending'
smsTargetStatusDeliverySuccessful = u'Delivery Successful'
smsTargetStatusNotRoutable = u'Not Routable'
smsTargetStatusUndefined = u'Undefined'
smsTargetStatusUnknown = u'Unknown'
usexFemale = u'\u0623\u0646\u062b\u0649'
usexMale = u'\u0630\u0643\u0631'
usexUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
vmrConnectError = u'\u062e\u0637\u0623 \u0641\u064a \u0627\u0644\u0627\u062a\u0635\u0627\u0644'
vmrFileReadError = u'\u062e\u0637\u0623 \u0641\u064a \u0642\u0631\u0627\u0621\u0629 \u0627\u0644\u0645\u0644\u0641'
vmrFileWriteError = u'\u062e\u0637\u0623 \u0641\u064a \u0627\u0644\u0643\u062a\u0627\u0628\u0629 \u0625\u0644\u0649 \u0627\u0644\u0645\u0644\u0641'
vmrMiscError = u'\u062e\u0637\u0623 \u0645\u062a\u0646\u0648\u0639'
vmrNoError = u'\u0644\u0627 \u064a\u0648\u062c\u062f \u062e\u0637\u0623'
vmrNoPrivilege = u'\u0644\u0627 \u064a\u0648\u062c\u062f \u0627\u0645\u062a\u064a\u0627\u0632 \u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a'
vmrNoVoicemail = u'\u0644\u0627 \u064a\u0648\u062c\u062f \u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a \u0643\u0647\u0630\u0627'
vmrPlaybackError = u'\u062e\u0637\u0623 \u0641\u064a \u0627\u0644\u062a\u0634\u063a\u064a\u0644'
vmrRecordingError = u'\u062e\u0637\u0623 \u0641\u064a \u0627\u0644\u062a\u0633\u062c\u064a\u0644'
vmrUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
vmsBlank = u'\u0641\u0627\u0631\u063a'
vmsBuffering = u'\u062a\u062e\u0632\u064a\u0646 \u0645\u0624\u0642\u062a'
vmsDeleting = u'\u062c\u0627\u0631\u064a \u0627\u0644\u062d\u0630\u0641'
vmsDownloading = u'\u062c\u0627\u0631\u064a \u0627\u0644\u062a\u062d\u0645\u064a\u0644'
vmsFailed = u'\u0641\u0634\u0644'
vmsNotDownloaded = u'\u0644\u0645 \u064a\u062a\u0645 \u0627\u0644\u062a\u062d\u0645\u064a\u0644'
vmsPlayed = u'\u062a\u0645 \u0627\u0644\u062a\u0634\u063a\u064a\u0644'
vmsPlaying = u'\u062c\u0627\u0631\u064a \u0627\u0644\u062a\u0634\u063a\u064a\u0644'
vmsRecorded = u'\u0645\u0633\u062c\u0644'
vmsRecording = u'\u062a\u0633\u062c\u064a\u0644 \u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a'
vmsUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
vmsUnplayed = u'\u0644\u0645 \u064a\u062a\u0645 \u0627\u0644\u062a\u0634\u063a\u064a\u0644'
vmsUploaded = u'\u062a\u0645 \u0627\u0644\u0625\u064a\u062f\u0627\u0639'
vmsUploading = u'\u062c\u0627\u0631\u064a \u0627\u0644\u0625\u064a\u062f\u0627\u0639'
vmtCustomGreeting = u'\u062a\u062d\u064a\u0629 \u0645\u062e\u0635\u0635\u0629'
vmtDefaultGreeting = u'\u0627\u0644\u062a\u062d\u064a\u0629 \u0627\u0644\u0627\u0641\u062a\u0631\u0627\u0636\u064a\u0629'
vmtIncoming = u'\u0628\u0631\u064a\u062f \u0635\u0648\u062a\u064a \u0642\u0627\u062f\u0645'
vmtOutgoing = u'\u0635\u0627\u062f\u0631'
vmtUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
vssAvailable = u'\u0645\u062a\u0627\u062d'
vssNotAvailable = u'\u063a\u064a\u0631 \u0645\u062a\u0627\u062d'
vssPaused = u'\u0625\u064a\u0642\u0627\u0641 \u0645\u0624\u0642\u062a'
vssRejected = u'\u0631\u0641\u0636'
vssRunning = u'\u062a\u0634\u063a\u064a\u0644'
vssStarting = u'\u0628\u062f\u0621'
vssStopping = u'\u0625\u064a\u0642\u0627\u0641'
vssUnknown = u'\u063a\u064a\u0631 \u0645\u0639\u0631\u0648\u0641\u0629'
|
api_attach_available = u'واجهة برمجة التطبيق (API) متاحة'
api_attach_not_available = u'غير متاح'
api_attach_pending_authorization = u'تعليق التصريح'
api_attach_refused = u'رفض'
api_attach_success = u'نجاح'
api_attach_unknown = u'غير معروفة'
bud_deleted_friend = u'تم حذفه من قائمة الأصدقاء'
bud_friend = u'صديق'
bud_never_been_friend = u'لم يوجد مطلقًا في قائمة الأصدقاء'
bud_pending_authorization = u'تعليق التصريح'
bud_unknown = u'غير معروفة'
cfr_blocked_by_recipient = u'تم حظر المكالمة بواسطة المستلم'
cfr_misc_error = u'خطأ متنوع'
cfr_no_common_codec = u'برنامج تشفير غير شائع'
cfr_no_proxy_found = u'لم يتم العثور على بروكسي'
cfr_not_authorized_by_recipient = u'لم يتم منح تصريح للمستخدم الحالي بواسطة المستلم'
cfr_recipient_not_friend = u'المستلم ليس صديقًا'
cfr_remote_device_error = u'مشكلة في جهاز الصوت البعيد'
cfr_session_terminated = u'انتهاء الجلسة'
cfr_sound_io_error = u'خطأ في إدخال/إخراج الصوت'
cfr_sound_recording_error = u'خطأ في تسجيل الصوت'
cfr_unknown = u'غير معروفة'
cfr_user_does_not_exist = u'المستخدم/رقم الهاتف غير موجود'
cfr_user_is_offline = u'غير متّصلة أو غير متّصل'
chs_all_calls = u'حوار قديم'
chs_dialog = u'حوار'
chs_incoming_calls = u'يجب الموافقة على المحادثة الجماعية'
chs_legacy_dialog = u'حوار قديم'
chs_missed_calls = u'حوار'
chs_multi_need_accept = u'يجب الموافقة على المحادثة الجماعية'
chs_multi_subscribed = u'تم الاشتراك في المحادثة الجماعية'
chs_outgoing_calls = u'تم الاشتراك في المحادثة الجماعية'
chs_unknown = u'غير معروفة'
chs_unsubscribed = u'تم إلغاء الاشتراك'
cls_busy = u'مشغول'
cls_cancelled = u'ألغي'
cls_early_media = u'تشغيل الوسائط (Early Media)'
cls_failed = u'عفواً، تعذّرت عملية الاتّصال!'
cls_finished = u'انتهى'
cls_in_progress = u'جاري الاتصال'
cls_local_hold = u'مكالمة قيد الانتظار من طرفي'
cls_missed = u'مكالمة لم يُرد عليها'
cls_on_hold = u'قيد الانتظار'
cls_refused = u'رفض'
cls_remote_hold = u'مكالمة قيد الانتظار من الطرف الثاني'
cls_ringing = u'الاتصال'
cls_routing = u'توجيه'
cls_transferred = u'غير معروفة'
cls_transferring = u'غير معروفة'
cls_unknown = u'غير معروفة'
cls_unplaced = u'لم يوضع مطلقًا'
cls_voicemail_buffering_greeting = u'تخزين التحية'
cls_voicemail_cancelled = u'تم إلغاء البريد الصوتي'
cls_voicemail_failed = u'فشل البريد الصوتي'
cls_voicemail_playing_greeting = u'تشغيل التحية'
cls_voicemail_recording = u'تسجيل بريد صوتي'
cls_voicemail_sent = u'تم إرسال البريد الصوتي'
cls_voicemail_uploading = u'إيداع بريد صوتي'
clt_incoming_p2_p = u'مكالمة نظير إلى نظير واردة'
clt_incoming_pstn = u'مكالمة هاتفية واردة'
clt_outgoing_p2_p = u'مكالمة نظير إلى نظير صادرة'
clt_outgoing_pstn = u'مكالمة هاتفية صادرة'
clt_unknown = u'غير معروفة'
cme_added_members = u'الأعضاء المضافة'
cme_created_chat_with = u'أنشأ محادثة مع'
cme_emoted = u'غير معروفة'
cme_left = u'غادر'
cme_said = u'قال'
cme_saw_members = u'الأعضاء المشاهَدون'
cme_set_topic = u'تعيين موضوع'
cme_unknown = u'غير معروفة'
cms_read = u'قراءة'
cms_received = u'مُستَلم'
cms_sending = u'جاري الإرسال...'
cms_sent = u'مُرسَل'
cms_unknown = u'غير معروفة'
con_connecting = u'جاري التوصيل'
con_offline = u'غير متّصل'
con_online = u'متصل'
con_pausing = u'إيقاف مؤقت'
con_unknown = u'غير معروفة'
cus_away = u'بالخارج'
cus_do_not_disturb = u'ممنوع الإزعاج'
cus_invisible = u'مخفي'
cus_logged_out = u'غير متّصل'
cus_not_available = u'غير متاح'
cus_offline = u'غير متّصل'
cus_online = u'متصل'
cus_skype_me = u'Skype Me'
cus_unknown = u'غير معروفة'
cvs_both_enabled = u'إرسال واستلام الفيديو'
cvs_none = u'لا يوجد فيديو'
cvs_receive_enabled = u'استلام الفيديو'
cvs_send_enabled = u'إرسال الفيديو'
cvs_unknown = u''
grp_all_friends = u'كافة الأصدقاء'
grp_all_users = u'كافة المستخدمين'
grp_custom_group = u'مخصص'
grp_online_friends = u'الأصدقاء المتصلون'
grp_pending_authorization_friends = u'تعليق التصريح'
grp_proposed_shared_group = u'Proposed Shared Group'
grp_recently_contacted_users = u'المستخدمون المتصلون حديثًا'
grp_shared_group = u'Shared Group'
grp_skype_friends = u'أصدقاء Skype'
grp_skype_out_friends = u'أصدقاء SkypeOut'
grp_ungrouped_friends = u'الأصدقاء غير المجمعين'
grp_unknown = u'غير معروفة'
grp_users_authorized_by_me = u'مصرح بواسطتي'
grp_users_blocked_by_me = u'محظور بواسطتي'
grp_users_waiting_my_authorization = u'في انتظار التصريح الخاص بي'
lea_add_declined = u'تم رفض الإضافة'
lea_added_not_authorized = u'يجب منح تصريح للشخص المضاف'
lea_adder_not_friend = u'الشخص المضيف يجب أن يكون صديقًا'
lea_unknown = u'غير معروفة'
lea_unsubscribe = u'تم إلغاء الاشتراك'
lea_user_incapable = u'المستخدم غير مؤهل'
lea_user_not_found = u'المستخدم غير موجود'
ols_away = u'بالخارج'
ols_do_not_disturb = u'ممنوع الإزعاج'
ols_not_available = u'غير متاح'
ols_offline = u'غير متّصل'
ols_online = u'متصل'
ols_skype_me = u'Skype Me'
ols_skype_out = u'SkypeOut'
ols_unknown = u'غير معروفة'
sms_message_status_composing = u'Composing'
sms_message_status_delivered = u'Delivered'
sms_message_status_failed = u'Failed'
sms_message_status_read = u'Read'
sms_message_status_received = u'Received'
sms_message_status_sending_to_server = u'Sending to Server'
sms_message_status_sent_to_server = u'Sent to Server'
sms_message_status_some_targets_failed = u'Some Targets Failed'
sms_message_status_unknown = u'Unknown'
sms_message_type_cc_request = u'Confirmation Code Request'
sms_message_type_cc_submit = u'Confirmation Code Submit'
sms_message_type_incoming = u'Incoming'
sms_message_type_outgoing = u'Outgoing'
sms_message_type_unknown = u'Unknown'
sms_target_status_acceptable = u'Acceptable'
sms_target_status_analyzing = u'Analyzing'
sms_target_status_delivery_failed = u'Delivery Failed'
sms_target_status_delivery_pending = u'Delivery Pending'
sms_target_status_delivery_successful = u'Delivery Successful'
sms_target_status_not_routable = u'Not Routable'
sms_target_status_undefined = u'Undefined'
sms_target_status_unknown = u'Unknown'
usex_female = u'أنثى'
usex_male = u'ذكر'
usex_unknown = u'غير معروفة'
vmr_connect_error = u'خطأ في الاتصال'
vmr_file_read_error = u'خطأ في قراءة الملف'
vmr_file_write_error = u'خطأ في الكتابة إلى الملف'
vmr_misc_error = u'خطأ متنوع'
vmr_no_error = u'لا يوجد خطأ'
vmr_no_privilege = u'لا يوجد امتياز بريد صوتي'
vmr_no_voicemail = u'لا يوجد بريد صوتي كهذا'
vmr_playback_error = u'خطأ في التشغيل'
vmr_recording_error = u'خطأ في التسجيل'
vmr_unknown = u'غير معروفة'
vms_blank = u'فارغ'
vms_buffering = u'تخزين مؤقت'
vms_deleting = u'جاري الحذف'
vms_downloading = u'جاري التحميل'
vms_failed = u'فشل'
vms_not_downloaded = u'لم يتم التحميل'
vms_played = u'تم التشغيل'
vms_playing = u'جاري التشغيل'
vms_recorded = u'مسجل'
vms_recording = u'تسجيل بريد صوتي'
vms_unknown = u'غير معروفة'
vms_unplayed = u'لم يتم التشغيل'
vms_uploaded = u'تم الإيداع'
vms_uploading = u'جاري الإيداع'
vmt_custom_greeting = u'تحية مخصصة'
vmt_default_greeting = u'التحية الافتراضية'
vmt_incoming = u'بريد صوتي قادم'
vmt_outgoing = u'صادر'
vmt_unknown = u'غير معروفة'
vss_available = u'متاح'
vss_not_available = u'غير متاح'
vss_paused = u'إيقاف مؤقت'
vss_rejected = u'رفض'
vss_running = u'تشغيل'
vss_starting = u'بدء'
vss_stopping = u'إيقاف'
vss_unknown = u'غير معروفة'
|
def go():
with open('input.txt', 'r') as f:
ids = [item for item in f.read().split('\n') if item]
for i in range(len(ids)):
for j in range(i + 1, len(ids)):
diff_count = 0
for k in range(len(ids[i])):
if ids[i][k] != ids[j][k]:
diff_count += 1
if diff_count == 1:
return ''.join([ids[i][k] for k in range(len(ids[i])) if ids[i][k] == ids[j][k]])
print(go())
|
def go():
with open('input.txt', 'r') as f:
ids = [item for item in f.read().split('\n') if item]
for i in range(len(ids)):
for j in range(i + 1, len(ids)):
diff_count = 0
for k in range(len(ids[i])):
if ids[i][k] != ids[j][k]:
diff_count += 1
if diff_count == 1:
return ''.join([ids[i][k] for k in range(len(ids[i])) if ids[i][k] == ids[j][k]])
print(go())
|
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyNvidiaMlPy(PythonPackage):
"""Python Bindings for the NVIDIA Management Library."""
homepage = "https://www.nvidia.com/"
pypi = "nvidia-ml-py/nvidia-ml-py-11.450.51.tar.gz"
version('11.450.51', sha256='5aa6dd23a140b1ef2314eee5ca154a45397b03e68fd9ebc4f72005979f511c73')
# pip silently replaces distutils with setuptools
depends_on('py-setuptools', type='build')
|
class Pynvidiamlpy(PythonPackage):
"""Python Bindings for the NVIDIA Management Library."""
homepage = 'https://www.nvidia.com/'
pypi = 'nvidia-ml-py/nvidia-ml-py-11.450.51.tar.gz'
version('11.450.51', sha256='5aa6dd23a140b1ef2314eee5ca154a45397b03e68fd9ebc4f72005979f511c73')
depends_on('py-setuptools', type='build')
|
# -*- coding: utf-8 -*-
def main():
abcd = sorted([int(input()) for _ in range(4)])
ef = sorted([int(input()) for _ in range(2)])
print(sum(abcd[1:] + ef[1:]))
if __name__ == '__main__':
main()
|
def main():
abcd = sorted([int(input()) for _ in range(4)])
ef = sorted([int(input()) for _ in range(2)])
print(sum(abcd[1:] + ef[1:]))
if __name__ == '__main__':
main()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.