content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#-----------------------------------
# AutoNaptPython
#
# Copyright (c) 2018 RainForest
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
#-----------------------------------
class Event2(object):
def __init__(self, doc = None):
self.handlers = []
self.__doc__ = doc
def __str__(self):
return 'Event<%s>' % str(self.__doc__)
def add(self, handler):
self.handlers.append(handler)
return self
def remove(self, handler):
self.handlers.remove(handler)
return self
def __call__(self, sender, e):
for handler in self.handlers:
handler(sender, e)
__iadd__ = add
__isub__ = remove
| class Event2(object):
def __init__(self, doc=None):
self.handlers = []
self.__doc__ = doc
def __str__(self):
return 'Event<%s>' % str(self.__doc__)
def add(self, handler):
self.handlers.append(handler)
return self
def remove(self, handler):
self.handlers.remove(handler)
return self
def __call__(self, sender, e):
for handler in self.handlers:
handler(sender, e)
__iadd__ = add
__isub__ = remove |
class Parser:
def __init__(self, directory, rel_path):
pass
def parse(self):
return {}, []
def get_parser(): return 5
| class Parser:
def __init__(self, directory, rel_path):
pass
def parse(self):
return ({}, [])
def get_parser():
return 5 |
load("@bazel_tools//tools/jdk:toolchain_utils.bzl", "find_java_runtime_toolchain", "find_java_toolchain")
def _proto_path(proto):
"""
The proto path is not really a file path
It's the path to the proto that was seen when the descriptor file was generated.
"""
path = proto.path
root = proto.root.path
ws = proto.owner.workspace_root
if path.startswith(root):
path = path[len(root):]
if path.startswith("/"):
path = path[1:]
if path.startswith(ws):
path = path[len(ws):]
if path.startswith("/"):
path = path[1:]
return path
def _protoc_cc_output_files(proto_file_sources):
cc_hdrs = []
cc_srcs = []
for p in proto_file_sources:
basename = p.basename[:-len(".proto")]
cc_hdrs.append(basename + ".pb.h")
cc_hdrs.append(basename + ".pb.validate.h")
cc_srcs.append(basename + ".pb.cc")
cc_srcs.append(basename + ".pb.validate.cc")
return cc_hdrs + cc_srcs
def _proto_sources(ctx):
protos = []
for dep in ctx.attr.deps:
protos += [f for f in dep[ProtoInfo].direct_sources]
return protos
def _output_dir(ctx):
dir_out = ctx.genfiles_dir.path
if ctx.label.workspace_root:
dir_out += "/" + ctx.label.workspace_root
return dir_out
def _protoc_gen_validate_cc_impl(ctx):
"""Generate C++ protos using protoc-gen-validate plugin"""
protos = _proto_sources(ctx)
cc_files = _protoc_cc_output_files(protos)
out_files = [ctx.actions.declare_file(out) for out in cc_files]
dir_out = _output_dir(ctx)
args = [
"--cpp_out=" + dir_out,
"--validate_out=lang=cc:" + dir_out,
]
return _protoc_gen_validate_impl(
ctx = ctx,
lang = "cc",
protos = protos,
out_files = out_files,
protoc_args = args,
package_command = "true",
)
def _protoc_python_output_files(proto_file_sources):
python_srcs = []
for p in proto_file_sources:
basename = p.basename[:-len(".proto")]
python_srcs.append(basename.replace("-", "_", maxsplit = None) + "_pb2.py")
return python_srcs
def _protoc_gen_validate_python_impl(ctx):
"""Generate Python protos using protoc-gen-validate plugin"""
protos = _proto_sources(ctx)
python_files = _protoc_python_output_files(protos)
out_files = [ctx.actions.declare_file(out) for out in python_files]
dir_out = _output_dir(ctx)
args = [
"--python_out=" + dir_out,
]
return _protoc_gen_validate_impl(
ctx = ctx,
lang = "python",
protos = protos,
out_files = out_files,
protoc_args = args,
package_command = "true",
)
def _protoc_gen_validate_impl(ctx, lang, protos, out_files, protoc_args, package_command):
protoc_args.append("--plugin=protoc-gen-validate=" + ctx.executable._plugin.path)
dir_out = ctx.genfiles_dir.path
if ctx.label.workspace_root:
dir_out += "/" + ctx.label.workspace_root
tds = depset([], transitive = [dep[ProtoInfo].transitive_descriptor_sets for dep in ctx.attr.deps])
descriptor_args = [ds.path for ds in tds.to_list()]
if len(descriptor_args) != 0:
protoc_args += ["--descriptor_set_in=%s" % ctx.configuration.host_path_separator.join(descriptor_args)]
package_command = package_command.format(dir_out = dir_out)
ctx.actions.run_shell(
outputs = out_files,
inputs = protos + tds.to_list(),
tools = [ctx.executable._plugin, ctx.executable._protoc],
command = " && ".join([
ctx.executable._protoc.path + " $@",
package_command,
]),
arguments = protoc_args + [_proto_path(proto) for proto in protos],
mnemonic = "ProtoGenValidate" + lang.capitalize() + "Generate",
use_default_shell_env = True,
)
return struct(
files = depset(out_files),
)
cc_proto_gen_validate = rule(
attrs = {
"deps": attr.label_list(
mandatory = True,
providers = [ProtoInfo],
),
"_protoc": attr.label(
cfg = "host",
default = Label("@com_google_protobuf//:protoc"),
executable = True,
allow_single_file = True,
),
"_plugin": attr.label(
cfg = "host",
default = Label("@com_envoyproxy_protoc_gen_validate//:protoc-gen-validate"),
allow_files = True,
executable = True,
),
},
output_to_genfiles = True,
implementation = _protoc_gen_validate_cc_impl,
)
_ProtoValidateSourceInfo = provider(
fields = {
"sources": "Depset of sources created by protoc with protoc-gen-validate plugin",
},
)
def _create_include_path(include):
return "--proto_path={0}={1}".format(_proto_path(include), include.path)
def _java_proto_gen_validate_aspect_impl(target, ctx):
proto_info = target[ProtoInfo]
includes = proto_info.transitive_imports
srcs = proto_info.direct_sources
options = ",".join(["lang=java"])
srcjar = ctx.actions.declare_file("%s-validate-gensrc.jar" % ctx.label.name)
args = ctx.actions.args()
args.add(ctx.executable._plugin.path, format = "--plugin=protoc-gen-validate=%s")
args.add("--validate_out={0}:{1}".format(options, srcjar.path))
args.add_all(includes, map_each = _create_include_path)
args.add_all(srcs, map_each = _proto_path)
ctx.actions.run(
inputs = depset(transitive = [proto_info.transitive_imports]),
outputs = [srcjar],
executable = ctx.executable._protoc,
arguments = [args],
tools = [ctx.executable._plugin],
progress_message = "Generating %s" % srcjar.path,
)
return [_ProtoValidateSourceInfo(
sources = depset(
[srcjar],
transitive = [dep[_ProtoValidateSourceInfo].sources for dep in ctx.rule.attr.deps],
),
)]
_java_proto_gen_validate_aspect = aspect(
_java_proto_gen_validate_aspect_impl,
provides = [_ProtoValidateSourceInfo],
attr_aspects = ["deps"],
attrs = {
"_protoc": attr.label(
cfg = "host",
default = Label("@com_google_protobuf//:protoc"),
executable = True,
allow_single_file = True,
),
"_plugin": attr.label(
cfg = "host",
default = Label("@com_envoyproxy_protoc_gen_validate//:protoc-gen-validate"),
allow_files = True,
executable = True,
),
},
)
def _java_proto_gen_validate_impl(ctx):
source_jars = [source_jar for dep in ctx.attr.deps for source_jar in dep[_ProtoValidateSourceInfo].sources.to_list()]
deps = [java_common.make_non_strict(dep[JavaInfo]) for dep in ctx.attr.java_deps]
deps += [dep[JavaInfo] for dep in ctx.attr._validate_deps]
java_info = java_common.compile(
ctx,
source_jars = source_jars,
deps = deps,
output_source_jar = ctx.outputs.srcjar,
output = ctx.outputs.jar,
java_toolchain = find_java_toolchain(ctx, ctx.attr._java_toolchain),
host_javabase = find_java_runtime_toolchain(ctx, ctx.attr._host_javabase),
)
return [java_info]
"""Bazel rule to create a Java protobuf validation library from proto sources files.
Args:
deps: proto_library rules that contain the necessary .proto files
java_deps: the java_proto_library of the protos being compiled.
"""
java_proto_gen_validate = rule(
attrs = {
"deps": attr.label_list(
providers = [ProtoInfo],
aspects = [_java_proto_gen_validate_aspect],
mandatory = True,
),
"java_deps": attr.label_list(
providers = [JavaInfo],
mandatory = True,
),
"_validate_deps": attr.label_list(
default = [
Label("@com_envoyproxy_protoc_gen_validate//validate:validate_java"),
Label("@com_google_re2j//jar"),
Label("@com_google_protobuf//:protobuf_java"),
Label("@com_google_protobuf//:protobuf_java_util"),
Label("@com_envoyproxy_protoc_gen_validate//java/pgv-java-stub/src/main/java/io/envoyproxy/pgv"),
Label("@com_envoyproxy_protoc_gen_validate//java/pgv-java-validation/src/main/java/io/envoyproxy/pgv"),
],
),
"_java_toolchain": attr.label(default = Label("@bazel_tools//tools/jdk:current_java_toolchain")),
"_host_javabase": attr.label(
cfg = "host",
default = Label("@bazel_tools//tools/jdk:current_host_java_runtime"),
),
},
fragments = ["java"],
provides = [JavaInfo],
outputs = {
"jar": "lib%{name}.jar",
"srcjar": "lib%{name}-src.jar",
},
implementation = _java_proto_gen_validate_impl,
)
python_proto_gen_validate = rule(
attrs = {
"deps": attr.label_list(
mandatory = True,
providers = ["proto"],
),
"_protoc": attr.label(
cfg = "host",
default = Label("@com_google_protobuf//:protoc"),
executable = True,
allow_single_file = True,
),
"_plugin": attr.label(
cfg = "host",
default = Label("@com_envoyproxy_protoc_gen_validate//:protoc-gen-validate"),
allow_files = True,
executable = True,
),
},
output_to_genfiles = True,
implementation = _protoc_gen_validate_python_impl,
)
| load('@bazel_tools//tools/jdk:toolchain_utils.bzl', 'find_java_runtime_toolchain', 'find_java_toolchain')
def _proto_path(proto):
"""
The proto path is not really a file path
It's the path to the proto that was seen when the descriptor file was generated.
"""
path = proto.path
root = proto.root.path
ws = proto.owner.workspace_root
if path.startswith(root):
path = path[len(root):]
if path.startswith('/'):
path = path[1:]
if path.startswith(ws):
path = path[len(ws):]
if path.startswith('/'):
path = path[1:]
return path
def _protoc_cc_output_files(proto_file_sources):
cc_hdrs = []
cc_srcs = []
for p in proto_file_sources:
basename = p.basename[:-len('.proto')]
cc_hdrs.append(basename + '.pb.h')
cc_hdrs.append(basename + '.pb.validate.h')
cc_srcs.append(basename + '.pb.cc')
cc_srcs.append(basename + '.pb.validate.cc')
return cc_hdrs + cc_srcs
def _proto_sources(ctx):
protos = []
for dep in ctx.attr.deps:
protos += [f for f in dep[ProtoInfo].direct_sources]
return protos
def _output_dir(ctx):
dir_out = ctx.genfiles_dir.path
if ctx.label.workspace_root:
dir_out += '/' + ctx.label.workspace_root
return dir_out
def _protoc_gen_validate_cc_impl(ctx):
"""Generate C++ protos using protoc-gen-validate plugin"""
protos = _proto_sources(ctx)
cc_files = _protoc_cc_output_files(protos)
out_files = [ctx.actions.declare_file(out) for out in cc_files]
dir_out = _output_dir(ctx)
args = ['--cpp_out=' + dir_out, '--validate_out=lang=cc:' + dir_out]
return _protoc_gen_validate_impl(ctx=ctx, lang='cc', protos=protos, out_files=out_files, protoc_args=args, package_command='true')
def _protoc_python_output_files(proto_file_sources):
python_srcs = []
for p in proto_file_sources:
basename = p.basename[:-len('.proto')]
python_srcs.append(basename.replace('-', '_', maxsplit=None) + '_pb2.py')
return python_srcs
def _protoc_gen_validate_python_impl(ctx):
"""Generate Python protos using protoc-gen-validate plugin"""
protos = _proto_sources(ctx)
python_files = _protoc_python_output_files(protos)
out_files = [ctx.actions.declare_file(out) for out in python_files]
dir_out = _output_dir(ctx)
args = ['--python_out=' + dir_out]
return _protoc_gen_validate_impl(ctx=ctx, lang='python', protos=protos, out_files=out_files, protoc_args=args, package_command='true')
def _protoc_gen_validate_impl(ctx, lang, protos, out_files, protoc_args, package_command):
protoc_args.append('--plugin=protoc-gen-validate=' + ctx.executable._plugin.path)
dir_out = ctx.genfiles_dir.path
if ctx.label.workspace_root:
dir_out += '/' + ctx.label.workspace_root
tds = depset([], transitive=[dep[ProtoInfo].transitive_descriptor_sets for dep in ctx.attr.deps])
descriptor_args = [ds.path for ds in tds.to_list()]
if len(descriptor_args) != 0:
protoc_args += ['--descriptor_set_in=%s' % ctx.configuration.host_path_separator.join(descriptor_args)]
package_command = package_command.format(dir_out=dir_out)
ctx.actions.run_shell(outputs=out_files, inputs=protos + tds.to_list(), tools=[ctx.executable._plugin, ctx.executable._protoc], command=' && '.join([ctx.executable._protoc.path + ' $@', package_command]), arguments=protoc_args + [_proto_path(proto) for proto in protos], mnemonic='ProtoGenValidate' + lang.capitalize() + 'Generate', use_default_shell_env=True)
return struct(files=depset(out_files))
cc_proto_gen_validate = rule(attrs={'deps': attr.label_list(mandatory=True, providers=[ProtoInfo]), '_protoc': attr.label(cfg='host', default=label('@com_google_protobuf//:protoc'), executable=True, allow_single_file=True), '_plugin': attr.label(cfg='host', default=label('@com_envoyproxy_protoc_gen_validate//:protoc-gen-validate'), allow_files=True, executable=True)}, output_to_genfiles=True, implementation=_protoc_gen_validate_cc_impl)
__proto_validate_source_info = provider(fields={'sources': 'Depset of sources created by protoc with protoc-gen-validate plugin'})
def _create_include_path(include):
return '--proto_path={0}={1}'.format(_proto_path(include), include.path)
def _java_proto_gen_validate_aspect_impl(target, ctx):
proto_info = target[ProtoInfo]
includes = proto_info.transitive_imports
srcs = proto_info.direct_sources
options = ','.join(['lang=java'])
srcjar = ctx.actions.declare_file('%s-validate-gensrc.jar' % ctx.label.name)
args = ctx.actions.args()
args.add(ctx.executable._plugin.path, format='--plugin=protoc-gen-validate=%s')
args.add('--validate_out={0}:{1}'.format(options, srcjar.path))
args.add_all(includes, map_each=_create_include_path)
args.add_all(srcs, map_each=_proto_path)
ctx.actions.run(inputs=depset(transitive=[proto_info.transitive_imports]), outputs=[srcjar], executable=ctx.executable._protoc, arguments=[args], tools=[ctx.executable._plugin], progress_message='Generating %s' % srcjar.path)
return [__proto_validate_source_info(sources=depset([srcjar], transitive=[dep[_ProtoValidateSourceInfo].sources for dep in ctx.rule.attr.deps]))]
_java_proto_gen_validate_aspect = aspect(_java_proto_gen_validate_aspect_impl, provides=[_ProtoValidateSourceInfo], attr_aspects=['deps'], attrs={'_protoc': attr.label(cfg='host', default=label('@com_google_protobuf//:protoc'), executable=True, allow_single_file=True), '_plugin': attr.label(cfg='host', default=label('@com_envoyproxy_protoc_gen_validate//:protoc-gen-validate'), allow_files=True, executable=True)})
def _java_proto_gen_validate_impl(ctx):
source_jars = [source_jar for dep in ctx.attr.deps for source_jar in dep[_ProtoValidateSourceInfo].sources.to_list()]
deps = [java_common.make_non_strict(dep[JavaInfo]) for dep in ctx.attr.java_deps]
deps += [dep[JavaInfo] for dep in ctx.attr._validate_deps]
java_info = java_common.compile(ctx, source_jars=source_jars, deps=deps, output_source_jar=ctx.outputs.srcjar, output=ctx.outputs.jar, java_toolchain=find_java_toolchain(ctx, ctx.attr._java_toolchain), host_javabase=find_java_runtime_toolchain(ctx, ctx.attr._host_javabase))
return [java_info]
'Bazel rule to create a Java protobuf validation library from proto sources files.\n\nArgs:\n deps: proto_library rules that contain the necessary .proto files\n java_deps: the java_proto_library of the protos being compiled.\n'
java_proto_gen_validate = rule(attrs={'deps': attr.label_list(providers=[ProtoInfo], aspects=[_java_proto_gen_validate_aspect], mandatory=True), 'java_deps': attr.label_list(providers=[JavaInfo], mandatory=True), '_validate_deps': attr.label_list(default=[label('@com_envoyproxy_protoc_gen_validate//validate:validate_java'), label('@com_google_re2j//jar'), label('@com_google_protobuf//:protobuf_java'), label('@com_google_protobuf//:protobuf_java_util'), label('@com_envoyproxy_protoc_gen_validate//java/pgv-java-stub/src/main/java/io/envoyproxy/pgv'), label('@com_envoyproxy_protoc_gen_validate//java/pgv-java-validation/src/main/java/io/envoyproxy/pgv')]), '_java_toolchain': attr.label(default=label('@bazel_tools//tools/jdk:current_java_toolchain')), '_host_javabase': attr.label(cfg='host', default=label('@bazel_tools//tools/jdk:current_host_java_runtime'))}, fragments=['java'], provides=[JavaInfo], outputs={'jar': 'lib%{name}.jar', 'srcjar': 'lib%{name}-src.jar'}, implementation=_java_proto_gen_validate_impl)
python_proto_gen_validate = rule(attrs={'deps': attr.label_list(mandatory=True, providers=['proto']), '_protoc': attr.label(cfg='host', default=label('@com_google_protobuf//:protoc'), executable=True, allow_single_file=True), '_plugin': attr.label(cfg='host', default=label('@com_envoyproxy_protoc_gen_validate//:protoc-gen-validate'), allow_files=True, executable=True)}, output_to_genfiles=True, implementation=_protoc_gen_validate_python_impl) |
# Set up constants
WIDTH = 25
HEIGHT = 6
LAYER_SIZE = WIDTH * HEIGHT
# Read in the input file and convert to a list
pixel_string = ""
with open("./input.txt") as f:
pixel_string = f.readline()
unlayered_pixel_values = list(pixel_string.strip())
# Make into a list of layers
idx = 0
layers = []
while idx < len(unlayered_pixel_values):
layers.append(unlayered_pixel_values[idx:(idx + LAYER_SIZE)])
idx += LAYER_SIZE
# Find the layer with the fewest zeroes
fewest_zeroes = LAYER_SIZE + 1
layer_with_fewest_zeroes = None
for i, layer in enumerate(layers):
zeroes = 0
for pixel in layer:
if pixel == "0":
zeroes += 1
if zeroes < fewest_zeroes:
fewest_zeroes = zeroes
layer_with_fewest_zeroes = i
# For the layer with the fewest zeroes, count the ones and twos
# and then print the product of the ones and the twos
layer_of_interest = layers[layer_with_fewest_zeroes]
ones = 0
twos = 0
for pixel in layer_of_interest:
if pixel == "1":
ones += 1
if pixel == "2":
twos += 1
product = ones * twos
print(product)
| width = 25
height = 6
layer_size = WIDTH * HEIGHT
pixel_string = ''
with open('./input.txt') as f:
pixel_string = f.readline()
unlayered_pixel_values = list(pixel_string.strip())
idx = 0
layers = []
while idx < len(unlayered_pixel_values):
layers.append(unlayered_pixel_values[idx:idx + LAYER_SIZE])
idx += LAYER_SIZE
fewest_zeroes = LAYER_SIZE + 1
layer_with_fewest_zeroes = None
for (i, layer) in enumerate(layers):
zeroes = 0
for pixel in layer:
if pixel == '0':
zeroes += 1
if zeroes < fewest_zeroes:
fewest_zeroes = zeroes
layer_with_fewest_zeroes = i
layer_of_interest = layers[layer_with_fewest_zeroes]
ones = 0
twos = 0
for pixel in layer_of_interest:
if pixel == '1':
ones += 1
if pixel == '2':
twos += 1
product = ones * twos
print(product) |
def pg_version(conn):
"""
Returns the PostgreSQL server version as numeric and full version.
"""
num_version = conn.get_pg_version()
conn.execute("SELECT version()")
full_version = list(conn.get_rows())[0]['version']
return dict(numeric=num_version, full=full_version)
| def pg_version(conn):
"""
Returns the PostgreSQL server version as numeric and full version.
"""
num_version = conn.get_pg_version()
conn.execute('SELECT version()')
full_version = list(conn.get_rows())[0]['version']
return dict(numeric=num_version, full=full_version) |
class BaseExceptions(Exception):
pass
class DeleteException(BaseException):
"""Raised when delete failed"""
def __init__(self, resp_data):
if isinstance(resp_data, dict):
self.err = ''.join('Failed with reason {}'.format(val) for key, val in resp_data.items())
else:
self.err = 'Delete failed with an unknown reason'
def __str__(self):
return '{}'.format(self.err)
class NotFoundException(BaseException):
"""Raised when item is not found"""
def __init__(self, msg):
self.msg = msg
def __str__(self):
return 'Unable to found {}'.format(self.msg)
class CreateException(BaseException):
"""Raised when creation failed"""
def __init__(self, resp_data):
if isinstance(resp_data, dict):
self.err = ''.join('{} '.format(val[0]) for key, val in resp_data.items())
else:
self.err = 'Creation failed with unknown reason'
def __str__(self):
return '{}'.format(self.err)
class UpdateException(BaseException):
"""Raised when an object update fails"""
def __init__(self, resp_data):
if isinstance(resp_data, dict):
self.err = ''.join('{} '.format(val[0]) for key, val in resp_data.items())
else:
self.err = 'Update failed with unknown reason'
def __str__(self):
return '{}'.format(self.err)
class AuthException(BaseException):
"""Raised when an API call method is not allowed"""
pass
| class Baseexceptions(Exception):
pass
class Deleteexception(BaseException):
"""Raised when delete failed"""
def __init__(self, resp_data):
if isinstance(resp_data, dict):
self.err = ''.join(('Failed with reason {}'.format(val) for (key, val) in resp_data.items()))
else:
self.err = 'Delete failed with an unknown reason'
def __str__(self):
return '{}'.format(self.err)
class Notfoundexception(BaseException):
"""Raised when item is not found"""
def __init__(self, msg):
self.msg = msg
def __str__(self):
return 'Unable to found {}'.format(self.msg)
class Createexception(BaseException):
"""Raised when creation failed"""
def __init__(self, resp_data):
if isinstance(resp_data, dict):
self.err = ''.join(('{} '.format(val[0]) for (key, val) in resp_data.items()))
else:
self.err = 'Creation failed with unknown reason'
def __str__(self):
return '{}'.format(self.err)
class Updateexception(BaseException):
"""Raised when an object update fails"""
def __init__(self, resp_data):
if isinstance(resp_data, dict):
self.err = ''.join(('{} '.format(val[0]) for (key, val) in resp_data.items()))
else:
self.err = 'Update failed with unknown reason'
def __str__(self):
return '{}'.format(self.err)
class Authexception(BaseException):
"""Raised when an API call method is not allowed"""
pass |
class CommandBuilder():
def __init__(self, cindex):
self.cindex = cindex
class CodeBuilder(CommandBuilder):
def __init__(self, cindex, cmd):
super().__init__(cindex)
self.cmd = cmd
def __str__(self):
return self.cmd
class SlugBuilder(CommandBuilder):
def __init__(self, cindex, time, location, transition):
super().__init__(cindex)
self.time = time
self.location = location
self.transition = transition
def __str__(self):
return F" scene bg {self.location}" + (F"\n with {self.transition}" if self.transition else "")
class ActorBuilder(CommandBuilder):
def __init__(self, cindex, alias, actor):
super().__init__(cindex)
self.alias = alias
self.actor = actor
def __str__(self):
return F"define {self.alias} = Character(\"{self.actor.upper()}\", color=\"#fff\")"
class LineBuilder(CommandBuilder):
def __init__(self, cindex, actor, blocking, line):
super().__init__(cindex)
self.actor = actor
self.blocking = blocking
self.line = line
def __str__(self):
return F" {self.actor} \"{self.line}\"" | class Commandbuilder:
def __init__(self, cindex):
self.cindex = cindex
class Codebuilder(CommandBuilder):
def __init__(self, cindex, cmd):
super().__init__(cindex)
self.cmd = cmd
def __str__(self):
return self.cmd
class Slugbuilder(CommandBuilder):
def __init__(self, cindex, time, location, transition):
super().__init__(cindex)
self.time = time
self.location = location
self.transition = transition
def __str__(self):
return f' scene bg {self.location}' + (f'\n with {self.transition}' if self.transition else '')
class Actorbuilder(CommandBuilder):
def __init__(self, cindex, alias, actor):
super().__init__(cindex)
self.alias = alias
self.actor = actor
def __str__(self):
return f'define {self.alias} = Character("{self.actor.upper()}", color="#fff")'
class Linebuilder(CommandBuilder):
def __init__(self, cindex, actor, blocking, line):
super().__init__(cindex)
self.actor = actor
self.blocking = blocking
self.line = line
def __str__(self):
return f' {self.actor} "{self.line}"' |
def data_provider(fn_data_provider):
"""Data provider decorator, allows another callable to provide the data for the test"""
def test_decorator(fn):
def repl(self, *args):
for i in fn_data_provider():
try:
fn(self, *i)
except AssertionError:
print("Assertion error caught with data set {}".format(i))
raise
return repl
return test_decorator | def data_provider(fn_data_provider):
"""Data provider decorator, allows another callable to provide the data for the test"""
def test_decorator(fn):
def repl(self, *args):
for i in fn_data_provider():
try:
fn(self, *i)
except AssertionError:
print('Assertion error caught with data set {}'.format(i))
raise
return repl
return test_decorator |
model_filename = "cifar10.model"
data_filename = "cifar10.npz"
model_url = "#"
data_url = "https://github.com/danielwilczak101/EasyNN/raw/datasets/cifar/cifar10.npz"
labels = {
0: "airplane",
1: "automobile",
2: "bird",
3: "cat",
4: "deer",
5: "dog",
6: "frog",
7: "horse",
8: "ship",
9: "truck"
} | model_filename = 'cifar10.model'
data_filename = 'cifar10.npz'
model_url = '#'
data_url = 'https://github.com/danielwilczak101/EasyNN/raw/datasets/cifar/cifar10.npz'
labels = {0: 'airplane', 1: 'automobile', 2: 'bird', 3: 'cat', 4: 'deer', 5: 'dog', 6: 'frog', 7: 'horse', 8: 'ship', 9: 'truck'} |
#Normalmenet se declara asi
#numero = 9
#La variable que se relaciona con la instancia de una clase
class Persona:
edad=18#Clase Persona con variable de clase que es edad
def __init__(self,nombre,nacionalidad):
self.nombre=nombre#variables de instancia
self.nacionalidad=nacionalidad
persona1= Persona("Jose","Mexicano")
#Acceder a una variable de clase
print(Persona.edad)# esta imprime (Variable de clase)
#Creando objeto para imprimir print(Persona.nombre) para el objeto persona2
persona2=Persona("Franklin","Colombo-Argentino")
print(persona2.nombre)# esta no imprime porque hay que crear el objeto (Variable de instancia)
| class Persona:
edad = 18
def __init__(self, nombre, nacionalidad):
self.nombre = nombre
self.nacionalidad = nacionalidad
persona1 = persona('Jose', 'Mexicano')
print(Persona.edad)
persona2 = persona('Franklin', 'Colombo-Argentino')
print(persona2.nombre) |
#
# PySNMP MIB module SIAE-IFEXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file://./sm_ifext.mib
# Produced by pysmi-0.3.2 at Fri Jul 19 08:18:02 2019
# On host 0e190c6811ee platform Linux version 4.9.125-linuxkit by user root
# Using Python version 3.7.3 (default, Apr 3 2019, 05:39:12)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint")
InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex")
AlarmSeverityCode, AlarmStatus = mibBuilder.importSymbols("SIAE-ALARM-MIB", "AlarmSeverityCode", "AlarmStatus")
siaeMib, = mibBuilder.importSymbols("SIAE-TREE-MIB", "siaeMib")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ObjectIdentity, Counter64, Bits, Gauge32, MibIdentifier, iso, NotificationType, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Unsigned32, IpAddress, Integer32, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "Counter64", "Bits", "Gauge32", "MibIdentifier", "iso", "NotificationType", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Unsigned32", "IpAddress", "Integer32", "ModuleIdentity")
DisplayString, RowStatus, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "TextualConvention")
ifext = ModuleIdentity((1, 3, 6, 1, 4, 1, 3373, 1103, 73))
ifext.setRevisions(('2015-07-21 00:00', '2014-12-02 00:00', '2014-09-26 00:00', '2014-06-05 00:00', '2014-02-21 00:00', '2013-10-28 00:00',))
if mibBuilder.loadTexts: ifext.setLastUpdated('201507210000Z')
if mibBuilder.loadTexts: ifext.setOrganization('SIAE MICROELETTRONICA spa')
ifextMibVersion = MibScalar((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 1), Integer32().clone(1)).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifextMibVersion.setStatus('current')
ifextTable = MibTable((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2), )
if mibBuilder.loadTexts: ifextTable.setStatus('current')
ifextTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1), ).setIndexNames((0, "SIAE-IFEXT-MIB", "ifextIfIndex"))
if mibBuilder.loadTexts: ifextTableEntry.setStatus('current')
ifextIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: ifextIfIndex.setStatus('current')
ifextLabel = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifextLabel.setStatus('current')
ifextAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3), ("loopback", 4))).clone('down')).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifextAdminStatus.setStatus('current')
ifextPortUsage = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("unused", 0), ("lan", 1), ("radio", 2), ("mgmt", 3), ("stack", 4), ("aux", 5), ("pwe3", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifextPortUsage.setStatus('current')
ifextMediumType = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("copper", 1), ("fiber", 2), ("combo", 3), ("other", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifextMediumType.setStatus('current')
ifextMediumSelection = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("none", 0), ("copper", 1), ("fiber", 2))).clone('none')).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifextMediumSelection.setStatus('current')
ifextAlarmReportEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2))).clone('enable')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: ifextAlarmReportEnable.setStatus('current')
ifextSfpId = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifextSfpId.setStatus('current')
ifextCapabilities = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 9), Bits().clone(namedValues=NamedValues(("ifextCapabilityLoop", 0), ("ifextCapability2g5Bps", 1), ("ifextCapabilityMabSensor", 2), ("ifextCapabilityEncrypt", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifextCapabilities.setStatus('current')
ifextLosAlarm = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 10), AlarmStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifextLosAlarm.setStatus('current')
ifextRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 11), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: ifextRowStatus.setStatus('current')
ifextMaintTable = MibTable((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 3), )
if mibBuilder.loadTexts: ifextMaintTable.setStatus('current')
ifextMaintTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 3, 1), ).setIndexNames((0, "SIAE-IFEXT-MIB", "ifextIfIndex"))
if mibBuilder.loadTexts: ifextMaintTableEntry.setStatus('current')
ifextLineLoop = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ifextLineLoop.setStatus('current')
ifextLosAlarmSeverityCode = MibScalar((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 5), AlarmSeverityCode().clone('majorTrapEnable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ifextLosAlarmSeverityCode.setStatus('current')
mibBuilder.exportSymbols("SIAE-IFEXT-MIB", ifextLabel=ifextLabel, ifextAlarmReportEnable=ifextAlarmReportEnable, ifextMaintTable=ifextMaintTable, ifextMediumType=ifextMediumType, ifextMaintTableEntry=ifextMaintTableEntry, ifextPortUsage=ifextPortUsage, ifextRowStatus=ifextRowStatus, ifextLineLoop=ifextLineLoop, ifextLosAlarm=ifextLosAlarm, ifextCapabilities=ifextCapabilities, ifextIfIndex=ifextIfIndex, ifextTableEntry=ifextTableEntry, ifextMibVersion=ifextMibVersion, PYSNMP_MODULE_ID=ifext, ifextSfpId=ifextSfpId, ifextTable=ifextTable, ifextLosAlarmSeverityCode=ifextLosAlarmSeverityCode, ifext=ifext, ifextMediumSelection=ifextMediumSelection, ifextAdminStatus=ifextAdminStatus)
| (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueRangeConstraint')
(interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex')
(alarm_severity_code, alarm_status) = mibBuilder.importSymbols('SIAE-ALARM-MIB', 'AlarmSeverityCode', 'AlarmStatus')
(siae_mib,) = mibBuilder.importSymbols('SIAE-TREE-MIB', 'siaeMib')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(object_identity, counter64, bits, gauge32, mib_identifier, iso, notification_type, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, unsigned32, ip_address, integer32, module_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'ObjectIdentity', 'Counter64', 'Bits', 'Gauge32', 'MibIdentifier', 'iso', 'NotificationType', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'Unsigned32', 'IpAddress', 'Integer32', 'ModuleIdentity')
(display_string, row_status, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'RowStatus', 'TextualConvention')
ifext = module_identity((1, 3, 6, 1, 4, 1, 3373, 1103, 73))
ifext.setRevisions(('2015-07-21 00:00', '2014-12-02 00:00', '2014-09-26 00:00', '2014-06-05 00:00', '2014-02-21 00:00', '2013-10-28 00:00'))
if mibBuilder.loadTexts:
ifext.setLastUpdated('201507210000Z')
if mibBuilder.loadTexts:
ifext.setOrganization('SIAE MICROELETTRONICA spa')
ifext_mib_version = mib_scalar((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 1), integer32().clone(1)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifextMibVersion.setStatus('current')
ifext_table = mib_table((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2))
if mibBuilder.loadTexts:
ifextTable.setStatus('current')
ifext_table_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1)).setIndexNames((0, 'SIAE-IFEXT-MIB', 'ifextIfIndex'))
if mibBuilder.loadTexts:
ifextTableEntry.setStatus('current')
ifext_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 1), interface_index())
if mibBuilder.loadTexts:
ifextIfIndex.setStatus('current')
ifext_label = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifextLabel.setStatus('current')
ifext_admin_status = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('up', 1), ('down', 2), ('testing', 3), ('loopback', 4))).clone('down')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifextAdminStatus.setStatus('current')
ifext_port_usage = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('unused', 0), ('lan', 1), ('radio', 2), ('mgmt', 3), ('stack', 4), ('aux', 5), ('pwe3', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifextPortUsage.setStatus('current')
ifext_medium_type = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('copper', 1), ('fiber', 2), ('combo', 3), ('other', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifextMediumType.setStatus('current')
ifext_medium_selection = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('none', 0), ('copper', 1), ('fiber', 2))).clone('none')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifextMediumSelection.setStatus('current')
ifext_alarm_report_enable = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disable', 1), ('enable', 2))).clone('enable')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
ifextAlarmReportEnable.setStatus('current')
ifext_sfp_id = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifextSfpId.setStatus('current')
ifext_capabilities = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 9), bits().clone(namedValues=named_values(('ifextCapabilityLoop', 0), ('ifextCapability2g5Bps', 1), ('ifextCapabilityMabSensor', 2), ('ifextCapabilityEncrypt', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifextCapabilities.setStatus('current')
ifext_los_alarm = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 10), alarm_status()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifextLosAlarm.setStatus('current')
ifext_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 11), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
ifextRowStatus.setStatus('current')
ifext_maint_table = mib_table((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 3))
if mibBuilder.loadTexts:
ifextMaintTable.setStatus('current')
ifext_maint_table_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 3, 1)).setIndexNames((0, 'SIAE-IFEXT-MIB', 'ifextIfIndex'))
if mibBuilder.loadTexts:
ifextMaintTableEntry.setStatus('current')
ifext_line_loop = mib_table_column((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 3, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disable', 1), ('enable', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ifextLineLoop.setStatus('current')
ifext_los_alarm_severity_code = mib_scalar((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 5), alarm_severity_code().clone('majorTrapEnable')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ifextLosAlarmSeverityCode.setStatus('current')
mibBuilder.exportSymbols('SIAE-IFEXT-MIB', ifextLabel=ifextLabel, ifextAlarmReportEnable=ifextAlarmReportEnable, ifextMaintTable=ifextMaintTable, ifextMediumType=ifextMediumType, ifextMaintTableEntry=ifextMaintTableEntry, ifextPortUsage=ifextPortUsage, ifextRowStatus=ifextRowStatus, ifextLineLoop=ifextLineLoop, ifextLosAlarm=ifextLosAlarm, ifextCapabilities=ifextCapabilities, ifextIfIndex=ifextIfIndex, ifextTableEntry=ifextTableEntry, ifextMibVersion=ifextMibVersion, PYSNMP_MODULE_ID=ifext, ifextSfpId=ifextSfpId, ifextTable=ifextTable, ifextLosAlarmSeverityCode=ifextLosAlarmSeverityCode, ifext=ifext, ifextMediumSelection=ifextMediumSelection, ifextAdminStatus=ifextAdminStatus) |
"""Custom dataloaders for testing"""
class CustomInfDataloader:
def __init__(self, dataloader):
self.dataloader = dataloader
self.iter = iter(dataloader)
self.count = 0
def __iter__(self):
self.count = 0
return self
def __next__(self):
if self.count >= 50:
raise StopIteration
self.count = self.count + 1
try:
return next(self.iter)
except StopIteration:
self.iter = iter(self.dataloader)
return next(self.iter)
class CustomNotImplementedErrorDataloader:
def __init__(self, dataloader):
self.dataloader = dataloader
self.iter = iter(dataloader)
self.count = 0
def __len__(self):
"""raise NotImplementedError"""
raise NotImplementedError
def __iter__(self):
self.count = 0
return self
def __next__(self):
if self.count >= 50:
raise StopIteration
self.count = self.count + 1
try:
return next(self.iter)
except StopIteration:
self.iter = iter(self.dataloader)
return next(self.iter)
| """Custom dataloaders for testing"""
class Custominfdataloader:
def __init__(self, dataloader):
self.dataloader = dataloader
self.iter = iter(dataloader)
self.count = 0
def __iter__(self):
self.count = 0
return self
def __next__(self):
if self.count >= 50:
raise StopIteration
self.count = self.count + 1
try:
return next(self.iter)
except StopIteration:
self.iter = iter(self.dataloader)
return next(self.iter)
class Customnotimplementederrordataloader:
def __init__(self, dataloader):
self.dataloader = dataloader
self.iter = iter(dataloader)
self.count = 0
def __len__(self):
"""raise NotImplementedError"""
raise NotImplementedError
def __iter__(self):
self.count = 0
return self
def __next__(self):
if self.count >= 50:
raise StopIteration
self.count = self.count + 1
try:
return next(self.iter)
except StopIteration:
self.iter = iter(self.dataloader)
return next(self.iter) |
a = float(input("a = "))
b = float(input("b = "))
c = float(input("c = "))
if a==b==c:
print('nothing')
elif a==c:
print(2)
elif b==a:
print(3)
elif b==c:
print(1)
else:
print('nothing')
| a = float(input('a = '))
b = float(input('b = '))
c = float(input('c = '))
if a == b == c:
print('nothing')
elif a == c:
print(2)
elif b == a:
print(3)
elif b == c:
print(1)
else:
print('nothing') |
"""
Example Backup Plugin
"""
__import__("pkg_resources").declare_namespace(__name__)
| """
Example Backup Plugin
"""
__import__('pkg_resources').declare_namespace(__name__) |
"""
Management of OpenStack Neutron Security Group Rules
====================================================
.. versionadded:: 2018.3.0
:depends: shade
:configuration: see :py:mod:`salt.modules.neutronng` for setup instructions
Example States
.. code-block:: yaml
create security group rule:
neutron_secgroup_rule.present:
- name: security_group1
- project_name: Project1
- protocol: icmp
delete security group:
neutron_secgroup_rule.absent:
- name_or_id: security_group1
create security group with optional params:
neutron_secgroup_rule.present:
- name: security_group1
- description: "Very Secure Security Group"
- project_id: 1dcac318a83b4610b7a7f7ba01465548
"""
__virtualname__ = "neutron_secgroup_rule"
def __virtual__():
if "neutronng.list_subnets" in __salt__:
return __virtualname__
return (
False,
"The neutronng execution module failed to load: shade python module is not available",
)
def _rule_compare(rule1, rule2):
"""
Compare the common keys between security group rules against eachother
"""
commonkeys = set(rule1.keys()).intersection(rule2.keys())
for key in commonkeys:
if rule1[key] != rule2[key]:
return False
return True
def present(name, auth=None, **kwargs):
"""
Ensure a security group rule exists
defaults: port_range_min=None, port_range_max=None, protocol=None,
remote_ip_prefix=None, remote_group_id=None, direction='ingress',
ethertype='IPv4', project_id=None
name
Name of the security group to associate with this rule
project_name
Name of the project associated with the security group
protocol
The protocol that is matched by the security group rule.
Valid values are None, tcp, udp, and icmp.
"""
ret = {"name": name, "changes": {}, "result": True, "comment": ""}
kwargs = __utils__["args.clean_kwargs"](**kwargs)
__salt__["neutronng.setup_clouds"](auth)
if "project_name" in kwargs:
kwargs["project_id"] = kwargs["project_name"]
del kwargs["project_name"]
project = __salt__["keystoneng.project_get"](name=kwargs["project_id"])
if project is None:
ret["result"] = False
ret["comment"] = "Project does not exist"
return ret
secgroup = __salt__["neutronng.security_group_get"](
name=name, filters={"tenant_id": project.id}
)
if secgroup is None:
ret["result"] = False
ret["changes"] = ({},)
ret["comment"] = "Security Group does not exist {}".format(name)
return ret
# we have to search through all secgroup rules for a possible match
rule_exists = None
for rule in secgroup["security_group_rules"]:
if _rule_compare(rule, kwargs) is True:
rule_exists = True
if rule_exists is None:
if __opts__["test"] is True:
ret["result"] = None
ret["changes"] = kwargs
ret["comment"] = "Security Group rule will be created."
return ret
# The variable differences are a little clumsy right now
kwargs["secgroup_name_or_id"] = secgroup
new_rule = __salt__["neutronng.security_group_rule_create"](**kwargs)
ret["changes"] = new_rule
ret["comment"] = "Created security group rule"
return ret
return ret
def absent(name, auth=None, **kwargs):
"""
Ensure a security group rule does not exist
name
name or id of the security group rule to delete
rule_id
uuid of the rule to delete
project_id
id of project to delete rule from
"""
rule_id = kwargs["rule_id"]
ret = {"name": rule_id, "changes": {}, "result": True, "comment": ""}
__salt__["neutronng.setup_clouds"](auth)
secgroup = __salt__["neutronng.security_group_get"](
name=name, filters={"tenant_id": kwargs["project_id"]}
)
# no need to delete a rule if the security group doesn't exist
if secgroup is None:
ret["comment"] = "security group does not exist"
return ret
# This should probably be done with compare on fields instead of
# rule_id in the future
rule_exists = None
for rule in secgroup["security_group_rules"]:
if _rule_compare(rule, {"id": rule_id}) is True:
rule_exists = True
if rule_exists:
if __opts__["test"]:
ret["result"] = None
ret["changes"] = {"id": kwargs["rule_id"]}
ret["comment"] = "Security group rule will be deleted."
return ret
__salt__["neutronng.security_group_rule_delete"](rule_id=rule_id)
ret["changes"]["id"] = rule_id
ret["comment"] = "Deleted security group rule"
return ret
| """
Management of OpenStack Neutron Security Group Rules
====================================================
.. versionadded:: 2018.3.0
:depends: shade
:configuration: see :py:mod:`salt.modules.neutronng` for setup instructions
Example States
.. code-block:: yaml
create security group rule:
neutron_secgroup_rule.present:
- name: security_group1
- project_name: Project1
- protocol: icmp
delete security group:
neutron_secgroup_rule.absent:
- name_or_id: security_group1
create security group with optional params:
neutron_secgroup_rule.present:
- name: security_group1
- description: "Very Secure Security Group"
- project_id: 1dcac318a83b4610b7a7f7ba01465548
"""
__virtualname__ = 'neutron_secgroup_rule'
def __virtual__():
if 'neutronng.list_subnets' in __salt__:
return __virtualname__
return (False, 'The neutronng execution module failed to load: shade python module is not available')
def _rule_compare(rule1, rule2):
"""
Compare the common keys between security group rules against eachother
"""
commonkeys = set(rule1.keys()).intersection(rule2.keys())
for key in commonkeys:
if rule1[key] != rule2[key]:
return False
return True
def present(name, auth=None, **kwargs):
"""
Ensure a security group rule exists
defaults: port_range_min=None, port_range_max=None, protocol=None,
remote_ip_prefix=None, remote_group_id=None, direction='ingress',
ethertype='IPv4', project_id=None
name
Name of the security group to associate with this rule
project_name
Name of the project associated with the security group
protocol
The protocol that is matched by the security group rule.
Valid values are None, tcp, udp, and icmp.
"""
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
kwargs = __utils__['args.clean_kwargs'](**kwargs)
__salt__['neutronng.setup_clouds'](auth)
if 'project_name' in kwargs:
kwargs['project_id'] = kwargs['project_name']
del kwargs['project_name']
project = __salt__['keystoneng.project_get'](name=kwargs['project_id'])
if project is None:
ret['result'] = False
ret['comment'] = 'Project does not exist'
return ret
secgroup = __salt__['neutronng.security_group_get'](name=name, filters={'tenant_id': project.id})
if secgroup is None:
ret['result'] = False
ret['changes'] = ({},)
ret['comment'] = 'Security Group does not exist {}'.format(name)
return ret
rule_exists = None
for rule in secgroup['security_group_rules']:
if _rule_compare(rule, kwargs) is True:
rule_exists = True
if rule_exists is None:
if __opts__['test'] is True:
ret['result'] = None
ret['changes'] = kwargs
ret['comment'] = 'Security Group rule will be created.'
return ret
kwargs['secgroup_name_or_id'] = secgroup
new_rule = __salt__['neutronng.security_group_rule_create'](**kwargs)
ret['changes'] = new_rule
ret['comment'] = 'Created security group rule'
return ret
return ret
def absent(name, auth=None, **kwargs):
"""
Ensure a security group rule does not exist
name
name or id of the security group rule to delete
rule_id
uuid of the rule to delete
project_id
id of project to delete rule from
"""
rule_id = kwargs['rule_id']
ret = {'name': rule_id, 'changes': {}, 'result': True, 'comment': ''}
__salt__['neutronng.setup_clouds'](auth)
secgroup = __salt__['neutronng.security_group_get'](name=name, filters={'tenant_id': kwargs['project_id']})
if secgroup is None:
ret['comment'] = 'security group does not exist'
return ret
rule_exists = None
for rule in secgroup['security_group_rules']:
if _rule_compare(rule, {'id': rule_id}) is True:
rule_exists = True
if rule_exists:
if __opts__['test']:
ret['result'] = None
ret['changes'] = {'id': kwargs['rule_id']}
ret['comment'] = 'Security group rule will be deleted.'
return ret
__salt__['neutronng.security_group_rule_delete'](rule_id=rule_id)
ret['changes']['id'] = rule_id
ret['comment'] = 'Deleted security group rule'
return ret |
#!/usr/bin/env python3
""" This is the exceptions file foi the CalculationsWithDots project """
class InvalidName(Exception):
""" Description of InvalidName
This Exception class is raised, if the given name is invalid.
"""
pass
class InvalidCoordinate(Exception):
""" Description of InvalidCoordinate
This Exception class is raised, if the given coordinate is invalid.
"""
pass | """ This is the exceptions file foi the CalculationsWithDots project """
class Invalidname(Exception):
""" Description of InvalidName
This Exception class is raised, if the given name is invalid.
"""
pass
class Invalidcoordinate(Exception):
""" Description of InvalidCoordinate
This Exception class is raised, if the given coordinate is invalid.
"""
pass |
# -*- coding: utf-8 -*-
"""@package Methods.Geometry.Segment.get_end
Return the end point of an Segment method
@date Created on Thu Jul 27 13:51:43 2018
@copyright (C) 2015-2016 EOMYS ENGINEERING.
@author pierre_b
@todo unittest it
"""
def get_end(self):
"""Return the end point of the segment
Parameters
----------
self : Segment
A Segment object
Returns
-------
end: complex
End point of the Segment
"""
return self.end
| """@package Methods.Geometry.Segment.get_end
Return the end point of an Segment method
@date Created on Thu Jul 27 13:51:43 2018
@copyright (C) 2015-2016 EOMYS ENGINEERING.
@author pierre_b
@todo unittest it
"""
def get_end(self):
"""Return the end point of the segment
Parameters
----------
self : Segment
A Segment object
Returns
-------
end: complex
End point of the Segment
"""
return self.end |
# 456. 132 Pattern
"""
Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k]
such that i < j < k and nums[i] < nums[k] < nums[j].
Return true if there is a 132 pattern in nums, otherwise, return false.
Follow up: The O(n^2) is trivial, could you come up with the O(n logn) or the O(n) solution?
Input: nums = [3,1,4,2]
Output: true
Explanation: There is a 132 pattern in the sequence: [1, 4, 2].
"""
class Solution:
def find132pattern(self, nums: List[int]) -> bool:
# Initialzed the stack
stack = []
# Handling the edge case, if there are less than 3 elements
if len(set(nums)) < 3:
return False
# Precomputing the minimum value array with first index same as first index of nums array
# to get arr[i] in O(1)
minVal = [nums[0]]
for i in range(1, len(nums)):
minVal.append(min(nums[i], minVal[-1]))
# Loop over for "j" index from right to left as "i"th index is fixed and can be taken from minVal
for i in range(len(nums) - 1, -1, -1):
# If the ith element is greater than the minimim ith element then only move forward
if nums[i] > minVal[i]:
# Remove the value from the top of the stack if "arr[k]" is smaller than the minimum
while stack and stack[-1] <= minVal[i]:
stack.pop()
# If arr[i] < arr[k] < arr[j], return True
if stack and minVal[i] < stack[-1] < nums[i]:
return True
stack.append(nums[i])
return False
| """
Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k]
such that i < j < k and nums[i] < nums[k] < nums[j].
Return true if there is a 132 pattern in nums, otherwise, return false.
Follow up: The O(n^2) is trivial, could you come up with the O(n logn) or the O(n) solution?
Input: nums = [3,1,4,2]
Output: true
Explanation: There is a 132 pattern in the sequence: [1, 4, 2].
"""
class Solution:
def find132pattern(self, nums: List[int]) -> bool:
stack = []
if len(set(nums)) < 3:
return False
min_val = [nums[0]]
for i in range(1, len(nums)):
minVal.append(min(nums[i], minVal[-1]))
for i in range(len(nums) - 1, -1, -1):
if nums[i] > minVal[i]:
while stack and stack[-1] <= minVal[i]:
stack.pop()
if stack and minVal[i] < stack[-1] < nums[i]:
return True
stack.append(nums[i])
return False |
#!/usr/bin/python
"""
This is a collections of functions common to the other, individual pieces of this project
"""
__author__ = "AJ Wilson"
__copyright__ = " "
__license__ = " "
__version__ = "0.0.0.0"
__maintainer__ = "AJ Wilson"
__email__ = "aj.wilson08[at]gmail.com"
__status__ = "WIP"
def function1():
return None
| """
This is a collections of functions common to the other, individual pieces of this project
"""
__author__ = 'AJ Wilson'
__copyright__ = ' '
__license__ = ' '
__version__ = '0.0.0.0'
__maintainer__ = 'AJ Wilson'
__email__ = 'aj.wilson08[at]gmail.com'
__status__ = 'WIP'
def function1():
return None |
def fib(n):
'''
uses generater to return fibonacci sequence
up to given # n dynamically
'''
a,b = 1,1
for _ in range(0,n):
yield a
a,b = b,a+b
return a
| def fib(n):
"""
uses generater to return fibonacci sequence
up to given # n dynamically
"""
(a, b) = (1, 1)
for _ in range(0, n):
yield a
(a, b) = (b, a + b)
return a |
config = {
"qqGroup": "",
"pro_ids": ['11111', '22222'],
"daily": {
"pro_ids": ['11111']
},
# "pk": {
# "me": "22222",
# "vs": ['33333']
# }
"dailyInterval": 25,
"pkInterval": 30
}
| config = {'qqGroup': '', 'pro_ids': ['11111', '22222'], 'daily': {'pro_ids': ['11111']}, 'dailyInterval': 25, 'pkInterval': 30} |
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def swapPairs(self, head):
if not head:
return None
if not head.next:
return head
curr = head
after = head.next
pre = None
head = after
while after:
curr.next = after.next
after.next = curr
if pre:
pre.next = after
tmp = curr
curr = after
after = tmp
if not after.next:
break
pre = curr.next
curr = curr.next.next
after = after.next.next
print(pre.val)
return head
solution = Solution()
a = ListNode(0)
b = ListNode(1)
c = ListNode(2)
d = ListNode(3)
a.next = b
b.next = c
x = solution.swapPairs(a)
while x:
print(x.val)
x = x.next | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def swap_pairs(self, head):
if not head:
return None
if not head.next:
return head
curr = head
after = head.next
pre = None
head = after
while after:
curr.next = after.next
after.next = curr
if pre:
pre.next = after
tmp = curr
curr = after
after = tmp
if not after.next:
break
pre = curr.next
curr = curr.next.next
after = after.next.next
print(pre.val)
return head
solution = solution()
a = list_node(0)
b = list_node(1)
c = list_node(2)
d = list_node(3)
a.next = b
b.next = c
x = solution.swapPairs(a)
while x:
print(x.val)
x = x.next |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# CODE NAME HERE
# CODE DESCRIPTION HERE
Created on 2019-01-17 at 14:31
@author: cook
"""
__all__ = []
# =============================================================================
# Define functions
# =============================================================================
# =============================================================================
# End of code
# =============================================================================
| """
# CODE NAME HERE
# CODE DESCRIPTION HERE
Created on 2019-01-17 at 14:31
@author: cook
"""
__all__ = [] |
{
'targets': [
{
'target_name': 'brotli',
'type': 'static_library',
'include_dirs': ['c/include'],
'conditions': [
['OS=="linux"', {
'defines': [
'OS_LINUX'
]
}],
['OS=="freebsd"', {
'defines': [
'OS_FREEBSD'
]
}],
['OS=="mac"', {
'defines': [
'OS_MACOSX'
]
}],
],
'direct_dependent_settings': {
'include_dirs': [ 'c/include' ]
},
'libraries': [
'-lm',
],
'sources': [
# Common
'c/common/dictionary.c',
'c/common/transform.c',
# Decoder
'c/dec/bit_reader.c',
'c/dec/decode.c',
'c/dec/huffman.c',
'c/dec/state.c',
# Encoder
'c/enc/backward_references.c',
'c/enc/backward_references_hq.c',
'c/enc/bit_cost.c',
'c/enc/block_splitter.c',
'c/enc/brotli_bit_stream.c',
'c/enc/cluster.c',
'c/enc/compress_fragment.c',
'c/enc/compress_fragment_two_pass.c',
'c/enc/dictionary_hash.c',
'c/enc/encode.c',
'c/enc/encoder_dict.c',
'c/enc/entropy_encode.c',
'c/enc/histogram.c',
'c/enc/literal_cost.c',
'c/enc/memory.c',
'c/enc/metablock.c',
'c/enc/static_dict.c',
'c/enc/utf8_util.c'
]
}
]
}
| {'targets': [{'target_name': 'brotli', 'type': 'static_library', 'include_dirs': ['c/include'], 'conditions': [['OS=="linux"', {'defines': ['OS_LINUX']}], ['OS=="freebsd"', {'defines': ['OS_FREEBSD']}], ['OS=="mac"', {'defines': ['OS_MACOSX']}]], 'direct_dependent_settings': {'include_dirs': ['c/include']}, 'libraries': ['-lm'], 'sources': ['c/common/dictionary.c', 'c/common/transform.c', 'c/dec/bit_reader.c', 'c/dec/decode.c', 'c/dec/huffman.c', 'c/dec/state.c', 'c/enc/backward_references.c', 'c/enc/backward_references_hq.c', 'c/enc/bit_cost.c', 'c/enc/block_splitter.c', 'c/enc/brotli_bit_stream.c', 'c/enc/cluster.c', 'c/enc/compress_fragment.c', 'c/enc/compress_fragment_two_pass.c', 'c/enc/dictionary_hash.c', 'c/enc/encode.c', 'c/enc/encoder_dict.c', 'c/enc/entropy_encode.c', 'c/enc/histogram.c', 'c/enc/literal_cost.c', 'c/enc/memory.c', 'c/enc/metablock.c', 'c/enc/static_dict.c', 'c/enc/utf8_util.c']}]} |
{
'variables': {
'base_cflags': [
'-Wall',
'-Wextra',
'-Wno-unused-parameter',
'-std=c++11',
],
'debug_cflags': ['-g', '-O0'],
'release_cflags': ['-O3'],
},
'targets': [
{
'target_name': 'tonclient',
'sources': ['binding.cc'],
'conditions': [
['OS == "win"', {
'libraries': [
'../tonclient.lib',
'advapi32.lib',
'ws2_32.lib',
'userenv.lib',
'shell32.lib',
'Secur32.lib',
'Crypt32.lib',
],
}, {
'libraries': [
'../libtonclient.a',
'-Wl,-rpath,./addon/'
],
}],
],
'configurations': {
'Debug': {
'cflags': ['<@(debug_cflags)'],
'xcode_settings': {
'OTHER_CFLAGS': ['<@(debug_cflags)'],
},
},
'Release': {
'cflags': ['<@(release_cflags)'],
'xcode_settings': {
'OTHER_CFLAGS': ['<@(release_cflags)'],
},
},
},
'cflags': ['<@(base_cflags)'],
'xcode_settings': {
'OTHER_CFLAGS': ['<@(base_cflags)'],
},
},
],
}
| {'variables': {'base_cflags': ['-Wall', '-Wextra', '-Wno-unused-parameter', '-std=c++11'], 'debug_cflags': ['-g', '-O0'], 'release_cflags': ['-O3']}, 'targets': [{'target_name': 'tonclient', 'sources': ['binding.cc'], 'conditions': [['OS == "win"', {'libraries': ['../tonclient.lib', 'advapi32.lib', 'ws2_32.lib', 'userenv.lib', 'shell32.lib', 'Secur32.lib', 'Crypt32.lib']}, {'libraries': ['../libtonclient.a', '-Wl,-rpath,./addon/']}]], 'configurations': {'Debug': {'cflags': ['<@(debug_cflags)'], 'xcode_settings': {'OTHER_CFLAGS': ['<@(debug_cflags)']}}, 'Release': {'cflags': ['<@(release_cflags)'], 'xcode_settings': {'OTHER_CFLAGS': ['<@(release_cflags)']}}}, 'cflags': ['<@(base_cflags)'], 'xcode_settings': {'OTHER_CFLAGS': ['<@(base_cflags)']}}]} |
int1 = input("Enter first integer: ")
int2 = input("Enter second integer: ")
sum = int(int1) + int(int2)
if sum in range(105, 201):
print(200)
| int1 = input('Enter first integer: ')
int2 = input('Enter second integer: ')
sum = int(int1) + int(int2)
if sum in range(105, 201):
print(200) |
class Documents:
def __init__(self, session):
self.session = session
def index_documents(self, content_source_key, documents, **kwargs):
"""Index a batch of documents in a content source.
Raises :class:`~elastic_workplace_search.NonExistentRecord` if the
content_source_key is malformed or invalid. Raises
:class:`~elastic_workplace_search.WorkplaceSearchError` if there are any
HTTP errors.
:param content_source_key: Key for the content source.
:param documents: Array of documents to be indexed.
:return: Array of document indexing results.
>>> from elastic_workplace_search import Client
>>> from elastic_workplace_search.exceptions import WorkplaceSearchError
>>> content_source_key = 'content source key'
>>> authorization_token = 'authorization token'
>>> client = Client(authorization_token)
>>> documents = [
{
'id': '1',
'url': 'https://github.com/elastic/workplace-search-python',
'title': 'Elastic Workplace Search Official Python client',
'body': 'A descriptive body'
}
]
>>> try:
>>> document_results = client.documents.index_documents(content_source_key, documents)
>>> print(document_results)
>>> except WorkplaceSearchError:
>>> # handle exception
>>> pass
[{'errors': [], 'id': '1', 'id': None}]
"""
return self._async_create_or_update_documents(content_source_key,
documents)
def delete_documents(self, content_source_key, ids):
"""Destroys documents in a content source by their ids.
Raises :class:`~elastic_workplace_search.NonExistentRecord` if the
content_source_key is malformed or invalid. Raises
:class:`~elastic_workplace_search.WorkplaceSearchError` if there are any
HTTP errors.
:param content_source_key: Key for the content source.
:param ids: Array of document ids to be destroyed.
:return: Array of result dicts, with keys of `id` and `status`
>>> from elastic_workplace_search import Client
>>> from elastic_workplace_search.exceptions import WorkplaceSearchError
>>> content_source_key = 'content source key'
>>> authorization_token = 'authorization token'
>>> client = Client(authorization_token)
>>> try:
>>> response = client.documents.delete_documents(content_source_key, ['1'])
>>> print(response)
>>> except WorkplaceSearchError:
>>> # handle exception
>>> pass
[{"id": '1',"success": True}]
"""
endpoint = "sources/{}/documents/bulk_destroy".format(
content_source_key)
return self.session.request('post', endpoint, json=ids)
def _async_create_or_update_documents(self, content_source_key, documents):
endpoint = "sources/{}/documents/bulk_create".format(content_source_key)
return self.session.request('post', endpoint, json=documents)
| class Documents:
def __init__(self, session):
self.session = session
def index_documents(self, content_source_key, documents, **kwargs):
"""Index a batch of documents in a content source.
Raises :class:`~elastic_workplace_search.NonExistentRecord` if the
content_source_key is malformed or invalid. Raises
:class:`~elastic_workplace_search.WorkplaceSearchError` if there are any
HTTP errors.
:param content_source_key: Key for the content source.
:param documents: Array of documents to be indexed.
:return: Array of document indexing results.
>>> from elastic_workplace_search import Client
>>> from elastic_workplace_search.exceptions import WorkplaceSearchError
>>> content_source_key = 'content source key'
>>> authorization_token = 'authorization token'
>>> client = Client(authorization_token)
>>> documents = [
{
'id': '1',
'url': 'https://github.com/elastic/workplace-search-python',
'title': 'Elastic Workplace Search Official Python client',
'body': 'A descriptive body'
}
]
>>> try:
>>> document_results = client.documents.index_documents(content_source_key, documents)
>>> print(document_results)
>>> except WorkplaceSearchError:
>>> # handle exception
>>> pass
[{'errors': [], 'id': '1', 'id': None}]
"""
return self._async_create_or_update_documents(content_source_key, documents)
def delete_documents(self, content_source_key, ids):
"""Destroys documents in a content source by their ids.
Raises :class:`~elastic_workplace_search.NonExistentRecord` if the
content_source_key is malformed or invalid. Raises
:class:`~elastic_workplace_search.WorkplaceSearchError` if there are any
HTTP errors.
:param content_source_key: Key for the content source.
:param ids: Array of document ids to be destroyed.
:return: Array of result dicts, with keys of `id` and `status`
>>> from elastic_workplace_search import Client
>>> from elastic_workplace_search.exceptions import WorkplaceSearchError
>>> content_source_key = 'content source key'
>>> authorization_token = 'authorization token'
>>> client = Client(authorization_token)
>>> try:
>>> response = client.documents.delete_documents(content_source_key, ['1'])
>>> print(response)
>>> except WorkplaceSearchError:
>>> # handle exception
>>> pass
[{"id": '1',"success": True}]
"""
endpoint = 'sources/{}/documents/bulk_destroy'.format(content_source_key)
return self.session.request('post', endpoint, json=ids)
def _async_create_or_update_documents(self, content_source_key, documents):
endpoint = 'sources/{}/documents/bulk_create'.format(content_source_key)
return self.session.request('post', endpoint, json=documents) |
# Create Plotter
acc_plotter = skdiscovery.data_structure.series.accumulators.Plotter('Plotter')
# Create stage containter for Plotter
sc_plotter = StageContainer(acc_plotter)
| acc_plotter = skdiscovery.data_structure.series.accumulators.Plotter('Plotter')
sc_plotter = stage_container(acc_plotter) |
# https://leetcode.com/problems/binary-watch/
#
# algorithms
# Easy (45.81%)
# Total Accepted: 69,493
# Total Submissions: 151,697
class Solution(object):
def readBinaryWatch(self, num):
"""
:type num: int
:rtype: List[str]
"""
hour = [1, 2, 4, 8]
minute = [1, 2, 4, 8, 16, 32]
res = []
h_arr, m_arr = [], []
def recursive(arr, idx, length, tmp, res_arr):
arr_len = len(arr)
if length == 0:
res_arr.append(tmp)
return
if idx >= arr_len:
return
for i in xrange(idx, arr_len):
recursive(arr, i + 1, length - 1, tmp + arr[i], res_arr)
for i in xrange(0, num + 1):
h_arr, m_arr = [], []
recursive(hour, 0, i, 0, h_arr)
recursive(minute, 0, num - i, 0, m_arr)
for h in h_arr:
if h > 11:
continue
for m in m_arr:
if m > 59:
continue
tmp = str(h) + ':' + ('0' if m < 10 else '') + str(m)
res.append(tmp)
return res
| class Solution(object):
def read_binary_watch(self, num):
"""
:type num: int
:rtype: List[str]
"""
hour = [1, 2, 4, 8]
minute = [1, 2, 4, 8, 16, 32]
res = []
(h_arr, m_arr) = ([], [])
def recursive(arr, idx, length, tmp, res_arr):
arr_len = len(arr)
if length == 0:
res_arr.append(tmp)
return
if idx >= arr_len:
return
for i in xrange(idx, arr_len):
recursive(arr, i + 1, length - 1, tmp + arr[i], res_arr)
for i in xrange(0, num + 1):
(h_arr, m_arr) = ([], [])
recursive(hour, 0, i, 0, h_arr)
recursive(minute, 0, num - i, 0, m_arr)
for h in h_arr:
if h > 11:
continue
for m in m_arr:
if m > 59:
continue
tmp = str(h) + ':' + ('0' if m < 10 else '') + str(m)
res.append(tmp)
return res |
"""
An *example* .bzl file.
You will find here a rule, a macro and the implementation function for the rule.
"""
def custom_macro(name, format, srcs=[]):
'''Custom macro documentation example.
Args:
:param format: The format to write check report in.
:param srcs: Source files to run the checks against.
'''
pass
def __impl_custom_build_rule(ctx):
"""Documentation of the custom_build_rule implementation."""
filesd = None
return [DefaultInfo(files=filesd)]
custom_build_rule = rule(
implementation = __impl_custom_build_rule,
doc = """Explanation of **custom_build_rule**. Taken from `doc` attribute of rule definition.
""",
attrs = {
"targets": attr.label(
mandatory=True,
allow_files=True,
doc="List of dependency rules which are building libraries"),
"package_name": attr.string(
mandatory=True,
doc="Test string"),
"package_script": attr.label(
mandatory=False,
default="//scripts:doc_gen_logger.py",
allow_single_file=True,
doc="Python script for simple file packaging"),
}
) | """
An *example* .bzl file.
You will find here a rule, a macro and the implementation function for the rule.
"""
def custom_macro(name, format, srcs=[]):
"""Custom macro documentation example.
Args:
:param format: The format to write check report in.
:param srcs: Source files to run the checks against.
"""
pass
def __impl_custom_build_rule(ctx):
"""Documentation of the custom_build_rule implementation."""
filesd = None
return [default_info(files=filesd)]
custom_build_rule = rule(implementation=__impl_custom_build_rule, doc='Explanation of **custom_build_rule**. Taken from `doc` attribute of rule definition.\n', attrs={'targets': attr.label(mandatory=True, allow_files=True, doc='List of dependency rules which are building libraries'), 'package_name': attr.string(mandatory=True, doc='Test string'), 'package_script': attr.label(mandatory=False, default='//scripts:doc_gen_logger.py', allow_single_file=True, doc='Python script for simple file packaging')}) |
# ----------------------------------------------------------------------
# ctokens.py
#
# Token specifications for symbols in ANSI C and C++. This file is
# meant to be used as a library in other tokenizers.
# ----------------------------------------------------------------------
# Reserved words
tokens = [
# Literals (identifier, integer constant, float constant, string constant, char const)
'ID', 'TYPEID', 'INTEGER', 'FLOAT', 'STRING', 'CHARACTER',
# Operators (+,-,*,/,%,|,&,~,^,<<,>>, ||, &&, !, <, <=, >, >=, ==, !=)
'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MODULO',
'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT',
'LOR', 'LAND', 'LNOT',
'LT', 'LE', 'GT', 'GE', 'EQ', 'NE',
# Assignment (=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=)
'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL',
'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL',
# Increment/decrement (++,--)
'INCREMENT', 'DECREMENT',
# Structure dereference (->)
'ARROW',
# Ternary operator (?)
'TERNARY',
# Delimeters ( ) [ ] { } , . ; :
'LPAREN', 'RPAREN',
'LBRACKET', 'RBRACKET',
'LBRACE', 'RBRACE',
'COMMA', 'PERIOD', 'SEMI', 'COLON',
# Ellipsis (...)
'ELLIPSIS',
]
# Operators
t_PLUS = r'\+'
t_MINUS = r'-'
t_TIMES = r'\*'
t_DIVIDE = r'/'
t_MODULO = r'%'
t_OR = r'\|'
t_AND = r'&'
t_NOT = r'~'
t_XOR = r'\^'
t_LSHIFT = r'<<'
t_RSHIFT = r'>>'
t_LOR = r'\|\|'
t_LAND = r'&&'
t_LNOT = r'!'
t_LT = r'<'
t_GT = r'>'
t_LE = r'<='
t_GE = r'>='
t_EQ = r'=='
t_NE = r'!='
# Assignment operators
t_EQUALS = r'='
t_TIMESEQUAL = r'\*='
t_DIVEQUAL = r'/='
t_MODEQUAL = r'%='
t_PLUSEQUAL = r'\+='
t_MINUSEQUAL = r'-='
t_LSHIFTEQUAL = r'<<='
t_RSHIFTEQUAL = r'>>='
t_ANDEQUAL = r'&='
t_OREQUAL = r'\|='
t_XOREQUAL = r'\^='
# Increment/decrement
t_INCREMENT = r'\+\+'
t_DECREMENT = r'--'
# ->
t_ARROW = r'->'
# ?
t_TERNARY = r'\?'
# Delimeters
t_LPAREN = r'\('
t_RPAREN = r'\)'
t_LBRACKET = r'\['
t_RBRACKET = r'\]'
t_LBRACE = r'\{'
t_RBRACE = r'\}'
t_COMMA = r','
t_PERIOD = r'\.'
t_SEMI = r';'
t_COLON = r':'
t_ELLIPSIS = r'\.\.\.'
# Identifiers
t_ID = r'[A-Za-z_][A-Za-z0-9_]*'
# Integer literal
t_INTEGER = r'\d+([uU]|[lL]|[uU][lL]|[lL][uU])?'
# Floating literal
t_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?'
# String literal
t_STRING = r'\"([^\\\n]|(\\.))*?\"'
# Character constant 'c' or L'c'
t_CHARACTER = r'(L)?\'([^\\\n]|(\\.))*?\''
# Comment (C-Style)
def t_COMMENT(t):
r'/\*(.|\n)*?\*/'
t.lexer.lineno += t.value.count('\n')
return t
# Comment (C++-Style)
def t_CPPCOMMENT(t):
r'//.*\n'
t.lexer.lineno += 1
return t
| tokens = ['ID', 'TYPEID', 'INTEGER', 'FLOAT', 'STRING', 'CHARACTER', 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MODULO', 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', 'LOR', 'LAND', 'LNOT', 'LT', 'LE', 'GT', 'GE', 'EQ', 'NE', 'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL', 'LSHIFTEQUAL', 'RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL', 'INCREMENT', 'DECREMENT', 'ARROW', 'TERNARY', 'LPAREN', 'RPAREN', 'LBRACKET', 'RBRACKET', 'LBRACE', 'RBRACE', 'COMMA', 'PERIOD', 'SEMI', 'COLON', 'ELLIPSIS']
t_plus = '\\+'
t_minus = '-'
t_times = '\\*'
t_divide = '/'
t_modulo = '%'
t_or = '\\|'
t_and = '&'
t_not = '~'
t_xor = '\\^'
t_lshift = '<<'
t_rshift = '>>'
t_lor = '\\|\\|'
t_land = '&&'
t_lnot = '!'
t_lt = '<'
t_gt = '>'
t_le = '<='
t_ge = '>='
t_eq = '=='
t_ne = '!='
t_equals = '='
t_timesequal = '\\*='
t_divequal = '/='
t_modequal = '%='
t_plusequal = '\\+='
t_minusequal = '-='
t_lshiftequal = '<<='
t_rshiftequal = '>>='
t_andequal = '&='
t_orequal = '\\|='
t_xorequal = '\\^='
t_increment = '\\+\\+'
t_decrement = '--'
t_arrow = '->'
t_ternary = '\\?'
t_lparen = '\\('
t_rparen = '\\)'
t_lbracket = '\\['
t_rbracket = '\\]'
t_lbrace = '\\{'
t_rbrace = '\\}'
t_comma = ','
t_period = '\\.'
t_semi = ';'
t_colon = ':'
t_ellipsis = '\\.\\.\\.'
t_id = '[A-Za-z_][A-Za-z0-9_]*'
t_integer = '\\d+([uU]|[lL]|[uU][lL]|[lL][uU])?'
t_float = '((\\d+)(\\.\\d+)(e(\\+|-)?(\\d+))? | (\\d+)e(\\+|-)?(\\d+))([lL]|[fF])?'
t_string = '\\"([^\\\\\\n]|(\\\\.))*?\\"'
t_character = "(L)?\\'([^\\\\\\n]|(\\\\.))*?\\'"
def t_comment(t):
"""/\\*(.|\\n)*?\\*/"""
t.lexer.lineno += t.value.count('\n')
return t
def t_cppcomment(t):
"""//.*\\n"""
t.lexer.lineno += 1
return t |
twitch_icon = "<:twitch:404633403603025921> "
cmd_fail = "<:tickNo:342738745092734976> "
cmd_success = "<:tickYes:342738345673228290> "
loading = "<a:loading:515632705262583819> "
bullet = "<:bullet:516382013779869726> "
right_arrow_alt = "<:arrow:343407434746036224>"
left_arrow = "<a:a_left_arrow:527634992415899650>"
right_arrow = "<a:a_right_arrow:527634993015685130>"
| twitch_icon = '<:twitch:404633403603025921> '
cmd_fail = '<:tickNo:342738745092734976> '
cmd_success = '<:tickYes:342738345673228290> '
loading = '<a:loading:515632705262583819> '
bullet = '<:bullet:516382013779869726> '
right_arrow_alt = '<:arrow:343407434746036224>'
left_arrow = '<a:a_left_arrow:527634992415899650>'
right_arrow = '<a:a_right_arrow:527634993015685130>' |
list_a = [10, 20, 30]
list_b = ["Jan", "Peter", "Max"]
list_c = [True, False, True]
for val_a, val_b, val_c in zip(list_a, list_b, list_c):
print(val_a, val_b, val_c)
print("\n")
for i in range(len(list_a)):
print(i, list_a[i])
print("\n")
for i, val in enumerate(list_a):
print(i, val)
| list_a = [10, 20, 30]
list_b = ['Jan', 'Peter', 'Max']
list_c = [True, False, True]
for (val_a, val_b, val_c) in zip(list_a, list_b, list_c):
print(val_a, val_b, val_c)
print('\n')
for i in range(len(list_a)):
print(i, list_a[i])
print('\n')
for (i, val) in enumerate(list_a):
print(i, val) |
class ViewDisplaySketchyLines(object,IDisposable):
""" Represents the settings for sketchy lines. """
def Dispose(self):
""" Dispose(self: ViewDisplaySketchyLines) """
pass
def ReleaseUnmanagedResources(self,*args):
""" ReleaseUnmanagedResources(self: ViewDisplaySketchyLines,disposing: bool) """
pass
def __enter__(self,*args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self,*args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
EnableSketchyLines=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""True to enable sketchy lines visibility. False to disable it.
Get: EnableSketchyLines(self: ViewDisplaySketchyLines) -> bool
Set: EnableSketchyLines(self: ViewDisplaySketchyLines)=value
"""
Extension=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""The extension scale value. Controls the magnitude of line's extension.
Values between 0 and 10.
Get: Extension(self: ViewDisplaySketchyLines) -> int
Set: Extension(self: ViewDisplaySketchyLines)=value
"""
IsValidObject=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Specifies whether the .NET object represents a valid Revit entity.
Get: IsValidObject(self: ViewDisplaySketchyLines) -> bool
"""
Jitter=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""The jitter defines jitteriness of the line.
Values between 0 and 10.
Get: Jitter(self: ViewDisplaySketchyLines) -> int
Set: Jitter(self: ViewDisplaySketchyLines)=value
"""
| class Viewdisplaysketchylines(object, IDisposable):
""" Represents the settings for sketchy lines. """
def dispose(self):
""" Dispose(self: ViewDisplaySketchyLines) """
pass
def release_unmanaged_resources(self, *args):
""" ReleaseUnmanagedResources(self: ViewDisplaySketchyLines,disposing: bool) """
pass
def __enter__(self, *args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self, *args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __repr__(self, *args):
""" __repr__(self: object) -> str """
pass
enable_sketchy_lines = property(lambda self: object(), lambda self, v: None, lambda self: None)
'True to enable sketchy lines visibility. False to disable it.\n\n\n\nGet: EnableSketchyLines(self: ViewDisplaySketchyLines) -> bool\n\n\n\nSet: EnableSketchyLines(self: ViewDisplaySketchyLines)=value\n\n'
extension = property(lambda self: object(), lambda self, v: None, lambda self: None)
"The extension scale value. Controls the magnitude of line's extension.\n\n Values between 0 and 10.\n\n\n\nGet: Extension(self: ViewDisplaySketchyLines) -> int\n\n\n\nSet: Extension(self: ViewDisplaySketchyLines)=value\n\n"
is_valid_object = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Specifies whether the .NET object represents a valid Revit entity.\n\n\n\nGet: IsValidObject(self: ViewDisplaySketchyLines) -> bool\n\n\n\n'
jitter = property(lambda self: object(), lambda self, v: None, lambda self: None)
'The jitter defines jitteriness of the line.\n\n Values between 0 and 10.\n\n\n\nGet: Jitter(self: ViewDisplaySketchyLines) -> int\n\n\n\nSet: Jitter(self: ViewDisplaySketchyLines)=value\n\n' |
PATH_DATA = "../train_data/pan20-author-profiling-training-2020-02-23"
PATH_DATA_EN = "../train_data/pan20-author-profiling-training-2020-02-23/en"
PATH_DATA_ES = "../train_data/pan20-author-profiling-training-2020-02-23/es"
PATH_DATA_EN_TRUTH = "../train_data/pan20-author-profiling-training-2020-02-23/en/truth.txt"
PATH_DATA_ES_TRUTH = "../train_data/pan20-author-profiling-training-2020-02-23/es/truth.txt"
PATH_EXPR = "../expr"
PATH_MODELS = "../models"
PATH_OUT = "../out"
PATH_IMGS = "../imgs"
#D2V
D2V_EPOCHS = 50
D2V_LR = 0.01
D2V_VS = 100
#TPOT
TPOT_OUT = 2
#EXTENDED_TFIDF
parametersWide = {"loss":["hinge","log","modified_huber"], \
"penalty":["elasticnet"],"alpha":[0.01,0.001,0.0001,0.0005],\
"l1_ratio":[0.05,0.25,0.3,0.6,0.8,0.95], \
"power_t":[0.5,0.1,0.9]}
#TIRA_ONE_PARAMTERES
parametersTIRA_DIMS = [256,512,768]
parametersTIRA_FEATURES = [2500,5000,10000,15000]
parametersTIRA_GS1 = {"loss":["hinge","log"],\
"penalty":["elasticnet"],\
"alpha":[0.01,0.001,0.0001,0.0005],\
"l1_ratio":[0.05,0.25,0.3,0.6,0.8,0.95],\
"power_t":[0.5,0.1,0.9]}
parametersTIRA_GS2 = {"C":[0.1,1,10,25,50,100,500],"penalty":["l2"]}
| path_data = '../train_data/pan20-author-profiling-training-2020-02-23'
path_data_en = '../train_data/pan20-author-profiling-training-2020-02-23/en'
path_data_es = '../train_data/pan20-author-profiling-training-2020-02-23/es'
path_data_en_truth = '../train_data/pan20-author-profiling-training-2020-02-23/en/truth.txt'
path_data_es_truth = '../train_data/pan20-author-profiling-training-2020-02-23/es/truth.txt'
path_expr = '../expr'
path_models = '../models'
path_out = '../out'
path_imgs = '../imgs'
d2_v_epochs = 50
d2_v_lr = 0.01
d2_v_vs = 100
tpot_out = 2
parameters_wide = {'loss': ['hinge', 'log', 'modified_huber'], 'penalty': ['elasticnet'], 'alpha': [0.01, 0.001, 0.0001, 0.0005], 'l1_ratio': [0.05, 0.25, 0.3, 0.6, 0.8, 0.95], 'power_t': [0.5, 0.1, 0.9]}
parameters_tira_dims = [256, 512, 768]
parameters_tira_features = [2500, 5000, 10000, 15000]
parameters_tira_gs1 = {'loss': ['hinge', 'log'], 'penalty': ['elasticnet'], 'alpha': [0.01, 0.001, 0.0001, 0.0005], 'l1_ratio': [0.05, 0.25, 0.3, 0.6, 0.8, 0.95], 'power_t': [0.5, 0.1, 0.9]}
parameters_tira_gs2 = {'C': [0.1, 1, 10, 25, 50, 100, 500], 'penalty': ['l2']} |
__all__ = ['Meta']
class Meta:
pass
| __all__ = ['Meta']
class Meta:
pass |
# Copyright (c) 2019 zfit
# TODO: improve errors of models. Generate more general error, inherit and use more specific?
class PDFCompatibilityError(Exception):
pass
class LogicalUndefinedOperationError(Exception):
pass
class ExtendedPDFError(Exception):
pass
class AlreadyExtendedPDFError(ExtendedPDFError):
pass
class NotExtendedPDFError(ExtendedPDFError):
pass
class ConversionError(Exception):
pass
class SubclassingError(Exception):
pass
class BasePDFSubclassingError(SubclassingError):
pass
class IntentionNotUnambiguousError(Exception):
pass
class UnderdefinedError(IntentionNotUnambiguousError):
pass
class LimitsUnderdefinedError(UnderdefinedError):
pass
class OverdefinedError(IntentionNotUnambiguousError):
pass
class LimitsOverdefinedError(OverdefinedError):
pass
class AxesNotUnambiguousError(IntentionNotUnambiguousError):
pass
class NotSpecifiedError(Exception):
pass
class LimitsNotSpecifiedError(NotSpecifiedError):
pass
class NormRangeNotSpecifiedError(NotSpecifiedError):
pass
class AxesNotSpecifiedError(NotSpecifiedError):
pass
class ObsNotSpecifiedError(NotSpecifiedError):
pass
# Parameter Errors
class NameAlreadyTakenError(Exception):
pass
# Operation errors
class IncompatibleError(Exception):
pass
class ShapeIncompatibleError(IncompatibleError):
pass
class ObsIncompatibleError(IncompatibleError):
pass
class SpaceIncompatibleError(IncompatibleError):
pass
class LimitsIncompatibleError(IncompatibleError):
pass
class ModelIncompatibleError(IncompatibleError):
pass
# Data errors
class WeightsNotImplementedError(Exception):
pass
# Minimizer errors
class NotMinimizedError(Exception):
pass
# Runtime Errors
class NoSessionSpecifiedError(Exception):
pass
# PDF class internal handling errors
class NormRangeNotImplementedError(Exception):
"""Indicates that a function does not support the normalization range argument `norm_range`."""
pass
class MultipleLimitsNotImplementedError(Exception):
"""Indicates that a function does not support several limits in a :py:class:`~zfit.Space`."""
pass
# Developer verbose messages
class DueToLazynessNotImplementedError(Exception):
"""Only for developing purpose! Does not serve as a 'real' Exception."""
pass
| class Pdfcompatibilityerror(Exception):
pass
class Logicalundefinedoperationerror(Exception):
pass
class Extendedpdferror(Exception):
pass
class Alreadyextendedpdferror(ExtendedPDFError):
pass
class Notextendedpdferror(ExtendedPDFError):
pass
class Conversionerror(Exception):
pass
class Subclassingerror(Exception):
pass
class Basepdfsubclassingerror(SubclassingError):
pass
class Intentionnotunambiguouserror(Exception):
pass
class Underdefinederror(IntentionNotUnambiguousError):
pass
class Limitsunderdefinederror(UnderdefinedError):
pass
class Overdefinederror(IntentionNotUnambiguousError):
pass
class Limitsoverdefinederror(OverdefinedError):
pass
class Axesnotunambiguouserror(IntentionNotUnambiguousError):
pass
class Notspecifiederror(Exception):
pass
class Limitsnotspecifiederror(NotSpecifiedError):
pass
class Normrangenotspecifiederror(NotSpecifiedError):
pass
class Axesnotspecifiederror(NotSpecifiedError):
pass
class Obsnotspecifiederror(NotSpecifiedError):
pass
class Namealreadytakenerror(Exception):
pass
class Incompatibleerror(Exception):
pass
class Shapeincompatibleerror(IncompatibleError):
pass
class Obsincompatibleerror(IncompatibleError):
pass
class Spaceincompatibleerror(IncompatibleError):
pass
class Limitsincompatibleerror(IncompatibleError):
pass
class Modelincompatibleerror(IncompatibleError):
pass
class Weightsnotimplementederror(Exception):
pass
class Notminimizederror(Exception):
pass
class Nosessionspecifiederror(Exception):
pass
class Normrangenotimplementederror(Exception):
"""Indicates that a function does not support the normalization range argument `norm_range`."""
pass
class Multiplelimitsnotimplementederror(Exception):
"""Indicates that a function does not support several limits in a :py:class:`~zfit.Space`."""
pass
class Duetolazynessnotimplementederror(Exception):
"""Only for developing purpose! Does not serve as a 'real' Exception."""
pass |
def good():
return ['Harry', 'Ron', 'Hermione']
# expected output:
'''
['Harry', 'Ron', 'Hermione']
'''
print( good() ) | def good():
return ['Harry', 'Ron', 'Hermione']
"\n['Harry', 'Ron', 'Hermione'] \n"
print(good()) |
glosario = {'listas' : "Se pueden identificar con []", 'tuplas' : "Se identifican con *()",
'glosario' : "Se identifican con {}", 'if' : "Condicional", 'for' : "Ciclo", '#' : "Para crear un comentario",
'str' : "Abreviacion de String", '==' : "usado para comparar elementos", "=!" : "Usado para verificar que dos elementos son diferentes",
'and' : "Usado en condicionales para comprar mas formas a los elementos"}
for clave in glosario.values():
print(clave.title()) | glosario = {'listas': 'Se pueden identificar con []', 'tuplas': 'Se identifican con *()', 'glosario': 'Se identifican con {}', 'if': 'Condicional', 'for': 'Ciclo', '#': 'Para crear un comentario', 'str': 'Abreviacion de String', '==': 'usado para comparar elementos', '=!': 'Usado para verificar que dos elementos son diferentes', 'and': 'Usado en condicionales para comprar mas formas a los elementos'}
for clave in glosario.values():
print(clave.title()) |
n = 8
fib0 = 0
fib1 = 1
if n > 0:
temp = fib0
fib0 = fib1
fib1 = fib1 + temp
n = n - 1
else:
print(f'Resultado {fib0}') | n = 8
fib0 = 0
fib1 = 1
if n > 0:
temp = fib0
fib0 = fib1
fib1 = fib1 + temp
n = n - 1
else:
print(f'Resultado {fib0}') |
class Solution(object):
def maxSlidingWindow(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
que, len1, len2 = [], 0, len(nums)
ans = []
for i in range(k):
while len1 > 0 and nums[i] >= que[-1][0]:
que.pop()
len1 -= 1
que.append((nums[i], i))
len1 += 1
for i in range(k, len2):
ans.append(que[0][0])
if i - que[0][1] >= k:
del que[0]
len1 -= 1
while len1 > 0 and nums[i] >= que[-1][0]:
que.pop()
len1 -= 1
que.append((nums[i], i))
len1 += 1
ans.append(que[0][0])
return ans
| class Solution(object):
def max_sliding_window(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
(que, len1, len2) = ([], 0, len(nums))
ans = []
for i in range(k):
while len1 > 0 and nums[i] >= que[-1][0]:
que.pop()
len1 -= 1
que.append((nums[i], i))
len1 += 1
for i in range(k, len2):
ans.append(que[0][0])
if i - que[0][1] >= k:
del que[0]
len1 -= 1
while len1 > 0 and nums[i] >= que[-1][0]:
que.pop()
len1 -= 1
que.append((nums[i], i))
len1 += 1
ans.append(que[0][0])
return ans |
class ShellGame(object):
def __init__(self, start, swaps):
self.start = start
self.swaps = swaps
def find_the_ball(self):
if len(self.swaps) == 0:
return self.start
else:
for pos in self.swaps:
for x in pos:
self.start = x
return self.start
| class Shellgame(object):
def __init__(self, start, swaps):
self.start = start
self.swaps = swaps
def find_the_ball(self):
if len(self.swaps) == 0:
return self.start
else:
for pos in self.swaps:
for x in pos:
self.start = x
return self.start |
"""
from: http://adventofcode.com/2017/day/5
--- Part Two ---
Now, the jumps are even stranger: after each jump, if the offset was three or more, instead decrease
it by 1. Otherwise, increase it by 1 as before.
Using this rule with the above example, the process now takes 10 steps, and the offset values after
finding the exit are left as 2 3 2 3 -1.
How many steps does it now take to reach the exit?
"""
def main():
"""Solve the problem!"""
maze = []
jump_count = 0
# import the maze
with open("input.txt") as input_file:
for line in input_file:
maze.append(int(line))
index = 0
while index < len(maze):
jump_value = maze[index]
if jump_value >= 3:
maze[index] = maze[index] - 1
else:
maze[index] = maze[index] + 1
index = index + jump_value
jump_count = jump_count + 1
print(jump_count)
if __name__ == "__main__":
main()
| """
from: http://adventofcode.com/2017/day/5
--- Part Two ---
Now, the jumps are even stranger: after each jump, if the offset was three or more, instead decrease
it by 1. Otherwise, increase it by 1 as before.
Using this rule with the above example, the process now takes 10 steps, and the offset values after
finding the exit are left as 2 3 2 3 -1.
How many steps does it now take to reach the exit?
"""
def main():
"""Solve the problem!"""
maze = []
jump_count = 0
with open('input.txt') as input_file:
for line in input_file:
maze.append(int(line))
index = 0
while index < len(maze):
jump_value = maze[index]
if jump_value >= 3:
maze[index] = maze[index] - 1
else:
maze[index] = maze[index] + 1
index = index + jump_value
jump_count = jump_count + 1
print(jump_count)
if __name__ == '__main__':
main() |
ROP_POPJUMPLR_STACK12 = 0x0101CD24;
ROP_POPJUMPLR_STACK20 = 0x01024D88;
ROP_CALLFUNC = 0x01080274;
ROP_CALLR28_POP_R28_TO_R31 = 0x0107DD70;
ROP_POP_R28R29R30R31 = 0x0101D8D4;
ROP_POP_R27 = 0x0101CB00;
ROP_POP_R24_TO_R31 = 0x010204C8;
ROP_CALLFUNCPTR_WITHARGS_FROM_R3MEM = 0x010253C0;
ROP_SETR3TOR31_POP_R31 = 0x0101CC10;
ROP_Register = 0x010277B8;
ROP_Deregister = 0x010277C4;
ROP_CopyToSaveArea = 0x010277DC;
ROP_CopyFromSaveArea = 0x010277D0;
ROP_CreateThreadInternal = 0x01041BA8;
ROP_LR_TO_0XC_R1 = 0x0101CD24;
ROP_lwz_r3_0_r3__lwz_r0_0xc_r1__mtlr_r0__addi_r1_r1_8__blr = 0x01040C58;
ROP_memcpy = 0x01035FC8;
ROP_DCFlushRange = 0x01023F88;
ROP_ICInvalidateRange = 0x010240B0;
ROP_OSSwitchSecCodeGenMode = 0x010376C0;
ROP_OSCodegenCopy = 0x010376D8;
ROP_OSGetCodegenVirtAddrRange = 0x010375C0;
ROP_OSGetCoreId = 0x01024E8C;
ROP_OSGetCurrentThread = 0x01043150;
ROP_OSSetThreadAffinity = 0x010429DC;
ROP_OSYieldThread = 0x010418E4;
ROP_OSFatal = 0x01031618;
ROP_Exit = 0x0101CD80;
ROP_OSScreenFlipBuffersEx = 0x0103AFD0;
ROP_OSScreenClearBufferEx = 0x0103B090;
ROP_OSDynLoad_Acquire = 0x0102A3B4;
ROP_OSDynLoad_FindExport = 0x0102B828;
ROP_os_snprintf = 0x0102F160;
ROP_OSSendAppSwitchRequest = 0x01039C30;
ROP_OSExitThread = 0x01041D6C;
ROP_OSSleepTicks = 0x0104274C;
ROP_OSTestAndSetAtomic64 = 0x010229BC;
ROP_OSDisableInterrupts = 0x01033250;
ROP_OSForceFullRelaunch = 0x01035FA8;
ROP_OSRestoreInterrupts = 0x01033368;
ROP__Exit = 0x0101CD80;
ROP_OSCreateThread = 0x01041B64;
ROP_OSResumeThread = 0x01042108;
ROP_IM_Open = 0x010821F0;
ROP_IM_SetDeviceState = 0x01082598;
ROP_IM_Close = 0x01082200;
ROP___PPCExit = 0x0101C580;
ROP_OSRequestFastExit = 0x01039630;
ROP_OSRestartCrashedApp = 0x010302DC;
ROP_OSShutdown = 0x0101FD0C;
ROP_OSSuspendThread = 0x01042C60;
ROP_OSRunThreadsOnExit = 0x01047644;
ROP_OSBlockThreadsOnExit = 0x01047628;
ROP_GX2SetSemaphore_2C = 0x01157F18;
ROP_GX2_r3r4load = 0x0114EF74;
ROP_GX2_r30r31load = 0x011519EC;
ROP_GX2_do_flush = 0x0114F394;
ROP_GX2_call_r12 = 0x01189DDC;
ROP_GX2Init = 0x01156B78;
ROP_GX2Shutdown = 0x0115733C;
ROP_GX2Flush = 0x011575AC;
ROP_GX2DrawDone = 0x01157560;
ROP_GX2WaitForVsync = 0x01151964;
ROP_GX2DirectCallDisplayList = 0x01152BF0;
ROP_socket = 0x010C21C8;
ROP_connect = 0x010C0828;
ROP_recv = 0x010C0AEC;
ROP_R3_TO_R11 = 0x0DA6364C;
ROP_R11_TO_R1 = 0x0C009578;
ROP_R3_TO_R7 = 0x0D37A6F4;
ROP_R3_TO_R4 = 0x0DA6364C;
ROP_POP_R12 = 0x0C8F991C;
ROP_R3_TO_R6 = 0x0DFA353C;
ROP_R3_TO_R5_POP_R29_R30_R31 = 0x0DA21BC4;
| rop_popjumplr_stack12 = 16895268
rop_popjumplr_stack20 = 16928136
rop_callfunc = 17302132
rop_callr28_pop_r28_to_r31 = 17292656
rop_pop_r28_r29_r30_r31 = 16898260
rop_pop_r27 = 16894720
rop_pop_r24_to_r31 = 16909512
rop_callfuncptr_withargs_from_r3_mem = 16929728
rop_setr3_tor31_pop_r31 = 16894992
rop__register = 16938936
rop__deregister = 16938948
rop__copy_to_save_area = 16938972
rop__copy_from_save_area = 16938960
rop__create_thread_internal = 17046440
rop_lr_to_0_xc_r1 = 16895268
rop_lwz_r3_0_r3__lwz_r0_0xc_r1__mtlr_r0__addi_r1_r1_8__blr = 17042520
rop_memcpy = 16998344
rop_dc_flush_range = 16924552
rop_ic_invalidate_range = 16924848
rop_os_switch_sec_code_gen_mode = 17004224
rop_os_codegen_copy = 17004248
rop_os_get_codegen_virt_addr_range = 17003968
rop_os_get_core_id = 16928396
rop_os_get_current_thread = 17051984
rop_os_set_thread_affinity = 17050076
rop_os_yield_thread = 17045732
rop_os_fatal = 16979480
rop__exit = 16895360
rop_os_screen_flip_buffers_ex = 17018832
rop_os_screen_clear_buffer_ex = 17019024
rop_os_dyn_load__acquire = 16950196
rop_os_dyn_load__find_export = 16955432
rop_os_snprintf = 16970080
rop_os_send_app_switch_request = 17013808
rop_os_exit_thread = 17046892
rop_os_sleep_ticks = 17049420
rop_os_test_and_set_atomic64 = 16918972
rop_os_disable_interrupts = 16986704
rop_os_force_full_relaunch = 16998312
rop_os_restore_interrupts = 16986984
rop___exit = 16895360
rop_os_create_thread = 17046372
rop_os_resume_thread = 17047816
rop_im__open = 17310192
rop_im__set_device_state = 17311128
rop_im__close = 17310208
rop___ppc_exit = 16893312
rop_os_request_fast_exit = 17012272
rop_os_restart_crashed_app = 16974556
rop_os_shutdown = 16907532
rop_os_suspend_thread = 17050720
rop_os_run_threads_on_exit = 17069636
rop_os_block_threads_on_exit = 17069608
rop_gx2_set_semaphore_2_c = 18186008
rop_gx2_r3r4load = 18149236
rop_gx2_r30r31load = 18160108
rop_gx2_do_flush = 18150292
rop_gx2_call_r12 = 18390492
rop_gx2_init = 18180984
rop_gx2_shutdown = 18182972
rop_gx2_flush = 18183596
rop_gx2_draw_done = 18183520
rop_gx2_wait_for_vsync = 18159972
rop_gx2_direct_call_display_list = 18164720
rop_socket = 17572296
rop_connect = 17565736
rop_recv = 17566444
rop_r3_to_r11 = 228996684
rop_r11_to_r1 = 201364856
rop_r3_to_r7 = 221751028
rop_r3_to_r4 = 228996684
rop_pop_r12 = 210737436
rop_r3_to_r6 = 234501436
rop_r3_to_r5_pop_r29_r30_r31 = 228727748 |
class NoPrivateKey(Exception):
"""
No private key was provided so unable to perform any operations requiring message signing.
"""
pass
class DigitalTwinMapError(Exception):
"""
No Digital Twin was created with this index or there is no such topic in Digital Twin map.
"""
pass
| class Noprivatekey(Exception):
"""
No private key was provided so unable to perform any operations requiring message signing.
"""
pass
class Digitaltwinmaperror(Exception):
"""
No Digital Twin was created with this index or there is no such topic in Digital Twin map.
"""
pass |
#
# PySNMP MIB module CISCO-VPN-LIC-USAGE-MONITOR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-VPN-LIC-USAGE-MONITOR-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:03:26 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion")
ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup")
MibIdentifier, ObjectIdentity, Counter64, TimeTicks, IpAddress, ModuleIdentity, Bits, Unsigned32, Counter32, NotificationType, iso, Gauge32, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "ObjectIdentity", "Counter64", "TimeTicks", "IpAddress", "ModuleIdentity", "Bits", "Unsigned32", "Counter32", "NotificationType", "iso", "Gauge32", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
ciscoVpnLicUsageMonitorMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 816))
ciscoVpnLicUsageMonitorMIB.setRevisions(('2013-09-13 00:00',))
if mibBuilder.loadTexts: ciscoVpnLicUsageMonitorMIB.setLastUpdated('201309130000Z')
if mibBuilder.loadTexts: ciscoVpnLicUsageMonitorMIB.setOrganization('Cisco Systems, Inc.')
class VPNLicType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("other", 1), ("anyconnectpremium", 2))
class VPNLicDeviceRole(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("server", 1), ("bkpserver", 2), ("client", 3))
class LicServerStatus(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("active", 1), ("inactive", 2), ("expired", 3))
class LicServerRegistered(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("no", 1), ("yes", 2), ("invalid", 3))
ciscoVpnLicUsageMonitorMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0))
ciscoVpnLicUsageMonitorMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 1))
ciscoVpnLicUsageMonitorMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 1))
cvpnLicDeviceRole = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 1), VPNLicDeviceRole()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicDeviceRole.setStatus('current')
cvpnLicServer = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2))
cvpnLicBkpServer = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3))
cvpnLicClient = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4))
cvpnLicServerAddrType = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 1), InetAddressType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerAddrType.setStatus('current')
cvpnLicServerAddr = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 2), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerAddr.setStatus('current')
cvpnLicBkpSerAddrType = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 3), InetAddressType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicBkpSerAddrType.setStatus('current')
cvpnLicBkpSerAddr = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 4), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicBkpSerAddr.setStatus('current')
cvpnLicServerVer = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerVer.setStatus('current')
cvpnLicServerStatus = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 6), LicServerStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerStatus.setStatus('current')
cvpnLicServerTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7), )
if mibBuilder.loadTexts: cvpnLicServerTable.setStatus('current')
cvpnLicServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1), ).setIndexNames((0, "CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerVPNLicType"))
if mibBuilder.loadTexts: cvpnLicServerEntry.setStatus('current')
cvpnLicServerVPNLicType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 1), VPNLicType())
if mibBuilder.loadTexts: cvpnLicServerVPNLicType.setStatus('current')
cvpnLicServerNumLicCapacity = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 2), Unsigned32()).setUnits('license').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerNumLicCapacity.setStatus('current')
cvpnLicServerNumLicAvail = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 3), Unsigned32()).setUnits('license').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerNumLicAvail.setStatus('current')
cvpnLicServerUtilized = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 4), Unsigned32()).setUnits('license').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerUtilized.setStatus('current')
cvpnLicBkpServerAddrType = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 1), InetAddressType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicBkpServerAddrType.setStatus('current')
cvpnLicBkpServerAddr = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 2), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicBkpServerAddr.setStatus('current')
cvpnLicBkpServerDevID = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 3), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicBkpServerDevID.setStatus('current')
cvpnLicBkpServerVer = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 4), Unsigned32()).setUnits('license').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicBkpServerVer.setStatus('current')
cvpnLicBkpServerRegd = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 5), LicServerRegistered()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicBkpServerRegd.setStatus('current')
cvpnLicBkpServerHAPeerDevID = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 6), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicBkpServerHAPeerDevID.setStatus('current')
cvpnLicBkpServerHAPeerRegd = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 7), LicServerRegistered()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicBkpServerHAPeerRegd.setStatus('current')
cvpnLicBkpServerStatus = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 8), LicServerStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicBkpServerStatus.setStatus('current')
cvpnLicServerHelloTx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 9), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerHelloTx.setStatus('current')
cvpnLicServerHelloRx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 10), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerHelloRx.setStatus('current')
cvpnLicServerHelloError = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 11), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerHelloError.setStatus('current')
cvpnLicServerSyncTx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 12), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerSyncTx.setStatus('current')
cvpnLicServerSyncRx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 13), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerSyncRx.setStatus('current')
cvpnLicServerSyncError = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 14), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerSyncError.setStatus('current')
cvpnLicServerUpdateTx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 15), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerUpdateTx.setStatus('current')
cvpnLicServerUpdateRx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 16), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerUpdateRx.setStatus('current')
cvpnLicServerUpdateError = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 17), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicServerUpdateError.setStatus('current')
cvpnLicClntInfoTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1), )
if mibBuilder.loadTexts: cvpnLicClntInfoTable.setStatus('current')
cvpnLicClntInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1), ).setIndexNames((0, "CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntVPNLicType"), (0, "CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoDeviceID"))
if mibBuilder.loadTexts: cvpnLicClntInfoEntry.setStatus('current')
cvpnLicClntVPNLicType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 1), VPNLicType())
if mibBuilder.loadTexts: cvpnLicClntVPNLicType.setStatus('current')
cvpnLicClntInfoDeviceID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 2), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 64)))
if mibBuilder.loadTexts: cvpnLicClntInfoDeviceID.setStatus('current')
cvpnLicClntInfoHostName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 3), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoHostName.setStatus('current')
cvpnLicClntInfoPlatLmt = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 4), Unsigned32()).setUnits('license').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoPlatLmt.setStatus('current')
cvpnLicClntInfoCurUsage = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 5), Unsigned32()).setUnits('license').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoCurUsage.setStatus('current')
cvpnLicClntInfoHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 6), Unsigned32()).setUnits('license').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoHigh.setStatus('current')
cvpnLicClntInfoRegReqTx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 7), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoRegReqTx.setStatus('current')
cvpnLicClntInfoRegReqRx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 8), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoRegReqRx.setStatus('current')
cvpnLicClntInfoRegReqError = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 9), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoRegReqError.setStatus('current')
cvpnLicClntInfoGetReqTx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 10), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoGetReqTx.setStatus('current')
cvpnLicClntInfoGetReqRx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 11), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoGetReqRx.setStatus('current')
cvpnLicClntInfoGetReqError = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 12), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoGetReqError.setStatus('current')
cvpnLicClntInfoRelReqTx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 13), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoRelReqTx.setStatus('current')
cvpnLicClntInfoRelReqRx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 14), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoRelReqRx.setStatus('current')
cvpnLicClntInfoRelReqError = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 15), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoRelReqError.setStatus('current')
cvpnLicClntInfoTransferReqTx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 16), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoTransferReqTx.setStatus('current')
cvpnLicClntInfoTransferReqRx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 17), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoTransferReqRx.setStatus('current')
cvpnLicClntInfoTransferReqError = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 18), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cvpnLicClntInfoTransferReqError.setStatus('current')
ciscoVpnLicUsageMonitorMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 2))
ciscoVpnLicUsageMonitorMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 1, 1)).setObjects(("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "ciscoVPNSharedLicUsageMandatoryGroup"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "ciscoVPNSharedLicOptUsageGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoVpnLicUsageMonitorMIBCompliance = ciscoVpnLicUsageMonitorMIBCompliance.setStatus('current')
ciscoVPNSharedLicUsageMandatoryGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 2, 1)).setObjects(("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicDeviceRole"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerAddrType"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerAddr"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpSerAddrType"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpSerAddr"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerVer"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerStatus"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerNumLicCapacity"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerNumLicAvail"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerUtilized"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoHostName"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoPlatLmt"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoCurUsage"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoHigh"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoVPNSharedLicUsageMandatoryGroup = ciscoVPNSharedLicUsageMandatoryGroup.setStatus('current')
ciscoVPNSharedLicOptUsageGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 2, 2)).setObjects(("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerAddrType"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerAddr"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerDevID"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerVer"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerRegd"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerHAPeerDevID"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerHAPeerRegd"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerStatus"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerHelloTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerHelloRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerHelloError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerSyncTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerSyncRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerSyncError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerUpdateTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerUpdateRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerUpdateError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRegReqTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRegReqRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRegReqError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoGetReqTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoGetReqRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoGetReqError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRelReqTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRelReqRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRelReqError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoTransferReqTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoTransferReqRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoTransferReqError"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoVPNSharedLicOptUsageGroup = ciscoVPNSharedLicOptUsageGroup.setStatus('current')
mibBuilder.exportSymbols("CISCO-VPN-LIC-USAGE-MONITOR-MIB", cvpnLicClient=cvpnLicClient, cvpnLicServerVer=cvpnLicServerVer, cvpnLicClntInfoEntry=cvpnLicClntInfoEntry, cvpnLicBkpServerHAPeerDevID=cvpnLicBkpServerHAPeerDevID, cvpnLicBkpServerHAPeerRegd=cvpnLicBkpServerHAPeerRegd, cvpnLicServerHelloTx=cvpnLicServerHelloTx, LicServerStatus=LicServerStatus, cvpnLicClntInfoHostName=cvpnLicClntInfoHostName, cvpnLicClntInfoRelReqRx=cvpnLicClntInfoRelReqRx, ciscoVpnLicUsageMonitorMIBCompliance=ciscoVpnLicUsageMonitorMIBCompliance, cvpnLicServerUpdateRx=cvpnLicServerUpdateRx, ciscoVpnLicUsageMonitorMIBGroups=ciscoVpnLicUsageMonitorMIBGroups, cvpnLicClntInfoTransferReqTx=cvpnLicClntInfoTransferReqTx, cvpnLicServerUpdateError=cvpnLicServerUpdateError, cvpnLicServerSyncTx=cvpnLicServerSyncTx, cvpnLicClntInfoTransferReqError=cvpnLicClntInfoTransferReqError, ciscoVpnLicUsageMonitorMIBCompliances=ciscoVpnLicUsageMonitorMIBCompliances, cvpnLicServerVPNLicType=cvpnLicServerVPNLicType, ciscoVPNSharedLicOptUsageGroup=ciscoVPNSharedLicOptUsageGroup, cvpnLicServerStatus=cvpnLicServerStatus, VPNLicDeviceRole=VPNLicDeviceRole, cvpnLicServerUpdateTx=cvpnLicServerUpdateTx, ciscoVPNSharedLicUsageMandatoryGroup=ciscoVPNSharedLicUsageMandatoryGroup, cvpnLicBkpSerAddr=cvpnLicBkpSerAddr, cvpnLicBkpServerRegd=cvpnLicBkpServerRegd, cvpnLicClntVPNLicType=cvpnLicClntVPNLicType, cvpnLicClntInfoPlatLmt=cvpnLicClntInfoPlatLmt, cvpnLicClntInfoRelReqTx=cvpnLicClntInfoRelReqTx, cvpnLicClntInfoRegReqTx=cvpnLicClntInfoRegReqTx, ciscoVpnLicUsageMonitorMIB=ciscoVpnLicUsageMonitorMIB, cvpnLicBkpServerAddrType=cvpnLicBkpServerAddrType, cvpnLicClntInfoGetReqRx=cvpnLicClntInfoGetReqRx, cvpnLicServerUtilized=cvpnLicServerUtilized, cvpnLicBkpServerStatus=cvpnLicBkpServerStatus, cvpnLicServerSyncRx=cvpnLicServerSyncRx, cvpnLicClntInfoTable=cvpnLicClntInfoTable, cvpnLicClntInfoRegReqRx=cvpnLicClntInfoRegReqRx, cvpnLicClntInfoCurUsage=cvpnLicClntInfoCurUsage, cvpnLicServerTable=cvpnLicServerTable, cvpnLicServerNumLicAvail=cvpnLicServerNumLicAvail, PYSNMP_MODULE_ID=ciscoVpnLicUsageMonitorMIB, ciscoVpnLicUsageMonitorMIBConform=ciscoVpnLicUsageMonitorMIBConform, cvpnLicClntInfoRegReqError=cvpnLicClntInfoRegReqError, cvpnLicClntInfoGetReqTx=cvpnLicClntInfoGetReqTx, cvpnLicClntInfoRelReqError=cvpnLicClntInfoRelReqError, LicServerRegistered=LicServerRegistered, cvpnLicBkpServerAddr=cvpnLicBkpServerAddr, cvpnLicClntInfoTransferReqRx=cvpnLicClntInfoTransferReqRx, cvpnLicBkpServerVer=cvpnLicBkpServerVer, cvpnLicClntInfoGetReqError=cvpnLicClntInfoGetReqError, VPNLicType=VPNLicType, cvpnLicServerHelloRx=cvpnLicServerHelloRx, cvpnLicDeviceRole=cvpnLicDeviceRole, cvpnLicServerHelloError=cvpnLicServerHelloError, cvpnLicServerAddrType=cvpnLicServerAddrType, cvpnLicServer=cvpnLicServer, ciscoVpnLicUsageMonitorMIBObjects=ciscoVpnLicUsageMonitorMIBObjects, cvpnLicServerEntry=cvpnLicServerEntry, cvpnLicServerSyncError=cvpnLicServerSyncError, cvpnLicClntInfoHigh=cvpnLicClntInfoHigh, cvpnLicServerAddr=cvpnLicServerAddr, cvpnLicClntInfoDeviceID=cvpnLicClntInfoDeviceID, cvpnLicBkpSerAddrType=cvpnLicBkpSerAddrType, cvpnLicBkpServer=cvpnLicBkpServer, cvpnLicBkpServerDevID=cvpnLicBkpServerDevID, cvpnLicServerNumLicCapacity=cvpnLicServerNumLicCapacity)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion')
(cisco_mgmt,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoMgmt')
(inet_address_type, inet_address) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressType', 'InetAddress')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(module_compliance, object_group, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'ObjectGroup', 'NotificationGroup')
(mib_identifier, object_identity, counter64, time_ticks, ip_address, module_identity, bits, unsigned32, counter32, notification_type, iso, gauge32, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibIdentifier', 'ObjectIdentity', 'Counter64', 'TimeTicks', 'IpAddress', 'ModuleIdentity', 'Bits', 'Unsigned32', 'Counter32', 'NotificationType', 'iso', 'Gauge32', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
cisco_vpn_lic_usage_monitor_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 9, 816))
ciscoVpnLicUsageMonitorMIB.setRevisions(('2013-09-13 00:00',))
if mibBuilder.loadTexts:
ciscoVpnLicUsageMonitorMIB.setLastUpdated('201309130000Z')
if mibBuilder.loadTexts:
ciscoVpnLicUsageMonitorMIB.setOrganization('Cisco Systems, Inc.')
class Vpnlictype(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2))
named_values = named_values(('other', 1), ('anyconnectpremium', 2))
class Vpnlicdevicerole(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3))
named_values = named_values(('server', 1), ('bkpserver', 2), ('client', 3))
class Licserverstatus(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3))
named_values = named_values(('active', 1), ('inactive', 2), ('expired', 3))
class Licserverregistered(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3))
named_values = named_values(('no', 1), ('yes', 2), ('invalid', 3))
cisco_vpn_lic_usage_monitor_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0))
cisco_vpn_lic_usage_monitor_mib_conform = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 1))
cisco_vpn_lic_usage_monitor_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 1))
cvpn_lic_device_role = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 1), vpn_lic_device_role()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicDeviceRole.setStatus('current')
cvpn_lic_server = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2))
cvpn_lic_bkp_server = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3))
cvpn_lic_client = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4))
cvpn_lic_server_addr_type = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 1), inet_address_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerAddrType.setStatus('current')
cvpn_lic_server_addr = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 2), inet_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerAddr.setStatus('current')
cvpn_lic_bkp_ser_addr_type = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 3), inet_address_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicBkpSerAddrType.setStatus('current')
cvpn_lic_bkp_ser_addr = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 4), inet_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicBkpSerAddr.setStatus('current')
cvpn_lic_server_ver = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerVer.setStatus('current')
cvpn_lic_server_status = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 6), lic_server_status()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerStatus.setStatus('current')
cvpn_lic_server_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7))
if mibBuilder.loadTexts:
cvpnLicServerTable.setStatus('current')
cvpn_lic_server_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1)).setIndexNames((0, 'CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerVPNLicType'))
if mibBuilder.loadTexts:
cvpnLicServerEntry.setStatus('current')
cvpn_lic_server_vpn_lic_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 1), vpn_lic_type())
if mibBuilder.loadTexts:
cvpnLicServerVPNLicType.setStatus('current')
cvpn_lic_server_num_lic_capacity = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 2), unsigned32()).setUnits('license').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerNumLicCapacity.setStatus('current')
cvpn_lic_server_num_lic_avail = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 3), unsigned32()).setUnits('license').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerNumLicAvail.setStatus('current')
cvpn_lic_server_utilized = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 4), unsigned32()).setUnits('license').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerUtilized.setStatus('current')
cvpn_lic_bkp_server_addr_type = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 1), inet_address_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicBkpServerAddrType.setStatus('current')
cvpn_lic_bkp_server_addr = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 2), inet_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicBkpServerAddr.setStatus('current')
cvpn_lic_bkp_server_dev_id = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 3), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicBkpServerDevID.setStatus('current')
cvpn_lic_bkp_server_ver = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 4), unsigned32()).setUnits('license').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicBkpServerVer.setStatus('current')
cvpn_lic_bkp_server_regd = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 5), lic_server_registered()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicBkpServerRegd.setStatus('current')
cvpn_lic_bkp_server_ha_peer_dev_id = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 6), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicBkpServerHAPeerDevID.setStatus('current')
cvpn_lic_bkp_server_ha_peer_regd = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 7), lic_server_registered()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicBkpServerHAPeerRegd.setStatus('current')
cvpn_lic_bkp_server_status = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 8), lic_server_status()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicBkpServerStatus.setStatus('current')
cvpn_lic_server_hello_tx = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 9), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerHelloTx.setStatus('current')
cvpn_lic_server_hello_rx = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 10), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerHelloRx.setStatus('current')
cvpn_lic_server_hello_error = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 11), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerHelloError.setStatus('current')
cvpn_lic_server_sync_tx = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 12), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerSyncTx.setStatus('current')
cvpn_lic_server_sync_rx = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 13), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerSyncRx.setStatus('current')
cvpn_lic_server_sync_error = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 14), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerSyncError.setStatus('current')
cvpn_lic_server_update_tx = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 15), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerUpdateTx.setStatus('current')
cvpn_lic_server_update_rx = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 16), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerUpdateRx.setStatus('current')
cvpn_lic_server_update_error = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 17), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicServerUpdateError.setStatus('current')
cvpn_lic_clnt_info_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1))
if mibBuilder.loadTexts:
cvpnLicClntInfoTable.setStatus('current')
cvpn_lic_clnt_info_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1)).setIndexNames((0, 'CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntVPNLicType'), (0, 'CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoDeviceID'))
if mibBuilder.loadTexts:
cvpnLicClntInfoEntry.setStatus('current')
cvpn_lic_clnt_vpn_lic_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 1), vpn_lic_type())
if mibBuilder.loadTexts:
cvpnLicClntVPNLicType.setStatus('current')
cvpn_lic_clnt_info_device_id = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 2), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(1, 64)))
if mibBuilder.loadTexts:
cvpnLicClntInfoDeviceID.setStatus('current')
cvpn_lic_clnt_info_host_name = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 3), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoHostName.setStatus('current')
cvpn_lic_clnt_info_plat_lmt = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 4), unsigned32()).setUnits('license').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoPlatLmt.setStatus('current')
cvpn_lic_clnt_info_cur_usage = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 5), unsigned32()).setUnits('license').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoCurUsage.setStatus('current')
cvpn_lic_clnt_info_high = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 6), unsigned32()).setUnits('license').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoHigh.setStatus('current')
cvpn_lic_clnt_info_reg_req_tx = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 7), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoRegReqTx.setStatus('current')
cvpn_lic_clnt_info_reg_req_rx = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 8), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoRegReqRx.setStatus('current')
cvpn_lic_clnt_info_reg_req_error = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 9), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoRegReqError.setStatus('current')
cvpn_lic_clnt_info_get_req_tx = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 10), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoGetReqTx.setStatus('current')
cvpn_lic_clnt_info_get_req_rx = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 11), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoGetReqRx.setStatus('current')
cvpn_lic_clnt_info_get_req_error = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 12), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoGetReqError.setStatus('current')
cvpn_lic_clnt_info_rel_req_tx = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 13), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoRelReqTx.setStatus('current')
cvpn_lic_clnt_info_rel_req_rx = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 14), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoRelReqRx.setStatus('current')
cvpn_lic_clnt_info_rel_req_error = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 15), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoRelReqError.setStatus('current')
cvpn_lic_clnt_info_transfer_req_tx = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 16), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoTransferReqTx.setStatus('current')
cvpn_lic_clnt_info_transfer_req_rx = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 17), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoTransferReqRx.setStatus('current')
cvpn_lic_clnt_info_transfer_req_error = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 18), counter32()).setUnits('packets').setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvpnLicClntInfoTransferReqError.setStatus('current')
cisco_vpn_lic_usage_monitor_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 2))
cisco_vpn_lic_usage_monitor_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 1, 1)).setObjects(('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'ciscoVPNSharedLicUsageMandatoryGroup'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'ciscoVPNSharedLicOptUsageGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_vpn_lic_usage_monitor_mib_compliance = ciscoVpnLicUsageMonitorMIBCompliance.setStatus('current')
cisco_vpn_shared_lic_usage_mandatory_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 2, 1)).setObjects(('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicDeviceRole'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerAddrType'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerAddr'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicBkpSerAddrType'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicBkpSerAddr'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerVer'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerStatus'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerNumLicCapacity'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerNumLicAvail'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerUtilized'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoHostName'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoPlatLmt'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoCurUsage'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoHigh'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_vpn_shared_lic_usage_mandatory_group = ciscoVPNSharedLicUsageMandatoryGroup.setStatus('current')
cisco_vpn_shared_lic_opt_usage_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 2, 2)).setObjects(('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicBkpServerAddrType'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicBkpServerAddr'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicBkpServerDevID'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicBkpServerVer'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicBkpServerRegd'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicBkpServerHAPeerDevID'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicBkpServerHAPeerRegd'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicBkpServerStatus'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerHelloTx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerHelloRx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerHelloError'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerSyncTx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerSyncRx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerSyncError'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerUpdateTx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerUpdateRx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicServerUpdateError'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoRegReqTx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoRegReqRx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoRegReqError'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoGetReqTx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoGetReqRx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoGetReqError'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoRelReqTx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoRelReqRx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoRelReqError'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoTransferReqTx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoTransferReqRx'), ('CISCO-VPN-LIC-USAGE-MONITOR-MIB', 'cvpnLicClntInfoTransferReqError'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_vpn_shared_lic_opt_usage_group = ciscoVPNSharedLicOptUsageGroup.setStatus('current')
mibBuilder.exportSymbols('CISCO-VPN-LIC-USAGE-MONITOR-MIB', cvpnLicClient=cvpnLicClient, cvpnLicServerVer=cvpnLicServerVer, cvpnLicClntInfoEntry=cvpnLicClntInfoEntry, cvpnLicBkpServerHAPeerDevID=cvpnLicBkpServerHAPeerDevID, cvpnLicBkpServerHAPeerRegd=cvpnLicBkpServerHAPeerRegd, cvpnLicServerHelloTx=cvpnLicServerHelloTx, LicServerStatus=LicServerStatus, cvpnLicClntInfoHostName=cvpnLicClntInfoHostName, cvpnLicClntInfoRelReqRx=cvpnLicClntInfoRelReqRx, ciscoVpnLicUsageMonitorMIBCompliance=ciscoVpnLicUsageMonitorMIBCompliance, cvpnLicServerUpdateRx=cvpnLicServerUpdateRx, ciscoVpnLicUsageMonitorMIBGroups=ciscoVpnLicUsageMonitorMIBGroups, cvpnLicClntInfoTransferReqTx=cvpnLicClntInfoTransferReqTx, cvpnLicServerUpdateError=cvpnLicServerUpdateError, cvpnLicServerSyncTx=cvpnLicServerSyncTx, cvpnLicClntInfoTransferReqError=cvpnLicClntInfoTransferReqError, ciscoVpnLicUsageMonitorMIBCompliances=ciscoVpnLicUsageMonitorMIBCompliances, cvpnLicServerVPNLicType=cvpnLicServerVPNLicType, ciscoVPNSharedLicOptUsageGroup=ciscoVPNSharedLicOptUsageGroup, cvpnLicServerStatus=cvpnLicServerStatus, VPNLicDeviceRole=VPNLicDeviceRole, cvpnLicServerUpdateTx=cvpnLicServerUpdateTx, ciscoVPNSharedLicUsageMandatoryGroup=ciscoVPNSharedLicUsageMandatoryGroup, cvpnLicBkpSerAddr=cvpnLicBkpSerAddr, cvpnLicBkpServerRegd=cvpnLicBkpServerRegd, cvpnLicClntVPNLicType=cvpnLicClntVPNLicType, cvpnLicClntInfoPlatLmt=cvpnLicClntInfoPlatLmt, cvpnLicClntInfoRelReqTx=cvpnLicClntInfoRelReqTx, cvpnLicClntInfoRegReqTx=cvpnLicClntInfoRegReqTx, ciscoVpnLicUsageMonitorMIB=ciscoVpnLicUsageMonitorMIB, cvpnLicBkpServerAddrType=cvpnLicBkpServerAddrType, cvpnLicClntInfoGetReqRx=cvpnLicClntInfoGetReqRx, cvpnLicServerUtilized=cvpnLicServerUtilized, cvpnLicBkpServerStatus=cvpnLicBkpServerStatus, cvpnLicServerSyncRx=cvpnLicServerSyncRx, cvpnLicClntInfoTable=cvpnLicClntInfoTable, cvpnLicClntInfoRegReqRx=cvpnLicClntInfoRegReqRx, cvpnLicClntInfoCurUsage=cvpnLicClntInfoCurUsage, cvpnLicServerTable=cvpnLicServerTable, cvpnLicServerNumLicAvail=cvpnLicServerNumLicAvail, PYSNMP_MODULE_ID=ciscoVpnLicUsageMonitorMIB, ciscoVpnLicUsageMonitorMIBConform=ciscoVpnLicUsageMonitorMIBConform, cvpnLicClntInfoRegReqError=cvpnLicClntInfoRegReqError, cvpnLicClntInfoGetReqTx=cvpnLicClntInfoGetReqTx, cvpnLicClntInfoRelReqError=cvpnLicClntInfoRelReqError, LicServerRegistered=LicServerRegistered, cvpnLicBkpServerAddr=cvpnLicBkpServerAddr, cvpnLicClntInfoTransferReqRx=cvpnLicClntInfoTransferReqRx, cvpnLicBkpServerVer=cvpnLicBkpServerVer, cvpnLicClntInfoGetReqError=cvpnLicClntInfoGetReqError, VPNLicType=VPNLicType, cvpnLicServerHelloRx=cvpnLicServerHelloRx, cvpnLicDeviceRole=cvpnLicDeviceRole, cvpnLicServerHelloError=cvpnLicServerHelloError, cvpnLicServerAddrType=cvpnLicServerAddrType, cvpnLicServer=cvpnLicServer, ciscoVpnLicUsageMonitorMIBObjects=ciscoVpnLicUsageMonitorMIBObjects, cvpnLicServerEntry=cvpnLicServerEntry, cvpnLicServerSyncError=cvpnLicServerSyncError, cvpnLicClntInfoHigh=cvpnLicClntInfoHigh, cvpnLicServerAddr=cvpnLicServerAddr, cvpnLicClntInfoDeviceID=cvpnLicClntInfoDeviceID, cvpnLicBkpSerAddrType=cvpnLicBkpSerAddrType, cvpnLicBkpServer=cvpnLicBkpServer, cvpnLicBkpServerDevID=cvpnLicBkpServerDevID, cvpnLicServerNumLicCapacity=cvpnLicServerNumLicCapacity) |
# Copyright(c) 2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Intel Corporation nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# GUID value: "58656F6E-4650-4741-B747-425376303031"
# The string below will be converted to hex format
# before being written into the bitstream file
METADATA_GUID = b'XeonFPGA\xb7GBSv001'
# Metadata length field is a unsigned 32 bit int
SIZEOF_LEN_FIELD = 4
# Length of GUID string
GUID_LEN = len(METADATA_GUID)
| metadata_guid = b'XeonFPGA\xb7GBSv001'
sizeof_len_field = 4
guid_len = len(METADATA_GUID) |
{
"targets": [
{
"target_name": "lmdb-queue",
"include_dirs" : [
"<!(node -e \"require('nan')\")",
"<!(node -e \"require('nnu')\")",
"deps"
],
"dependencies": [
"<(module_root_dir)/deps/lmdb.gyp:lmdb"
],
"sources": [
"src/module.cc",
"src/env.h",
"src/env.cc",
"src/topic.h",
"src/topic.cc",
"src/consumer.h",
"src/consumer.cc",
"src/producer.h",
"src/producer.cc",
"src/wrapper.h"
],
"conditions": [
[
"OS == 'win'", {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeTypeInfo': 'false',
'EnableFunctionLevelLinking': 'true',
'DisableSpecificWarnings': [ '4267' ],
'AdditionalOptions': ['/EHsc']
}
}
}
],
[
"OS=='linux'", {
"cflags_cc": [ "-std=c++11" ]
}
],
[
'OS == "mac"', {
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.7',
'OTHER_CPLUSPLUSFLAGS': [
'-std=c++11' ,
'-stdlib=libc++'
]
}
}
]
]
}
]
} | {'targets': [{'target_name': 'lmdb-queue', 'include_dirs': ['<!(node -e "require(\'nan\')")', '<!(node -e "require(\'nnu\')")', 'deps'], 'dependencies': ['<(module_root_dir)/deps/lmdb.gyp:lmdb'], 'sources': ['src/module.cc', 'src/env.h', 'src/env.cc', 'src/topic.h', 'src/topic.cc', 'src/consumer.h', 'src/consumer.cc', 'src/producer.h', 'src/producer.cc', 'src/wrapper.h'], 'conditions': [["OS == 'win'", {'msvs_settings': {'VCCLCompilerTool': {'RuntimeTypeInfo': 'false', 'EnableFunctionLevelLinking': 'true', 'DisableSpecificWarnings': ['4267'], 'AdditionalOptions': ['/EHsc']}}}], ["OS=='linux'", {'cflags_cc': ['-std=c++11']}], ['OS == "mac"', {'xcode_settings': {'MACOSX_DEPLOYMENT_TARGET': '10.7', 'OTHER_CPLUSPLUSFLAGS': ['-std=c++11', '-stdlib=libc++']}}]]}]} |
# coding: utf-8
"""
railgun-cli
````````````
railgun command line tool
:License: MIT
:Copyright: @neo1218 @oaoouo
"""
__version__ = '0.1.3'
| """
railgun-cli
````````````
railgun command line tool
:License: MIT
:Copyright: @neo1218 @oaoouo
"""
__version__ = '0.1.3' |
# the key is the name of the class of the workload and the value is the program argument string
def get_workloads(checkpoint, analytics_data_paths: list, lda_data_paths: list, gbt_data_path: str,
pagerank_data_path: str, k: int, iterations: int, checkpoint_interval: int,
sampling_fraction: float = 0.01, analytics_only: bool = False) -> dict:
if analytics_only:
# for a faster run
workloads = {
"Analytics": f"--sampling-fraction {sampling_fraction} --checkpoint-rdd {checkpoint} {analytics_data_paths[0]} {analytics_data_paths[1]}"
}
else:
workloads = {
"Analytics": f"--sampling-fraction {sampling_fraction} --checkpoint-rdd {checkpoint} {analytics_data_paths[0]} {analytics_data_paths[1]}",
"LDAWorkload": f"--k {k} --iterations {iterations} --checkpoint {checkpoint} --checkpoint-interval {checkpoint_interval} {lda_data_paths[0]} {lda_data_paths[1]}",
"GradientBoostedTrees": f"--iterations {iterations} --checkpoint {checkpoint} --checkpoint-interval {checkpoint_interval} {gbt_data_path}",
"PageRank": f"--save-path output/ --iterations {iterations} --checkpoint {checkpoint} {pagerank_data_path}"
}
return workloads
| def get_workloads(checkpoint, analytics_data_paths: list, lda_data_paths: list, gbt_data_path: str, pagerank_data_path: str, k: int, iterations: int, checkpoint_interval: int, sampling_fraction: float=0.01, analytics_only: bool=False) -> dict:
if analytics_only:
workloads = {'Analytics': f'--sampling-fraction {sampling_fraction} --checkpoint-rdd {checkpoint} {analytics_data_paths[0]} {analytics_data_paths[1]}'}
else:
workloads = {'Analytics': f'--sampling-fraction {sampling_fraction} --checkpoint-rdd {checkpoint} {analytics_data_paths[0]} {analytics_data_paths[1]}', 'LDAWorkload': f'--k {k} --iterations {iterations} --checkpoint {checkpoint} --checkpoint-interval {checkpoint_interval} {lda_data_paths[0]} {lda_data_paths[1]}', 'GradientBoostedTrees': f'--iterations {iterations} --checkpoint {checkpoint} --checkpoint-interval {checkpoint_interval} {gbt_data_path}', 'PageRank': f'--save-path output/ --iterations {iterations} --checkpoint {checkpoint} {pagerank_data_path}'}
return workloads |
__author__ = 'Cib'
class interface():
pass
| __author__ = 'Cib'
class Interface:
pass |
def foo(a):
"""
:param a:
"""
pass
foo("a")
| def foo(a):
"""
:param a:
"""
pass
foo('a') |
class MyStack:
def __init__(self):
self.q = deque()
def push(self, x: int) -> None:
self.q.append(x)
def pop(self) -> int:
for i in range(len(self.q)-1):
self.q.append(self.q.popleft())
return self.q.popleft()
def top(self) -> int:
temp = self.pop()
self.q.append(temp)
return temp
def empty(self) -> bool:
return len(self.q) == 0
# Your MyStack object will be instantiated and called as such:
# obj = MyStack()
# obj.push(x)
# param_2 = obj.pop()
# param_3 = obj.top()
# param_4 = obj.empty() | class Mystack:
def __init__(self):
self.q = deque()
def push(self, x: int) -> None:
self.q.append(x)
def pop(self) -> int:
for i in range(len(self.q) - 1):
self.q.append(self.q.popleft())
return self.q.popleft()
def top(self) -> int:
temp = self.pop()
self.q.append(temp)
return temp
def empty(self) -> bool:
return len(self.q) == 0 |
N = int(input())
A = list(map(int, input().split()))
ans = 0
max_tall = 0
for i in range(0, N):
if max_tall > A[i]:
ans += max_tall - A[i]
if A[i] > max_tall:
max_tall = A[i]
print(ans) | n = int(input())
a = list(map(int, input().split()))
ans = 0
max_tall = 0
for i in range(0, N):
if max_tall > A[i]:
ans += max_tall - A[i]
if A[i] > max_tall:
max_tall = A[i]
print(ans) |
#
# PySNMP MIB module A3COM0027-RMON-EXTENSIONS (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM0027-RMON-EXTENSIONS
# Produced by pysmi-0.3.4 at Wed May 1 11:08:40 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)
#
rmonExtensions, = mibBuilder.importSymbols("A3COM0004-GENERIC", "rmonExtensions")
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Integer32, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, Bits, ObjectIdentity, Unsigned32, MibIdentifier, NotificationType, ModuleIdentity, Counter64, iso, Counter32, TimeTicks, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "Bits", "ObjectIdentity", "Unsigned32", "MibIdentifier", "NotificationType", "ModuleIdentity", "Counter64", "iso", "Counter32", "TimeTicks", "IpAddress")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
remotePoll = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 1))
hostExtensions = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 2))
alarmExtensions = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 3))
eventExtensions = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 4))
command = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 5))
probeConfigNetExtensions = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 6))
mibBuilder.exportSymbols("A3COM0027-RMON-EXTENSIONS", remotePoll=remotePoll, probeConfigNetExtensions=probeConfigNetExtensions, hostExtensions=hostExtensions, eventExtensions=eventExtensions, command=command, alarmExtensions=alarmExtensions)
| (rmon_extensions,) = mibBuilder.importSymbols('A3COM0004-GENERIC', 'rmonExtensions')
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(integer32, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, gauge32, bits, object_identity, unsigned32, mib_identifier, notification_type, module_identity, counter64, iso, counter32, time_ticks, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Gauge32', 'Bits', 'ObjectIdentity', 'Unsigned32', 'MibIdentifier', 'NotificationType', 'ModuleIdentity', 'Counter64', 'iso', 'Counter32', 'TimeTicks', 'IpAddress')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
remote_poll = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 1))
host_extensions = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 2))
alarm_extensions = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 3))
event_extensions = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 4))
command = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 5))
probe_config_net_extensions = mib_identifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 6))
mibBuilder.exportSymbols('A3COM0027-RMON-EXTENSIONS', remotePoll=remotePoll, probeConfigNetExtensions=probeConfigNetExtensions, hostExtensions=hostExtensions, eventExtensions=eventExtensions, command=command, alarmExtensions=alarmExtensions) |
class ps_data:
@property
def train_data(self):
return self._train_data
@property
def indexs(self):
return self._indexs
@train_data.setter
def train_data(self, val):
self._train_data=val
@indexs.setter
def indexs(self, val):
self._indexs=val
| class Ps_Data:
@property
def train_data(self):
return self._train_data
@property
def indexs(self):
return self._indexs
@train_data.setter
def train_data(self, val):
self._train_data = val
@indexs.setter
def indexs(self, val):
self._indexs = val |
class Advice:
def __init__(self):
self.clothes = []
self.weather = None
def add_cloth(self, cloth):
self.clothes.append(cloth)
def add_message(self, message):
self.clothes.append(message)
def add_weather(self, weather):
self.weather = weather
| class Advice:
def __init__(self):
self.clothes = []
self.weather = None
def add_cloth(self, cloth):
self.clothes.append(cloth)
def add_message(self, message):
self.clothes.append(message)
def add_weather(self, weather):
self.weather = weather |
def _cantidad_caracter(cadena, caracter, indice, cantidad):
if indice == len(cadena):
return cantidad
if caracter == cadena[indice]:
cantidad += 1
return _cantidad_caracter(cadena, caracter, indice + 1, cantidad)
def cantidad_caracter(cadena, caracter):
"""Cuenta la cantidad de apariciones del caracter en la cadena"""
return _cantidad_caracter(cadena, caracter, 0, 0) | def _cantidad_caracter(cadena, caracter, indice, cantidad):
if indice == len(cadena):
return cantidad
if caracter == cadena[indice]:
cantidad += 1
return _cantidad_caracter(cadena, caracter, indice + 1, cantidad)
def cantidad_caracter(cadena, caracter):
"""Cuenta la cantidad de apariciones del caracter en la cadena"""
return _cantidad_caracter(cadena, caracter, 0, 0) |
script_part1 =r"""
<!DOCTYPE html>
<html lang="en">
<head>
<title>Cog Graph</title>
<style type="text/css">
body {
padding: 0;
margin: 0;
width: 100%;!important;
height: 100%;!important;
}
#cog-graph-view {
width: 700px;
height: 700px;
}
</style>
"""
graph_lib_src = r"""
<script
type="text/javascript"
src="{js_src}"
></script>
</head>
"""
graph_template = r"""
<body>
<div id="cog-graph-view"></div>
<script type="text/javascript">
results ={plot_data_insert} """
script_part2 = r"""
var nodes = new vis.DataSet();
var edges = new vis.DataSet();
for (let i = 0; i < results.length; i++) {
res = results[i];
nodes.update({
id: res.from,
label: res.from
});
nodes.update({
id: res.to,
label: res.to
});
edges.update({
from: res.from,
to: res.to
});
}
var container = document.getElementById("cog-graph-view");
var data = {
nodes: nodes,
edges: edges,
};
var options = {
nodes: {
font: {
size: 20,
color: "black"
},
color: "#46944f",
shape: "dot",
widthConstraint: 200,
},
edges: {
font: "12px arial #ff0000",
scaling: {
label: true,
},
shadow: true,
smooth: true,
arrows: { to: {enabled: true}}
},
physics: {
barnesHut: {
gravitationalConstant: -30000
},
stabilization: {
iterations: 1000
},
}
};
var network = new vis.Network(container, data, options);
</script>
</body>
</html>
""" | script_part1 = '\n<!DOCTYPE html>\n<html lang="en">\n <head>\n <title>Cog Graph</title>\n <style type="text/css">\n body {\n padding: 0;\n margin: 0;\n width: 100%;!important; \n height: 100%;!important; \n }\n\n #cog-graph-view {\n width: 700px;\n height: 700px;\n }\n </style>\n'
graph_lib_src = '\n\n <script\n type="text/javascript"\n src="{js_src}"\n ></script>\n </head> \n'
graph_template = ' \n <body>\n <div id="cog-graph-view"></div>\n\n <script type="text/javascript">\n\n results ={plot_data_insert} '
script_part2 = '\n\n var nodes = new vis.DataSet();\n var edges = new vis.DataSet();\n for (let i = 0; i < results.length; i++) {\n res = results[i];\n nodes.update({\n id: res.from,\n label: res.from\n });\n nodes.update({\n id: res.to,\n label: res.to\n });\n edges.update({\n from: res.from,\n to: res.to\n });\n\n }\n\n var container = document.getElementById("cog-graph-view");\n var data = {\n nodes: nodes,\n edges: edges,\n };\n var options = {\n nodes: {\n font: {\n size: 20,\n color: "black"\n },\n color: "#46944f",\n shape: "dot",\n widthConstraint: 200,\n\n },\n edges: {\n font: "12px arial #ff0000",\n scaling: {\n label: true,\n },\n shadow: true,\n smooth: true,\n arrows: { to: {enabled: true}}\n },\n physics: {\n barnesHut: {\n gravitationalConstant: -30000\n },\n stabilization: {\n iterations: 1000\n },\n }\n\n };\n var network = new vis.Network(container, data, options);\n </script>\n </body>\n</html>\n\n' |
__all__= [
'table',
'projects',
'annotations',
'converters',
'metrics'
]
__version__ = '0.0.3'
| __all__ = ['table', 'projects', 'annotations', 'converters', 'metrics']
__version__ = '0.0.3' |
"""
Faster R-CNN with Normalized Wasserstein Assigner
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.053
Average Precision (AP) @[ IoU=0.25 | area= all | maxDets=1500 ] = -1.000
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.130
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=1500 ] = 0.031
Average Precision (AP) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.000
Average Precision (AP) @[ IoU=0.50:0.95 | area= tiny | maxDets=1500 ] = 0.009
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.145
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.270
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.091
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=300 ] = 0.092
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.092
Average Recall (AR) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.000
Average Recall (AR) @[ IoU=0.50:0.95 | area= tiny | maxDets=1500 ] = 0.008
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.272
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.394
Optimal LRP @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.950
Optimal LRP Loc @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.307
Optimal LRP FP @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.583
Optimal LRP FN @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.849
# Class-specific LRP-Optimal Thresholds #
[0.742 0.196 0.547 0.534 0.445 0.29 0.35 nan]
2021-06-05 19:50:57,332 - mmdet - INFO -
+----------+-------+---------------+-------+--------------+-------+
| category | AP | category | AP | category | AP |
+----------+-------+---------------+-------+--------------+-------+
| airplane | 0.141 | bridge | 0.008 | storage-tank | 0.105 |
| ship | 0.071 | swimming-pool | 0.047 | vehicle | 0.033 |
| person | 0.018 | wind-mill | 0.000 | None | None |
+----------+-------+---------------+-------+--------------+-------+
2021-06-05 19:50:57,333 - mmdet - INFO -
+----------+-------+---------------+-------+--------------+-------+
| category | oLRP | category | oLRP | category | oLRP |
+----------+-------+---------------+-------+--------------+-------+
| airplane | 0.880 | bridge | 0.982 | storage-tank | 0.905 |
| ship | 0.933 | swimming-pool | 0.948 | vehicle | 0.969 |
| person | 0.981 | wind-mill | 1.000 | None | None |
+----------+-------+---------------+-------+--------------+-------+
"""
_base_ = [
'../_base_/models/faster_rcnn_r50_fpn_aitod.py',
'../_base_/datasets/aitod_detection.py',
'../_base_/schedules/schedule_1x.py',
'../_base_/default_runtime.py'
]
model = dict(
train_cfg=dict(
rpn=dict(
assigner=dict(
pos_iou_thr=0.7,
neg_iou_thr=0.4,
min_pos_iou=0.4)),
rcnn=dict(
assigner=dict(
pos_iou_thr=0.7,
neg_iou_thr=0.4,
min_pos_iou=0.4))))
fp16 = dict(loss_scale=512.)
# optimizer
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
# learning policy
checkpoint_config = dict(interval=4)
| """
Faster R-CNN with Normalized Wasserstein Assigner
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.053
Average Precision (AP) @[ IoU=0.25 | area= all | maxDets=1500 ] = -1.000
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.130
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=1500 ] = 0.031
Average Precision (AP) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.000
Average Precision (AP) @[ IoU=0.50:0.95 | area= tiny | maxDets=1500 ] = 0.009
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.145
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.270
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.091
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=300 ] = 0.092
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.092
Average Recall (AR) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.000
Average Recall (AR) @[ IoU=0.50:0.95 | area= tiny | maxDets=1500 ] = 0.008
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.272
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.394
Optimal LRP @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.950
Optimal LRP Loc @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.307
Optimal LRP FP @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.583
Optimal LRP FN @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.849
# Class-specific LRP-Optimal Thresholds #
[0.742 0.196 0.547 0.534 0.445 0.29 0.35 nan]
2021-06-05 19:50:57,332 - mmdet - INFO -
+----------+-------+---------------+-------+--------------+-------+
| category | AP | category | AP | category | AP |
+----------+-------+---------------+-------+--------------+-------+
| airplane | 0.141 | bridge | 0.008 | storage-tank | 0.105 |
| ship | 0.071 | swimming-pool | 0.047 | vehicle | 0.033 |
| person | 0.018 | wind-mill | 0.000 | None | None |
+----------+-------+---------------+-------+--------------+-------+
2021-06-05 19:50:57,333 - mmdet - INFO -
+----------+-------+---------------+-------+--------------+-------+
| category | oLRP | category | oLRP | category | oLRP |
+----------+-------+---------------+-------+--------------+-------+
| airplane | 0.880 | bridge | 0.982 | storage-tank | 0.905 |
| ship | 0.933 | swimming-pool | 0.948 | vehicle | 0.969 |
| person | 0.981 | wind-mill | 1.000 | None | None |
+----------+-------+---------------+-------+--------------+-------+
"""
_base_ = ['../_base_/models/faster_rcnn_r50_fpn_aitod.py', '../_base_/datasets/aitod_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py']
model = dict(train_cfg=dict(rpn=dict(assigner=dict(pos_iou_thr=0.7, neg_iou_thr=0.4, min_pos_iou=0.4)), rcnn=dict(assigner=dict(pos_iou_thr=0.7, neg_iou_thr=0.4, min_pos_iou=0.4))))
fp16 = dict(loss_scale=512.0)
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
checkpoint_config = dict(interval=4) |
'''
lab2
'''
#3.1
my_name = "Tom"
print(my_name.upper())
#3.2
my_id = 123
print(my_id)
#3.3
# 123=my_id
my_id=your_id=123
print(my_id)
print(your_id)
#3.4
my_id_str= "123"
print(my_id_str)
#3.5
#print(my_name+my_id)
#3.6
print(my_name+my_id_str)
#3.7
print(my_name*3)
#3.8
print('hello, world. This is my first python string'.split('.'))
#3.9
#message = 'Tom's id is 123'
#print('Tom's id is 123')
message = "Tom's id is 123"
print(message)
| """
lab2
"""
my_name = 'Tom'
print(my_name.upper())
my_id = 123
print(my_id)
my_id = your_id = 123
print(my_id)
print(your_id)
my_id_str = '123'
print(my_id_str)
print(my_name + my_id_str)
print(my_name * 3)
print('hello, world. This is my first python string'.split('.'))
message = "Tom's id is 123"
print(message) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 14 14:14:47 2017
@author: bmjl
"""
class Point:
"""This is Point class"""
def __init__(self):
"""This is the Point constructur"""
print("Point created")
def hello(self):
"""Hello method"""
print("Hello")
def hello_module():
"""Hello function"""
print("Hello from mymod.")
if __name__ == "__main__":
print("My module") | """
Created on Wed Jun 14 14:14:47 2017
@author: bmjl
"""
class Point:
"""This is Point class"""
def __init__(self):
"""This is the Point constructur"""
print('Point created')
def hello(self):
"""Hello method"""
print('Hello')
def hello_module():
"""Hello function"""
print('Hello from mymod.')
if __name__ == '__main__':
print('My module') |
#/usr/bin/env python
def my_func1(callback):
def func_wrapper(x):
print("my_func1: {0} ".format(callback(x)))
return func_wrapper
@my_func1
def my_func2(x):
return x
# Actuall call sequence is similar to:
# deco = my_func1(my_func2)
# deco("test") => func_wrapper("test")
my_func2("test")
#-------------------------------------------
# Test decorator with parameter
def dec_param(param):
def my_func3(callback):
def func_wrapper(x):
print("my_func3: {0} {1} ".format(param, callback(x)))
return func_wrapper
return my_func3
@dec_param("tag")
def my_func4(x):
return x
# Actuall call sequence is similar to:
# deco = dec_pram("tag", my_func3(my_func4))
# deco("test") => func_wrapper("test")
my_func4("test")
| def my_func1(callback):
def func_wrapper(x):
print('my_func1: {0} '.format(callback(x)))
return func_wrapper
@my_func1
def my_func2(x):
return x
my_func2('test')
def dec_param(param):
def my_func3(callback):
def func_wrapper(x):
print('my_func3: {0} {1} '.format(param, callback(x)))
return func_wrapper
return my_func3
@dec_param('tag')
def my_func4(x):
return x
my_func4('test') |
# HARD
# Rolling Hash Method
# abc ==> a *26^2, b * 26^1, c * 26^0.
# ex: 123 ==> 1*10^2, 2 * 10^1, 3 * 10^0
# we find every possible substring to find if exist a duplicated one
# start with mid, if possible ==> find longer one else find shorter one
# Time O(NlogN) Space: O(N)
class Solution:
def longestDupSubstring(self, S: str) -> str:
n = len(S)
nums = [ord(S[i])- ord('a') for i in range(n)]
a = 26
mod = 2**32
#print(nums)
left,right = 1,n
while left <=right:
mid = left +(right-left >>1)
if self.match(mid,a,mod,n,nums) != -1:
left = mid +1
else:
right = mid -1
start = self.match(mid-1,a,mod,n,nums)
return S[start:start+left -1]
def match(self,mid,a,mod,n,nums):
h = 0
print('mid',mid)
for i in range(mid):
h = (h*a + nums[i])% mod
print(i,nums[i],h)
seen = set([h])
aMid = pow(a,mid,mod)
for i in range(1,n-mid+1):
h = (h*a - nums[i-1] *aMid + nums[i+mid-1]) % mod
if h in seen:
return i
seen.add(h)
return -1
| class Solution:
def longest_dup_substring(self, S: str) -> str:
n = len(S)
nums = [ord(S[i]) - ord('a') for i in range(n)]
a = 26
mod = 2 ** 32
(left, right) = (1, n)
while left <= right:
mid = left + (right - left >> 1)
if self.match(mid, a, mod, n, nums) != -1:
left = mid + 1
else:
right = mid - 1
start = self.match(mid - 1, a, mod, n, nums)
return S[start:start + left - 1]
def match(self, mid, a, mod, n, nums):
h = 0
print('mid', mid)
for i in range(mid):
h = (h * a + nums[i]) % mod
print(i, nums[i], h)
seen = set([h])
a_mid = pow(a, mid, mod)
for i in range(1, n - mid + 1):
h = (h * a - nums[i - 1] * aMid + nums[i + mid - 1]) % mod
if h in seen:
return i
seen.add(h)
return -1 |
def squareme(x):
return(x**2)
myvar = input("Give me a number to square: ")
myvar = float(myvar)
print("The square of %f is %f." % (myvar, squareme(myvar)) )
| def squareme(x):
return x ** 2
myvar = input('Give me a number to square: ')
myvar = float(myvar)
print('The square of %f is %f.' % (myvar, squareme(myvar))) |
class Solution:
def rotate(self, N, D):
D = D%16
val1 = ((N << D) % (2 ** 16)) ^ int(N // (2 ** (16 - D)))
#val1 = (N << D) | (N >> (16 - D))
val2 = (N >> D) ^ int((2 ** (16 - D)) * (N % (2 ** D)))
return [val1, val2]
if __name__ == '__main__':
t = int(input())
for _ in range(t):
n, d = input().strip().split(" ")
n, d = int(n), int(d)
ob = Solution()
ans = ob.rotate(n, d)
print(ans[0])
print(ans[1])
| class Solution:
def rotate(self, N, D):
d = D % 16
val1 = (N << D) % 2 ** 16 ^ int(N // 2 ** (16 - D))
val2 = N >> D ^ int(2 ** (16 - D) * (N % 2 ** D))
return [val1, val2]
if __name__ == '__main__':
t = int(input())
for _ in range(t):
(n, d) = input().strip().split(' ')
(n, d) = (int(n), int(d))
ob = solution()
ans = ob.rotate(n, d)
print(ans[0])
print(ans[1]) |
def test_expect_error(testdir):
string = """
Lorem ipsum
<!--pytest-codeblocks:expect-exception-->
```python
raise RuntimeError()
```
"""
testdir.makefile(".md", string)
result = testdir.runpytest("--codeblocks")
result.assert_outcomes(passed=1)
def test_expect_error_fail(testdir):
string1 = """
Lorem ipsum
<!--pytest-codeblocks:expect-exception-->
```python
1 + 1
```
"""
testdir.makefile(".md", string1)
result = testdir.runpytest("--codeblocks")
result.assert_outcomes(failed=1)
| def test_expect_error(testdir):
string = '\n Lorem ipsum\n <!--pytest-codeblocks:expect-exception-->\n ```python\n raise RuntimeError()\n ```\n '
testdir.makefile('.md', string)
result = testdir.runpytest('--codeblocks')
result.assert_outcomes(passed=1)
def test_expect_error_fail(testdir):
string1 = '\n Lorem ipsum\n <!--pytest-codeblocks:expect-exception-->\n ```python\n 1 + 1\n ```\n '
testdir.makefile('.md', string1)
result = testdir.runpytest('--codeblocks')
result.assert_outcomes(failed=1) |
# These are words that will appear in most intros, and should be ignored when calculating
# the similarity score.
# TODO: improve the set of words that we should ignore.
IGNORED_WORDS = set(["I", "I'm", "and", "a", "to"])
class Student:
name = ""
email = ""
year = 1
gender = "Female"
should_match_with_same_gender = False
intro = ""
def __init__(self, name, email, year, gender, should_match_with_same_gender, intro):
self.name = name
self.email = email
self.year = year
self.gender = gender
self.should_match_with_same_gender = should_match_with_same_gender
self.intro = intro
def __eq__(self, other):
return self.email == other.email
def __hash__(self):
return hash(self.email)
def build_rankings(from_students, to_students):
"""
Build dictionary of students to list of their preferred students, in order.
Parameters
----------
from_students: Iterable[Student]
These students are the rankers, used as dict keys
to_students: Iterable[Student]
These students are the rankees, used as dict values
Output
------
Dict[Student, List[Student]]
"""
def getvalue(pair):
return pair[1]
rankings = {}
for student in from_students:
student_rankings = {}
for other_student in to_students:
student_rankings[other_student] = _calculate_points(student, other_student)
student_rankings_pairs = sorted(student_rankings.items(), key=getvalue, reverse=True)
student_rankings_list = [other for other, _ in student_rankings_pairs]
rankings[student] = student_rankings_list
return rankings
def _calculate_points(ranker, rankee):
"""
Quantify how much the ranker might prefer to be matched with the rankee based on
whether or not the ranker has a gender preference, and how similar their intros are.
"""
# Add points based on words shared in intros
points = 0
ranker_words = set(ranker.intro.split())
rankee_words = set(rankee.intro.split())
words_in_common = ranker_words.intersection(rankee_words).difference(IGNORED_WORDS)
points += len(words_in_common)
# Add points if gender preferences match
if ranker.should_match_with_same_gender and ranker.gender == rankee.gender:
points += 10
return points
| ignored_words = set(['I', "I'm", 'and', 'a', 'to'])
class Student:
name = ''
email = ''
year = 1
gender = 'Female'
should_match_with_same_gender = False
intro = ''
def __init__(self, name, email, year, gender, should_match_with_same_gender, intro):
self.name = name
self.email = email
self.year = year
self.gender = gender
self.should_match_with_same_gender = should_match_with_same_gender
self.intro = intro
def __eq__(self, other):
return self.email == other.email
def __hash__(self):
return hash(self.email)
def build_rankings(from_students, to_students):
"""
Build dictionary of students to list of their preferred students, in order.
Parameters
----------
from_students: Iterable[Student]
These students are the rankers, used as dict keys
to_students: Iterable[Student]
These students are the rankees, used as dict values
Output
------
Dict[Student, List[Student]]
"""
def getvalue(pair):
return pair[1]
rankings = {}
for student in from_students:
student_rankings = {}
for other_student in to_students:
student_rankings[other_student] = _calculate_points(student, other_student)
student_rankings_pairs = sorted(student_rankings.items(), key=getvalue, reverse=True)
student_rankings_list = [other for (other, _) in student_rankings_pairs]
rankings[student] = student_rankings_list
return rankings
def _calculate_points(ranker, rankee):
"""
Quantify how much the ranker might prefer to be matched with the rankee based on
whether or not the ranker has a gender preference, and how similar their intros are.
"""
points = 0
ranker_words = set(ranker.intro.split())
rankee_words = set(rankee.intro.split())
words_in_common = ranker_words.intersection(rankee_words).difference(IGNORED_WORDS)
points += len(words_in_common)
if ranker.should_match_with_same_gender and ranker.gender == rankee.gender:
points += 10
return points |
#
# PySNMP MIB module HUAWEI-PPP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-PPP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:36:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint")
hwDatacomm, = mibBuilder.importSymbols("HUAWEI-MIB", "hwDatacomm")
InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex")
NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
ModuleIdentity, MibIdentifier, Gauge32, ObjectIdentity, Integer32, Counter32, Counter64, NotificationType, Unsigned32, iso, Bits, TimeTicks, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "MibIdentifier", "Gauge32", "ObjectIdentity", "Integer32", "Counter32", "Counter64", "NotificationType", "Unsigned32", "iso", "Bits", "TimeTicks", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
TruthValue, DisplayString, RowStatus, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "DisplayString", "RowStatus", "TextualConvention")
hwPppMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169))
if mibBuilder.loadTexts: hwPppMIB.setLastUpdated('200710172230Z')
if mibBuilder.loadTexts: hwPppMIB.setOrganization('Huawei Technologies co.,Ltd.')
hwPppObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1))
hwPppConfigTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1), )
if mibBuilder.loadTexts: hwPppConfigTable.setStatus('current')
hwPppConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1), ).setIndexNames((0, "HUAWEI-PPP-MIB", "hwPppIfIndex"))
if mibBuilder.loadTexts: hwPppConfigEntry.setStatus('current')
hwPppIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: hwPppIfIndex.setStatus('current')
hwPppMruNegType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ipv4", 1), ("ipv6", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hwPppMruNegType.setStatus('current')
hwPppMpIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1, 12), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hwPppMpIfIndex.setStatus('current')
hwPppAuthenticateTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2), )
if mibBuilder.loadTexts: hwPppAuthenticateTable.setStatus('current')
hwPppAuthenticateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1), ).setIndexNames((0, "HUAWEI-PPP-MIB", "hwPppIfIndex"))
if mibBuilder.loadTexts: hwPppAuthenticateEntry.setStatus('current')
hwPppAuthenticateMode = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("chap", 1), ("pap", 2), ("chappap", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hwPppAuthenticateMode.setStatus('current')
hwPppAuthenticateChapUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 12), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hwPppAuthenticateChapUserName.setStatus('current')
hwPppAuthenticateChapPwType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("cipher", 1), ("simple", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hwPppAuthenticateChapPwType.setStatus('current')
hwPppAuthenticateChapPw = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 14), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(1, 16), ValueSizeConstraint(24, 24), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hwPppAuthenticateChapPw.setStatus('current')
hwPppAuthenticatePapUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 15), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hwPppAuthenticatePapUserName.setStatus('current')
hwPppAuthenticatePapPwType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("cipher", 1), ("simple", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hwPppAuthenticatePapPwType.setStatus('current')
hwPppAuthenticatePapPw = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 17), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(1, 16), ValueSizeConstraint(24, 24), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hwPppAuthenticatePapPw.setStatus('current')
hwPppConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11))
hwPppCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 1))
hwPppCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 1, 1)).setObjects(("HUAWEI-PPP-MIB", "hwPppConfigObjectGroup"), ("HUAWEI-PPP-MIB", "hwPppAuthenticateObjectGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hwPppCompliance = hwPppCompliance.setStatus('current')
hwPppGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 2))
hwPppConfigObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 2, 1)).setObjects(("HUAWEI-PPP-MIB", "hwPppMruNegType"), ("HUAWEI-PPP-MIB", "hwPppMpIfIndex"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hwPppConfigObjectGroup = hwPppConfigObjectGroup.setStatus('current')
hwPppAuthenticateObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 2, 2)).setObjects(("HUAWEI-PPP-MIB", "hwPppAuthenticateMode"), ("HUAWEI-PPP-MIB", "hwPppAuthenticateChapUserName"), ("HUAWEI-PPP-MIB", "hwPppAuthenticateChapPwType"), ("HUAWEI-PPP-MIB", "hwPppAuthenticateChapPw"), ("HUAWEI-PPP-MIB", "hwPppAuthenticatePapUserName"), ("HUAWEI-PPP-MIB", "hwPppAuthenticatePapPwType"), ("HUAWEI-PPP-MIB", "hwPppAuthenticatePapPw"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hwPppAuthenticateObjectGroup = hwPppAuthenticateObjectGroup.setStatus('current')
mibBuilder.exportSymbols("HUAWEI-PPP-MIB", hwPppAuthenticateMode=hwPppAuthenticateMode, hwPppAuthenticateChapUserName=hwPppAuthenticateChapUserName, hwPppConformance=hwPppConformance, hwPppIfIndex=hwPppIfIndex, hwPppAuthenticatePapPw=hwPppAuthenticatePapPw, hwPppConfigObjectGroup=hwPppConfigObjectGroup, hwPppMruNegType=hwPppMruNegType, hwPppCompliances=hwPppCompliances, PYSNMP_MODULE_ID=hwPppMIB, hwPppGroups=hwPppGroups, hwPppAuthenticateEntry=hwPppAuthenticateEntry, hwPppObjects=hwPppObjects, hwPppConfigEntry=hwPppConfigEntry, hwPppAuthenticateTable=hwPppAuthenticateTable, hwPppAuthenticateChapPw=hwPppAuthenticateChapPw, hwPppAuthenticateChapPwType=hwPppAuthenticateChapPwType, hwPppAuthenticatePapUserName=hwPppAuthenticatePapUserName, hwPppCompliance=hwPppCompliance, hwPppConfigTable=hwPppConfigTable, hwPppAuthenticateObjectGroup=hwPppAuthenticateObjectGroup, hwPppAuthenticatePapPwType=hwPppAuthenticatePapPwType, hwPppMIB=hwPppMIB, hwPppMpIfIndex=hwPppMpIfIndex)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueRangeConstraint', 'SingleValueConstraint', 'ValueSizeConstraint')
(hw_datacomm,) = mibBuilder.importSymbols('HUAWEI-MIB', 'hwDatacomm')
(interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex')
(notification_group, object_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ObjectGroup', 'ModuleCompliance')
(module_identity, mib_identifier, gauge32, object_identity, integer32, counter32, counter64, notification_type, unsigned32, iso, bits, time_ticks, ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'MibIdentifier', 'Gauge32', 'ObjectIdentity', 'Integer32', 'Counter32', 'Counter64', 'NotificationType', 'Unsigned32', 'iso', 'Bits', 'TimeTicks', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn')
(truth_value, display_string, row_status, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'DisplayString', 'RowStatus', 'TextualConvention')
hw_ppp_mib = module_identity((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169))
if mibBuilder.loadTexts:
hwPppMIB.setLastUpdated('200710172230Z')
if mibBuilder.loadTexts:
hwPppMIB.setOrganization('Huawei Technologies co.,Ltd.')
hw_ppp_objects = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1))
hw_ppp_config_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1))
if mibBuilder.loadTexts:
hwPppConfigTable.setStatus('current')
hw_ppp_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1)).setIndexNames((0, 'HUAWEI-PPP-MIB', 'hwPppIfIndex'))
if mibBuilder.loadTexts:
hwPppConfigEntry.setStatus('current')
hw_ppp_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1, 1), interface_index())
if mibBuilder.loadTexts:
hwPppIfIndex.setStatus('current')
hw_ppp_mru_neg_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('ipv4', 1), ('ipv6', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hwPppMruNegType.setStatus('current')
hw_ppp_mp_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1, 12), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hwPppMpIfIndex.setStatus('current')
hw_ppp_authenticate_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2))
if mibBuilder.loadTexts:
hwPppAuthenticateTable.setStatus('current')
hw_ppp_authenticate_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1)).setIndexNames((0, 'HUAWEI-PPP-MIB', 'hwPppIfIndex'))
if mibBuilder.loadTexts:
hwPppAuthenticateEntry.setStatus('current')
hw_ppp_authenticate_mode = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('chap', 1), ('pap', 2), ('chappap', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hwPppAuthenticateMode.setStatus('current')
hw_ppp_authenticate_chap_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 12), octet_string().subtype(subtypeSpec=value_size_constraint(1, 64))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hwPppAuthenticateChapUserName.setStatus('current')
hw_ppp_authenticate_chap_pw_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('cipher', 1), ('simple', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hwPppAuthenticateChapPwType.setStatus('current')
hw_ppp_authenticate_chap_pw = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 14), octet_string().subtype(subtypeSpec=constraints_union(value_size_constraint(1, 16), value_size_constraint(24, 24)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hwPppAuthenticateChapPw.setStatus('current')
hw_ppp_authenticate_pap_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 15), octet_string().subtype(subtypeSpec=value_size_constraint(1, 64))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hwPppAuthenticatePapUserName.setStatus('current')
hw_ppp_authenticate_pap_pw_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 16), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('cipher', 1), ('simple', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hwPppAuthenticatePapPwType.setStatus('current')
hw_ppp_authenticate_pap_pw = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 17), octet_string().subtype(subtypeSpec=constraints_union(value_size_constraint(1, 16), value_size_constraint(24, 24)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hwPppAuthenticatePapPw.setStatus('current')
hw_ppp_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11))
hw_ppp_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 1))
hw_ppp_compliance = module_compliance((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 1, 1)).setObjects(('HUAWEI-PPP-MIB', 'hwPppConfigObjectGroup'), ('HUAWEI-PPP-MIB', 'hwPppAuthenticateObjectGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hw_ppp_compliance = hwPppCompliance.setStatus('current')
hw_ppp_groups = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 2))
hw_ppp_config_object_group = object_group((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 2, 1)).setObjects(('HUAWEI-PPP-MIB', 'hwPppMruNegType'), ('HUAWEI-PPP-MIB', 'hwPppMpIfIndex'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hw_ppp_config_object_group = hwPppConfigObjectGroup.setStatus('current')
hw_ppp_authenticate_object_group = object_group((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 2, 2)).setObjects(('HUAWEI-PPP-MIB', 'hwPppAuthenticateMode'), ('HUAWEI-PPP-MIB', 'hwPppAuthenticateChapUserName'), ('HUAWEI-PPP-MIB', 'hwPppAuthenticateChapPwType'), ('HUAWEI-PPP-MIB', 'hwPppAuthenticateChapPw'), ('HUAWEI-PPP-MIB', 'hwPppAuthenticatePapUserName'), ('HUAWEI-PPP-MIB', 'hwPppAuthenticatePapPwType'), ('HUAWEI-PPP-MIB', 'hwPppAuthenticatePapPw'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hw_ppp_authenticate_object_group = hwPppAuthenticateObjectGroup.setStatus('current')
mibBuilder.exportSymbols('HUAWEI-PPP-MIB', hwPppAuthenticateMode=hwPppAuthenticateMode, hwPppAuthenticateChapUserName=hwPppAuthenticateChapUserName, hwPppConformance=hwPppConformance, hwPppIfIndex=hwPppIfIndex, hwPppAuthenticatePapPw=hwPppAuthenticatePapPw, hwPppConfigObjectGroup=hwPppConfigObjectGroup, hwPppMruNegType=hwPppMruNegType, hwPppCompliances=hwPppCompliances, PYSNMP_MODULE_ID=hwPppMIB, hwPppGroups=hwPppGroups, hwPppAuthenticateEntry=hwPppAuthenticateEntry, hwPppObjects=hwPppObjects, hwPppConfigEntry=hwPppConfigEntry, hwPppAuthenticateTable=hwPppAuthenticateTable, hwPppAuthenticateChapPw=hwPppAuthenticateChapPw, hwPppAuthenticateChapPwType=hwPppAuthenticateChapPwType, hwPppAuthenticatePapUserName=hwPppAuthenticatePapUserName, hwPppCompliance=hwPppCompliance, hwPppConfigTable=hwPppConfigTable, hwPppAuthenticateObjectGroup=hwPppAuthenticateObjectGroup, hwPppAuthenticatePapPwType=hwPppAuthenticatePapPwType, hwPppMIB=hwPppMIB, hwPppMpIfIndex=hwPppMpIfIndex) |
class ColorLanguageTranslator:
START = "CRYCYMCRW"
END = "CMW"
@staticmethod
def base7(num):
if num == 0:
return '0'
new_num_string = ''
current = num
while current != 0:
remainder = current % 7
remainder_string = str(remainder)
new_num_string = remainder_string + new_num_string
current //= 7
return new_num_string
# Function for converting a base-7 number(given as a string) to a 3 digit color code:
@staticmethod
def base7_to_color_code(num):
colorDict = {
'0': 'K',
'1': 'R',
'2': 'G',
'3': 'Y',
'4': 'B',
'5': 'M',
'6': 'C',
}
if len(num) == 1:
num = "00" + num
elif len(num) == 2:
num = "0" + num
chars = list(num)
return colorDict[chars[0]] + colorDict[chars[1]] + colorDict[chars[2]]
@staticmethod
def translate(byte_array):
color_sequence = "".join([ColorLanguageTranslator.base7_to_color_code(ColorLanguageTranslator.base7(x)) for x in byte_array])
sequence_with_repetition = ColorLanguageTranslator.START + color_sequence + ColorLanguageTranslator.END
end_sequence = ""
for i, c in enumerate(sequence_with_repetition):
if i == 0 or sequence_with_repetition[i - 1] != c or end_sequence[i - 1] == 'W':
end_sequence += c
else:
end_sequence += 'W'
return end_sequence | class Colorlanguagetranslator:
start = 'CRYCYMCRW'
end = 'CMW'
@staticmethod
def base7(num):
if num == 0:
return '0'
new_num_string = ''
current = num
while current != 0:
remainder = current % 7
remainder_string = str(remainder)
new_num_string = remainder_string + new_num_string
current //= 7
return new_num_string
@staticmethod
def base7_to_color_code(num):
color_dict = {'0': 'K', '1': 'R', '2': 'G', '3': 'Y', '4': 'B', '5': 'M', '6': 'C'}
if len(num) == 1:
num = '00' + num
elif len(num) == 2:
num = '0' + num
chars = list(num)
return colorDict[chars[0]] + colorDict[chars[1]] + colorDict[chars[2]]
@staticmethod
def translate(byte_array):
color_sequence = ''.join([ColorLanguageTranslator.base7_to_color_code(ColorLanguageTranslator.base7(x)) for x in byte_array])
sequence_with_repetition = ColorLanguageTranslator.START + color_sequence + ColorLanguageTranslator.END
end_sequence = ''
for (i, c) in enumerate(sequence_with_repetition):
if i == 0 or sequence_with_repetition[i - 1] != c or end_sequence[i - 1] == 'W':
end_sequence += c
else:
end_sequence += 'W'
return end_sequence |
class RhinoObjectSelectionEventArgs(EventArgs):
# no doc
Document=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: Document(self: RhinoObjectSelectionEventArgs) -> RhinoDoc
"""
RhinoObjects=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: RhinoObjects(self: RhinoObjectSelectionEventArgs) -> Array[RhinoObject]
"""
Selected=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Returns true if objects are being selected.
Returns false if objects are being deseleced.
Get: Selected(self: RhinoObjectSelectionEventArgs) -> bool
"""
| class Rhinoobjectselectioneventargs(EventArgs):
document = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: Document(self: RhinoObjectSelectionEventArgs) -> RhinoDoc\n\n\n\n'
rhino_objects = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: RhinoObjects(self: RhinoObjectSelectionEventArgs) -> Array[RhinoObject]\n\n\n\n'
selected = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Returns true if objects are being selected.\n\n Returns false if objects are being deseleced.\n\n\n\nGet: Selected(self: RhinoObjectSelectionEventArgs) -> bool\n\n\n\n' |
#https://codeforces.com/problemset/problem/734/A
input()
string = input()
a = string.count('A')
d = string.count('D')
if(a>d):
print('Anton')
elif d>a:
print('Danik')
else:
print('Friendship') | input()
string = input()
a = string.count('A')
d = string.count('D')
if a > d:
print('Anton')
elif d > a:
print('Danik')
else:
print('Friendship') |
class ConnectionValidationInfo(object,IDisposable):
"""
This object contains information about fabrication connection validations.
ConnectionValidationInfo()
"""
def Dispose(self):
""" Dispose(self: ConnectionValidationInfo) """
pass
def GetWarning(self,index):
"""
GetWarning(self: ConnectionValidationInfo,index: int) -> ConnectionValidationWarning
Access specific warning number of warnings generated by reload.
"""
pass
def IsValidWarningIndex(self,index):
"""
IsValidWarningIndex(self: ConnectionValidationInfo,index: int) -> bool
Validate warning index.
"""
pass
def ManyWarnings(self):
"""
ManyWarnings(self: ConnectionValidationInfo) -> int
Returns number of warnings generated by reload.
"""
pass
def ReleaseUnmanagedResources(self,*args):
""" ReleaseUnmanagedResources(self: ConnectionValidationInfo,disposing: bool) """
pass
def __enter__(self,*args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self,*args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
IsValidObject=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Specifies whether the .NET object represents a valid Revit entity.
Get: IsValidObject(self: ConnectionValidationInfo) -> bool
"""
| class Connectionvalidationinfo(object, IDisposable):
"""
This object contains information about fabrication connection validations.
ConnectionValidationInfo()
"""
def dispose(self):
""" Dispose(self: ConnectionValidationInfo) """
pass
def get_warning(self, index):
"""
GetWarning(self: ConnectionValidationInfo,index: int) -> ConnectionValidationWarning
Access specific warning number of warnings generated by reload.
"""
pass
def is_valid_warning_index(self, index):
"""
IsValidWarningIndex(self: ConnectionValidationInfo,index: int) -> bool
Validate warning index.
"""
pass
def many_warnings(self):
"""
ManyWarnings(self: ConnectionValidationInfo) -> int
Returns number of warnings generated by reload.
"""
pass
def release_unmanaged_resources(self, *args):
""" ReleaseUnmanagedResources(self: ConnectionValidationInfo,disposing: bool) """
pass
def __enter__(self, *args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self, *args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __repr__(self, *args):
""" __repr__(self: object) -> str """
pass
is_valid_object = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Specifies whether the .NET object represents a valid Revit entity.\n\n\n\nGet: IsValidObject(self: ConnectionValidationInfo) -> bool\n\n\n\n' |
# Round the number from input to the required number of
# decimals.
# The input format:
# Two lines: the first with a floating-point number, the second
# with an integer representing the decimal count.
# The output format:
# A formatted string containing the rounded number.
# Do NOT forget to convert the input numbers and to enclose
# each value in {} in a formatted string
# Sample Input 1:
# 2.71828
# 3
# Sample Output 1:
# 2.718
# first solution
decimal = float(input())
nth_place = int(input())
print(f'%.{nth_place}f' % decimal)
#second sol
print(f'{decimal:.{nth_place}f}')
#one line code
print(f"{float(input()):.{int(input())}f}")
| decimal = float(input())
nth_place = int(input())
print(f'%.{nth_place}f' % decimal)
print(f'{decimal:.{nth_place}f}')
print(f'{float(input()):.{int(input())}f}') |
#
# Copyright (c) 2022 Samuel J. McKelvie
#
# MIT License - See LICENSE file accompanying this package.
#
"""Exception classes for cloud_init_gen package"""
class CloudInitGenError(Exception):
"""Generic exception raised by package cloud_init_gen"""
pass
| """Exception classes for cloud_init_gen package"""
class Cloudinitgenerror(Exception):
"""Generic exception raised by package cloud_init_gen"""
pass |
'''
This is the position of all the pieces, in a dictionary. This data is essential for the gameplay to work
'''
position_dic = { 'a1': "Left White Rook", 'b1': "Left White Knight", 'c1': "Left White Bishop", 'd1': "White Queen", 'e1': "White King", 'f1': "Right White Bishop", 'g1': "Right White Knight", 'h1': "Right White Rook",
'a2': "White Pawn1", 'b2': "White Pawn2", 'c2': "White Pawn3", 'd2': "White Pawn4", 'e2': "White Pawn5", 'f2': "White Pawn6", 'g2': "White Pawn7", 'h2': "White Pawn8",
'a3': "None", 'b3': "None", 'c3': "None", 'd3': "None", 'e3': "None", 'f3': "None", 'g3': "None", 'h3': "None",
'a4': "None", 'b4': "None", 'c4': "None", 'd4': "None", 'e4': "None", 'f4': "None", 'g4': "None", 'h4': "None",
'a5': "None", 'b5': "None", 'c5': "None", 'd5': "None", 'e5': "None", 'f5': "None", 'g5': "None", 'h5': "None",
'a6': "None", 'b6': "None", 'c6': "None", 'd6': "None", 'e6': "None", 'f6': "None", 'g6': "None", 'h6': "None",
'a8': "Left Black Rook", 'b8': "Left Black Knight", 'c8': "Left Black Bishop", 'd8': "Black Queen", 'e8': "Black King", 'f8': "Right Black Bishop", 'g8': "Right Black Knight", 'h8': "Right Black Rook",
'a7': "Black Pawn1", 'b7': "Black Pawn2", 'c7': "Black Pawn3", 'd7': "Black Pawn4", 'e7': "Black Pawn5", 'f7': "Black Pawn6", 'g7': "Black Pawn7", 'h7': "Black Pawn8"
}
'''
Decalres what team is allowed to move their pieces
'''
conversion_to_number = {'a1': 1, 'b1': 2, 'c1': 3, 'd1':4, 'e1':5, 'f1':6, 'g1':7, 'h1':8,
'a2': 9, 'b2': 10, 'c2': 11, 'd2':12, 'e2':13, 'f2':14, 'g2':15, 'h2':16,
'a3': 17, 'b3': 18, 'c3': 19, 'd3':20, 'e3':21, 'f3':22, 'g3':23, 'h3':24,
'a4': 25, 'b4': 26, 'c4': 27, 'd4':28, 'e4':29, 'f4':30, 'g4':31, 'h4':32,
'a5': 33, 'b5': 34, 'c5': 35, 'd5':36, 'e5':37, 'f5':38, 'g5':39, 'h5':40,
'a6': 41, 'b6': 42, 'c6': 43, 'd6':44, 'e6':45, 'f6':46, 'g6':47, 'h6':48,
'a7': 49, 'b7': 50, 'c7':51, 'd7':52, 'e7':53, 'f7':54, 'g7':55, 'h7':56,
'a8': 57, 'b8': 58, 'c8': 59, 'd8':60, 'e8':61, 'f8':62, 'g8':63, 'h8':64}
team_turn = 1
| """
This is the position of all the pieces, in a dictionary. This data is essential for the gameplay to work
"""
position_dic = {'a1': 'Left White Rook', 'b1': 'Left White Knight', 'c1': 'Left White Bishop', 'd1': 'White Queen', 'e1': 'White King', 'f1': 'Right White Bishop', 'g1': 'Right White Knight', 'h1': 'Right White Rook', 'a2': 'White Pawn1', 'b2': 'White Pawn2', 'c2': 'White Pawn3', 'd2': 'White Pawn4', 'e2': 'White Pawn5', 'f2': 'White Pawn6', 'g2': 'White Pawn7', 'h2': 'White Pawn8', 'a3': 'None', 'b3': 'None', 'c3': 'None', 'd3': 'None', 'e3': 'None', 'f3': 'None', 'g3': 'None', 'h3': 'None', 'a4': 'None', 'b4': 'None', 'c4': 'None', 'd4': 'None', 'e4': 'None', 'f4': 'None', 'g4': 'None', 'h4': 'None', 'a5': 'None', 'b5': 'None', 'c5': 'None', 'd5': 'None', 'e5': 'None', 'f5': 'None', 'g5': 'None', 'h5': 'None', 'a6': 'None', 'b6': 'None', 'c6': 'None', 'd6': 'None', 'e6': 'None', 'f6': 'None', 'g6': 'None', 'h6': 'None', 'a8': 'Left Black Rook', 'b8': 'Left Black Knight', 'c8': 'Left Black Bishop', 'd8': 'Black Queen', 'e8': 'Black King', 'f8': 'Right Black Bishop', 'g8': 'Right Black Knight', 'h8': 'Right Black Rook', 'a7': 'Black Pawn1', 'b7': 'Black Pawn2', 'c7': 'Black Pawn3', 'd7': 'Black Pawn4', 'e7': 'Black Pawn5', 'f7': 'Black Pawn6', 'g7': 'Black Pawn7', 'h7': 'Black Pawn8'}
'\nDecalres what team is allowed to move their pieces\n'
conversion_to_number = {'a1': 1, 'b1': 2, 'c1': 3, 'd1': 4, 'e1': 5, 'f1': 6, 'g1': 7, 'h1': 8, 'a2': 9, 'b2': 10, 'c2': 11, 'd2': 12, 'e2': 13, 'f2': 14, 'g2': 15, 'h2': 16, 'a3': 17, 'b3': 18, 'c3': 19, 'd3': 20, 'e3': 21, 'f3': 22, 'g3': 23, 'h3': 24, 'a4': 25, 'b4': 26, 'c4': 27, 'd4': 28, 'e4': 29, 'f4': 30, 'g4': 31, 'h4': 32, 'a5': 33, 'b5': 34, 'c5': 35, 'd5': 36, 'e5': 37, 'f5': 38, 'g5': 39, 'h5': 40, 'a6': 41, 'b6': 42, 'c6': 43, 'd6': 44, 'e6': 45, 'f6': 46, 'g6': 47, 'h6': 48, 'a7': 49, 'b7': 50, 'c7': 51, 'd7': 52, 'e7': 53, 'f7': 54, 'g7': 55, 'h7': 56, 'a8': 57, 'b8': 58, 'c8': 59, 'd8': 60, 'e8': 61, 'f8': 62, 'g8': 63, 'h8': 64}
team_turn = 1 |
count = 0
def max_ind_set(nodes, edges):
global count
if len(nodes) <= 1: return len(nodes)
node = nodes[0] # pick a node
# case 1: node lies in independent set => remove neighbours as well
nodes1 = [ n for n in nodes if n != node and (node, n) not in edges ]
size1 = 1 + max_ind_set(nodes1, edges)
count += 1
# case 2: node does not lie in independent set
nodes2 = [ n for n in nodes if n != node ]
size2 = max_ind_set(nodes2, edges)
count += 1
return max(size1, size2)
def max_ind_set_improved(nodes, edges):
if len(nodes) <= 1: return len(nodes)
node = nodes[0] # pick a node
# case 1: node lies in independent set => remove neighbours as well
nodes1 = [ n for n in nodes if n != node and (node, n) not in edges ]
size1 = 1 + max_ind_set_improved(nodes1, edges)
if len([ n for n in nodes if (node, n) in edges ]) <= 1:
return size1
# case 2: node does not lie in independent set
nodes2 = [ n for n in nodes if n != node ]
size2 = max_ind_set_improved(nodes2, edges)
return max(size1, size2)
if __name__ == '__main__':
nodes = [1,2,3,4,5,6,7,8]
edges = [(1,2),(1,3),(2,3),(2,4),(3,5),(4,5),(4,6),(5,7),(6,7),(6,8),(7,8)]
# undirected graph => edges go in both directions (simplifies algorithms)
edges += [ (b,a) for (a,b) in edges ]
print("max_ind_set = {}".format(max_ind_set(nodes,edges)))
print("max_ind_set_improved = {}".format(max_ind_set_improved(nodes,edges)))
print(count)
| count = 0
def max_ind_set(nodes, edges):
global count
if len(nodes) <= 1:
return len(nodes)
node = nodes[0]
nodes1 = [n for n in nodes if n != node and (node, n) not in edges]
size1 = 1 + max_ind_set(nodes1, edges)
count += 1
nodes2 = [n for n in nodes if n != node]
size2 = max_ind_set(nodes2, edges)
count += 1
return max(size1, size2)
def max_ind_set_improved(nodes, edges):
if len(nodes) <= 1:
return len(nodes)
node = nodes[0]
nodes1 = [n for n in nodes if n != node and (node, n) not in edges]
size1 = 1 + max_ind_set_improved(nodes1, edges)
if len([n for n in nodes if (node, n) in edges]) <= 1:
return size1
nodes2 = [n for n in nodes if n != node]
size2 = max_ind_set_improved(nodes2, edges)
return max(size1, size2)
if __name__ == '__main__':
nodes = [1, 2, 3, 4, 5, 6, 7, 8]
edges = [(1, 2), (1, 3), (2, 3), (2, 4), (3, 5), (4, 5), (4, 6), (5, 7), (6, 7), (6, 8), (7, 8)]
edges += [(b, a) for (a, b) in edges]
print('max_ind_set = {}'.format(max_ind_set(nodes, edges)))
print('max_ind_set_improved = {}'.format(max_ind_set_improved(nodes, edges)))
print(count) |
# encoding: utf-8
# module Grasshopper.Kernel.Undo calls itself Undo
# from Grasshopper,Version=1.0.0.20,Culture=neutral,PublicKeyToken=dda4f5ec2cd80803
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# no functions
# classes
class GH_UndoAction(object, IGH_UndoAction, GH_ISerializable):
# no doc
def Internal_Redo(self, *args):
""" Internal_Redo(self: GH_UndoAction,doc: GH_Document) """
pass
def Internal_Undo(self, *args):
""" Internal_Undo(self: GH_UndoAction,doc: GH_Document) """
pass
def Read(self, reader):
""" Read(self: GH_UndoAction,reader: GH_IReader) -> bool """
pass
def Redo(self, doc):
""" Redo(self: GH_UndoAction,doc: GH_Document) """
pass
def Undo(self, doc):
""" Undo(self: GH_UndoAction,doc: GH_Document) """
pass
def Write(self, writer):
""" Write(self: GH_UndoAction,writer: GH_IWriter) -> bool """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __repr__(self, *args):
""" __repr__(self: object) -> str """
pass
ExpiresDisplay = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: ExpiresDisplay(self: GH_UndoAction) -> bool
"""
ExpiresSolution = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: ExpiresSolution(self: GH_UndoAction) -> bool
"""
State = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: State(self: GH_UndoAction) -> GH_UndoState
"""
class GH_ArchivedUndoAction(GH_UndoAction, IGH_UndoAction, GH_ISerializable):
# no doc
def Deserialize(self, *args):
""" Deserialize(self: GH_ArchivedUndoAction,obj: GH_ISerializable) """
pass
def Internal_Redo(self, *args):
""" Internal_Redo(self: GH_UndoAction,doc: GH_Document) """
pass
def Internal_Undo(self, *args):
""" Internal_Undo(self: GH_UndoAction,doc: GH_Document) """
pass
def Read(self, reader):
""" Read(self: GH_ArchivedUndoAction,reader: GH_IReader) -> bool """
pass
def Serialize(self, *args):
""" Serialize(self: GH_ArchivedUndoAction,obj: GH_ISerializable) """
pass
def SerializeToByteArray(self, *args):
""" SerializeToByteArray(self: GH_ArchivedUndoAction,obj: GH_ISerializable) -> Array[Byte] """
pass
def Write(self, writer):
""" Write(self: GH_ArchivedUndoAction,writer: GH_IWriter) -> bool """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
m_data = None
class GH_ObjectUndoAction(GH_UndoAction, IGH_UndoAction, GH_ISerializable):
# no doc
def Internal_Redo(self, *args):
""" Internal_Redo(self: GH_ObjectUndoAction,doc: GH_Document) """
pass
def Internal_Undo(self, *args):
""" Internal_Undo(self: GH_ObjectUndoAction,doc: GH_Document) """
pass
def Object_Redo(self, *args):
""" Object_Redo(self: GH_ObjectUndoAction,doc: GH_Document,obj: IGH_DocumentObject) """
pass
def Object_Undo(self, *args):
""" Object_Undo(self: GH_ObjectUndoAction,doc: GH_Document,obj: IGH_DocumentObject) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self, *args): # cannot find CLR constructor
""" __new__(cls: type,object_id: Guid) """
pass
class GH_UndoException(Exception, ISerializable, _Exception):
"""
GH_UndoException(message: str)
GH_UndoException(message: str,*args: Array[object])
"""
def add_SerializeObjectState(self, *args):
""" add_SerializeObjectState(self: Exception,value: EventHandler[SafeSerializationEventArgs]) """
pass
def remove_SerializeObjectState(self, *args):
""" remove_SerializeObjectState(self: Exception,value: EventHandler[SafeSerializationEventArgs]) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self, message, args=None):
"""
__new__(cls: type,message: str)
__new__(cls: type,message: str,*args: Array[object])
"""
pass
def __str__(self, *args):
pass
class GH_UndoRecord(object):
"""
GH_UndoRecord()
GH_UndoRecord(name: str)
GH_UndoRecord(name: str,action: IGH_UndoAction)
GH_UndoRecord(name: str,*actions: Array[IGH_UndoAction])
GH_UndoRecord(name: str,actions: IEnumerable[IGH_UndoAction])
"""
def AddAction(self, action):
""" AddAction(self: GH_UndoRecord,action: IGH_UndoAction) """
pass
def Redo(self, doc):
""" Redo(self: GH_UndoRecord,doc: GH_Document) """
pass
def Undo(self, doc):
""" Undo(self: GH_UndoRecord,doc: GH_Document) """
pass
@staticmethod
def __new__(self, name=None, *__args):
"""
__new__(cls: type)
__new__(cls: type,name: str)
__new__(cls: type,name: str,action: IGH_UndoAction)
__new__(cls: type,name: str,*actions: Array[IGH_UndoAction])
__new__(cls: type,name: str,actions: IEnumerable[IGH_UndoAction])
"""
pass
ActionCount = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: ActionCount(self: GH_UndoRecord) -> int
"""
Actions = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: Actions(self: GH_UndoRecord) -> IList[IGH_UndoAction]
"""
ExpiresDisplay = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: ExpiresDisplay(self: GH_UndoRecord) -> bool
"""
ExpiresSolution = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: ExpiresSolution(self: GH_UndoRecord) -> bool
"""
Guid = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: Guid(self: GH_UndoRecord) -> Guid
"""
Name = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: Name(self: GH_UndoRecord) -> str
Set: Name(self: GH_UndoRecord)=value
"""
State = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: State(self: GH_UndoRecord) -> GH_UndoState
"""
Time = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: Time(self: GH_UndoRecord) -> DateTime
"""
class GH_UndoServer(object, IGH_DebugDescription):
""" GH_UndoServer(nOwner: GH_Document) """
def AppendToDebugLog(self, writer):
""" AppendToDebugLog(self: GH_UndoServer,writer: GH_DebugDescriptionWriter) """
pass
def Clear(self):
""" Clear(self: GH_UndoServer) """
pass
def ClearRedo(self):
""" ClearRedo(self: GH_UndoServer) """
pass
def ClearUndo(self):
""" ClearUndo(self: GH_UndoServer) """
pass
def PerformRedo(self):
""" PerformRedo(self: GH_UndoServer) """
pass
def PerformUndo(self):
""" PerformUndo(self: GH_UndoServer) """
pass
def PushUndoRecord(self, *__args):
"""
PushUndoRecord(self: GH_UndoServer,name: str,action: GH_UndoAction) -> Guid
PushUndoRecord(self: GH_UndoServer,record: GH_UndoRecord)
"""
pass
def RemoveRecord(self, id):
""" RemoveRecord(self: GH_UndoServer,id: Guid) -> bool """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self, nOwner):
""" __new__(cls: type,nOwner: GH_Document) """
pass
def __repr__(self, *args):
""" __repr__(self: object) -> str """
pass
FirstRedoName = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: FirstRedoName(self: GH_UndoServer) -> str
"""
FirstUndoName = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: FirstUndoName(self: GH_UndoServer) -> str
"""
MaxRecords = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: MaxRecords(self: GH_UndoServer) -> int
Set: MaxRecords(self: GH_UndoServer)=value
"""
RedoCount = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: RedoCount(self: GH_UndoServer) -> int
"""
RedoGuids = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: RedoGuids(self: GH_UndoServer) -> List[Guid]
"""
RedoNames = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: RedoNames(self: GH_UndoServer) -> List[str]
"""
UndoCount = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: UndoCount(self: GH_UndoServer) -> int
"""
UndoGuids = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: UndoGuids(self: GH_UndoServer) -> List[Guid]
"""
UndoNames = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: UndoNames(self: GH_UndoServer) -> List[str]
"""
class GH_UndoState(Enum, IComparable, IFormattable, IConvertible):
""" enum GH_UndoState,values: redo (1),undo (0) """
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self, *args):
pass
def __gt__(self, *args):
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self, *args):
pass
def __lt__(self, *args):
pass
def __ne__(self, *args):
pass
def __reduce_ex__(self, *args):
pass
def __str__(self, *args):
pass
redo = None
undo = None
value__ = None
class IGH_UndoAction(GH_ISerializable):
# no doc
def Redo(self, doc):
""" Redo(self: IGH_UndoAction,doc: GH_Document) """
pass
def Undo(self, doc):
""" Undo(self: IGH_UndoAction,doc: GH_Document) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
ExpiresDisplay = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: ExpiresDisplay(self: IGH_UndoAction) -> bool
"""
ExpiresSolution = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Get: ExpiresSolution(self: IGH_UndoAction) -> bool
"""
State = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get: State(self: IGH_UndoAction) -> GH_UndoState
"""
# variables with complex values
| """ NamespaceTracker represent a CLS namespace. """
class Gh_Undoaction(object, IGH_UndoAction, GH_ISerializable):
def internal__redo(self, *args):
""" Internal_Redo(self: GH_UndoAction,doc: GH_Document) """
pass
def internal__undo(self, *args):
""" Internal_Undo(self: GH_UndoAction,doc: GH_Document) """
pass
def read(self, reader):
""" Read(self: GH_UndoAction,reader: GH_IReader) -> bool """
pass
def redo(self, doc):
""" Redo(self: GH_UndoAction,doc: GH_Document) """
pass
def undo(self, doc):
""" Undo(self: GH_UndoAction,doc: GH_Document) """
pass
def write(self, writer):
""" Write(self: GH_UndoAction,writer: GH_IWriter) -> bool """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __repr__(self, *args):
""" __repr__(self: object) -> str """
pass
expires_display = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: ExpiresDisplay(self: GH_UndoAction) -> bool\n\n\n\n'
expires_solution = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: ExpiresSolution(self: GH_UndoAction) -> bool\n\n\n\n'
state = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: State(self: GH_UndoAction) -> GH_UndoState\n\n\n\n'
class Gh_Archivedundoaction(GH_UndoAction, IGH_UndoAction, GH_ISerializable):
def deserialize(self, *args):
""" Deserialize(self: GH_ArchivedUndoAction,obj: GH_ISerializable) """
pass
def internal__redo(self, *args):
""" Internal_Redo(self: GH_UndoAction,doc: GH_Document) """
pass
def internal__undo(self, *args):
""" Internal_Undo(self: GH_UndoAction,doc: GH_Document) """
pass
def read(self, reader):
""" Read(self: GH_ArchivedUndoAction,reader: GH_IReader) -> bool """
pass
def serialize(self, *args):
""" Serialize(self: GH_ArchivedUndoAction,obj: GH_ISerializable) """
pass
def serialize_to_byte_array(self, *args):
""" SerializeToByteArray(self: GH_ArchivedUndoAction,obj: GH_ISerializable) -> Array[Byte] """
pass
def write(self, writer):
""" Write(self: GH_ArchivedUndoAction,writer: GH_IWriter) -> bool """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
m_data = None
class Gh_Objectundoaction(GH_UndoAction, IGH_UndoAction, GH_ISerializable):
def internal__redo(self, *args):
""" Internal_Redo(self: GH_ObjectUndoAction,doc: GH_Document) """
pass
def internal__undo(self, *args):
""" Internal_Undo(self: GH_ObjectUndoAction,doc: GH_Document) """
pass
def object__redo(self, *args):
""" Object_Redo(self: GH_ObjectUndoAction,doc: GH_Document,obj: IGH_DocumentObject) """
pass
def object__undo(self, *args):
""" Object_Undo(self: GH_ObjectUndoAction,doc: GH_Document,obj: IGH_DocumentObject) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self, *args):
""" __new__(cls: type,object_id: Guid) """
pass
class Gh_Undoexception(Exception, ISerializable, _Exception):
"""
GH_UndoException(message: str)
GH_UndoException(message: str,*args: Array[object])
"""
def add__serialize_object_state(self, *args):
""" add_SerializeObjectState(self: Exception,value: EventHandler[SafeSerializationEventArgs]) """
pass
def remove__serialize_object_state(self, *args):
""" remove_SerializeObjectState(self: Exception,value: EventHandler[SafeSerializationEventArgs]) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self, message, args=None):
"""
__new__(cls: type,message: str)
__new__(cls: type,message: str,*args: Array[object])
"""
pass
def __str__(self, *args):
pass
class Gh_Undorecord(object):
"""
GH_UndoRecord()
GH_UndoRecord(name: str)
GH_UndoRecord(name: str,action: IGH_UndoAction)
GH_UndoRecord(name: str,*actions: Array[IGH_UndoAction])
GH_UndoRecord(name: str,actions: IEnumerable[IGH_UndoAction])
"""
def add_action(self, action):
""" AddAction(self: GH_UndoRecord,action: IGH_UndoAction) """
pass
def redo(self, doc):
""" Redo(self: GH_UndoRecord,doc: GH_Document) """
pass
def undo(self, doc):
""" Undo(self: GH_UndoRecord,doc: GH_Document) """
pass
@staticmethod
def __new__(self, name=None, *__args):
"""
__new__(cls: type)
__new__(cls: type,name: str)
__new__(cls: type,name: str,action: IGH_UndoAction)
__new__(cls: type,name: str,*actions: Array[IGH_UndoAction])
__new__(cls: type,name: str,actions: IEnumerable[IGH_UndoAction])
"""
pass
action_count = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: ActionCount(self: GH_UndoRecord) -> int\n\n\n\n'
actions = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: Actions(self: GH_UndoRecord) -> IList[IGH_UndoAction]\n\n\n\n'
expires_display = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: ExpiresDisplay(self: GH_UndoRecord) -> bool\n\n\n\n'
expires_solution = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: ExpiresSolution(self: GH_UndoRecord) -> bool\n\n\n\n'
guid = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: Guid(self: GH_UndoRecord) -> Guid\n\n\n\n'
name = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: Name(self: GH_UndoRecord) -> str\n\n\n\nSet: Name(self: GH_UndoRecord)=value\n\n'
state = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: State(self: GH_UndoRecord) -> GH_UndoState\n\n\n\n'
time = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: Time(self: GH_UndoRecord) -> DateTime\n\n\n\n'
class Gh_Undoserver(object, IGH_DebugDescription):
""" GH_UndoServer(nOwner: GH_Document) """
def append_to_debug_log(self, writer):
""" AppendToDebugLog(self: GH_UndoServer,writer: GH_DebugDescriptionWriter) """
pass
def clear(self):
""" Clear(self: GH_UndoServer) """
pass
def clear_redo(self):
""" ClearRedo(self: GH_UndoServer) """
pass
def clear_undo(self):
""" ClearUndo(self: GH_UndoServer) """
pass
def perform_redo(self):
""" PerformRedo(self: GH_UndoServer) """
pass
def perform_undo(self):
""" PerformUndo(self: GH_UndoServer) """
pass
def push_undo_record(self, *__args):
"""
PushUndoRecord(self: GH_UndoServer,name: str,action: GH_UndoAction) -> Guid
PushUndoRecord(self: GH_UndoServer,record: GH_UndoRecord)
"""
pass
def remove_record(self, id):
""" RemoveRecord(self: GH_UndoServer,id: Guid) -> bool """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self, nOwner):
""" __new__(cls: type,nOwner: GH_Document) """
pass
def __repr__(self, *args):
""" __repr__(self: object) -> str """
pass
first_redo_name = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: FirstRedoName(self: GH_UndoServer) -> str\n\n\n\n'
first_undo_name = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: FirstUndoName(self: GH_UndoServer) -> str\n\n\n\n'
max_records = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: MaxRecords(self: GH_UndoServer) -> int\n\n\n\nSet: MaxRecords(self: GH_UndoServer)=value\n\n'
redo_count = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: RedoCount(self: GH_UndoServer) -> int\n\n\n\n'
redo_guids = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: RedoGuids(self: GH_UndoServer) -> List[Guid]\n\n\n\n'
redo_names = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: RedoNames(self: GH_UndoServer) -> List[str]\n\n\n\n'
undo_count = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: UndoCount(self: GH_UndoServer) -> int\n\n\n\n'
undo_guids = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: UndoGuids(self: GH_UndoServer) -> List[Guid]\n\n\n\n'
undo_names = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: UndoNames(self: GH_UndoServer) -> List[str]\n\n\n\n'
class Gh_Undostate(Enum, IComparable, IFormattable, IConvertible):
""" enum GH_UndoState,values: redo (1),undo (0) """
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self, *args):
pass
def __gt__(self, *args):
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self, *args):
pass
def __lt__(self, *args):
pass
def __ne__(self, *args):
pass
def __reduce_ex__(self, *args):
pass
def __str__(self, *args):
pass
redo = None
undo = None
value__ = None
class Igh_Undoaction(GH_ISerializable):
def redo(self, doc):
""" Redo(self: IGH_UndoAction,doc: GH_Document) """
pass
def undo(self, doc):
""" Undo(self: IGH_UndoAction,doc: GH_Document) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
expires_display = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: ExpiresDisplay(self: IGH_UndoAction) -> bool\n\n\n\n'
expires_solution = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: ExpiresSolution(self: IGH_UndoAction) -> bool\n\n\n\n'
state = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: State(self: IGH_UndoAction) -> GH_UndoState\n\n\n\n' |
"""j2cl_test build macro
Works similarly to junit_test; see j2cl_test_common.bzl for details
"""
load(":j2cl_test_common.bzl", "j2cl_test_common")
# buildifier: disable=function-docstring-args
def j2cl_test(
name,
tags = [],
**kwargs):
"""Macro for running a JUnit test cross compiled as a web test
This macro uses the j2cl_test_tranpile macro to transpile tests and feed
them into a jsunit_test.
"""
j2cl_test_common(
name,
tags = tags + ["j2cl"],
**kwargs
)
| """j2cl_test build macro
Works similarly to junit_test; see j2cl_test_common.bzl for details
"""
load(':j2cl_test_common.bzl', 'j2cl_test_common')
def j2cl_test(name, tags=[], **kwargs):
"""Macro for running a JUnit test cross compiled as a web test
This macro uses the j2cl_test_tranpile macro to transpile tests and feed
them into a jsunit_test.
"""
j2cl_test_common(name, tags=tags + ['j2cl'], **kwargs) |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
load("//antlir/bzl:shape.bzl", "shape")
load("//antlir/bzl:target_tagger.bzl", "new_target_tagger", "target_tagger_to_feature")
load(":requires.shape.bzl", "requires_t")
def feature_requires(
users = None,
groups = None,
files = None):
"""
`feature.requires(...)` adds macro-level requirements on image layers.
Currently this supports requiring users, groups and files to exist in the layer
being built. This feature doesn't materialize anything in the built image, but it
will cause a compiler error if any of the users/groups that are requested do not
exist in either the `parent_layer` or the layer being built.
An example of a reasonable use-case of this functionality is defining a macro
that generates systemd units that run as a specific user, where
`feature.requires` can be used for additional compile-time safety that the user,
groups or files do indeed exist.
"""
req = shape.new(
requires_t,
users = users,
groups = groups,
files = files,
)
return target_tagger_to_feature(
new_target_tagger(),
items = struct(requires = [req]),
# The `fake_macro_library` docblock explains this self-dependency
extra_deps = ["//antlir/bzl/image/feature:requires"],
)
| load('//antlir/bzl:shape.bzl', 'shape')
load('//antlir/bzl:target_tagger.bzl', 'new_target_tagger', 'target_tagger_to_feature')
load(':requires.shape.bzl', 'requires_t')
def feature_requires(users=None, groups=None, files=None):
"""
`feature.requires(...)` adds macro-level requirements on image layers.
Currently this supports requiring users, groups and files to exist in the layer
being built. This feature doesn't materialize anything in the built image, but it
will cause a compiler error if any of the users/groups that are requested do not
exist in either the `parent_layer` or the layer being built.
An example of a reasonable use-case of this functionality is defining a macro
that generates systemd units that run as a specific user, where
`feature.requires` can be used for additional compile-time safety that the user,
groups or files do indeed exist.
"""
req = shape.new(requires_t, users=users, groups=groups, files=files)
return target_tagger_to_feature(new_target_tagger(), items=struct(requires=[req]), extra_deps=['//antlir/bzl/image/feature:requires']) |
ENCRYPTED_MESSAGE = 'IQ PQTVJ CV PQQP'
DECRYPTED_MESSAGE = 'GO NORTH AT NOON'
CIPHER_OPTIONS = ['null','caesar','atbash']
cipher_used_in_this_example = CIPHER_OPTIONS[1] # replace with the index of the cipher used in this encryption
| encrypted_message = 'IQ PQTVJ CV PQQP'
decrypted_message = 'GO NORTH AT NOON'
cipher_options = ['null', 'caesar', 'atbash']
cipher_used_in_this_example = CIPHER_OPTIONS[1] |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"img_resize": "00_clipmodel.ipynb",
"imgs_resize": "00_clipmodel.ipynb",
"dict_to_device": "00_clipmodel.ipynb",
"norm": "00_clipmodel.ipynb",
"detach_norm": "00_clipmodel.ipynb",
"text2clip_en": "00_clipmodel.ipynb",
"images2clip_en": "00_clipmodel.ipynb",
"image2clip": "00_clipmodel.ipynb",
"en_model_name": "00_clipmodel.ipynb",
"tokenizer": "00_clipmodel.ipynb",
"en_processor": "00_clipmodel.ipynb",
"en_size": "00_clipmodel.ipynb",
"en_dim": "00_clipmodel.ipynb",
"images2clip": "00_clipmodel.ipynb",
"text2clip": "00_clipmodel.ipynb",
"read_sql_query": "00_custom_pandas.ipynb",
"Path.ls": "00_tools.ipynb",
"mapbox_access_token": "00_paths.ipynb",
"main_path": "00_paths.ipynb",
"data_path": "00_paths.ipynb",
"reference_images_path": "00_paths.ipynb",
"testset_path": "00_paths.ipynb",
"engine": "00_psql.ipynb",
"Session": "00_psql.ipynb",
"session": "00_psql.ipynb",
"Base": "00_psql.ipynb",
"du": "00_psql.ipynb",
"query": "00_psql.ipynb",
"current": "00_psql.ipynb",
"kill": "00_tools.ipynb",
"schema": "00_psql.ipynb",
"LocalBase": "00_psql.ipynb",
"insert_on_conflict": "00_psql.ipynb",
"read_sql": "00_psql.ipynb",
"Foods": "00_psql.ipynb",
"Users": "00_psql.ipynb",
"Dishes": "00_psql.ipynb",
"User_properties": "00_psql.ipynb",
"FoodsP": "00_psql.ipynb",
"FoodsPI": "00_psql.ipynb",
"FFoods": "00_psql.ipynb",
"Food_reference_images": "00_psql.ipynb",
"Portions": "00_psql.ipynb",
"Indexed": "00_psql.ipynb",
"collection_name": "01_search.ipynb",
"dim": "00_qdrant.ipynb",
"QdrantClient.get_collections": "00_qdrant.ipynb",
"QdrantClient.collection_len": "00_qdrant.ipynb",
"prod_client": "00_qdrant.ipynb",
"dev_client": "00_qdrant.ipynb",
"get_image_from_url": "00_tools.ipynb",
"get_hash_folder": "00_tools.ipynb",
"save_selected_cities": "00_tools.ipynb",
"save_location_dicts": "00_tools.ipynb",
"get_top_n_countries": "00_tools.ipynb",
"path_info": "00_tools.ipynb",
"rm_r": "00_tools.ipynb",
"search_notebooks": "00_tools.ipynb",
"df_chunk_generator": "00_tools.ipynb",
"docker_container": "00_tools.ipynb",
"LogDBHandler": "00_tools.ipynb",
"get_logger": "00_tools.ipynb",
"read_image_from_url": "01_search.ipynb",
"compound_return": "00_tools.ipynb",
"copy_func": "00_tools.ipynb",
"patch_to": "00_tools.ipynb",
"patch": "00_tools.ipynb",
"to_pickle": "00_tools.ipynb",
"from_pickle": "00_tools.ipynb",
"telegram": "00_tools.ipynb",
"pdrows": "00_tools.ipynb",
"pd_highlight": "00_tools.ipynb",
"inline": "00_tools.ipynb",
"plot_map": "00_tools.ipynb",
"htop": "00_tools.ipynb",
"get_proxies": "00_tools.ipynb",
"append_csv": "00_tools.ipynb",
"repeat_df": "00_tools.ipynb",
"to_sql": "00_tools.ipynb",
"timestamp2int": "00_tools.ipynb",
"pd_timestamp": "00_tools.ipynb",
"startEndTimestamp": "00_tools.ipynb",
"pd_set_float": "00_tools.ipynb",
"plot_multiple_y": "00_tools.ipynb",
"sql_head": "00_tools.ipynb",
"make_clickable": "00_tools.ipynb",
"selected_countries": "00_tools.ipynb",
"foods": "01_search.ipynb",
"search_image": "01_search.ipynb",
"cos": "01_search.ipynb",
"table": "01_search.ipynb",
"search_image_": "01_search.ipynb",
"series2tensor": "01_search.ipynb",
"multiply_vector": "01_search.ipynb",
"drop_vector": "01_search.ipynb",
"multiple_foods": "01_search.ipynb"}
modules = ["clipmodel.py",
"custom_pandas.py",
"paths.py",
"psql.py",
"qdrant.py",
"tools.py",
"classify_image.py",
"search.py"]
doc_url = "https://{user}.github.io/food/"
git_url = "https://github.com/{user}/food/tree/{branch}/"
def custom_doc_links(name): return None
| __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'img_resize': '00_clipmodel.ipynb', 'imgs_resize': '00_clipmodel.ipynb', 'dict_to_device': '00_clipmodel.ipynb', 'norm': '00_clipmodel.ipynb', 'detach_norm': '00_clipmodel.ipynb', 'text2clip_en': '00_clipmodel.ipynb', 'images2clip_en': '00_clipmodel.ipynb', 'image2clip': '00_clipmodel.ipynb', 'en_model_name': '00_clipmodel.ipynb', 'tokenizer': '00_clipmodel.ipynb', 'en_processor': '00_clipmodel.ipynb', 'en_size': '00_clipmodel.ipynb', 'en_dim': '00_clipmodel.ipynb', 'images2clip': '00_clipmodel.ipynb', 'text2clip': '00_clipmodel.ipynb', 'read_sql_query': '00_custom_pandas.ipynb', 'Path.ls': '00_tools.ipynb', 'mapbox_access_token': '00_paths.ipynb', 'main_path': '00_paths.ipynb', 'data_path': '00_paths.ipynb', 'reference_images_path': '00_paths.ipynb', 'testset_path': '00_paths.ipynb', 'engine': '00_psql.ipynb', 'Session': '00_psql.ipynb', 'session': '00_psql.ipynb', 'Base': '00_psql.ipynb', 'du': '00_psql.ipynb', 'query': '00_psql.ipynb', 'current': '00_psql.ipynb', 'kill': '00_tools.ipynb', 'schema': '00_psql.ipynb', 'LocalBase': '00_psql.ipynb', 'insert_on_conflict': '00_psql.ipynb', 'read_sql': '00_psql.ipynb', 'Foods': '00_psql.ipynb', 'Users': '00_psql.ipynb', 'Dishes': '00_psql.ipynb', 'User_properties': '00_psql.ipynb', 'FoodsP': '00_psql.ipynb', 'FoodsPI': '00_psql.ipynb', 'FFoods': '00_psql.ipynb', 'Food_reference_images': '00_psql.ipynb', 'Portions': '00_psql.ipynb', 'Indexed': '00_psql.ipynb', 'collection_name': '01_search.ipynb', 'dim': '00_qdrant.ipynb', 'QdrantClient.get_collections': '00_qdrant.ipynb', 'QdrantClient.collection_len': '00_qdrant.ipynb', 'prod_client': '00_qdrant.ipynb', 'dev_client': '00_qdrant.ipynb', 'get_image_from_url': '00_tools.ipynb', 'get_hash_folder': '00_tools.ipynb', 'save_selected_cities': '00_tools.ipynb', 'save_location_dicts': '00_tools.ipynb', 'get_top_n_countries': '00_tools.ipynb', 'path_info': '00_tools.ipynb', 'rm_r': '00_tools.ipynb', 'search_notebooks': '00_tools.ipynb', 'df_chunk_generator': '00_tools.ipynb', 'docker_container': '00_tools.ipynb', 'LogDBHandler': '00_tools.ipynb', 'get_logger': '00_tools.ipynb', 'read_image_from_url': '01_search.ipynb', 'compound_return': '00_tools.ipynb', 'copy_func': '00_tools.ipynb', 'patch_to': '00_tools.ipynb', 'patch': '00_tools.ipynb', 'to_pickle': '00_tools.ipynb', 'from_pickle': '00_tools.ipynb', 'telegram': '00_tools.ipynb', 'pdrows': '00_tools.ipynb', 'pd_highlight': '00_tools.ipynb', 'inline': '00_tools.ipynb', 'plot_map': '00_tools.ipynb', 'htop': '00_tools.ipynb', 'get_proxies': '00_tools.ipynb', 'append_csv': '00_tools.ipynb', 'repeat_df': '00_tools.ipynb', 'to_sql': '00_tools.ipynb', 'timestamp2int': '00_tools.ipynb', 'pd_timestamp': '00_tools.ipynb', 'startEndTimestamp': '00_tools.ipynb', 'pd_set_float': '00_tools.ipynb', 'plot_multiple_y': '00_tools.ipynb', 'sql_head': '00_tools.ipynb', 'make_clickable': '00_tools.ipynb', 'selected_countries': '00_tools.ipynb', 'foods': '01_search.ipynb', 'search_image': '01_search.ipynb', 'cos': '01_search.ipynb', 'table': '01_search.ipynb', 'search_image_': '01_search.ipynb', 'series2tensor': '01_search.ipynb', 'multiply_vector': '01_search.ipynb', 'drop_vector': '01_search.ipynb', 'multiple_foods': '01_search.ipynb'}
modules = ['clipmodel.py', 'custom_pandas.py', 'paths.py', 'psql.py', 'qdrant.py', 'tools.py', 'classify_image.py', 'search.py']
doc_url = 'https://{user}.github.io/food/'
git_url = 'https://github.com/{user}/food/tree/{branch}/'
def custom_doc_links(name):
return None |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def calculate(n, d):
s = str(n)
m = -1
for i in range(0, len(s) - d + 1):
p = 1
for j in range(0, d):
p *= int(s[i+j])
if p > m:
m = p
return m
# https://stackoverflow.com/questions/12385040/python-defining-an-integer-variable-over-multiple-lines
num = int("""
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
66896648950445244523161731856403098711121722383113
62229893423380308135336276614282806444486645238749
30358907296290491560440772390713810515859307960866
70172427121883998797908792274921901699720888093776
65727333001053367881220235421809751254540594752243
52584907711670556013604839586446706324415722155397
53697817977846174064955149290862569321978468622482
83972241375657056057490261407972968652414535100474
82166370484403199890008895243450658541227588666881
16427171479924442928230863465674813919123162824586
17866458359124566529476545682848912883142607690042
24219022671055626321111109370544217506941658960408
07198403850962455444362981230987879927244284909188
84580156166097919133875499200524063689912560717606
05886116467109405077541002256983155200055935729725
71636269561882670428252483600823257530420752963450""".replace("\n",""))
print(calculate(num, 4))
print(calculate(num, 13))
| def calculate(n, d):
s = str(n)
m = -1
for i in range(0, len(s) - d + 1):
p = 1
for j in range(0, d):
p *= int(s[i + j])
if p > m:
m = p
return m
num = int('\n73167176531330624919225119674426574742355349194934\n96983520312774506326239578318016984801869478851843\n85861560789112949495459501737958331952853208805511\n12540698747158523863050715693290963295227443043557\n66896648950445244523161731856403098711121722383113\n62229893423380308135336276614282806444486645238749\n30358907296290491560440772390713810515859307960866\n70172427121883998797908792274921901699720888093776\n65727333001053367881220235421809751254540594752243\n52584907711670556013604839586446706324415722155397\n53697817977846174064955149290862569321978468622482\n83972241375657056057490261407972968652414535100474\n82166370484403199890008895243450658541227588666881\n16427171479924442928230863465674813919123162824586\n17866458359124566529476545682848912883142607690042\n24219022671055626321111109370544217506941658960408\n07198403850962455444362981230987879927244284909188\n84580156166097919133875499200524063689912560717606\n05886116467109405077541002256983155200055935729725\n71636269561882670428252483600823257530420752963450'.replace('\n', ''))
print(calculate(num, 4))
print(calculate(num, 13)) |
# -*- coding: utf-8 -*-
__author__ = 'Russell Davies'
__copyright__ = 'Copyright (c) 2019-present - Russell Davies'
__description__ = 'The blakemere package provides a collection of python libraries created by Russell Davies.'
__email__ = 'russell@blakemere.ca'
__license__ = 'MIT'
__title__ = 'blakemere'
__version__ = '0.1.0' | __author__ = 'Russell Davies'
__copyright__ = 'Copyright (c) 2019-present - Russell Davies'
__description__ = 'The blakemere package provides a collection of python libraries created by Russell Davies.'
__email__ = 'russell@blakemere.ca'
__license__ = 'MIT'
__title__ = 'blakemere'
__version__ = '0.1.0' |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""ICM-20948: Low power 9-axis MotionTracking device that is ideally suited for Smartphones, Tablets, Wearable Sensors, and IoT applications."""
__author__ = "ChISL"
__copyright__ = "TBD"
__credits__ = ["TDK Invensense"]
__license__ = "TBD"
__version__ = "Version 0.1"
__maintainer__ = "https://chisl.io"
__email__ = "info@chisl.io"
__status__ = "Test"
#
# THIS FILE IS AUTOMATICALLY CREATED
# D O N O T M O D I F Y !
#
class REG:
WHO_AM_I = 0
USER_CTRL = 3
LP_CONFIG = 5
PWR_MGMT_1 = 6
PWR_MGMT_2 = 7
INT_PIN_CFG = 15
INT_ENABLE = 16
INT_ENABLE_1 = 17
INT_ENABLE_2 = 18
INT_ENABLE_3 = 19
I2C_MST_STATUS = 23
INT_STATUS = 25
INT_STATUS_1 = 26
INT_STATUS_2 = 27
INT_STATUS_3 = 28
DELAY_TIMEH = 40
DELAY_TIMEL = 41
ACCEL_XOUT_H = 45
ACCEL_XOUT_L = 46
ACCEL_YOUT_H = 47
ACCEL_YOUT_L = 48
ACCEL_ZOUT_H = 49
ACCEL_ZOUT_L = 50
GYRO_XOUT_H = 51
GYRO_XOUT_L = 52
GYRO_YOUT_H = 53
GYRO_YOUT_L = 54
GYRO_ZOUT_H = 55
GYRO_ZOUT_L = 56
TEMP_OUT_H = 57
TEMP_OUT_L = 58
EXT_SLV_SENS_DATA_00 = 59
EXT_SLV_SENS_DATA_01 = 60
EXT_SLV_SENS_DATA_02 = 61
EXT_SLV_SENS_DATA_03 = 62
EXT_SLV_SENS_DATA_04 = 63
EXT_SLV_SENS_DATA_05 = 64
EXT_SLV_SENS_DATA_06 = 65
EXT_SLV_SENS_DATA_07 = 66
EXT_SLV_SENS_DATA_08 = 67
EXT_SLV_SENS_DATA_09 = 68
EXT_SLV_SENS_DATA_10 = 69
EXT_SLV_SENS_DATA_11 = 70
EXT_SLV_SENS_DATA_12 = 71
EXT_SLV_SENS_DATA_13 = 72
EXT_SLV_SENS_DATA_14 = 73
EXT_SLV_SENS_DATA_15 = 74
EXT_SLV_SENS_DATA_16 = 75
EXT_SLV_SENS_DATA_17 = 76
EXT_SLV_SENS_DATA_18 = 77
EXT_SLV_SENS_DATA_19 = 78
EXT_SLV_SENS_DATA_20 = 79
EXT_SLV_SENS_DATA_21 = 80
EXT_SLV_SENS_DATA_22 = 81
EXT_SLV_SENS_DATA_23 = 82
FIFO_EN_1 = 102
FIFO_EN_2 = 103
FIFO_RST = 104
FIFO_MODE = 105
FIFO_COUNTH = 112
FIFO_COUNTL = 113
FIFO_R_W = 114
DATA_RDY_STATUS = 116
FIFO_CFG = 118
REG_BANK_SEL = 127
| """ICM-20948: Low power 9-axis MotionTracking device that is ideally suited for Smartphones, Tablets, Wearable Sensors, and IoT applications."""
__author__ = 'ChISL'
__copyright__ = 'TBD'
__credits__ = ['TDK Invensense']
__license__ = 'TBD'
__version__ = 'Version 0.1'
__maintainer__ = 'https://chisl.io'
__email__ = 'info@chisl.io'
__status__ = 'Test'
class Reg:
who_am_i = 0
user_ctrl = 3
lp_config = 5
pwr_mgmt_1 = 6
pwr_mgmt_2 = 7
int_pin_cfg = 15
int_enable = 16
int_enable_1 = 17
int_enable_2 = 18
int_enable_3 = 19
i2_c_mst_status = 23
int_status = 25
int_status_1 = 26
int_status_2 = 27
int_status_3 = 28
delay_timeh = 40
delay_timel = 41
accel_xout_h = 45
accel_xout_l = 46
accel_yout_h = 47
accel_yout_l = 48
accel_zout_h = 49
accel_zout_l = 50
gyro_xout_h = 51
gyro_xout_l = 52
gyro_yout_h = 53
gyro_yout_l = 54
gyro_zout_h = 55
gyro_zout_l = 56
temp_out_h = 57
temp_out_l = 58
ext_slv_sens_data_00 = 59
ext_slv_sens_data_01 = 60
ext_slv_sens_data_02 = 61
ext_slv_sens_data_03 = 62
ext_slv_sens_data_04 = 63
ext_slv_sens_data_05 = 64
ext_slv_sens_data_06 = 65
ext_slv_sens_data_07 = 66
ext_slv_sens_data_08 = 67
ext_slv_sens_data_09 = 68
ext_slv_sens_data_10 = 69
ext_slv_sens_data_11 = 70
ext_slv_sens_data_12 = 71
ext_slv_sens_data_13 = 72
ext_slv_sens_data_14 = 73
ext_slv_sens_data_15 = 74
ext_slv_sens_data_16 = 75
ext_slv_sens_data_17 = 76
ext_slv_sens_data_18 = 77
ext_slv_sens_data_19 = 78
ext_slv_sens_data_20 = 79
ext_slv_sens_data_21 = 80
ext_slv_sens_data_22 = 81
ext_slv_sens_data_23 = 82
fifo_en_1 = 102
fifo_en_2 = 103
fifo_rst = 104
fifo_mode = 105
fifo_counth = 112
fifo_countl = 113
fifo_r_w = 114
data_rdy_status = 116
fifo_cfg = 118
reg_bank_sel = 127 |
def mergeList(lis1, list2):
print("list1 =", list1)
print("list2 =", list2)
list3 = []
for i in list1:
if(i % 2 == 1):
list3.append(i)
for i in list2:
if(i % 2 == 0):
list3.append(i)
return list3
list1 = [10, 20, 23, 11, 17]
list2 = [13, 43, 24, 36, 12]
print("Result List is", mergeList(list1, list2)) | def merge_list(lis1, list2):
print('list1 =', list1)
print('list2 =', list2)
list3 = []
for i in list1:
if i % 2 == 1:
list3.append(i)
for i in list2:
if i % 2 == 0:
list3.append(i)
return list3
list1 = [10, 20, 23, 11, 17]
list2 = [13, 43, 24, 36, 12]
print('Result List is', merge_list(list1, list2)) |
# -*- coding: utf-8 -*-
# by Juan Carlos Montoya <odooerpcloud@gmail.com>
{
'name': "Library Management",
'summary': """
Library Management Module for Odoo 11
""",
'description': """
Library Management Module for Odoo 11
""",
'author': "Odoo ERP Cloud",
'website': "http://odooerpcloud.com",
'category': 'Tools',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base'],
# always loaded
'data': [
"security/groups.xml",
"security/ir.model.access.csv",
"views/book_view.xml",
"data/books.xml",
],
'application': True,
} | {'name': 'Library Management', 'summary': '\n Library Management Module for Odoo 11\n ', 'description': '\n Library Management Module for Odoo 11\n\n ', 'author': 'Odoo ERP Cloud', 'website': 'http://odooerpcloud.com', 'category': 'Tools', 'version': '0.1', 'depends': ['base'], 'data': ['security/groups.xml', 'security/ir.model.access.csv', 'views/book_view.xml', 'data/books.xml'], 'application': True} |
#daemon = True
# 1 core should equal 2*1+1=3 workers
workers = 3
# we want to use threads for concurrency. we estimate that a maximum of 3*7=21 users will use the application simultaneously
worker_class = "gthread"
threads = 7
#accesslog = "logs/access.log"
#errorlog = "logs/error.log"
| workers = 3
worker_class = 'gthread'
threads = 7 |
# 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 OSFException(Exception):
"""Base Exception class"""
class OSFError(OSFException):
"""Base Error class"""
class PowerManagementError(OSFError):
"""Base Error class for Power Management API"""
class CloudManagementError(OSFError):
"""Base Error class for Cloud Management API"""
class ServiceError(OSFError):
"""Base Error class for Service API"""
class ContainerError(OSFError):
"""Base Error class for Container API"""
class NodeCollectionError(OSFError):
"""Base Error class for NodeCollection API"""
class OSFDriverNotFound(OSFError):
"""Driver Not Found by os-faults registry"""
class OSFDriverWithSuchNameExists(OSFError):
"""Driver with such name already exists in os-faults registry"""
| class Osfexception(Exception):
"""Base Exception class"""
class Osferror(OSFException):
"""Base Error class"""
class Powermanagementerror(OSFError):
"""Base Error class for Power Management API"""
class Cloudmanagementerror(OSFError):
"""Base Error class for Cloud Management API"""
class Serviceerror(OSFError):
"""Base Error class for Service API"""
class Containererror(OSFError):
"""Base Error class for Container API"""
class Nodecollectionerror(OSFError):
"""Base Error class for NodeCollection API"""
class Osfdrivernotfound(OSFError):
"""Driver Not Found by os-faults registry"""
class Osfdriverwithsuchnameexists(OSFError):
"""Driver with such name already exists in os-faults registry""" |
#! /usr/bin/env python
# Copyright Lajos Katona
#
# 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.
def search_linear(mylist, t):
for i, l in enumerate(mylist):
if l == t:
return i
return -1
def search_logarithm(mylist, t):
lower_b = 0
upper_b = len(mylist)
while True:
if lower_b == upper_b:
return -1
mid = (lower_b + upper_b) // 2
mid_item = mylist[mid]
if mid_item == t:
return mid
if mid_item < t:
lower_b = mid + 1
else:
upper_b = mid
if __name__ == '__main__':
mylist = [1, 2, 3, 4, 5]
print(search_linear(mylist, 4))
print(search_logarithm(mylist, 4))
| def search_linear(mylist, t):
for (i, l) in enumerate(mylist):
if l == t:
return i
return -1
def search_logarithm(mylist, t):
lower_b = 0
upper_b = len(mylist)
while True:
if lower_b == upper_b:
return -1
mid = (lower_b + upper_b) // 2
mid_item = mylist[mid]
if mid_item == t:
return mid
if mid_item < t:
lower_b = mid + 1
else:
upper_b = mid
if __name__ == '__main__':
mylist = [1, 2, 3, 4, 5]
print(search_linear(mylist, 4))
print(search_logarithm(mylist, 4)) |
#!/usr/bin/env python
"""
Container class for parameters that are used to create a movie tile
"""
__author__ = 'Michal Frystacky'
class Movie:
"""
Container for extracted movie information data
"""
def __init__(self, title, poster_image_url, youtube_url, summary, director, *stars):
"""
Constructor that requires all the arguments and an arbitrary many stars (1+) that will be passed to
fresh_tomatoes.py to generate movie tiles
:param title: The movie name (e.x. Terminator)
:type title: str
:param poster_image_url: A string to a location of an image of the movie poster (e.x. images/red_poster.img,
http://www.impawards.com/2012/posters/django_unchained_xlg.jpg)
:type poster_image_url: str
:param youtube_url: A url to a trailer hosted on youtube (e.x. https://www.youtube.com/watch?v=nlvYKl1fjBI)
:type youtube_url: str
:param summary: A summary text of the movie (such as the ones found on imdb)
:type summary: str
:param director: The main director of the movie
:type director: str
:param stars: An unpacked list of stars (e.x. "Taylor Kitsch", "Lynn Collins", "Willem Dafoe"
:type stars: str
:return: Nothing
"""
self.title = title
self.poster_image_url = poster_image_url
self.trailer_youtube_url = youtube_url
self.summary_text = summary
self.director = director
self.stars = []
for star in stars:
self.stars.append(star)
| """
Container class for parameters that are used to create a movie tile
"""
__author__ = 'Michal Frystacky'
class Movie:
"""
Container for extracted movie information data
"""
def __init__(self, title, poster_image_url, youtube_url, summary, director, *stars):
"""
Constructor that requires all the arguments and an arbitrary many stars (1+) that will be passed to
fresh_tomatoes.py to generate movie tiles
:param title: The movie name (e.x. Terminator)
:type title: str
:param poster_image_url: A string to a location of an image of the movie poster (e.x. images/red_poster.img,
http://www.impawards.com/2012/posters/django_unchained_xlg.jpg)
:type poster_image_url: str
:param youtube_url: A url to a trailer hosted on youtube (e.x. https://www.youtube.com/watch?v=nlvYKl1fjBI)
:type youtube_url: str
:param summary: A summary text of the movie (such as the ones found on imdb)
:type summary: str
:param director: The main director of the movie
:type director: str
:param stars: An unpacked list of stars (e.x. "Taylor Kitsch", "Lynn Collins", "Willem Dafoe"
:type stars: str
:return: Nothing
"""
self.title = title
self.poster_image_url = poster_image_url
self.trailer_youtube_url = youtube_url
self.summary_text = summary
self.director = director
self.stars = []
for star in stars:
self.stars.append(star) |
"""A rule for building projects using the [GNU Make](https://www.gnu.org/software/make/) build tool"""
load(
"//foreign_cc/private:cc_toolchain_util.bzl",
"get_flags_info",
"get_tools_info",
)
load(
"//foreign_cc/private:detect_root.bzl",
"detect_root",
)
load(
"//foreign_cc/private:framework.bzl",
"CC_EXTERNAL_RULE_ATTRIBUTES",
"CC_EXTERNAL_RULE_FRAGMENTS",
"cc_external_rule_impl",
"create_attrs",
)
load("//foreign_cc/private:make_script.bzl", "create_make_script")
load("//toolchains/native_tools:tool_access.bzl", "get_make_data")
def _make(ctx):
make_data = get_make_data(ctx)
tools_deps = ctx.attr.tools_deps + make_data.deps
attrs = create_attrs(
ctx.attr,
configure_name = "GNUMake",
create_configure_script = _create_make_script,
tools_deps = tools_deps,
make_path = make_data.path,
)
return cc_external_rule_impl(ctx, attrs)
def _create_make_script(configureParameters):
ctx = configureParameters.ctx
attrs = configureParameters.attrs
inputs = configureParameters.inputs
root = detect_root(ctx.attr.lib_source)
tools = get_tools_info(ctx)
flags = get_flags_info(ctx)
data = ctx.attr.data or list()
# Generate a list of arguments for make
args = " ".join([
ctx.expand_location(arg, data)
for arg in ctx.attr.args
])
make_commands = []
for target in ctx.attr.targets:
make_commands.append("{make} -C $$EXT_BUILD_ROOT$$/{root} {target} {args}".format(
make = attrs.make_path,
root = root,
args = args,
target = target,
))
return create_make_script(
root = root,
inputs = inputs,
make_commands = make_commands,
)
def _attrs():
attrs = dict(CC_EXTERNAL_RULE_ATTRIBUTES)
attrs.pop("make_commands")
attrs.update({
"args": attr.string_list(
doc = "A list of arguments to pass to the call to `make`",
),
"targets": attr.string_list(
doc = (
"A list of targets within the foreign build system to produce. An empty string (`\"\"`) will result in " +
"a call to the underlying build system with no explicit target set"
),
mandatory = False,
default = ["", "install"],
),
})
return attrs
make = rule(
doc = (
"Rule for building external libraries with GNU Make. " +
"GNU Make commands (make and make install by default) are invoked with prefix=\"install\" " +
"(by default), and other environment variables for compilation and linking, taken from Bazel C/C++ " +
"toolchain and passed dependencies."
),
attrs = _attrs(),
fragments = CC_EXTERNAL_RULE_FRAGMENTS,
output_to_genfiles = True,
implementation = _make,
toolchains = [
"@rules_foreign_cc//toolchains:make_toolchain",
"@rules_foreign_cc//foreign_cc/private/framework:shell_toolchain",
"@bazel_tools//tools/cpp:toolchain_type",
],
# TODO: Remove once https://github.com/bazelbuild/bazel/issues/11584 is closed and the min supported
# version is updated to a release of Bazel containing the new default for this setting.
incompatible_use_toolchain_transition = True,
)
| """A rule for building projects using the [GNU Make](https://www.gnu.org/software/make/) build tool"""
load('//foreign_cc/private:cc_toolchain_util.bzl', 'get_flags_info', 'get_tools_info')
load('//foreign_cc/private:detect_root.bzl', 'detect_root')
load('//foreign_cc/private:framework.bzl', 'CC_EXTERNAL_RULE_ATTRIBUTES', 'CC_EXTERNAL_RULE_FRAGMENTS', 'cc_external_rule_impl', 'create_attrs')
load('//foreign_cc/private:make_script.bzl', 'create_make_script')
load('//toolchains/native_tools:tool_access.bzl', 'get_make_data')
def _make(ctx):
make_data = get_make_data(ctx)
tools_deps = ctx.attr.tools_deps + make_data.deps
attrs = create_attrs(ctx.attr, configure_name='GNUMake', create_configure_script=_create_make_script, tools_deps=tools_deps, make_path=make_data.path)
return cc_external_rule_impl(ctx, attrs)
def _create_make_script(configureParameters):
ctx = configureParameters.ctx
attrs = configureParameters.attrs
inputs = configureParameters.inputs
root = detect_root(ctx.attr.lib_source)
tools = get_tools_info(ctx)
flags = get_flags_info(ctx)
data = ctx.attr.data or list()
args = ' '.join([ctx.expand_location(arg, data) for arg in ctx.attr.args])
make_commands = []
for target in ctx.attr.targets:
make_commands.append('{make} -C $$EXT_BUILD_ROOT$$/{root} {target} {args}'.format(make=attrs.make_path, root=root, args=args, target=target))
return create_make_script(root=root, inputs=inputs, make_commands=make_commands)
def _attrs():
attrs = dict(CC_EXTERNAL_RULE_ATTRIBUTES)
attrs.pop('make_commands')
attrs.update({'args': attr.string_list(doc='A list of arguments to pass to the call to `make`'), 'targets': attr.string_list(doc='A list of targets within the foreign build system to produce. An empty string (`""`) will result in ' + 'a call to the underlying build system with no explicit target set', mandatory=False, default=['', 'install'])})
return attrs
make = rule(doc='Rule for building external libraries with GNU Make. ' + 'GNU Make commands (make and make install by default) are invoked with prefix="install" ' + '(by default), and other environment variables for compilation and linking, taken from Bazel C/C++ ' + 'toolchain and passed dependencies.', attrs=_attrs(), fragments=CC_EXTERNAL_RULE_FRAGMENTS, output_to_genfiles=True, implementation=_make, toolchains=['@rules_foreign_cc//toolchains:make_toolchain', '@rules_foreign_cc//foreign_cc/private/framework:shell_toolchain', '@bazel_tools//tools/cpp:toolchain_type'], incompatible_use_toolchain_transition=True) |
# Customer class
class Customer:
def __init__(self, name, address, phone):
self.__name = name
self.__address = address
self.__phone = phone
def set_name(self, name):
self.__name = name
def set_address(self, address):
self.__address = address
def set_phone(self, phone):
self.__phone = phone
def get_name(self):
return self.__name
def get_address(self):
return self.__address
def get_phone(self):
return self.__phone
| class Customer:
def __init__(self, name, address, phone):
self.__name = name
self.__address = address
self.__phone = phone
def set_name(self, name):
self.__name = name
def set_address(self, address):
self.__address = address
def set_phone(self, phone):
self.__phone = phone
def get_name(self):
return self.__name
def get_address(self):
return self.__address
def get_phone(self):
return self.__phone |
# %% [695. Max Area of Island](https://leetcode.com/problems/max-area-of-island/)
class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
n, m = len(grid), len(grid[0])
u = unionfind(n, m)
for i in range(n):
for j in range(m):
if j + 1 < m and grid[i][j] == grid[i][j + 1] == 1:
u.unite((i, j), (i, j + 1))
if i + 1 < n and grid[i][j] == grid[i + 1][j] == 1:
u.unite((i, j), (i + 1, j))
u = collections.Counter(
u.find(i, j) for i in range(n) for j in range(m) if grid[i][j] == 1
).most_common(1)
return u[0][1] if u else 0
class unionfind:
def __init__(self, n, m):
self.m = m
self.parent = list(range(n * m))
def find(self, i, j):
k = i * self.m + j
while self.parent[k] != k:
k = self.parent[k]
return k
def unite(self, p, q):
self.parent[self.find(*q)] = self.find(*p)
| class Solution:
def max_area_of_island(self, grid: List[List[int]]) -> int:
(n, m) = (len(grid), len(grid[0]))
u = unionfind(n, m)
for i in range(n):
for j in range(m):
if j + 1 < m and grid[i][j] == grid[i][j + 1] == 1:
u.unite((i, j), (i, j + 1))
if i + 1 < n and grid[i][j] == grid[i + 1][j] == 1:
u.unite((i, j), (i + 1, j))
u = collections.Counter((u.find(i, j) for i in range(n) for j in range(m) if grid[i][j] == 1)).most_common(1)
return u[0][1] if u else 0
class Unionfind:
def __init__(self, n, m):
self.m = m
self.parent = list(range(n * m))
def find(self, i, j):
k = i * self.m + j
while self.parent[k] != k:
k = self.parent[k]
return k
def unite(self, p, q):
self.parent[self.find(*q)] = self.find(*p) |
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
{
'includes': [
'../build/common.gypi',
],
'targets': [
{
'target_name': 'webrtc_test_common',
'type': 'static_library',
'sources': [
'configurable_frame_size_encoder.cc',
'configurable_frame_size_encoder.h',
'direct_transport.cc',
'direct_transport.h',
'encoder_settings.cc',
'encoder_settings.h',
'fake_audio_device.cc',
'fake_audio_device.h',
'fake_decoder.cc',
'fake_decoder.h',
'fake_encoder.cc',
'fake_encoder.h',
'fake_network_pipe.cc',
'fake_network_pipe.h',
'flags.cc',
'flags.h',
'frame_generator_capturer.cc',
'frame_generator_capturer.h',
'mock_transport.h',
'null_platform_renderer.cc',
'null_transport.cc',
'null_transport.h',
'rtp_rtcp_observer.h',
'run_tests.cc',
'run_tests.h',
'run_loop.cc',
'run_loop.h',
'statistics.cc',
'statistics.h',
'vcm_capturer.cc',
'vcm_capturer.h',
'video_capturer.cc',
'video_capturer.h',
'video_renderer.cc',
'video_renderer.h',
],
# TODO(pbos): As far as I can tell these are dependencies from
# video_render and they should really not be here. This target provides
# no platform-specific rendering.
'direct_dependent_settings': {
'conditions': [
['OS=="linux"', {
'libraries': [
'-lXext',
'-lX11',
'-lGL',
],
}],
['OS=="android"', {
'libraries' : [
'-lGLESv2', '-llog',
],
}],
['OS=="mac"', {
'xcode_settings' : {
'OTHER_LDFLAGS' : [
'-framework Foundation',
'-framework AppKit',
'-framework Cocoa',
'-framework OpenGL',
'-framework CoreVideo',
'-framework CoreAudio',
'-framework AudioToolbox',
],
},
}],
],
},
'dependencies': [
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'<(webrtc_root)/modules/modules.gyp:video_capture_module',
'<(webrtc_root)/modules/modules.gyp:media_file',
'<(webrtc_root)/test/test.gyp:frame_generator',
'<(webrtc_root)/test/test.gyp:test_support',
],
},
],
'conditions': [
['include_tests==1', {
'targets': [
{
'target_name': 'webrtc_test_common_unittests',
'type': '<(gtest_target_type)',
'dependencies': [
'webrtc_test_common',
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/testing/gmock.gyp:gmock',
'<(webrtc_root)/test/test.gyp:test_support_main',
],
'sources': [
'fake_network_pipe_unittest.cc',
],
},
], #targets
}], # include_tests
], # conditions
}
| {'includes': ['../build/common.gypi'], 'targets': [{'target_name': 'webrtc_test_common', 'type': 'static_library', 'sources': ['configurable_frame_size_encoder.cc', 'configurable_frame_size_encoder.h', 'direct_transport.cc', 'direct_transport.h', 'encoder_settings.cc', 'encoder_settings.h', 'fake_audio_device.cc', 'fake_audio_device.h', 'fake_decoder.cc', 'fake_decoder.h', 'fake_encoder.cc', 'fake_encoder.h', 'fake_network_pipe.cc', 'fake_network_pipe.h', 'flags.cc', 'flags.h', 'frame_generator_capturer.cc', 'frame_generator_capturer.h', 'mock_transport.h', 'null_platform_renderer.cc', 'null_transport.cc', 'null_transport.h', 'rtp_rtcp_observer.h', 'run_tests.cc', 'run_tests.h', 'run_loop.cc', 'run_loop.h', 'statistics.cc', 'statistics.h', 'vcm_capturer.cc', 'vcm_capturer.h', 'video_capturer.cc', 'video_capturer.h', 'video_renderer.cc', 'video_renderer.h'], 'direct_dependent_settings': {'conditions': [['OS=="linux"', {'libraries': ['-lXext', '-lX11', '-lGL']}], ['OS=="android"', {'libraries': ['-lGLESv2', '-llog']}], ['OS=="mac"', {'xcode_settings': {'OTHER_LDFLAGS': ['-framework Foundation', '-framework AppKit', '-framework Cocoa', '-framework OpenGL', '-framework CoreVideo', '-framework CoreAudio', '-framework AudioToolbox']}}]]}, 'dependencies': ['<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/third_party/gflags/gflags.gyp:gflags', '<(webrtc_root)/modules/modules.gyp:video_capture_module', '<(webrtc_root)/modules/modules.gyp:media_file', '<(webrtc_root)/test/test.gyp:frame_generator', '<(webrtc_root)/test/test.gyp:test_support']}], 'conditions': [['include_tests==1', {'targets': [{'target_name': 'webrtc_test_common_unittests', 'type': '<(gtest_target_type)', 'dependencies': ['webrtc_test_common', '<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/testing/gmock.gyp:gmock', '<(webrtc_root)/test/test.gyp:test_support_main'], 'sources': ['fake_network_pipe_unittest.cc']}]}]]} |
#!/usr/bin/python3
'''This module contains the add_integer function
'''
def add_integer(a, b=98):
'''add_integer adds two integers and/or floats together
and returns an integer of their sum
'''
if not isinstance(a, (int, float)):
raise TypeError("a must be an integer")
if not isinstance(b, (int, float)):
raise TypeError("b must be an integer")
return int(a) + int(b)
| """This module contains the add_integer function
"""
def add_integer(a, b=98):
"""add_integer adds two integers and/or floats together
and returns an integer of their sum
"""
if not isinstance(a, (int, float)):
raise type_error('a must be an integer')
if not isinstance(b, (int, float)):
raise type_error('b must be an integer')
return int(a) + int(b) |
class Config(object):
def __init__(self, stellar_sed, laser_sed,
filt, nsamples, sample_rate, pulse_duration):
self.stellar_sed = stellar_sed
self.laser_sed = laser_sed
self.filt = filt
self.nsamples = nsamples # in ns
self.sample_rate = sample_rate # in ns
self.pulse_duration = pulse_duration
| class Config(object):
def __init__(self, stellar_sed, laser_sed, filt, nsamples, sample_rate, pulse_duration):
self.stellar_sed = stellar_sed
self.laser_sed = laser_sed
self.filt = filt
self.nsamples = nsamples
self.sample_rate = sample_rate
self.pulse_duration = pulse_duration |
# This is a util to create the advancement files
# Advancement list from https://github.com/jan00bl/mcfunction-novum/blob/master/lib/1.16/id/advancement.json
advancements = [
"minecraft:adventure/adventuring_time",
"minecraft:adventure/arbalistic",
"minecraft:adventure/bullseye",
"minecraft:adventure/hero_of_the_village",
"minecraft:adventure/honey_block_slide",
"minecraft:adventure/kill_all_mobs",
"minecraft:adventure/kill_a_mob",
"minecraft:adventure/ol_betsy",
"minecraft:adventure/root",
"minecraft:adventure/shoot_arrow",
"minecraft:adventure/sleep_in_bed",
"minecraft:adventure/sniper_duel",
"minecraft:adventure/summon_iron_golem",
"minecraft:adventure/throw_trident",
"minecraft:adventure/totem_of_undying",
"minecraft:adventure/trade",
"minecraft:adventure/two_birds_one_arrow",
"minecraft:adventure/very_very_frightening",
"minecraft:adventure/voluntary_exile",
"minecraft:adventure/whos_the_pillager_now",
"minecraft:end/dragon_breath",
"minecraft:end/dragon_egg",
"minecraft:end/elytra",
"minecraft:end/enter_end_gateway",
"minecraft:end/find_end_city",
"minecraft:end/kill_dragon",
"minecraft:end/levitate",
"minecraft:end/respawn_dragon",
"minecraft:end/root",
"minecraft:husbandry/balanced_diet",
"minecraft:husbandry/bred_all_animals",
"minecraft:husbandry/breed_an_animal",
"minecraft:husbandry/complete_catalogue",
"minecraft:husbandry/fishy_business",
"minecraft:husbandry/obtain_netherite_hoe",
"minecraft:husbandry/plant_seed",
"minecraft:husbandry/root",
"minecraft:husbandry/safely_harvest_honey",
"minecraft:husbandry/silk_touch_nest",
"minecraft:husbandry/tactical_fishing",
"minecraft:husbandry/tame_an_animal",
"minecraft:nether/all_effects",
"minecraft:nether/all_potions",
"minecraft:nether/brew_potion",
"minecraft:nether/charge_respawn_anchor",
"minecraft:nether/create_beacon",
"minecraft:nether/create_full_beacon",
"minecraft:nether/distract_piglin",
"minecraft:nether/explore_nether",
"minecraft:nether/fast_travel",
"minecraft:nether/find_bastion",
"minecraft:nether/find_fortress",
"minecraft:nether/get_wither_skull",
"minecraft:nether/loot_bastion",
"minecraft:nether/netherite_armor",
"minecraft:nether/obtain_ancient_debris",
"minecraft:nether/obtain_blaze_rod",
"minecraft:nether/obtain_crying_obsidian",
"minecraft:nether/return_to_sender",
"minecraft:nether/ride_strider",
"minecraft:nether/root",
"minecraft:nether/summon_wither",
"minecraft:nether/uneasy_alliance",
"minecraft:nether/use_lodestone",
"minecraft:story/cure_zombie_villager",
"minecraft:story/deflect_arrow",
"minecraft:story/enchant_item",
"minecraft:story/enter_the_end",
"minecraft:story/enter_the_nether",
"minecraft:story/follow_ender_eye",
"minecraft:story/form_obsidian",
"minecraft:story/iron_tools",
"minecraft:story/lava_bucket",
"minecraft:story/mine_diamond",
"minecraft:story/mine_stone",
"minecraft:story/obtain_armor",
"minecraft:story/root",
"minecraft:story/shiny_gear",
"minecraft:story/smelt_iron",
"minecraft:story/upgrade_tools"
]
for i, a in enumerate(advancements):
print("execute if entity @a[advancements={" + a + "=true}] run scoreboard players set #adv" + str(
i) + " globaladvance 1")
print("\n\n\n")
for i, a in enumerate(advancements):
print("execute if score #adv" + str(i) +
" globaladvance matches 1 run advancement grant @a only " + a)
| advancements = ['minecraft:adventure/adventuring_time', 'minecraft:adventure/arbalistic', 'minecraft:adventure/bullseye', 'minecraft:adventure/hero_of_the_village', 'minecraft:adventure/honey_block_slide', 'minecraft:adventure/kill_all_mobs', 'minecraft:adventure/kill_a_mob', 'minecraft:adventure/ol_betsy', 'minecraft:adventure/root', 'minecraft:adventure/shoot_arrow', 'minecraft:adventure/sleep_in_bed', 'minecraft:adventure/sniper_duel', 'minecraft:adventure/summon_iron_golem', 'minecraft:adventure/throw_trident', 'minecraft:adventure/totem_of_undying', 'minecraft:adventure/trade', 'minecraft:adventure/two_birds_one_arrow', 'minecraft:adventure/very_very_frightening', 'minecraft:adventure/voluntary_exile', 'minecraft:adventure/whos_the_pillager_now', 'minecraft:end/dragon_breath', 'minecraft:end/dragon_egg', 'minecraft:end/elytra', 'minecraft:end/enter_end_gateway', 'minecraft:end/find_end_city', 'minecraft:end/kill_dragon', 'minecraft:end/levitate', 'minecraft:end/respawn_dragon', 'minecraft:end/root', 'minecraft:husbandry/balanced_diet', 'minecraft:husbandry/bred_all_animals', 'minecraft:husbandry/breed_an_animal', 'minecraft:husbandry/complete_catalogue', 'minecraft:husbandry/fishy_business', 'minecraft:husbandry/obtain_netherite_hoe', 'minecraft:husbandry/plant_seed', 'minecraft:husbandry/root', 'minecraft:husbandry/safely_harvest_honey', 'minecraft:husbandry/silk_touch_nest', 'minecraft:husbandry/tactical_fishing', 'minecraft:husbandry/tame_an_animal', 'minecraft:nether/all_effects', 'minecraft:nether/all_potions', 'minecraft:nether/brew_potion', 'minecraft:nether/charge_respawn_anchor', 'minecraft:nether/create_beacon', 'minecraft:nether/create_full_beacon', 'minecraft:nether/distract_piglin', 'minecraft:nether/explore_nether', 'minecraft:nether/fast_travel', 'minecraft:nether/find_bastion', 'minecraft:nether/find_fortress', 'minecraft:nether/get_wither_skull', 'minecraft:nether/loot_bastion', 'minecraft:nether/netherite_armor', 'minecraft:nether/obtain_ancient_debris', 'minecraft:nether/obtain_blaze_rod', 'minecraft:nether/obtain_crying_obsidian', 'minecraft:nether/return_to_sender', 'minecraft:nether/ride_strider', 'minecraft:nether/root', 'minecraft:nether/summon_wither', 'minecraft:nether/uneasy_alliance', 'minecraft:nether/use_lodestone', 'minecraft:story/cure_zombie_villager', 'minecraft:story/deflect_arrow', 'minecraft:story/enchant_item', 'minecraft:story/enter_the_end', 'minecraft:story/enter_the_nether', 'minecraft:story/follow_ender_eye', 'minecraft:story/form_obsidian', 'minecraft:story/iron_tools', 'minecraft:story/lava_bucket', 'minecraft:story/mine_diamond', 'minecraft:story/mine_stone', 'minecraft:story/obtain_armor', 'minecraft:story/root', 'minecraft:story/shiny_gear', 'minecraft:story/smelt_iron', 'minecraft:story/upgrade_tools']
for (i, a) in enumerate(advancements):
print('execute if entity @a[advancements={' + a + '=true}] run scoreboard players set #adv' + str(i) + ' globaladvance 1')
print('\n\n\n')
for (i, a) in enumerate(advancements):
print('execute if score #adv' + str(i) + ' globaladvance matches 1 run advancement grant @a only ' + a) |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Membership Management',
'version': '1.0',
'category': 'Sales',
'description': """
This module allows you to manage all operations for managing memberships.
=========================================================================
It supports different kind of members:
--------------------------------------
* Free member
* Associated member (e.g.: a group subscribes to a membership for all subsidiaries)
* Paid members
* Special member prices
It is integrated with sales and accounting to allow you to automatically
invoice and send propositions for membership renewal.
""",
'depends': ['base', 'product', 'account'],
'data': [
'security/ir.model.access.csv',
'wizard/membership_invoice_views.xml',
'data/membership_data.xml',
'views/product_views.xml',
'views/partner_views.xml',
'report/report_membership_views.xml',
],
'demo': [
'data/membership_demo.xml',
],
'website': 'https://www.odoo.com/page/community-builder',
'test': [
'../account/test/account_minimal_test.xml',
],
}
| {'name': 'Membership Management', 'version': '1.0', 'category': 'Sales', 'description': '\nThis module allows you to manage all operations for managing memberships.\n=========================================================================\n\nIt supports different kind of members:\n--------------------------------------\n * Free member\n * Associated member (e.g.: a group subscribes to a membership for all subsidiaries)\n * Paid members\n * Special member prices\n\nIt is integrated with sales and accounting to allow you to automatically\ninvoice and send propositions for membership renewal.\n ', 'depends': ['base', 'product', 'account'], 'data': ['security/ir.model.access.csv', 'wizard/membership_invoice_views.xml', 'data/membership_data.xml', 'views/product_views.xml', 'views/partner_views.xml', 'report/report_membership_views.xml'], 'demo': ['data/membership_demo.xml'], 'website': 'https://www.odoo.com/page/community-builder', 'test': ['../account/test/account_minimal_test.xml']} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.