content
stringlengths 7
1.05M
|
|---|
class ScriptBase(type):
def __init__(cls, name, bases, attrs):
if cls is None:
return
if not hasattr(cls, "plugins"):
cls.plugins = []
else:
cls.plugins.append(cls)
class ServerBase:
__metaclass__ = ScriptBase
def __init__(self):
super(ServerBase, self).__init__()
def setup(self, nysa):
self.n = nysa
|
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# Find the max and then break the array in two parts.
# Then recursively
class Solution(object):
def constructMaximumBinaryTree(self, nums):
"""
:type nums: List[int]
:rtype: TreeNode
"""
def maxTree(nums, start, end):
if start >= end:
return None
else:
opt = (nums[start], start)
for i in xrange(start+1, end):
if nums[i] > opt[0]:
opt = (nums[i], i)
root = TreeNode(opt[0])
root.left = maxTree(nums, start, opt[1])
root.right = maxTree(nums, opt[1]+1, end)
return root
if nums is None:
return None
else:
return maxTree(nums, 0, len(nums))
|
class BuildProducts(object):
'''A class to help keep track of build products in the build.
Really this is just a wrapper around a dict stored at the key
'BUILD_TOOL' in an environment. This class doesn't worry about
what stored in that dict, though it's generally things like
SharedLib configurators and such.
'''
def __init__(self, env):
'''This looks up or, if necessary, creates a few keys in the
`env` that are used by this class.
'''
self.env = env
try:
products = env['BUILD_TOOL']
except KeyError:
env['BUILD_TOOL'] = {}
products = env['BUILD_TOOL']
try:
products = products['BUILD_PRODUCTS']
except KeyError:
products['BUILD_PRODUCTS'] = {}
products = products['BUILD_PRODUCTS']
self.products = products
def __getitem__(self, name):
'''Get the build product at `name`.
'''
return self.products[name]
def __setitem__(self, name, product):
'''Set the build product at `name` to `product`.
'''
self.products[name] = product
|
lista = []
pares = []
ímpar = []
while True:
n = int(input('Digite um valor ou ZERO para SAIR: '))
if n == 0:
break
lista.append(n)
lista.sort()
if n % 2 == 0:
pares.append(n)
pares.sort()
else:
ímpar.append(n)
ímpar.sort()
print(f'LISTA DIGITADA -> {lista}')
print(f'NUMEROS PARES -> {pares}')
print(f'NUMEROS ÍMPARES -> {ímpar}')
|
"""Meta Content presentation"""
amendment_header = [
"Amendment of Directive 85/611/EEC",
"Amendment of Directive 93/6/EEC",
"Amendment of Directive 2000/12/EC"
]
test_presentations = [
"Article 8 is replaced by the following:",
"In Article 7, paragraphs 1 and 2 are "
"replaced by the following:",
"Article 6 is amended as follows:",
"Article 2 is replaced by the following:",
"Article 1 is replaced by the following:",
"In Article 49, the following subparagraph is added "
"at the end of paragraph 2:",
"In Article 37, the following point (c) is added:",
"The following Chapter 5a is inserted after Article 72:",
"Article 73 is amended as follows:",
"(a) the title is replaced by the following:",
"(b) paragraphs 1, 2, 3 and 4 are replaced by the following:",
"In Part Two, Title I, the title of Chapter 6 is replaced by the "
"following:",
"in Article 11(15), point (b) is deleted;",
"in Article 89, the following paragraph is inserted:",
"the following Chapter is added in Title IV:",
"In Article 5 of Directive 85/611/EEC, paragraph 4 shall "
"be replaced by the following:",
"Article 2(2) shall be replaced by the following:"
]
|
class ResourceObject:
def __init__(self,
resource_type,
resource_name,
mem_limit_threshold,
mem_request_threshold,
cpu_limit_threshold,
cpu_request_threshold,
max_hit):
self.resource_type = resource_type
self.resource_name = resource_name
self.cpu_limit = 0
self.mem_limit = 0
self.cpu_request = 0
self.mem_request = 0
self.mem_hits = 0
self.cpu_hits = 0
self.mem_limit_threshold = mem_limit_threshold
self.mem_request_threshold = mem_request_threshold
self.cpu_limit_threshold = cpu_limit_threshold
self.cpu_request_threshold = cpu_request_threshold
self.max_hit = max_hit
def __hit_cpu(self):
if self.cpu_limit > self.cpu_limit_threshold or self.cpu_request > self.cpu_request_threshold:
self.cpu_hits += 1
if self.cpu_hits > self.max_hit:
self.cpu_hits = 1
else:
self.cpu_hits = 0
def __hit_mem(self):
if self.mem_limit > self.mem_limit_threshold or self.mem_request > self.mem_request_threshold:
self.mem_hits += 1
if self.mem_hits > self.max_hit:
self.mem_hits = 1
else:
self.mem_hits = 0
def update_memory(self, request, limit):
self.mem_limit = limit
self.mem_request = request
self.__hit_mem()
def update_cpu(self, request, limit):
self.cpu_limit = limit
self.cpu_request = request
self.__hit_cpu()
def get_notification(self, report_type):
message = ''
cpu_message = ''
mem_message = ''
if self.cpu_hits > 0:
cpu_message = f" [cpu request: {self.cpu_request}% , cpu limit: {self.cpu_limit}%]"
if self.mem_hits > 0:
mem_message = f" [memory request: {self.mem_request}% , memory limit: {self.mem_limit}%]"
if report_type == "all" and (self.cpu_hits == 1 or self.mem_hits == 1):
if self.cpu_hits > 0 and self.mem_hits > 0:
message = ' and'
message = f"{cpu_message}{message}{mem_message}"
elif report_type == 'cpu' and self.cpu_hits == 1:
message = cpu_message
elif report_type == 'memory' and self.mem_hits == 1:
message = mem_message
if message != '':
message = f"[{self.resource_type}] {self.resource_name} is under stress:{message}"
return message
|
M = []
size1 = int(input())
for i in range(size1):
row = []
for j in range(size1):
row.append(int(input()))
M.append(row)
M2 = []
for i in range(size1):
row = []
for j in range(size1):
row.append(int(input()))
M2.append(row)
result = [ [ 0 for i in range(size1) ] for j in range(size1) ]
for i in range(size1):
for j in range(size1):
for k in range(size1):
result[i][j] += M[i][k] * M2[k][j]
for i in range(size1):
print(result[i])
|
def currencyCodes():
"""
This function returns a list of currency codes.
It looks simple, but it can be improved without
affecting other components.
"""
currency_codes = ['USD', 'EUR', 'AUD']
return currency_codes
|
MYSQL_HOST = 'localhost'
MYSQL_DBNAME = 'spider'
MYSQL_USER = 'root'
MYSQL_PASSWD = '123456'
MYSQL_PORT = 3306
MYSQL_CHARSET = 'utf8'
MYSQL_UNICODE = True
|
class Concrete:
x: int
@require(lambda x: x > 0)
def __init__(self, x: int) -> None:
self.x = x
@require(lambda self: self.x > 2)
@require(lambda number: number > 0)
def some_func(self, number: int) -> int:
"""Do something."""
class Reference:
pass
__book_url__ = "dummy"
__book_version__ = "dummy"
associate_ref_with(Reference)
|
#! /usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2019/3/9 1:30 PM
# @Author : xiaoliji
# @Email : yutian9527@gmail.com
"""
在从左到右从上到下递增的矩阵中,判断目标数是否存在
>>> m = [[1, 2, 8, 9], [2, 4, 9, 12], [4, 7, 10, 13], [6, 8, 11, 15]]
>>> search_in_matrix(7, m)
True
>>> search_in_matrix(5, m)
False
"""
# 思路:从右上角顶点出发。
def search_in_matrix(target: int, matrix: 'List[List[int]]') -> 'bool':
row = 0
col = len(matrix[0]) - 1
while col >= 0 and row <= len(matrix) - 1:
if matrix[row][col] > target:
col -= 1
elif matrix[row][col] < target:
row += 1
else:
return True
return False
|
squares = [1, 4, 9, 16, 25]
i = 0
while i < len(squares):
print(i, squares[i])
i = i + 1
words = ['cat', 'window', 'defenestrate']
for w in words:
print(w, len(w))
for i in range(len(words)):
print(i, words[i], len(words[i]))
|
print('Sequencia de Fibonacci')
n = int(input('Quantos termos você quer mostrar: '))
t1 = 0#os dois primeiros termos sempre serão esses
t2 = 1
print('{} {}'.format(t1, t2), end=' ')
cont = 3
while cont <= n:
t3 = t1 + t2#aqui ele vai somar o primeior + segundo termo e da o terceiro termo
print('{}'.format(t3), end=' ')
t1 = t2#aqui ele transforma o primeiro termo em segundo
t2 = t3#e aqui ele transforma o segundo em terceiro, assim por diante ate que a sequencia
cont += 1
print('Fim')
|
def ov_range(a_1,a_2,b_1,b_2):
big_a=a_1
small_a=a_2
big_b=b_1
small_b=b_1
if a_1<a_2:
big_a=a_2
small_a=a_1
elif a_1>a_2:
big_a=a_1
small_a=a_2
if b_1>b_2:
big_b=b_1
small_b=b_2
elif b_1<b_2:
big_b=b_2
small_b=b_1
#print(big_a, '\n', small_a, '\n', big_b, '\n', small_b)
interval_1=big_a - small_a
interval_2=big_b - small_b
# when they dont overlap
if small_a > big_b:
return 0
elif small_b>big_a:
return 0
# When a dips into b
if big_b>big_a and small_a>small_b:
interval_1 = big_a - small_a
return interval_1
#when b completly overlaps a
if big_a>big_b and small_b>small_a:
interval_1 = big_b - small_b
return interval_1
elif big_a>big_b and big_b>small_a:
interval_1= big_b - small_a
return interval_1
#when a overlaps in b
if small_b<big_a:
interval_1=big_a - small_b
return interval_1
if small_b<big_b:
interval_2=big_b - small_a
#when b overlap in a
if big_a>big_b and big_b>small_a:
interval_1= big_b - small_a
return interval_1
#Good job
# Test function
def test(a1, a2, b1, b2, expected):
print(a1, a2, '&', b1, b2, '=>',
ov_range(a1, a2, b1, b2), '\t',
ov_range(a1, a2, b1, b2) == expected)
test(2,5,-1,3, 1)
test(3, 0, 2, 4, 1)
test(0, 5, 0, 1000, 5)
test(0, 1000, 0, 5, 5)
test(1, 4, 0, 5, 3)
test(0, 5, 2, 4, 2)
test(2,4,0,5, 2)
test(1,10,-5,-5,0)
test(10,1,5,15,5)
test(-5, 0, 2, 4, 0)
test(-5, -5, 2, 4, 0)
test(5, 0, 1, 1, 0)
test(7, -2, -1, 4, 5)
|
#!/usr/bin/env python
"""
_Agent_t_
Agent test methods
"""
__all__ = []
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
all_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])"""
def include_third_party_repositories():
http_archive(
name = "com_github_libevent",
build_file_content = all_content,
strip_prefix = "libevent-2.1.8-stable",
urls = ["https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz"],
)
http_archive(
name = "com_github_libtbb",
build_file = "//bazel:tbb.BUILD",
strip_prefix = "oneTBB-2020.3",
urls = ["https://github.com/oneapi-src/oneTBB/archive/v2020.3.tar.gz"],
sha256 = "ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3",
)
http_archive(
name = "com_github_libtbb_osx",
build_file = "//bazel:osx.tbb.BUILD",
strip_prefix = "oneTBB-2020.3",
urls = ["https://github.com/oneapi-src/oneTBB/archive/v2020.3.tar.gz"],
sha256 = "ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3",
)
http_archive(
name = "com_github_fmtlib_fmt",
sha256 = "4c0741e10183f75d7d6f730b8708a99b329b2f942dad5a9da3385ab92bb4a15c",
strip_prefix = "fmt-5.3.0",
urls = ["https://github.com/fmtlib/fmt/releases/download/5.3.0/fmt-5.3.0.zip"],
build_file = "//bazel:fmtlib.BUILD",
)
http_archive(
name = "com_github_gabime_spdlog",
build_file = "//bazel:spdlog.BUILD",
sha256 = "160845266e94db1d4922ef755637f6901266731c4cb3b30b45bf41efa0e6ab70",
strip_prefix = "spdlog-1.3.1",
urls = ["https://github.com/gabime/spdlog/archive/v1.3.1.tar.gz"],
)
|
class ContactInformation(object):
def __init__(self, name, weight=100, *args, **kwargs):
self.name = name
self.weight = weight
def __str__(self):
return "Unusable Contact: {:s} ({:d})".format(self.name, self.weight)
class EmailAddress(ContactInformation):
def __init__(self, name, email, *args, **kwargs):
super(EmailAddress, self).__init__(name, *args, **kwargs)
self.email = email
def __str__(self):
return "Email: {:s} <{:s}> ({:d})".format(self.name, self.email, self.weight)
class PhoneNumber(ContactInformation):
def __init__(self, name, phone, sms_ok=True, voice_ok=False, *args, **kwargs):
super(PhoneNumber, self).__init__(name, *args, **kwargs)
self.phone = phone
self.sms_ok = sms_ok
self.voice_ok = voice_ok
def __str__(self):
methods = []
if self.sms_ok:
methods.append('sms')
if self.voice_ok:
methods.append('voice')
return "Phone: {:s} <{:s}> [{:s}] ({:d})".format(self.name, self.phone, ', '.join(methods), self.weight)
class HipChat(ContactInformation):
def __init__(self, name, room, username=None, mention=None, notify=None, server=None, *args, **kwargs):
super(HipChat, self).__init__(name, *args, **kwargs)
self.room = room
self.username = username
self.server = server
if mention is None:
self.mention = True if username else False
else:
self.mention = mention
if notify is None:
self.notify = False if username else True
else:
self.notify = notify
def __str__(self):
path = [self.room]
if self.server:
path.insert(0, self.server)
if self.username:
path.append(self.username)
features = []
if self.mention:
features.append('mention')
if self.notify:
features.append('notify')
return "HipChat: {:s} <{:s}> [{:s}] ({:d})".format(self.name, '/'.join(path), ', '.join(features), self.weight)
class Recipient(object):
def __init__(self, name, contacts=None, *args, **kwargs):
self.name = name
self._contacts = contacts or []
def __str__(self):
return "{:s}: {:s}: {:s}".format(self.__class__.__name__, self.name, map(str, self.contacts) or 'No Contact Information')
def contacts(self, of_type=None, include_all=False, **having):
returned_types = []
for contact in sorted(self._contacts, key=lambda v: v.weight):
if of_type and not isinstance(contact, of_type):
continue
for key, value in having.items():
if getattr(contact, key, None) != value:
break
else:
if not include_all and contact.__class__ in returned_types:
continue
returned_types.append(contact.__class__)
yield contact
class Group(object):
def __init__(self, name, groups=None, recipients=None, *args, **kwargs):
self.name = name
self._groups = groups or []
self._recipients = recipients or []
def groups(self, recursive=True):
for group in self._groups:
yield group
if recursive:
for group_ in group.groups(recursive=True):
yield group_
def recipients(self, recursive=True):
for recipient in self._recipients:
yield recipient
if recursive:
for group in self.groups(recursive=False):
for recipient in group.recipients(recursive=True):
yield recipient
def contacts(self, of_type=None, include_all=False, recursive=True, **having):
for recipient in self.recipients(recursive=recursive):
for contact in recipient.contacts(of_type=of_type, include_all=include_all, **having):
yield contact
|
#
# Copyright 2019 FMR LLC <opensource@fmr.com>
#
# SPDX-License-Identifier: MIT
#
"""CLI and library to concurrently execute user-defined commands across AWS accounts.
## Overview
`awsrun` is both a CLI and library to execute commands over one or more AWS
accounts concurrently. Commands are user-defined Python modules that implement a
simple interface to abstract away the complications of obtaining credentials for
Boto3 sessions - especially when using SAML authentication and/or cross-account
access.
### CLI Usage
The awsrun CLI command is documented extensively on the `awsrun.cli` page. It
includes both a user guide as well as a reference guide on the use of the CLI
command, its command line options, use of the account loader and credential
plug-ins, as well as the syntax of the configuration file.
### Library Usage
Not only is awsrun a CLI, but it is, first and foremost, a Python package that
can be used in other Python libraries and scripts. The package contains
extensive documentation on its use. Each submodule contains an overview of the
module and how to use it, which is then followed by standard module docs for
classes and methods. The available [submodules](#header-submodules) can be found
at the bottom of this page. Of particular interest to library users will be the
following submodules:
`awsrun.runner`
: The core module to execute a command across one or more accounts. You will
find the `awsrun.runner.AccountRunner` and `awsrun.runner.Command` classes
defined in this module. Build your own commands by subclassing the base class.
See the [User-Defined Commmands](#user-defined-commands) next for more
information.
`awsrun.session`
: Contains the definition of the `awsrun.session.SessionProvider`, which is used
to provide Boto3 sessions pre-loaded with credentials. Included are several
built-in implementations such as `awsrun.session.aws.CredsViaProfile`,
`awsrun.session.aws.CredsViaSAML`, and `awsrun.session.aws.CredsViaCrossAccount`.
This module can be used outside of awsurn in other scripts. The module
documentation includes a user guide on how to do so.
### User-Defined Commands
To get the most benefit from awsrun, one typically writes their own used-defined
commands. Please refer to the `awsrun.commands` page for an extensive user guide
on building commands. In summary, a command is nothing more than a single Python
file that contains a subclass of `awsrun.runner.Command`. After the command has
been written, it must be added to the awsrun command path using the `--cmd-path`
[CLI flag](cli.html#options) or `cmd-path` option in the awsrun [configuration
file](cli.html#configuration_1).
### User-Defined Plug-ins
In addition to writing your own user-defined commands, you can write your own
account loader plug-ins as well as credential loader plug-ins. The following are
the high-level steps involved in writing your own plug-ins:
1. Subclass `awsrun.plugmgr.Plugin`. Be sure to read the class and module
documentation for details on how the CLI loads your plug-in.
2. Add an `__init__` method to register command line flags and configuration
options you want to make available to the end user. Be sure to call the
superclass's `__init__` method as well.
3. Provide an implementation for `awsrun.plugmgr.Plugin.instantiate`, which must
return an instance of either `awsrun.acctload.AccountLoader` or
`awsrun.session.SessionProvider` depending on whether you are writing an
account loader or a credential loader.
4. Provide an implementation for your account loader or credential loader
returned in step 3. Refer to the `awsrun.acctload.AccountLoader` and
`awsrun.session.SessionProvider` for the methods that must be implemented.
It is recommended that you review the existing plug-ins included in awsrun for
additional guidance on how to build your own.
## Future Plans
Prior to open-sourcing awsrun, the codebase was refactored to support the use of
other cloud service providers. This section includes the implementation details
as well as a high-level roadmap of future enhancements.
### Other CSPs
Other Cloud Service Providers (CSPs) aside from AWS and Azure can be supported.
The name of the installed CLI script is used to determine which CSP is being
used. For example, if the CLI has been installed as `awsrun`, the CSP is `aws`.
If the CLI has been installed as `azurerun`, the CSP is `azure`. The name of the
CSP dictates the following:
- The user configuration file is loaded from `$HOME/.csprun.yaml`, where `csp`
is the name of the CSP. This allows users to have CSP-specific configuration
files.
- The environment variable used to select an alternate path for the
configuration file is `CSPRUN_CONFIG`, where `CSP` is the name of the CSP.
This allows users to have multiple environment variables set for different
CSPs.
- The default command path is set to `awsrun.commands.csp`, where `csp` is the
name of the CSP. All of the included CSP commands are isolated in modules
dedicated to the CSP. This prevents commands for a different CSP from being
displayed on the command line when a user lists the available commands.
- The default credential loader plug-in is `awsrun.plugins.creds.csp.Default`,
where `csp` is the name of the CSP. Providing credentials to commands is done
via a credential loader. When none has been specified in the configuration
file, awsrun must default to a sane choice for a CSP.
### Roadmap
- Add tests for each module (only a handful have been done so far). PyTest is
the framework used in awsrun. See the tests/ directory which contains the
directories for unit and integration tests.
"""
name = "awsrun"
__version__ = "2.3.1"
|
py_ignore = """
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
"""
py_setup_tmp = """
from setuptools import setup, find_packages
setup(name='%s',
version='0.0.0',
description='%s',
url='%s',
author='%s',
author_email='%s',
license='MIT',
include_package_data=True,
zip_safe=False,
packages=find_packages(),
install_requires=[%s],
entry_points={
'console_scripts': ['%s']
},
)
"""
py_cmd_tmp = """
import argparse
parser = argparse.ArgumentParser(usage="Manager project, can create git , sync , encrypt your repo")
parser.add_argument("-i","--init", help="default to initialize a projet in current dir")
def main():
args = parser.parse_args()
if __name__ == "__main__":
main()
"""
read_me_tmp = """
# %s
<code>%s</code>
> %s
%s
"""
|
def nome_cidade_pais(cidade, pais, populacao=''):
"""[Junta o nome de uma cidade e o de um país de forma elegante]
"""
if populacao:
cidade_pais = f'{cidade.title()}, {pais.title()} - população {populacao}'
else:
cidade_pais = f'{cidade.title()}, {pais.title()}'
return cidade_pais
|
class train_test_setup():
def __init__(self, device, net_type, save_dir, voc, prerocess,
training_epoch=100, latent_k=32, batch_size=40, hidden_size=300, clip=50,
num_of_reviews = 5,
intra_method='dualFC', inter_method='dualFC',
learning_rate=0.00001, dropout=0, setence_max_len=50):
self.device = device
self.net_type = net_type
self.save_dir = save_dir
self.voc = voc
self.prerocess = prerocess # prerocess method
self.training_epoch = training_epoch
self.latent_k = latent_k
self.hidden_size = hidden_size
self.num_of_reviews = num_of_reviews
self.clip = clip
self.intra_method = intra_method
self.inter_method = inter_method
self.learning_rate = learning_rate
self.dropout = dropout
self.batch_size = batch_size
self.setence_max_len = setence_max_len
pass
def _get_asin_reviewer(self, select_table='clothing_'):
"""Get asin and reviewerID from file"""
asin, reviewerID = self.prerocess._read_asin_reviewer(table=select_table)
return asin, reviewerID
def set_training_batches(self, training_batches, external_memorys, candidate_items, candidate_users, training_batch_labels):
self.training_batches = training_batches
self.external_memorys = external_memorys
self.candidate_items = candidate_items
self.candidate_users = candidate_users
self.training_batch_labels = training_batch_labels
pass
def set_asin2title(self, asin2title):
self.asin2title = asin2title
pass
|
"""Provides HTML tags wrappers for pretty printing."""
def bold(s):
return '<b>'+s+'</b>'
def italic(s):
return '<i>'+s+'</i>'
def b(s):
return bold(s)
def i(s):
return italic(s)
def red(s):
return '<font color="red">'+s+'</font>'
def green(s):
return '<font color="green">'+s+'</font>'
def blue(s):
return '<font color="blue">'+s+'</font>'
|
class Solution(object):
def threeSumClosest(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
nums.sort()
triplate = []
prevSum = float("-inf")
prevDiff = target - prevSum
for i in range(len(nums) - 2):
if i > 0 and nums[i] == nums[i - 1]:
continue
left, right = i + 1, len(nums) - 1
while left < right:
currentSum = nums[i] + nums[left] + nums[right]
currentDiff = target - currentSum
prevDiff = target - prevSum
if abs(currentDiff) < abs(prevDiff):
triplate = [nums[i], nums[left], nums[right]]
prevDiff = currentDiff
prevSum = currentSum
if currentSum < target:
while left < right and nums[left] == nums[left + 1]:
left += 1
left += 1
elif currentSum > target:
while left < right and nums[right] == nums[right - 1]:
right -= 1
right -= 1
else:
return sum(triplate[:])
return sum(triplate[:])
sol = Solution()
input = [1,1,1,0]
target = -100
tripletsSum = sol.threeSumClosest(input, target)
print("Result: ", tripletsSum)
|
MODELS = {
"pwc": (
'configs/pwcnet/pwcnet_ft_4x1_300k_sintel_final_384x768.py',
'checkpoints/pwcnet_ft_4x1_300k_sintel_final_384x768.pth'
),
"flownetc": (
'configs/flownet/flownetc_8x1_sfine_sintel_384x448.py',
'checkpoints/flownetc_8x1_sfine_sintel_384x448.pth'
),
"raft": (
"configs/raft/raft_8x2_100k_mixed_368x768.py",
"checkpoints/raft_8x2_100k_mixed_368x768.pth"
)
}
|
'''
Implementation of exponential search
Time Complexity: O(logn)
Space Complexity: Depends on implementation of binary_search {O(logn): recursive, O(1):iterative}
Used for unbounded search, when the length of array is infinite or not known
'''
#iterative implementation of binary search
def binary_search(arr, s, e, x):
'''
#arr: the array in which we need to find an element (sorted, increasing order)
#s: start index
#e: end index
#x: element we are looking for
'''
#search until arr becomes empty []
while (e>=s):
m = s + int((e-s)/2) #middle index
if x==arr[m]: #if found at mid return index
return m
elif x>arr[m]: #if x>arr[m] search only in the right array
s = m+1
elif x<arr[m]: #if x<arr[m] search only in the left array
e = m-1
return -1
def exponential_search(arr, n, x):
if x==arr[0]:
return 0;
i=1 #index
#keep increasing index until the indexed element is smaller and then do binary search
while i<n and x>arr[i]:
i = i*2
return binary_search(arr, int(i/2), min(i, n), x)
arr = [2,3,4,10,40]
x = 10
index = exponential_search(arr, len(arr), x)
if index==-1:
print("Element not present in list")
else:
print("Element",x,"is present at",index)
|
# Copyright (c) 2016, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt
# of any required approvals from the U.S. Dept. of Energy).
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
Custom exception and warning classes.
"""
class EventException(Exception):
"""Custom Event exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class EventWarning(Warning):
"""Custom Event warning"""
pass
class TimeRangeException(Exception):
"""Custom TimeRange exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class TimeRangeWarning(Warning):
"""Custom TimeRange warning"""
pass
class IndexException(Exception):
"""Custom Index exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class IndexWarning(Warning):
"""Custom Index warning"""
pass
class UtilityException(Exception):
"""Custom Utility exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class UtilityWarning(Warning):
"""Custom Utility warning"""
pass
class PipelineException(Exception):
"""Custom Pipeline exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class PipelineWarning(Warning):
"""Custom Pipeline warning"""
pass
class PipelineIOException(Exception):
"""Custom PipelineIO exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class PipelineIOWarning(Warning):
"""Custom PipelineIO warning"""
pass
class CollectionException(Exception):
"""Custom Collection exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class CollectionWarning(Warning):
"""Custom Collection warning"""
pass
class TimeSeriesException(Exception):
"""Custom TimeSeries exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class TimeSeriesWarning(Warning):
"""Custom TimeSeries warning"""
pass
class ProcessorException(Exception):
"""Custom Processor exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class ProcessorWarning(Warning):
"""Custom Processor warning"""
pass
class FilterException(Exception):
"""Custom Filter exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class FilterWarning(Warning):
"""Custom Filter warning"""
pass
class FunctionException(Exception):
"""Custom Function exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class FunctionWarning(Warning):
"""Custom Function warning"""
pass
NAIVE_MESSAGE = 'non-naive (aware) datetime objects required'
|
"""
Searching lists.
"""
toys = ["blocks", "slinky", "fidget spinner", "cards", "doll house", "legos", "blocks", "teddy bear"]
# Finding items in a list
print(toys.index("legos"))
print(toys.index("blocks"))
#print(toys.index("video game"))
print("")
# Checking if items are in a list
print("legos" in toys)
print("blocks" in toys)
print("video game" in toys)
print("teddy bear" not in toys)
print("dice" not in toys)
print("")
# Counting items in list
print(toys.count("slinky"))
print(toys.count("blocks"))
|
class VaderStreamsConstants(object):
__slots__ = []
BASE_URL = 'http://vapi.vaders.tv/'
CATEGORIES_JSON_FILE_NAME = 'categories.json'
CATEGORIES_PATH = 'epg/categories'
CHANNELS_JSON_FILE_NAME = 'channels.json'
CHANNELS_PATH = 'epg/channels'
DB_FILE_NAME = 'vaderstreams.db'
DEFAULT_EPG_SOURCE = 'vaderstreams'
DEFAULT_PLAYLIST_PROTOCOL = 'hls'
DEFAULT_PLAYLIST_TYPE = 'dynamic'
EPG_BASE_URL = 'http://vaders.tv/'
JSON_EPG_TIME_DELTA_HOURS = 1
MATCHCENTER_SCHEDULE_JSON_FILE_NAME = 'schedule.json'
MATCHCENTER_SCHEDULE_PATH = 'mc/schedule'
PROVIDER_NAME = 'VaderStreams'
TEMPORARY_DB_FILE_NAME = 'vaderstreams_temp.db'
VALID_EPG_SOURCE_VALUES = ['other', 'vaderstreams']
VALID_PLAYLIST_PROTOCOL_VALUES = ['hls', 'mpegts']
VALID_PLAYLIST_TYPE_VALUES = ['dynamic', 'static']
VALID_SERVER_VALUES = ['auto']
XML_EPG_FILE_NAME = 'p2.xml.gz'
_provider_name = PROVIDER_NAME.lower()
|
class Vector:
def __init__(self, inputs: list):
self.inputs = inputs
def dot(self, weigths):
dot_product = 0
for index in range(len(self.inputs)):
dot_product = dot_product + (self.inputs[index] * weigths.inputs[index])
return dot_product
|
dependency_matcher_patterns = {
"pattern_parameter_adverbial_clause": [
{"RIGHT_ID": "action_head", "RIGHT_ATTRS": {"POS": "VERB"}},
{
"LEFT_ID": "action_head",
"REL_OP": ">",
"RIGHT_ID": "condition_head",
"RIGHT_ATTRS": {"DEP": "advcl"},
},
{
"LEFT_ID": "condition_head",
"REL_OP": ">",
"RIGHT_ID": "dependee_param",
"RIGHT_ATTRS": {"DEP": {"IN": ["nsubj", "nsubjpass"]}},
},
]
}
|
PAGE_ITEM_LIMIT = 10
RSS_ITEM_LIMIT = 10
OUTPUT_DIRECTORY = ""
|
"""Provides a macro to import all TensorFlow Serving dependencies.
Some of the external dependencies need to be initialized. To do this, duplicate
the initialization code from TensorFlow Serving's WORKSPACE file.
"""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def tf_serving_workspace():
"""All TensorFlow Serving external dependencies."""
# ===== Bazel package rules dependency =====
http_archive(
name = "rules_pkg",
sha256 = "352c090cc3d3f9a6b4e676cf42a6047c16824959b438895a76c2989c6d7c246a",
url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz",
)
# ===== RapidJSON (rapidjson.org) dependency =====
http_archive(
name = "com_github_tencent_rapidjson",
url = "https://github.com/Tencent/rapidjson/archive/v1.1.0.zip",
sha256 = "8e00c38829d6785a2dfb951bb87c6974fa07dfe488aa5b25deec4b8bc0f6a3ab",
strip_prefix = "rapidjson-1.1.0",
build_file = "@//third_party/rapidjson:BUILD",
)
# ===== libevent (libevent.org) dependency =====
http_archive(
name = "com_github_libevent_libevent",
url = "https://github.com/libevent/libevent/archive/release-2.1.8-stable.zip",
sha256 = "70158101eab7ed44fd9cc34e7f247b3cae91a8e4490745d9d6eb7edc184e4d96",
strip_prefix = "libevent-release-2.1.8-stable",
build_file = "@//third_party/libevent:BUILD",
)
# ===== ICU dependency =====
# Note: This overrides the dependency from TensorFlow with a version
# that contains all data.
http_archive(
name = "icu",
strip_prefix = "icu-release-64-2",
sha256 = "dfc62618aa4bd3ca14a3df548cd65fe393155edd213e49c39f3a30ccd618fc27",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/unicode-org/icu/archive/release-64-2.zip",
"https://github.com/unicode-org/icu/archive/release-64-2.zip",
],
build_file = "//third_party/icu:BUILD",
patches = ["//third_party/icu:data.patch"],
patch_args = ["-p1", "-s"],
)
# ===== TF.Text dependencies
# NOTE: Before updating this version, you must update the test model
# and double check all custom ops have a test:
# https://github.com/tensorflow/text/blob/master/oss_scripts/model_server/save_models.py
http_archive(
name = "org_tensorflow_text",
sha256 = "918e612a4c5e00d4223db2f7eaced1dc33ec4f989ab8cfee094ae237e22b090b",
strip_prefix = "text-2.4.3",
url = "https://github.com/tensorflow/text/archive/v2.4.3.zip",
patches = ["@//third_party/tf_text:tftext.patch"],
patch_args = ["-p1"],
repo_mapping = {"@com_google_re2": "@com_googlesource_code_re2"},
)
http_archive(
name = "com_google_sentencepiece",
strip_prefix = "sentencepiece-1.0.0",
sha256 = "c05901f30a1d0ed64cbcf40eba08e48894e1b0e985777217b7c9036cac631346",
url = "https://github.com/google/sentencepiece/archive/1.0.0.zip",
)
http_archive(
name = "com_google_glog",
sha256 = "1ee310e5d0a19b9d584a855000434bb724aa744745d5b8ab1855c85bff8a8e21",
strip_prefix = "glog-028d37889a1e80e8a07da1b8945ac706259e5fd8",
urls = [
"https://mirror.bazel.build/github.com/google/glog/archive/028d37889a1e80e8a07da1b8945ac706259e5fd8.tar.gz",
"https://github.com/google/glog/archive/028d37889a1e80e8a07da1b8945ac706259e5fd8.tar.gz",
],
)
|
"""
git
igualdad e identidad
excepciones
operadores binarios
"""
# excepcionew
# out of bounds exception
# keyerror
# excepcion para mejor validación de entrada
# excepcion para continuar en un error (keyerror en mi piano)
"""
<< (bit shift) (desplazamiento de bit a la izquierda)
011011
110110
101100
011000
>> (right bit shift) (desplazamiento de bit a la derecha)
1001
0100
0010
~ (complemento)
1100
0011
1010101111000
0101010000111
& (bitwise and)
1001
1010 &
1000
| (bitwise or)
1001
1010 |
1011
^ (xor)
1001
1010 ^
0011
"""
|
# %%
#######################################
def match_str_len_with_padding(
string1: str, string2: str, padding="#", align=("left", "center", "right")[1]
):
"""Returns a list containing the original longer string, and the smaller string with padding.
Examples:
>>> mystring = "Complex is better than complicated."
>>> secondstring = " blah "
>>> blah_song = "blah ba blah blah blah"
>>> match_str_len_with_padding(mystring, secondstring)\n
['Complex is better than complicated.', '############## blah ###############']
>>> match_str_len_with_padding(mystring, blah_song, padding="*")\n
['Complex is better than complicated.', '******blah ba blah blah blah*******']
>>> match_str_len_with_padding(mystring[::-1], mystring)\n
['.detacilpmoc naht retteb si xelpmoC', 'Complex is better than complicated.']
>>> match_str_len_with_padding(mystring, blah_song, padding="&", align='right')\n
['Complex is better than complicated.', '&&&&&&&&&&&&&blah ba blah blah blah']
>>> match_str_len_with_padding(mystring, blah_song, padding="<", align='left')\n
['Complex is better than complicated.', 'blah ba blah blah blah<<<<<<<<<<<<<']
References:
One liner if/else: https://youtu.be/MHlwl6GsT8s?t=990\n
Format() with embedded variables for 'format specifiers': https://stackoverflow.com/questions/3228865/how-do-i-format-a-number-with-a-variable-number-of-digits-in-python
Args:
string1 (str): String number 1 to use in the comparison
string2 (str): String number 2 to use in the comparison
padding (str, optional): Here you can specify the padding character. Defaults to "#".
align (str, optional): This is used to show valid arguments for this parameter (the default value is 'center'). Defaults to ('left','center','right')[1].
Returns:
list: Returns a list containing two strings of the same length, with the smaller string being padded.
"""
bigger_str = string1 if len(string1) >= len(string2) else string2
smaller_str = string1 if len(string1) < len(string2) else string2
length_to_match = len(bigger_str)
if align == "left":
padded_string = "{small_str:{somepad}<{thelength}}".format(
thelength=length_to_match, small_str=smaller_str, somepad=padding
)
elif align == "center":
padded_string = "{small_str:{somepad}^{thelength}}".format(
thelength=length_to_match, small_str=smaller_str, somepad=padding
)
elif align == "right":
padded_string = "{small_str:{somepad}>{thelength}}".format(
thelength=length_to_match, small_str=smaller_str, somepad=padding
)
if padded_string:
return [bigger_str, padded_string]
|
class Blacklist:
def __init__(self):
"""
Initializes a set of blaclisted words
"""
self.bl = set()
self.words = """
janvier
février
mars
avril
mai
juin
juillet
août
septembre
octobre
novembre
notamment
décembre
ai
accueil
ad
ads
adsense
ainsi
alors
amp
après
au
aujourd
auquel
aurait
auraient
aussi
autour
autre
autres
aux
auxquels
avec
avait
avoir
car
ccedil
ce
ceci
cela
ces
cet
cette
chaque
comme
dans
de
depuis
des
deux
devant
donc
dont
du
début
eacute
ecirc
egrave
elle
elles
en
encore
entre
es
est
et
gt
hui
il
ils
je
la
le
laquelle
lequel
les
leur
leurs
lui
ma
mais
me
mes
mieux
moins
mon
même
nbsp
ne
ni
notre
nous
on
or
ou
où
par
pas
peu
peut
plus
plusieurs
plutôt
pour
pr
puis
qu
quand
que
quel
quelle
quelles
quelque
quels
qui
quoi
quot
sa
se
selon
sera
ses
si
son
sous
sur
ta
tandis
tant
tel
tels
tes
ton
tous
tout
toute
toutes
très
tu
un
une
vers
voici
vous
votre
à
at
site
sont
fait
lien
faire
moi
ça
ca
aucun
être
etre
ont
nos
c'est
suis
sans
vos
voir
grand
ici
bonne
ca
pm
bon
d'un
d'une
été
var
là
del
était
el
chez
petite
passe
fois
www
post
http
flash
pays
fr
en
be
info
lire
note
liens
lien
page
pages
envoyer
article
articles
annuaire
adresse
recommander
rédigé
redige
tags
net
recherche
gratuit
contact
google
posté
poste
bienvenue
clic
rss
org
index
results
result
error
online
email
mail
ajouter
suite
billet
commentaire
commentaires
fil
répondre
blog
blogs
permanent
publié
publie
strong
span
style
color
trackback
trackbacks
permalien
archives
archive
message
messages
rétroliens
rétrolien
écrit
an
_blank
href
hps
can
class
line
else
our
am
write
search
home
click
country
if
was
are
here
not
free
from
we
my
posted
about
more
have
news
new
your
with
as
comments
comment
of
that
is
to
the
she
he
they
them
their
thus
it
its
did
you
may
might
must
will
in
all
and
by
for
yes
no
us
this
com
аз
ако
ала
бе
без
беше
би
бивш
бивша
бившо
бил
била
били
било
благодаря
близо
бъдат
бъде
бъдеш
бъда
бъдете
бяха
беше
бях
бяхме
във
вас
ваш
ваша
ваше
вашо
вашето
вашата
вашите
вече
ви
вие
винаги
все
всеки
всички
всичко
всяка
всяко
във
въпреки
върху
ги
главен
главна
главно
го
година
години
годишен
годишно
годишна
годишното
годишната
да
дали
два
двама
двамата
две
двете
ден
днес
дни
до
добра
добре
добро
добрата
доброто
добър
докато
докога
дори
досега
доста
друг
друга
други
другата
другите
едва
един
една
единият
едната
еднаква
еднакви
еднаквите
еднакъв
еднаквият
едно
ето
за
зад
заедно
заради
засега
затова
защо
защото
из
или
им
как
каква
какво
каквато
каквото
какъв
какъвто
както
какъв
като
кога
когато
кое
което
които
кой
който
колко
колкото
коя
която
къде
където
към
лесен
лесно
лесна
лесни
лесното
лесните
лесната
лесният
ли
лош
лоша
лошо
лоши
лошият
лошата
лошите
лошото
май
малко
малка
ме
между
мек
мен
месец
ми
много
мнозина
момент
момента
му
на
над
назад
най
напред
например
нас
не
него
нещо
нея
ни
ние
никой
нито
нищо
но
някои
някой
някоя
някое
няколко
обаче
около
освен
особено
от
отгоре
отново
още
пак
пo
повечe
повечето
под
поне
поради
после
почти
пред
преди
през
при
пък
първа
първатапърви
пършият
първо
първото
пъти
са
сам
само
се
сега
си
скоро
след
следващ
сме
според
сред
срещу
сте
съм
със
също
тази
така
такива
такъв
там
твой
те
тези
ти
то
това
тогава
този
той
толкова
точно
три
трябва
тук
тъй
тя
тях
утре
хиляди
часа
че
често
чрез
ще
щом
як
abaft
able
aboard
about
above
according
accordingly
across
actually
adj
afore
aforesaid
after
afterwards
again
against
agin
ago
ain
aint
albeit
all
allow
allows
almost
alone
along
alongside
already
also
although
always
amid
amidst
among
amongst
and
anent
another
any
anybody
anyhow
anyone
anything
anyway
anyways
anywhere
apart
appear
appreciate
appropriate
april
are
aren
around
aside
ask
asking
aslant
associated
athwart
august
available
away
awfully
back
bad
barring
became
because
become
becomes
becoming
been
before
beforehand
behind
being
believe
below
beneath
beside
besides
best
better
between
betwixt
beyond
big
both
brief
but
came
can
cannot
cant
cause
causes
certain
certainly
changes
circa
clearly
close
com
come
comes
comwww
concerning
consequently
consider
considering
contain
containing
contains
corresponding
cos
could
couldn
couldst
course
currently
date
december
definitely
described
despite
did
didn
different
difficult
does
doesn
doing
don
done
down
downwards
during
durst
each
easy
edu
eight
either
else
elsewhere
empty
enough
entirely
ere
especially
etc
even
ever
every
everybody
everyone
everything
everywhere
exactly
example
examples
except
excepting
failing
false
far
february
few
fifth
first
five
followed
following
follows
for
former
formerly
forth
four
friday
from
full
further
furthermore
get
gets
getting
given
gives
goes
going
gone
gonna
good
got
gotta
gotten
greetings
had
hadn
happens
hardly
has
hasn
hast
hath
have
haven
having
he
hello
help
hence
her
here
here
hereafter
hereby
herein
hereupon
hers
herself
him
himself
his
hither
hopefully
how
how
howbeit
however
ignored
immediate
inasmuch
inc
indeed
indicate
indicated
indicates
inner
inside
insofar
instantly
instead
into
inward
isn
its
itself
january
july
june
just
keep
keeps
kept
know
known
knows
last
lately
later
latter
latterly
least
left
less
lest
let
like
liked
likely
likewise
little
long
look
looking
looks
ltd
mainly
many
march
may
maybe
mayn
mean
meanwhile
merely
mid
midst
might
mightn
miss
monday
more
moreover
most
mostly
much
must
mustn
myself
name
namely
near
nearly
necessary
need
needn
needs
neither
never
nevertheless
new
next
nine
no-one
nobody
non
none
noone
nor
normally
not
nothing
notwithstanding
nought
novel
november
now
nowhere
obviously
october
off
often
okay
old
once
onceone
one
ones
oneself
only
onto
open
other
others
otherwise
ought
oughtn
our
ours
ourselves
out
outside
over
overall
own
particular
particularly
past
per
perhaps
placed
please
plus
possible
presumably
probably
provides
qua
que
quite
rather
ready
really
reasonably
regarding
regardless
regards
relatively
respectively
right
said
same
sans
saturday
saw
say
saying
says
second
secondly
see
seeing
seem
seemed
seeming
seems
seen
self
selves
sensible
sent
september
serious
seriously
seven
several
shall
shalt
shan
she
shed
shell
short
should
should
shouldn
since
six
some
somebody
somehow
someone
something
sometime
sometimes
somewhat
somewhere
soon
sorry
specified
specify
specifying
still
sub
such
sunday
sup
sure
take
taken
takes
taking
tall
tell
ten
tends
than
thank
thanks
thanx
that
thats
the
thee
their
theirs
them
themselves
then
thence
there
thereafter
thereby
therefor
therefore
therein
theres
thereupon
these
they
thine
thing
things
think
third
this
tho
thorough
thoroughly
those
thou
though
three
thro
through
throughout
thru
thursday
thus
thyself
till
together
too
took
toward
towards
tried
tries
true
truly
try
trying
tuesday
twice
two
under
underneath
unfortunately
unless
unlike
unlikely
until
unto
upon
use
used
useful
uses
using
usually
uucp
value
various
versus
very
via
viz
want
wants
was
wasn
way
we
wednesday
welcome
well
went
were
weren
wert
what
whatever
whatsoever
when
whence
whencesoever
whenever
whensoever
where
whereafter
whereas
whereat
whereby
wherefrom
wherein
whereinto
whereof
whereon
whereto
whereunto
whereupon
wherever
wherewith
whether
which
whichever
whichsoever
while
whilst
whither
who
whoever
whole
whom
whomever
whomsoever
whore
whose
whoso
whosoever
why
will
willing
wish
with
within
without
won
wonder
wont
would
wouldn
wouldst
xauthor
xcal
xnote
xother
xsubj
year
yes
yet
you
your
yours
yourself
yourselves
zero
ahogy
ahol
aki
akik
akkor
alatt
által
általában
amely
amelyek
amelyekben
amelyeket
amelyet
amelynek
ami
amit
amolyan
amíg
amikor
át
abban
ahhoz
annak
arra
arról
az
azok
azon
azt
azzal
azért
aztán
azután
azonban
bár
be
belül
benne
cikk
cikkek
cikkeket
csak
de
e
eddig
egész
egy
egyes
egyetlen
egyéb
egyik
egyre
ekkor
el
elég
ellen
elõ
elõször
elõtt
elsõ
én
éppen
ebben
ehhez
emilyen
ennek
erre
ez
ezt
ezek
ezen
ezzel
ezért
és
fel
felé
hanem
hiszen
hogy
hogyan
igen
így
illetve
ill
ilyen
ilyenkor
ison
ismét
itt
jó
jól
jobban
kell
kellett
keresztül
keressünk
ki
kívül
között
közül
legalább
lehet
lehetett
legyen
lenne
lenni
lesz
lett
maga
magát
majd
majd
már
más
másik
meg
még
mellett
mert
mely
melyek
mi
mit
míg
miért
milyen
mikor
minden
mindent
mindenki
mindig
mint
mintha
mivel
most
nagy
nagyobb
nagyon
ne
néha
nekem
neki
nem
néhány
nélkül
nincs
olyan
ott
össze
õ
õk
õket
pedig
persze
rá
s
saját
sem
semmi
sok
sokat
sokkal
számára
szemben
szerint
szinte
talán
tehát
teljes
tovább
továbbá
több
úgy
ugyanis
új
újabb
újra
után
utána
utolsó
vagy
vagyis
valaki
valami
valamint
való
vagyok
van
vannak
volt
voltam
voltak
voltunk
vissza
vele
viszont
volna
aby
ale
bardziej
bardzo
bez
bo
bowiem
co
czy
czyli
dla
dlatego
do
gdy
gdzie
go
ich
im
innych
iż
jak
jako
jednak
jego
jej
jeszcze
jeśli
już
kiedy
kilka
która
które
którego
której
który
których
którym
którzy
lub
mi
między
mnie
można
na
nad
nam
nas
naszego
naszych
nawet
nich
nie
nim
niż
od
oraz
po
pod
poza
przed
przede
przez
przy
również
się
sobie
swoje
ta
tak
takie
także
tam
te
tego
tej
ten
też
to
tu
tych
tylko
tym
we
wiele
wielu
więc
wszystkich
wszystkim
wszystko
właśnie
za
zawsze
ze
że
acá
actualmente
acuerdo
adelante
además
adrede
afirmó
agregó
ahí
ahora
ajena
ajenas
ajeno
ajenos
algo
algún
alguna
algunas
alguno
algunos
allá
allí
alrededor
ambos
añadió
antano
ante
anterior
antes
apenas
aproximadamente
aquel
aquella
aquellas
aquello
aquellos
aquí
arribaabajo
aseguró
así
aún
aunque
ayer
bajo
bastante
bien
breve
buen
buena
buenas
bueno
buenos
cada
casi
cerca
cierta
ciertas
cierto
ciertos
cinco
claro
comentó
cómo
con
conmigo
conocer
considera
consideró
consigo
contigo
contra
cosas
creo
cual
cuales
cualquier
cualquiera
cualquieras
cuán
cuando
cuanta
cuantas
cuanto
cuantos
cuatro
cuenta
dado
dan
dar
debajo
debe
deben
debido
decir
dejar
dejó
del
delante
demás
demasiada
demasiadas
demasiado
demasiados
dentro
deprisa
desde
despacio
después
detras
dia
dias
dice
dicen
dicho
dieron
diferente
diferentes
dijeron
dijo
dio
donde
dos
durante
ejemplo
ella
ellas
ello
ellos
embargo
encima
encuentra
enfrente
enseguida
entonces
entre
era
erais
éramos
eran
eras
eres
esa
esas
ese
eso
esos
ésta
estaba
estabais
estábamos
estaban
estabas
estad
estada
estadas
estado
estados
estáis
estamos
están
estando
estar
estará
estarán
estarás
estaré
estaréis
estaremos
estaría
estaríais
estaríamos
estarían
estarías
éstas
éste
esté
estéis
estemos
estén
estés
esto
éstos
estoy
estuve
estuviera
estuvierais
estuviéramos
estuvieran
estuvieras
estuvieron
estuviese
estuvieseis
estuviésemos
estuviesen
estuvieses
estuvimos
estuviste
estuvisteis
estuvo
excepto
existe
existen
explicó
expresó
fin
final
fue
fuera
fuerais
fuéramos
fueran
fueras
fueron
fuese
fueseis
fuésemos
fuesen
fueses
fui
fuimos
fuiste
fuisteis
gran
grandes
habéis
haber
había
habíais
habíamos
habían
habías
habida
habidas
habido
habidos
habiendo
habla
hablan
habrá
habrán
habrás
habré
habréis
habremos
habría
habríais
habríamos
habrían
habrías
hace
hacen
hacer
hacerlo
hacia
haciendo
han
has
hasta
hay
haya
hayáis
hayamos
hayan
hayas
hecho
hemos
hicieron
hizo
horas
hoy
hube
hubiera
hubierais
hubiéramos
hubieran
hubieras
hubieron
hubiese
hubieseis
hubiésemos
hubiesen
hubieses
hubimos
hubiste
hubisteis
hubo
igual
incluso
indicó
informó
jamás
junto
juntos
lado
las
lejos
les
llegó
lleva
llevar
los
luego
lugar
mal
manera
manifestó
más
mayor
mediante
medio
mejor
mencionó
menos
menudo
mía
mias
mientras
mío
mios
mis
misma
mismas
mismo
mismos
momento
mucha
muchas
muchísima
muchísimas
muchísimo
muchísimos
mucho
muchos
muy
nada
nadie
ningún
ninguna
ningunas
ninguno
ningunos
nos
nosotras
nosotros
nuestra
nuestras
nuestro
nuestros
nueva
nuevas
nuevo
nuevos
nunca
ocho
otra
otras
otro
otros
pais
para
parece
parecer
parte
partir
pasada
pasado
peor
pero
pesar
poca
pocas
poco
pocos
podemos
podrá
podrán
podría
podrían
poner
por
porque
posible
primer
primera
primero
primeros
principalmente
pronto
propia
propias
propio
propios
próximo
próximos
pudo
pueda
puede
pueden
pues
qeu
qué
quedó
queremos
querer
quién
quienes
quienesquiera
quienquiera
quiere
quiza
quizas
raras
realizado
realizar
realizó
repente
respecto
salvo
sea
seáis
seamos
sean
seas
según
segunda
segundo
seis
señaló
sentid
sentida
sentidas
sentido
sentidos
ser
será
serán
serás
seré
seréis
seremos
sería
seríais
seríamos
serían
serías
sido
siempre
siendo
siente
siete
sigue
siguiente
sin
sino
sintiendo
sobre
sois
sola
solamente
solas
sólo
solos
somos
son
soy
soyos
sra
sres
sta
supuesto
sus
suya
suyas
suyo
suyos
tal
tales
también
tampoco
tan
tanta
tantas
tanto
tantos
tarde
temprano
tendrá
tendrán
tendrás
tendré
tendréis
tendremos
tendría
tendríais
tendríamos
tendrían
tendrías
tened
tenéis
tenemos
tener
tenga
tengáis
tengamos
tengan
tengas
tengo
tenía
teníais
teníamos
tenían
tenías
tenida
tenidas
tenido
tenidos
teniendo
tercera
tiene
tienen
tienes
toda
todas
todavía
todo
todos
tomar
total
tras
trata
través
tres
tus
tuve
tuviera
tuvierais
tuviéramos
tuvieran
tuvieras
tuvieron
tuviese
tuvieseis
tuviésemos
tuviesen
tuvieses
tuvimos
tuviste
tuvisteis
tuvo
tuya
tuyas
tuyo
tuyos
última
últimas
último
últimos
una
unas
uno
unos
usted
ustedes
vamos
van
varias
varios
veces
ver
vez
vosostras
vosostros
vosotras
vosotros
vuestra
vuestras
vuestro
vuestros
aby
ac
ackoli
ackoli
ahoj
ale
ale
alespon
anebo
ani
ano
asi
aspon
at
avšak
až
ba
behem
bez
beze
blízko
bohužel
brzo
brezen
breznu
bud
bude
budeme
budeš
budete
budou
budu
byl
byla
byli
bylo
byly
bys
co
cau
cem
cemu
cerven
cervenci
cervenec
cervnu
cí
ctrnáct
ctvrtek
ctvrtka
ctyri
dál
dále
daleko
dekovat
dekujeme
dekuji
den
deset
devatenáct
devet
díky
dle
do
dobrý
docela
dokonce
doprostred
duben
dubnu
dva
dvacet
dvanáct
dve
hodne
chce
chceme
chceš
chcete
chci
chtejí
chtít
já
jak
jakému
jakmile
jaký
jakými
jde
je
jeden
jedenáct
jedna
jednak
jedno
jednou
jedou
jeho
její
jejich
jejích
jejím
jelikož
jemu
jen
jenom
jenž
jestli
jestlipak
jestliže
ješte
ji
jí
jich
jím
jimi
jiná
jinací
jinak
jinde
jiné
jinému
jiný
jsem
jsi
jsme
jsou
jste
kam
každá
každé
každému
každý
každým
kde
kdo
kdy
kdyby
kdyby
kdybych
kdybychom
kdybys
kdybyste
když
ke
kéž
koho
kolem
kolik
komu
konce
krome
která
které
kterému
který
kterými
kterí
kudy
kveten
kvetnu
kvuli
leden
lednu
listopad
listopadu
má
mají
málo
mám
máme
máš
máte
mé
me
mezi
mí
mimo
mít
mne
mnou
moc
mohl
mohou
moje
moji
možná
muj
musí
muže
my
mých
mým
na
nad
nade
nám
námi
naproti
napríc
nás
náš
naše
naši
našich
ne
ne
nebo
nebot
nebyl
nebyla
nebyli
nebyly
neco
necemu
necím
nedelá
nedelají
nedelám
nedeláme
nedeláš
nedeláte
nedele
nedeli
nej
nejak
nejaká
nejaké
nejakého
nejakému
nejaký
nejen
nejsi
nekde
nekdo
nekdy
nekoho
nekolikátý
nekom
nekomu
nekterá
nekteré
nekterého
nekterému
nekterý
nekým
nemají
nemáme
nemáte
nemel
nemu
není
než
nežli
ní
nic
nicemu
nicí
nich
nich
nijakému
nijaký
nikdo
nikdy
nikoho
nikomu
ním
nimi
nula
nýbrž
oba
obcas
obema
obou
oboum
od
ode
okolo
on
ona
onen
oni
oním
ono
onomu
ony
oproti
osm
osmnáct
ovšem
pak
pátek
pátku
patnáct
pet
po
pod
podle
pondelí
porád
potom
pozde
pro
proc
prosím
prosinci
prosinec
proste
proti
proto
protože
prece
pred
pres
prestože
pri
rovne
ríjen
ríjnu
sám
sama
samému
sami
samo
samy
samým
samými
se
sebe
sedm
sedm
sedmnáct
si
skoro
skrz
smejí
smí
snad
sobota
sobotu
soboty
spolu
srpen
srpnu
sta
sté
sto
streda
stredu
stredy
svoje
svoji
svuj
svých
šest
šestnáct
ta
tady
tak
tak
takhle
taková
takové
takovému
takový
takovým
taky
tam
tamhle
tamto
te
tebe
tebou
tebou
ted
teda
tedy
ten
tenhle
tento
tentýž
ti
tím
tímhle
tímto
tisíc
tisíce
to
tobe
tohle
tomu
tomuto
totiž
toto
trošku
treba
trebaže
tri
trináct
tudíž
tvá
tvé
tvoje
tvoji
tvuj
tvuj
tvých
tvým
tvými
ty
týž
únor
únoru
urcite
úterý
už
vám
vámi
vás
váš
vaše
vaši
vašich
ve
vecer
vedle
veškerému
veškerý
veškerým
vlastne
však
všechen
všechno
všem
všem
všemu
všichni
vším
vubec
vy
vždy
vždyt
za
zac
zajisté
zárí
zatímco
zatímco
ze
žádná
žádné
žádného
žádnému
žádnou
žádný
žádným
že
olen
olet
on
olemme
olette
ovat
ole
oli
olisi
olisit
olisin
olisimme
olisitte
olisivat
olit
olin
olimme
olitte
olivat
ollut
olleet
en
et
ei
emme
ette
eivät
minä
minun
minut
minua
minussa
minusta
minuun
minulla
minulta
minulle
sinä
sinun
sinut
sinua
sinussa
sinusta
sinuun
sinulla
sinulta
sinulle
hän
hänen
hänet
häntä
hänessä
hänestä
häneen
hänellä
häneltä
hänelle
me
meidän
meidät
meitä
meissä
meistä
meihin
meillä
meiltä
meille
te
teidän
teidät
teitä
teissä
teistä
teihin
teillä
teiltä
teille
he
heidän
heidät
heitä
heissä
heistä
heihin
heillä
heiltä
heille
tämä
tämän
tätä
tässä
tästä
tähän
tallä
tältä
tälle
tänä
täksi
tuo
tuon
tuotä
tuossa
tuosta
tuohon
tuolla
tuolta
tuolle
tuona
tuoksi
se
sen
sitä
siinä
siitä
siihen
sillä
siltä
sille
sinä
siksi
nämä
näiden
näitä
näissä
näistä
näihin
näillä
näiltä
näille
näinä
näiksi
nuo
noiden
noita
noissa
noista
noihin
noilla
noilta
noille
noina
noiksi
ne
niiden
niitä
niissä
niistä
niihin
niillä
niiltä
niille
niinä
niiksi
kuka
kenen
kenet
ketä
kenessä
kenestä
keneen
kenellä
keneltä
kenelle
kenenä
keneksi
ketkä
keiden
ketkä
keitä
keissä
keistä
keihin
keillä
keiltä
keille
keinä
keiksi
mikä
minkä
minkä
mitä
missä
mistä
mihin
millä
miltä
mille
minä
miksi
mitkä
joka
jonka
jota
jossa
josta
johon
jolla
jolta
jolle
jona
joksi
jotka
joiden
joita
joissa
joista
joihin
joilla
joilta
joille
joina
joiksi
että
ja
jos
koska
kuin
mutta
niin
sekä
sillä
tai
vaan
vai
vaikka
kanssa
mukaan
noin
poikki
yli
kun
niin
nyt
itse
abbastanza
abbia
abbiamo
abbiano
abbiate
abbiomo
accidenti
adesso
affinchè
affinche
agl
agli
ahime
alcuna
alcuni
alcuno
all
alla
alle
allo
altri
altrimenti
altro
altrui
anche
ancora
anni
anno
ansa
anzichè
assai
attesa
avanti
avemmo
avendo
avente
aver
avere
avesse
avessero
avessi
avessimo
aveste
avesti
avete
aveva
avevamo
avevano
avevate
avevi
avevo
avrà
avrai
avranno
avrebbe
avrebbero
avrei
avremmo
avremo
avreste
avresti
avrete
avrò
avuta
avute
avuti
avuto
basta
bene
benissimo
bensì
berlusconi
brava
bravo
casa
caso
cento
certa
certe
certi
certo
che
che
chi
chi
chicchessia
chinque
chiunque
ciascuna
ciascuno
cima
cio
cioe
circa
citta
codesta
codeste
codesti
codesto
cogli
coi
col
colei
coll
coloro
colui
come
comunque
con
concernente
consiglio
contro
contro
cortesia
cos
cosa
cosa
cosi
cui
dachè
dagl
dagli
dai
dal
dall
dalla
dalle
dallo
davanti
degl
degli
dei
del
del
dell
della
delle
dello
dentro
detto
deve
dice
dietro
dila
dire
dirimpetto
dopo
dov
dove
dove
dovra
due
dunque
dunque
durante
ebbe
ebbero
ebbi
ecco
egli
ella
eppure
era
erano
eravamo
eravate
eri
ero
esse
essendo
esser
essere
essi
faccia
facciamo
facciano
facciate
faccio
facemmo
facendo
facesse
facessero
facessi
facessimo
faceste
facesti
faceva
facevamo
facevano
facevate
facevi
facevo
fai
fanno
farà
farai
faranno
fare
farebbe
farebbero
farei
faremmo
faremo
fareste
faresti
farete
farò
fatto
favore
fece
fecero
feci
fin
finalmente
finche
fine
fino
forse
fosse
fossero
fossi
fossimo
foste
fosti
fra
frattanto
fui
fummo
fuori
furono
gia
giacchè
giacche
giorni
giorno
gli
gliela
gliele
glieli
glielo
gliene
governo
grande
grazie
gruppo
hai
hanno
i
ieri
improvviso
infatti
inoltre
insieme
intanto
intorno
invece
invere
la
lavoro
le
lei
lontano
loro
lui
lungo
macche
magari
mai
male
malgrado
malissimo
medesimo
mediante
meglio
meno
mentre
mesi
mezzo
mia
mie
miei
mieri
mila
miliardi
milioni
ministro
mio
moltissimo
molto
mondo
nazionale
neanche
negl
negli
nei
nel
nell
nella
nelle
nelle
nello
nemmeno
neppure
nessuna
nessuno
niente
noi
non
nonchè
nondimeno
nondimeno
nondimento
nostra
nostre
nostri
nostro
nostro
nulla
nuovo
oggi
ogni
ognuna
ognuno
oltre
onde
oppure
ora
ore
osi
ossia
ovvero
paese
parecchi
parecchie
parecchio
parte
partendo
peccato
peggio
per
perchè
perché
perciò
percio
perfino
pero
perque
persone
piedi
pieno
piglia
più
pochissimo
poco
poi
poiche
poichè
press
prima
primo
proprio
puo
purchè
pure
purtroppo
qualche
qualcuna
qualcuno
quale
quali
qualsiani
qualunque
quand
quando
quando
quanta
quante
quanti
quanto
quantunque
quasi
quattro
quel
quella
quelle
quelli
quello
quest
questa
queste
questi
questo
qui
quindi
riecco
saltro
salvo
sarà
sarai
saranno
sarebbe
sarebbero
sarei
saremmo
saremo
sareste
saresti
sarete
sarò
scopo
scorso
sebbene
secondo
seguente
sei
sempre
sennonchè
senza
senza
sia
siamo
siano
siate
siccome
siete
solito
solo
sono
soppra
sopra
sotto
sta
stai
stando
stanno
starà
starai
staranno
starebbe
starebbero
starei
staremmo
staremo
stareste
staresti
starete
starò
stata
state
stati
stato
stava
stavamo
stavano
stavate
stavi
stavo
stemmo
stesse
stessero
stessi
stessimo
stesso
steste
stesti
stette
stettero
stetti
stia
stiamo
stiano
stiate
sto
stresso
sua
subito
successivo
sue
sugl
sugli
sui
sul
sull
sulla
sulla
sulle
sulle
sullo
suo
suoi
talchè
tale
talvolta
tanto
tempo
torino
tra
tranne
trannefino
tre
troppo
tua
tue
tuo
tuo
tuoi
tutta
tuttavia
tuttavia
tutte
tutti
tutto
uguali
una
uno
uomo
uori
vale
varia
varie
vario
verso
via
vicino
vise
visto
vita
voi
volta
vostra
vostre
vostri
vostro
abaixo
adeus
adiante
agora
ainda
além
algo
algumas
alguns
ali
ano
anos
antes
aos
apenas
apoio
após
aquela
aquelas
aquele
aqueles
aqui
aquilo
área
assim
até
atras
através
baixo
bastante
bem
boa
boas
bom
bonito
bons
breve
cada
catorze
cedo
cento
certamente
certeza
certo
cima
cinco
coisa
com
como
conselho
contra
custa
dão
daquela
daquelas
daquele
daqueles
dar
das
debaixo
dela
delas
demais
dentro
depois
depressa
desde
dessa
dessas
desse
desses
desta
destas
deste
destes
devagar
dez
dezanove
dezasseis
dezassete
dezoito
dia
diante
direito
dois
dos
doze
duas
dúvida
ela
elas
êle
eles
embora
entre
essa
essas
esse
esses
esta
estas
este
estes
exemplo
falta
favor
fim
final
for
geral
grande
grandes
grupo
hoje
hora
horas
isso
isto
junto
lado
lhes
local
logo
longe
lugar
maior
maioria
mais
mal
mas
máximo
meio
menor
menos
mês
meses
meu
meus
mil
minha
minhas
momento
muito
muitos
nada
não
naquela
naquelas
naquele
naqueles
nas
nem
nenhuma
nessa
nessas
nesse
nesses
nesta
nestas
neste
nestes
ninguem
nível
noite
nome
nós
nossa
nossas
nosso
nossos
nova
novas
nove
novo
novos
num
numa
número
nunca
obra
obrigada
obrigado
oitava
oitavo
oito
onde
ontem
onze
outra
outras
outro
outros
para
parece
parte
paucas
pela
pelas
pelo
pelos
perto
pode
ponto
pontos
por
porque
posição
possível
possivelmente
posso
pouca
pouco
poucos
primeira
primeiras
primeiro
primeiros
própria
próprias
próprio
próprios
próxima
próximas
próximo
próximos
quáis
qual
quando
quanto
quarta
quarto
quatro
que
quem
queremas
questão
quinta
quinto
quinze
relação
são
segunda
segundo
seis
seja
sejam
sejamos
sem
sempre
sete
sétima
sétimo
seu
seus
sexta
sexto
sim
sistema
sob
sobre
sois
sua
suas
tal
talvez
também
tanta
tantas
tanto
tão
tarde
teu
teus
toda
todas
todo
todos
trabalho
três
treze
tua
tuas
tudo
uma
umas
uns
vagarosamente
vários
vez
vezes
vinte
você
vocês
vos
vossa
vossas
vosso
vossos
zero
och
det
att
en
jag
hon
som
han
på
den
med
var
sig
för
så
till
är
men
ett
om
hade
de
av
icke
mig
du
henne
då
sin
nu
har
inte
hans
honom
skulle
hennes
där
min
man
ej
vid
kunde
något
från
ut
när
efter
upp
vi
dem
vara
vad
över
än
dig
kan
sina
här
ha
mot
alla
under
någon
eller
allt
mycket
sedan
ju
denna
själv
detta
åt
utan
varit
hur
ingen
mitt
ni
bli
blev
oss
din
dessa
några
deras
blir
mina
samma
vilken
er
sådan
vår
blivit
dess
inom
mellan
sådant
varför
varje
vilka
ditt
vem
vilket
sitta
sådana
vart
dina
vars
vårt
våra
ert
era
vilkas
aan
aangaande
aangezien
achter
achterna
afgelopen
aldaar
aldus
alhoewel
alias
alle
allebei
alleen
alles
als
alsnog
altijd
altoos
ander
andere
anders
anderszins
behalve
behoudens
beide
beiden
ben
beneden
bent
bepaald
betreffende
bij
binnen
binnenin
boven
bovenal
bovendien
bovengenoemd
bovenstaand
bovenvermeld
buiten
daar
daarheen
daarin
daarna
daarnet
daarom
daarop
daarvanlangs
dan
dat
der
deze
die
dikwijls
dit
doch
doen
door
doorgaand
dus
echter
een
eens
eer
eerdat
eerder
eerlang
eerst
elk
elke
enig
enigszins
enkel
erdoor
even
eveneens
evenwel
gauw
gedurende
geen
gehad
gekund
geleden
gelijk
gemoeten
gemogen
geweest
gewoon
gewoonweg
haar
had
hadden
hare
heb
hebben
hebt
heeft
hem
hen
het
hier
hierbeneden
hierboven
hij
hoe
hoewel
hun
hunne
iemand
iets
ikzelf
inmiddels
inzake
jezelf
jij
jijzelf
jou
jouw
jouwe
juist
jullie
kan
klaar
kon
konden
krachtens
kunnen
kunt
later
liever
maar
mag
meer
men
met
mezelf
mij
mijn
mijnent
mijner
mijzelf
misschien
mocht
mochten
moest
moesten
moet
moeten
mogen
naar
nadat
net
niet
niets
noch
nog
nogal
ofschoon
omdat
omhoog
omlaag
omstreeks
omtrent
omver
onder
ondertussen
ongeveer
ons
onszelf
onze
ook
opnieuw
opzij
over
overeind
overigens
pas
precies
reeds
rond
rondom
sedert
sinds
sindsdien
slechts
sommige
spoedig
steeds
tamelijk
tegen
tenzij
terwijl
thans
tijdens
toch
toen
toenmaals
toenmalig
tot
totdat
tussen
uit
uitgezonderd
vaak
van
vandaan
vanuit
vanwege
veel
veeleer
verder
vervolgens
vol
volgens
voor
vooraf
vooral
vooralsnog
voorbij
voordat
voordezen
voordien
voorheen
voorop
vooruit
vrij
vroeg
waar
waarom
wanneer
want
waren
was
wat
weer
weg
wegens
wel
weldra
welk
welke
werd
wezen
wie
wiens
wier
wij
wijzelf
wil
worden
wordt
zal
zelf
zelfs
zich
zichzelf
zij
zijn
zijne
zodra
zonder
zou
zouden
zowat
zulke
zullen
zult
aber
ach
acht
achte
achten
achter
achtes
alle
allein
allem
allen
aller
allerdings
alles
allgemeinen
als
also
ander
andere
anderem
anderen
anderer
anderes
anderm
andern
anderr
anders
auch
auf
aus
ausser
ausserdem
außer
außerdem
bald
bei
beide
beiden
beim
beispiel
bekannt
bereits
besonders
besser
besten
bin
bis
bisher
bist
bißchen
dabei
dadurch
dafür
dagegen
daher
dahin
dahinter
damals
damit
danach
daneben
dank
dann
daran
darauf
daraus
darf
darfst
darin
darum
darunter
darüber
das
dasein
daselbst
dass
dasselbe
davon
davor
dazu
dazwischen
daß
dein
deine
deinem
deinen
deiner
deines
dem
dementsprechend
demgegenüber
demgemäss
demgemäß
demselben
demzufolge
den
denen
denn
denselben
der
deren
derer
derjenige
derjenigen
dermassen
dermaßen
derselbe
derselben
des
deshalb
desselben
dessen
deswegen
dich
die
diejenige
diejenigen
dienstag
dies
diese
dieselbe
dieselben
diesem
diesen
dieser
dieses
dir
doch
donnerstag
dort
drei
drin
dritte
dritten
dritter
drittes
durch
durchaus
durfte
durften
dürfen
dürft
eben
ebenso
ehe
ehrlich
eigen
eigene
eigenen
eigener
eigenes
ein
einander
eine
einem
einen
einer
eines
einig
einige
einigem
einigen
einiger
einiges
einmal
eins
elf
ende
endlich
entlang
entweder
ernst
erst
erste
ersten
erster
erstes
etwa
etwas
euch
euer
eure
eurem
euren
eurer
eures
freitag
früher
fünf
fünfte
fünften
fünfter
fünftes
für
fürs
gab
ganz
ganze
ganzen
ganzer
ganzes
gar
gedurft
gegen
gegenüber
gehabt
gehen
geht
gekannt
gekonnt
gemacht
gemocht
gemusst
genau
genug
gerade
gern
gesagt
geschweige
gewesen
gewollt
geworden
gibt
ging
gleich
gott
gross
grosse
grossen
grosser
grosses
groß
große
großen
großer
großes
gut
gute
guter
gutes
hab
habe
haben
habt
hast
hat
hatte
hatten
heisst
her
herein
herum
heute
hier
hin
hinter
hintern
hoch
hätte
hätten
ich
ihm
ihn
ihnen
ihr
ihre
ihrem
ihren
ihrer
ihres
immer
indem
infolgedessen
ins
irgend
ist
jahr
jahre
jahren
jede
jedem
jeden
jeder
jedermann
jedermanns
jedes
jedesmal
jedoch
jemand
jemandem
jemanden
jene
jenem
jenen
jener
jenes
jetzt
kam
kann
kannst
kaum
kein
keine
keinem
keinen
keiner
keines
kleine
kleinen
kleiner
kleines
kommen
kommt
konnte
konnten
kurz
können
könnt
könnte
lang
lange
leicht
leide
lieber
los
machen
macht
machte
mag
magst
mahn
man
manche
manchem
manchen
mancher
manches
mann
mehr
mein
meine
meinem
meinen
meiner
meines
mensch
menschen
mich
mir
mit
mittel
mittwoch
mochte
mochten
montag
morgen
muss
musst
musste
mussten
muß
müssen
müsst
möchte
mögen
möglich
mögt
nach
nachdem
nahm
natürlich
neben
nein
neue
neuen
neun
neunte
neunten
neunter
neuntes
nicht
nichts
nie
niemand
niemandem
niemanden
noch
nun
nur
nämlich
oben
ober
obgleich
oder
offen
oft
ohne
ordnung
paar
recht
rechte
rechten
rechter
rechtes
richtig
rund
sache
sagt
sagte
sah
samstag
satt
schlecht
schluss
schon
sechs
sechste
sechsten
sechster
sechstes
sehr
sei
seid
seien
sein
seine
seinem
seinen
seiner
seines
seit
seitdem
selbst
sich
sie
sieben
siebente
siebenten
siebenter
siebentes
sind
sogar
solang
solch
solche
solchem
solchen
solcher
solches
soll
sollen
sollte
sollten
sondern
sonntag
sonst
soviel
soweit
sowie
später
statt
tag
tage
tagen
tat
teil
tel
tritt
trotzdem
tun
uhr
und
und?
uns
unse
unsem
unsen
unser
unsere
unserem
unseren
unserer
unseres
unses
unsre
unsrem
unsren
unsrer
unsres
unter
vergangenen
viel
viele
vielem
vielen
vielleicht
vier
vierte
vierten
vierter
viertes
vom
von
vor
wahr?
wann
war
waren
warst
wart
warum
was
weg
wegen
weil
weit
weiter
weitere
weiteren
weiteres
welche
welchem
welchen
welcher
welches
wem
wen
wenig
wenige
weniger
weniges
wenigstens
wenn
wer
werde
werden
werdet
weshalb
wessen
wie
wieder
will
willst
wir
wird
wirklich
wirst
wohl
wollen
wollt
wollte
wollten
womit
worden
wurde
wurden
würde
würden
während
währenddem
währenddessen
wäre
wären
über
überhaupt
übrigens
zehn
zehnte
zehnten
zehnter
zehntes
zeit
zuerst
zugleich
zum
zunächst
zur
zurück
zusammen
zwanzig
zwar
zwei
zweite
zweiten
zweiter
zweites
zwischen
zwischens
zwölf
og
jeg
det
at
en
et
den
til
er
som
på
de
med
han
av
ikke
ikkje
der
så
var
meg
seg
men
ett
har
om
vi
min
mitt
ha
hadde
hun
nå
over
da
ved
fra
du
ut
sin
dem
oss
opp
man
kan
hans
hvor
eller
hva
skal
selv
sjøl
her
alle
vil
bli
ble
blei
blitt
kunne
inn
når
være
kom
noen
noe
ville
dere
som
deres
kun
ja
etter
ned
skulle
denne
for
deg
si
sine
sitt
mot
å
meget
hvorfor
dette
disse
uten
hvordan
ingen
din
ditt
blir
samme
hvilken
hvilke
sånn
inni
mellom
vår
hver
hvem
vors
hvis
både
bare
enn
fordi
før
mange
også
slik
vært
være
båe
begge
siden
dykk
dykkar
dei
deira
deires
deim
di
då
eg
ein
eit
eitt
elles
honom
hjå
ho
hoe
henne
hennar
hennes
hoss
hossen
ikkje
ingi
inkje
korleis
korso
kva
kvar
kvarhelst
kven
kvi
kvifor
me
medan
mi
mine
mykje
no
nokon
noka
nokor
noko
nokre
si
sia
sidan
so
somt
somme
um
upp
vere
vore
verte
vort
varte
vart
un
despre
dupa
înainte
tot
toţi
aproape
asemenea
una
şi
răspuns
oricare
oricine
oricui
oriunde
sunt
este
ca
întreabă
întrebare
la
rau
fi
pentru
fiind
între
mare
apropo
dar
de
poate
zi
ziua
zile
făcut
fă
face
jos
fiecare
etc
altfel
departe
găseşte
pentru
ia
bun
are
având
ea
aici
iei
lui
acum
eu
dacă
în
doar
ştie
şti
mare
mic
mult
poate
multe
nevoie
niciodată
nou
noutăţi
nu
not
nimic
de
frecvent
batrân
pornit
oprit
odată
doar
oops
sau
altul
alta
afară
pagina
pune
întrebare
întrebări
întrebat
citat
decât
recent
spus
văzut
spune
vede
trebui
trebuia
deci
câţiva
ceva
cândva
undeva
curând
adevarat
acela
acel
acesta
aceasta
aceştia
lor
ei
atunci
acolo
prin
timp
spre
tot
sub
sus
utilizatori
versiune
foarte
via
vrea
vreau
fost
cale
noi
mers
ce
când
unde
care
cine
larg
cu
fără
da
înca
tu
lol
aan
af
al
alles
als
altijd
andere
ben
bij
daar
dan
dat
de
der
deze
die
dit
doch
doen
door
dus
een
eens
en
er
ge
geen
geweest
haar
had
heb
hebben
heeft
hem
het
hier
hij
hoe
hun
iemand
iets
ik
in
is
ja
je
kan
kon
kunnen
maar
me
meer
men
met
mij
mijn
moet
na
naar
niet
niets
nog
nu
of
om
omdat
ons
ook
op
over
reeds
te
tegen
toch
toen
tot
u
uit
uw
van
veel
voor
want
waren
was
wat
we
wel
werd
wezen
wie
wij
wil
worden
zal
ze
zei
zelf
zich
zij
zijn
zo
zonder
zou
"""
self._make_bl()
def _make_bl(self):
words = self.words.split('\n')
for w in words:
w = w.strip()
self.bl.add( w )
|
'''
EASY 203. Remove Linked List Elements
You are given a license key represented as a string S which consists only alphanumeric character and dashes.
The string is separated into N+1 groups by N dashes.
Given a number K, we would want to reformat the strings such that each group contains exactly K characters,
except for the first group which could be shorter than K, but still must contain at least one character.
Furthermore, there must be a dash inserted between two groups and all lowercase letters should be converted to uppercase.
Given a non-empty string S and a number K, format the string according to the rules described above.
Example 1:
Input: S = "5F3Z-2e-9-w", K = 4
Output: "5F3Z-2E9W"
Explanation: The string S has been split into two parts, each part has 4 characters.
Note that the two extra dashes are not needed and can be removed.
'''
class Solution:
def removeElements(self, head: ListNode, val: int) -> ListNode:
dummy_head = ListNode(-1)
dummy_head.next = head
curr = dummy_head
while curr.next:
if curr.next.val == val:
curr.next = curr.next.next
else:
curr = curr.next
return dummy_head.next
|
"""
4101 : 크냐?
URL : https://www.acmicpc.net/problem/4101
Input :
1 19
4 4
23 14
0 0
Output :
No
No
Yes
"""
while True:
a, b = map(int, input().split())
if (a == 0) and (b == 0):
break
if a > b:
print('Yes')
else:
print('No')
|
cities = [
'Vilnius',
'Kaunas',
'Klaipeda',
'Siauliai',
'Panevezys',
'Alytus',
'Dainava (Kaunas)',
'Eiguliai',
'Marijampole',
'Mazeikiai',
'Silainiai',
'Fabijoniskes',
'Jonava',
'Utena',
'Pasilaiciai',
'Kedainiai',
'Seskine',
'Lazdynai',
'Telsiai',
'Visaginas',
'Taurage',
'Justiniskes',
'Ukmerge',
'Aleksotas',
'Plunge',
'Naujamiestis',
'Kretinga',
'Silute',
'Vilkpede',
'Radviliskis',
'Pilaite',
'Palanga',
'Druskininkai',
'Gargzdai',
'Rokiskis',
'Birzai',
'Kursenai',
'Garliava',
'Elektrenai',
'Jurbarkas',
'Vilkaviskis',
'Raseiniai',
'Anyksciai',
'Naujoji Akmene',
'Lentvaris',
'Grigiskes',
'Prienai',
'Joniskis',
'Kelme',
'Rasos',
'Varena',
'Kaisiadorys',
'Pasvalys',
'Kupiskis',
'Zarasai',
'Skuodas',
'Sirvintos',
'Kazlu Ruda',
'Moletai',
'Salcininkai',
'Svencioneliai',
'Sakiai',
'Ignalina',
'Pabrade',
'Kybartai',
'Nemencine',
'Silale',
'Pakruojis',
'Svencionys',
'Trakai',
'Vievis'
]
|
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string.
:type root: TreeNode
:rtype: str
"""
result = []
def dfs(root):
if root == None:
result.append("null")
return
result.append(str(root.val))
dfs(root.left)
dfs(root.right)
dfs(root)
return ','.join(result)
def deserialize(self, data):
"""Decodes your encoded data to tree.
:type data: str
:rtype: TreeNode
"""
array = data.split(",")
def dfs(array):
if len(array) == 0: return None
first = array.pop(0)
if first == "null": return None
node = TreeNode(int(first))
node.left = dfs(array)
node.right = dfs(array)
return node
return dfs(array)
# Your Codec object will be instantiated and called as such:
# codec = Codec()
# codec.deserialize(codec.serialize(root))
|
def add_numbers(num1, num2):
return num1 + num2
def subtract_numbers(num1, num2):
return num1 - num2
def multiply_numbers(num1, num2):
return num1 * num2
def divide_numbers(num1, num2):
return num1 / num2
|
REQUEST_DELETE_CONTENT_RANGE = 'deleteContentRange'
REQUEST_DELETE_TABLE_ROW = 'deleteTableRow'
REQUEST_INSERT_TABLE = 'insertTable'
REQUEST_INSERT_TABLE_ROW = 'insertTableRow'
REQUEST_INSERT_TEXT = 'insertText'
REQUEST_MERGE_TABLE_CELLS = 'mergeTableCells'
REQUEST_UPDATE_TEXT_STYLE = 'updateTextStyle'
BODY = 'body'
BOLD = 'bold'
BOOKMARK_ID = 'bookmarkId'
CONTENT = 'content'
COLUMN_INDEX = 'columnIndex'
COLUMN_SPAN = 'columnSpan'
CONTENT = 'content'
ELEMENTS = 'elements'
END_INDEX = 'endIndex'
END_OF_SEGMENT_LOCATION = 'endOfSegmentLocation'
FIELDS = 'fields'
HEADING_ID = 'headingId'
INDEX = 'index'
INSERT_BELOW = 'insertBelow'
ITALIC = 'italic'
LINK = 'link'
LOCATION = 'location'
NUMBER_OF_COLUMNS = 'columns'
NUMBER_OF_ROWS = 'rows'
PARAGRAPH = 'paragraph'
RANGE = 'range'
ROW_INDEX = 'rowIndex'
ROW_SPAN = 'rowSpan'
SEGMENT_ID = 'segmentId'
SMALL_CAPS = 'smallCaps'
START_INDEX = 'startIndex'
STRIKETHROUGH = 'strikethrough'
TABLE = 'table'
TABLE_CELLS = 'tableCells'
TABLE_CELL_LOCATION = 'tableCellLocation'
TABLE_RANGE = 'tableRange'
TABLE_ROWS = 'tableRows'
TABLE_START_LOCATION = 'tableStartLocation'
TEXT = 'text'
TEXT_RUN = 'textRun'
TEXT_STYLE = 'textStyle'
UNDERLINE = 'underline'
URL = 'url'
GOOGLE_DOC_URL_PREFIX = 'https://docs.google.com/document/d/'
GOOGLE_DOC_MIMETYPE = 'application/vnd.google-apps.document'
WORD_DOC_MIMETYPE = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
sum = lambda a,b : a + b
print("suma: "+ str(sum(1,2)))
# Map lambdas
names = ["Christian", "yamile", "Anddy", "Lucero", "Evelyn"]
names = map(lambda name:name.upper(),names)
print(list(names))
def decrement_list (*vargs):
return list(map(lambda number: number - 1,vargs))
print(decrement_list(1,2,3))
#all
def is_all_strings(lst):
return all(type(l) == str for l in lst)
print(is_all_strings(['2',3]))
#sorted
numbers = [2,3,5,1,8,3,7,9,4]
print(numbers)
print(sorted(numbers))
print(sorted(numbers,reverse=True))
print(numbers)
def extremes(ass):
return min (ass),max(ass)
print(extremes([1,2,3,4,5]))
print(extremes("alcatraz"))
print(extremes([1,2,3,4,5]))
print(all(n%2==0 for n in [10, 2, 0, 4, 4, 4, 40]))
|
#Escreva um programa que leia dois números inteiros e compare-os, mostrando na tela uma mensagem:
#O primeiro valor é maior, O segundo valor é menor , Não existe valor maior, os dois são iguais.
# Fazendo a leitura de dois números
n1 = float(input('Digite o primeiro valor: '))
n2 = float(input('Digite o segundo valor: '))
print('')
# Montando a estrutura de condição
if n1 == n2:
print('Não existe valor maior, pois os dois são iguais.')
elif n1 > n2:
print('O primeiro valor o maior. ')
else:
print('O segundo valor é o maior. ')
#Desafio Concluído
|
""" This file is create and managed by Tahir Iqbal
----------------------------------------------
It can be use only for education purpose
"""
# List Modification
mix_list = [1, 'Programmer', 5.0, True]
print(mix_list)
# Mutable : Because re-assign value
mix_list[0] = 2
print(mix_list)
# Adding item in list
mix_list.append('Python')
print(mix_list)
# Shortcut version of adding item
mix_list += ['Solo']
print(mix_list)
# Adding item at order place
mix_list.insert(1, 'I am')
print(mix_list)
# Delete a list item
del mix_list[0]
print(mix_list)
|
"""
ED Data imports exception types
"""
class FieldsValidationError(Exception):
"""
Exception type for validation errors related to
DataModel instances.
"""
pass
class UnexpectedQueryResult(Exception):
"""
Exception for unexpected database results.
"""
pass
class NoResultsError(UnexpectedQueryResult):
"""
Exception when results from a query were expected
but none were found.
"""
|
def author_picture():
author_picture_list = [
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/"
"2ca50ff2ca024a75a893b80257458104.jpg",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/"
"f3b24a5e1d534ba49b36f4ac36ce4f09.jpg",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/"
"e7c07866de6f4cb0bccac1baad568d93.jpg",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/"
"9c405d8ba8824dcab891b483afbea2bb.png",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/"
"8800fb7a237740779f17b8ac57defa57.png"
]
return author_picture_list
def work_picture():
work_picture_list = [
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/"
"4a60ada1fc0f478ca109f9fe49419328.jpg",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/"
"20595550fe6e4830bcc8a03f2f7d4b9c.jpg",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/"
"83c57efc02d74c7687bcbe62b06b5245.jpg",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/"
"330d96fde0644196bc9a87276782b1f0.jpg",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/"
"19e2e5ad971a4bf4af25d2b62b428854.jpg",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/"
"26b333ce54724623aeb1d83f68b4b512.png",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/"
"3734093298344d09834fd4897100530f.png",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190527/"
"8005c7f2b69a4111ad5351c5dec8f022.png",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/"
"8800fb7a237740779f17b8ac57defa57.png",
"https://edu-test-1255999742.file.myqcloud.com/portrait/20190524/"
"4b3f7fdef342445fb2941dbb15a7eed0.jpg"
]
return work_picture_list
def turtle_code():
code = """import turtle
t = turtle.Turtle()
screen = turtle.Screen()
screen.bgpic('userupload/sucai/3702/20200218/58eb54f9753d1.jpg')
t.begin_fill()
turtle.colormode(255)
t.forward(150)
t.right(90)
t.forward(170)
t.right(90)
t.forward(150)
t.right(90)
t.forward(170)
t.fillcolor(250, 255, 230)
t.end_fill()
t.right(30)
t.begin_fill()
t.fillcolor(255, 120, 60)
t.forward(150)
t.right(120)
t.forward(150)
t.end_fill()
print('abc')"""
return code
def wrong_code():
code = "import turtle\n\n" \
"t = turtle.Turtle()\n" \
"t.forward(150)\n" \
"print(abc)\n"
return code
def pygame_code():
code = """import pygame
from pygame.locals import *
background_image = 'userupload/sucai/3702/20200118/bgimg.jpg'
mouse_image = 'userupload/sucai/3702/20200224/Snipaste_2019-07-23_17-44-01.png'
pygame.init()
screen = pygame.display.set_mode((640, 480), 0, 32)
pygame.display.set_caption('hello world')
background = pygame.image.load(background_image)
mouse_cursor = pygame.image.load(mouse_image)
while True:
screen.blit(background, (0, 0))
x, y = pygame.mouse.get_pos()
x -= mouse_cursor.get_width()/2
y -= mouse_cursor.get_height()/2
screen.blit(mouse_cursor, (x, y))
pygame.display.update()
"""
return code
def multiple_files_code(file_name, content):
main_code = f"from {file_name} import hello\n\na = hello()\nprint(a)\n\n"
file_code = f"def hello():\n s = '{content}'\n\n return s"
return main_code, file_code
def three_dimensional_code():
code = """import cadquery as cq
model = cq.Workplane("XY")
model = model.box(10, 20, 30)
show_model(model, cq)
"""
return code
def robot_code():
code = 'import robot\n\n' \
'r=robot.robot()\n' \
'r.up(1)\n' \
'r.nod(1)\n'
return code
|
s = 'pvkq{m164675262033l4m49lnp7p9mnk28k75}'
flag = ''
for i in range(1,27): # 凯撒密码
t = ''
for c in s:
if c.islower():
t += chr(ord('a') + ((ord(c) - ord('a')) + i) % 26)
elif c.isupper():
t += chr(ord('A') + ((ord(c) - ord('A')) + i) % 26)
else:
t += c
if "flag" in t:
flag = t
break
print(flag) # flag{c164675262033b4c49bdf7f9cda28a75}
|
# python3 theory/conditionals.py
def plus(a, b):
if type(a) is int or type(a) is float:
if type(b) is int or type(b) is float:
return a + b
else:
return None
else:
return None
print(plus(1, '10'))
def can_drink(age):
print(f"You are {age} years old.")
if age < 18:
print("You can't drink.")
elif age == 18 or age == 19:
print("Go easy on it cowbow.")
elif age > 19 and age < 25:
print("Buckle up son.")
else:
print("Enjoy your drink!")
can_drink(17)
can_drink(19)
can_drink(21)
can_drink(25)
|
def os_return(distro):
if distro == 'rhel':
return_value = {
'distribution': 'centos',
'version': '7.5',
'dist_name': 'CentOS Linux',
'based_on': 'rhel'
}
elif distro == 'ubuntu':
return_value = {
'distribution': 'ec2',
'version': '16.04',
'dist_name': 'Ubuntu',
'based_on': 'debian'
}
elif distro == 'suse':
return_value = {
'distribution': 'sles',
'version': '12',
'dist_name': 'SLES',
'based_on': 'suse'
}
return return_value
def system_compatability(test_pass=True):
if test_pass:
return {
'OS': 'PASS',
'version': 'PASS'
}
return {
'OS': 'PASS',
'version': 'FAIL'
}
def memory_cpu(test_pass=True):
if test_pass:
return {
'memory': {
'minimum': 16.0,
'actual': 251.88
},
'cpu_cores': {
'minimum': 8,
'actual': 64
}
}
return {
'memory': {
'minimum': 16.0,
'actual': 14.88
},
'cpu_cores': {
'minimum': 8,
'actual': 4
}
}
def mounts(test_pass=True):
if test_pass:
return {
'/': {
'recommended': 130.0,
'free': 498.13,
'total': 499.7,
'mount_options': 'rw,inode64,noquota',
'file_system': 'xfs',
'ftype': '1'
},
'/tmp': {
'recommended': 30.0,
'free': 39.13,
'total': 39.7,
'mount_options': 'rw,inode64,noquota',
'file_system': 'ext4'
},
}
return {
'/': {
'recommended': 0.0,
'free': 19.13,
'total': 19.7,
'mount_options': 'rw,inode64,noquota',
'file_system': 'xfs',
'ftype': '0'
},
'/tmp': {
'recommended': 30.0,
'free': 19.13,
'total': 19.7,
'mount_options': 'rw,inode64,noquota',
'file_system': 'ext4'
},
'/opt/anaconda': {
'recommended': 100.0,
'free': 98.13,
'total': 99.7,
'mount_options': 'rw,inode64,noquota',
'file_system': 'ext4'
},
'/var': {
'recommended': 100.0,
'free': 98.13,
'total': 99.7,
'mount_options': 'rw,inode64,noquota',
'file_system': 'ext4'
}
}
def resolv_conf(test_pass=True):
if test_pass:
return {
'search_domains': ['test.domain', 'another.domain'],
'options': []
}
return {
'search_domains': [
'test.domain',
'another.domain',
'again.domain',
'optional.domain'
],
'options': ['timeout:2', 'rotate']
}
def resolv_conf_warn():
return {
'search_domains': ['test.domain', 'another.domain'],
'options': ['rotate']
}
def ports(test_pass=True):
if test_pass:
return {
'eth0': {
'80': 'open',
'443': 'open',
'32009': 'open',
'61009': 'open',
'65535': 'open'
}
}
return {
'eth0': {
'80': 'open',
'443': 'closed',
'32009': 'closed',
'61009': 'closed',
'65535': 'closed'
}
}
def agents(test_pass=True):
if test_pass:
return {'running': []}
return {'running': ['puppet-agent']}
def modules(test_pass=True):
if test_pass:
return {
'missing': [],
'enabled': [
'iptable_filter',
'br_netfilter',
'iptable_nat',
'ebtables',
'overlay'
]
}
return {
'missing': [
'iptable_filter',
'br_netfilter',
'iptable_nat',
'ebtables'
],
'enabled': ['overlay']
}
def sysctl(test_pass=True):
if test_pass:
return {
'enabled': [
'net.bridge.bridge-nf-call-iptables',
'net.bridge.bridge-nf-call-ip6tables',
'fs.may_detach_mounts',
'net.ipv4.ip_forward'
],
'disabled': []
}
return {
'enabled': ['net.ipv4.ip_forward'],
'disabled': [
'net.bridge.bridge-nf-call-ip6tables',
'net.bridge.bridge-nf-call-iptables',
'fs.may_detach_mounts'
]
}
def selinux(test_pass=True):
if test_pass:
return {
'getenforce': 'disabled',
'config': 'permissive'
}
return {
'getenforce': 'disabled',
'config': 'enforcing'
}
def infinity(test_pass=True):
if test_pass:
return True
return False
|
"""Return list of values that are multiplies of x."""
def count_by(x, n):
"""Return a sequence of numbers counting by `x` `n` times."""
return [i * x for i in range(1, n + 1)]
|
class NoGloveValueError(Exception):
"""
Raised if no value can be found in GloVe for a user's text.
"""
pass
|
class Config:
@staticmethod
def get(repo, config_key):
splitted_keys = config_key.split('.')
splitted_keys_in_byte = [key.encode() for key in splitted_keys]
if splitted_keys.__len__() > 2:
section = tuple(splitted_keys_in_byte[:-1])
arg = splitted_keys_in_byte[-1]
else:
section = splitted_keys_in_byte[0]
arg = splitted_keys_in_byte[1]
config = repo.get_config()
try:
value = config.get(section, arg)
except KeyError:
value = None
return value.decode() if value else value
|
path = 'home/sample.mp4'
akhil = []
akhil = path.split(".")
video = akhil[0].split("/")
print(video[len(video)-1])
|
def converteHora(hora):
# Se a hora for 00:
if int(hora[:2]) == 0:
return f"12{hora[2:]} AM"
# Se for 12
if int(hora[:2]) == 12:
return f"12{hora[2:]} PM"
# Se for de tarde
if int(hora[:2]) > 12:
return f"0{int(hora[:2]) - 12 }{hora[2:]} PM"
return f"{hora} AM"
print(converteHora("09:39"))
|
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes': [
'../../build/common.gypi',
],
'targets': [
{
'target_name': 'libpng',
'type': '<(library)',
'dependencies': [
'../zlib/zlib.gyp:zlib',
],
'defines': [
'CHROME_PNG_WRITE_SUPPORT',
'PNG_USER_CONFIG',
],
'msvs_guid': 'C564F145-9172-42C3-BFCB-6014CA97DBCD',
'sources': [
'png.c',
'png.h',
'pngconf.h',
'pngerror.c',
'pnggccrd.c',
'pngget.c',
'pngmem.c',
'pngpread.c',
'pngread.c',
'pngrio.c',
'pngrtran.c',
'pngrutil.c',
'pngset.c',
'pngtrans.c',
'pngusr.h',
'pngvcrd.c',
'pngwio.c',
'pngwrite.c',
'pngwtran.c',
'pngwutil.c',
],
'direct_dependent_settings': {
'include_dirs': [
'.',
],
'defines': [
'CHROME_PNG_WRITE_SUPPORT',
'PNG_USER_CONFIG',
],
},
'export_dependent_settings': [
'../zlib/zlib.gyp:zlib',
],
'conditions': [
['OS!="win"', {'product_name': 'png'}],
],
},
],
}
|
#
# PySNMP MIB module HPN-ICF-FC-PSM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-FC-PSM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:38:51 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint")
HpnicfFcNameIdOrZero, = mibBuilder.importSymbols("HPN-ICF-FC-TC-MIB", "HpnicfFcNameIdOrZero")
hpnicfSan, = mibBuilder.importSymbols("HPN-ICF-VSAN-MIB", "hpnicfSan")
ifDescr, InterfaceIndexOrZero, InterfaceIndex = mibBuilder.importSymbols("IF-MIB", "ifDescr", "InterfaceIndexOrZero", "InterfaceIndex")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Counter64, NotificationType, Bits, Gauge32, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, MibIdentifier, IpAddress, TimeTicks, Integer32, ModuleIdentity, iso, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "NotificationType", "Bits", "Gauge32", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "MibIdentifier", "IpAddress", "TimeTicks", "Integer32", "ModuleIdentity", "iso", "Counter32")
TruthValue, RowStatus, TextualConvention, TimeStamp, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "RowStatus", "TextualConvention", "TimeStamp", "DisplayString")
hpnicfFcPsm = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8))
hpnicfFcPsm.setRevisions(('2013-10-17 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: hpnicfFcPsm.setRevisionsDescriptions(('HPN-ICF-FC-PSM-MIB module is for managing the implementation of FC port security.',))
if mibBuilder.loadTexts: hpnicfFcPsm.setLastUpdated('201310170000Z')
if mibBuilder.loadTexts: hpnicfFcPsm.setOrganization('')
if mibBuilder.loadTexts: hpnicfFcPsm.setContactInfo('')
if mibBuilder.loadTexts: hpnicfFcPsm.setDescription('This MIB contains the objects for FC port security.')
hpnicfFcPsmNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0))
hpnicfFcPsmObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1))
hpnicfFcPsmScalarObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 1))
hpnicfFcPsmConfiguration = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2))
hpnicfFcPsmStats = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3))
class HpnicfFcPsmPortBindDevType(TextualConvention, Integer32):
description = 'The types of the instance of hpnicfFcPsmLoginDev, including nWWN(Node World Wide Name), pWWN(Port World Wide Name), sWWN(Switch World Wide Name), and wildCard.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("nWWN", 1), ("pWWN", 2), ("sWWN", 3), ("wildCard", 4))
class HpnicfFcPsmClearEntryType(TextualConvention, Integer32):
description = 'This object when set to clearStatic, results in port bind static entries being cleared on this VSAN(Virtual Storage Area Networks). This object when set to clearAutoLearn, results in port bind auto-learnt entries being cleared on this VSAN. This object when set to clearAll, results in all of the port bind entries being cleared on this VSAN. No action is taken if this object is set to noop. The value of this object when read is always noop.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("clearStatic", 1), ("clearAutoLearn", 2), ("clearAll", 3), ("noop", 4))
hpnicfFcPsmNotifyEnable = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfFcPsmNotifyEnable.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmNotifyEnable.setDescription('Whether to generate the notification or not depends on the object.')
hpnicfFcPsmEnableTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1), )
if mibBuilder.loadTexts: hpnicfFcPsmEnableTable.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnableTable.setDescription('Enable or disable the port security feature on a specified VSAN.')
hpnicfFcPsmEnableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"))
if mibBuilder.loadTexts: hpnicfFcPsmEnableEntry.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnableEntry.setDescription('Detailed information about the port security.')
hpnicfFcPsmEnableVsanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4095)))
if mibBuilder.loadTexts: hpnicfFcPsmEnableVsanIndex.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnableVsanIndex.setDescription('The ID of VSAN on this entry.')
hpnicfFcPsmEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("enable", 1), ("enableWithAutoLearn", 2), ("disable", 3), ("noop", 4))).clone('noop')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfFcPsmEnable.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnable.setDescription('When set to enable, the port security is on, the value of hpnicfFcPsmEnableState will be true. When set to enableWithAutoLearn, the port security is on with auto-learning, the value of hpnicfFcPsmEnableState will be true. When set to disable, the port security is off, the value of hpnicfFcPsmEnableState will be false. The noop means no action. The value of this object when read is always noop.')
hpnicfFcPsmEnableState = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 1, 1, 3), TruthValue().clone('false')).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmEnableState.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnableState.setDescription('The state of the port security. When the value is true, it means the port security is on, while the false means the port security is off.')
hpnicfFcPsmConfigTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2), )
if mibBuilder.loadTexts: hpnicfFcPsmConfigTable.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmConfigTable.setDescription('A table that contains the configured entries.')
hpnicfFcPsmConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"), (0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmIndex"))
if mibBuilder.loadTexts: hpnicfFcPsmConfigEntry.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmConfigEntry.setDescription('Detailed information about each configuration.')
hpnicfFcPsmIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 32768)))
if mibBuilder.loadTexts: hpnicfFcPsmIndex.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmIndex.setDescription('The index of this entry.')
hpnicfFcPsmLoginDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 2), HpnicfFcPsmPortBindDevType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpnicfFcPsmLoginDevType.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmLoginDevType.setDescription('This represents the type of the instance of hpnicfFcPsmLoginDev, which includes nWWN, pWWN, sWWN, and wildCard.')
hpnicfFcPsmLoginDev = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 3), HpnicfFcNameIdOrZero()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpnicfFcPsmLoginDev.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmLoginDev.setDescription('The logging-in device name, which is decided by the hpnicfFcPsmLoginDevType object. It represents node WWN when the value of hpnicfFcPsmLoginDevType is nWWN. It represents port WWN when the value of hpnicfFcPsmLoginDevType is pWWN. It represents switch WWN when the value of hpnicfFcPsmLoginDevType is sWWN. It represents any device when the value of hpnicfFcPsmLoginDevType is wildCard, and the value of the instance of this object should be zero-length string. The value of this object should not be invalid when hpnicfFcPsmRowStatus is set to createAndGo or active.')
hpnicfFcPsmLoginPoint = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 4), InterfaceIndexOrZero()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpnicfFcPsmLoginPoint.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmLoginPoint.setDescription('The address of the port on the local switch through which the instance of hpnicfFcPsmLoginDev can log in. It represents ifindex when the value is not zero. It represents any port when the value is zero.')
hpnicfFcPsmRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 2, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpnicfFcPsmRowStatus.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmRowStatus.setDescription('Entry status. When creating a new instance of this table, the following objects should be set simultaneously: hpnicfFcPsmLoginDevType, h3cFcPsmLoginDev, hpnicfFcPsmLoginPoint, hpnicfFcPsmRowStatus. If hpnicfFcPsmLoginDevType is set to wildCard, the value of the instance of hpnicfFcPsmLoginDev should be zero-length string. The value of hpnicfFcPsmLoginDevType and hpnicfFcPsmLoginPoint cannot be set to wildCard and zero at the same time.')
hpnicfFcPsmEnfTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3), )
if mibBuilder.loadTexts: hpnicfFcPsmEnfTable.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnfTable.setDescription('The FC port security enforced table. It contains not only the configured policies, but also the learning ones learnt by the switch itself.')
hpnicfFcPsmEnfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"), (0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnfIndex"))
if mibBuilder.loadTexts: hpnicfFcPsmEnfEntry.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnfEntry.setDescription('Detailed information about the FC port security enforced policy.')
hpnicfFcPsmEnfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 32768)))
if mibBuilder.loadTexts: hpnicfFcPsmEnfIndex.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnfIndex.setDescription('The index of this entry.')
hpnicfFcPsmEnfLoginDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 2), HpnicfFcPsmPortBindDevType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDevType.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDevType.setDescription('This represents the type of the instance of hpnicfFcPsmEnfLoginDev, which includes nWWN, pWWN, sWWN, and wildCard.')
hpnicfFcPsmEnfLoginDev = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 3), HpnicfFcNameIdOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDev.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginDev.setDescription('The logging-in device name, which is decided by the hpnicfFcPsmEnfLoginDevType object. It represents node WWN when the value of hpnicfFcPsmEnfLoginDevType is nWWN. It represents port WWN when the value of hpnicfFcPsmEnfLoginDevType is pWWN. It represents switch WWN when the value of hpnicfFcPsmEnfLoginDevType is sWWN. It represents any device when the value of hpnicfFcPsmEnfLoginDevType is wildCard, and the value of the instance of this object should be zero-length string.')
hpnicfFcPsmEnfLoginPoint = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 4), InterfaceIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginPoint.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnfLoginPoint.setDescription('The address of the port on the local switch through which the instance of hpnicfFcPsmEnfLoginDev can log in. It represents ifindex when the value is not zero. It represents any port when the value is zero.')
hpnicfFcPsmEnfEntryType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("learning", 1), ("learnt", 2), ("static", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmEnfEntryType.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEnfEntryType.setDescription('When the value is learning, it represents the entry is learnt by the switch itself temporarily and will be deleted when the device log out. When the value is learnt, it represents the entry is learnt by the switch permanently. When the value is static, it represents the entry is configured.')
hpnicfFcPsmCopyToConfigTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4), )
if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigTable.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigTable.setDescription('Specifies whether to copy the entries from enforced table to the ones on configured table.')
hpnicfFcPsmCopyToConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"))
if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigEntry.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfigEntry.setDescription('Detailed information about the operation.')
hpnicfFcPsmCopyToConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("copy", 1), ("noop", 2))).clone('noop')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfig.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmCopyToConfig.setDescription('When the object is set to copy, the learned entries will be copied on to the configured table on this VSAN, while the noop means no operation. The value of this object when read is always noop.')
hpnicfFcPsmAutoLearnTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5), )
if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnTable.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnTable.setDescription('This table shows whether the auto-learning is enabled or not on specific VSANs.')
hpnicfFcPsmAutoLearnEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"))
if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEntry.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEntry.setDescription('Detailed information about the auto-learning.')
hpnicfFcPsmAutoLearnEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 5, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEnable.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmAutoLearnEnable.setDescription('This object is set to true to enable, or false to disable auto-learning on the local switch. When set to true, the switch can learn the devices that have already logged in as learning entries on the enforced table, while the false can stop the learning operation with the learning entries transformed to learnt ones.')
hpnicfFcPsmClearTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6), )
if mibBuilder.loadTexts: hpnicfFcPsmClearTable.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmClearTable.setDescription('This table is used for cleaning specific entries in enforced table.')
hpnicfFcPsmClearEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"))
if mibBuilder.loadTexts: hpnicfFcPsmClearEntry.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmClearEntry.setDescription('Detailed information about the cleaning options.')
hpnicfFcPsmClearType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1, 1), HpnicfFcPsmClearEntryType().clone('noop')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfFcPsmClearType.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmClearType.setDescription('This object when set to clearStatic, results in port bind static entries being cleared on this VSAN. This object when set to clearAutoLearn, results in auto-learnt entries being cleared on this VSAN. This object when set to clearAll, results in all of the port bind entries being cleared on this VSAN. No action is taken if this object is set to noop. The value of this object when read is always noop.')
hpnicfFcPsmClearIntf = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 2, 6, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfFcPsmClearIntf.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmClearIntf.setDescription('The object specifies the interface on which the entries will be cleared. If the object is zero or not set, it means the specified entries on all interfaces will be cleared.')
hpnicfFcPsmStatsTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1), )
if mibBuilder.loadTexts: hpnicfFcPsmStatsTable.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmStatsTable.setDescription('This table contains statistics of devices, which had been allowed or denied to log into the switch.')
hpnicfFcPsmStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"))
if mibBuilder.loadTexts: hpnicfFcPsmStatsEntry.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmStatsEntry.setDescription('Detailed information about the statistics.')
hpnicfFcPsmAllowedLogins = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmAllowedLogins.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmAllowedLogins.setDescription('The number of requests that have been allowed on the specified VSAN.')
hpnicfFcPsmDeniedLogins = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmDeniedLogins.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmDeniedLogins.setDescription('The number of requests that have been denied on the specified VSAN.')
hpnicfFcPsmStatsClear = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("clear", 1), ("noop", 2))).clone('noop')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfFcPsmStatsClear.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmStatsClear.setDescription('The statistics on this VSAN will be cleared if this object is set to clear. No action is taken if this object is set to noop. The value of this object when read is always noop.')
hpnicfFcPsmViolationTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2), )
if mibBuilder.loadTexts: hpnicfFcPsmViolationTable.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmViolationTable.setDescription('This table maintains the information about the violations happened, containing at most 1024 items. When the number exceeds 1024, the earliest item will be over-written.')
hpnicfFcPsmViolationEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1), ).setIndexNames((0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmEnableVsanIndex"), (0, "HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmViolationIndex"))
if mibBuilder.loadTexts: hpnicfFcPsmViolationEntry.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmViolationEntry.setDescription('Detailed information about the violation.')
hpnicfFcPsmViolationIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024)))
if mibBuilder.loadTexts: hpnicfFcPsmViolationIndex.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmViolationIndex.setDescription('The index of this entry. The entry is uniquely distinguished by WWN, WWN type and ifindex where the login was denied.')
hpnicfFcPsmLoginPWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 2), HpnicfFcNameIdOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmLoginPWWN.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmLoginPWWN.setDescription('The pWWN of the device whose FLOGI(Fabric Login) request had been denied. If the device is an n-node, the value of the instance of hpnicfFcPsmLoginSWWN should be zero-length string.')
hpnicfFcPsmLoginNWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 3), HpnicfFcNameIdOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmLoginNWWN.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmLoginNWWN.setDescription('The nWWN of the device whose FLOGI request had been denied. If the device is an n-node, the value of the instance of hpnicfFcPsmLoginSWWN should be zero-length string.')
hpnicfFcPsmLoginSWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 4), HpnicfFcNameIdOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmLoginSWWN.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmLoginSWWN.setDescription('The sWWN of the device whose FLOGI request had been denied. If the device is a switch, the values of the instance of hpnicfFcPsmLoginPWWN and hpnicfFcPsmLoginNWWN should be zero-length string.')
hpnicfFcPsmLoginIntf = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 5), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmLoginIntf.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmLoginIntf.setDescription('The ifindex of the port where the login was denied.')
hpnicfFcPsmLoginTime = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 6), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmLoginTime.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmLoginTime.setDescription('Specifies the value of SysUpTime when the last denied login happened.')
hpnicfFcPsmLoginCount = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 1, 3, 2, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFcPsmLoginCount.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmLoginCount.setDescription('The number of times for a certain nWWN/pWWN or sWWN had been denied to log into an interface of the local device.')
hpnicfFcPsmFPortDenyNotify = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0, 1)).setObjects(("IF-MIB", "ifDescr"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginPWWN"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginIntf"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginTime"))
if mibBuilder.loadTexts: hpnicfFcPsmFPortDenyNotify.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmFPortDenyNotify.setDescription('Notifies that a FLOGI is denied on an F port of the local device.')
hpnicfFcPsmEPortDenyNotify = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 8, 0, 2)).setObjects(("IF-MIB", "ifDescr"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginSWWN"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginIntf"), ("HPN-ICF-FC-PSM-MIB", "hpnicfFcPsmLoginTime"))
if mibBuilder.loadTexts: hpnicfFcPsmEPortDenyNotify.setStatus('current')
if mibBuilder.loadTexts: hpnicfFcPsmEPortDenyNotify.setDescription('Notifies that a switch is denied on an E port of the local device.')
mibBuilder.exportSymbols("HPN-ICF-FC-PSM-MIB", hpnicfFcPsmClearIntf=hpnicfFcPsmClearIntf, hpnicfFcPsmStats=hpnicfFcPsmStats, hpnicfFcPsmClearType=hpnicfFcPsmClearType, hpnicfFcPsmLoginDevType=hpnicfFcPsmLoginDevType, hpnicfFcPsmClearTable=hpnicfFcPsmClearTable, hpnicfFcPsmEnfIndex=hpnicfFcPsmEnfIndex, hpnicfFcPsmConfiguration=hpnicfFcPsmConfiguration, hpnicfFcPsmStatsTable=hpnicfFcPsmStatsTable, hpnicfFcPsmConfigTable=hpnicfFcPsmConfigTable, hpnicfFcPsmEnable=hpnicfFcPsmEnable, hpnicfFcPsmLoginPWWN=hpnicfFcPsmLoginPWWN, hpnicfFcPsmEnfTable=hpnicfFcPsmEnfTable, hpnicfFcPsmLoginTime=hpnicfFcPsmLoginTime, hpnicfFcPsmEnfLoginPoint=hpnicfFcPsmEnfLoginPoint, hpnicfFcPsmClearEntry=hpnicfFcPsmClearEntry, hpnicfFcPsmIndex=hpnicfFcPsmIndex, HpnicfFcPsmPortBindDevType=HpnicfFcPsmPortBindDevType, hpnicfFcPsmCopyToConfigEntry=hpnicfFcPsmCopyToConfigEntry, hpnicfFcPsmLoginNWWN=hpnicfFcPsmLoginNWWN, hpnicfFcPsm=hpnicfFcPsm, hpnicfFcPsmAutoLearnTable=hpnicfFcPsmAutoLearnTable, hpnicfFcPsmEnfEntryType=hpnicfFcPsmEnfEntryType, hpnicfFcPsmEnfLoginDevType=hpnicfFcPsmEnfLoginDevType, hpnicfFcPsmEnableVsanIndex=hpnicfFcPsmEnableVsanIndex, hpnicfFcPsmViolationTable=hpnicfFcPsmViolationTable, hpnicfFcPsmLoginPoint=hpnicfFcPsmLoginPoint, hpnicfFcPsmScalarObjects=hpnicfFcPsmScalarObjects, hpnicfFcPsmViolationIndex=hpnicfFcPsmViolationIndex, hpnicfFcPsmLoginDev=hpnicfFcPsmLoginDev, hpnicfFcPsmNotifyEnable=hpnicfFcPsmNotifyEnable, hpnicfFcPsmDeniedLogins=hpnicfFcPsmDeniedLogins, hpnicfFcPsmCopyToConfig=hpnicfFcPsmCopyToConfig, hpnicfFcPsmObjects=hpnicfFcPsmObjects, hpnicfFcPsmEnfEntry=hpnicfFcPsmEnfEntry, hpnicfFcPsmViolationEntry=hpnicfFcPsmViolationEntry, hpnicfFcPsmConfigEntry=hpnicfFcPsmConfigEntry, PYSNMP_MODULE_ID=hpnicfFcPsm, hpnicfFcPsmEnfLoginDev=hpnicfFcPsmEnfLoginDev, hpnicfFcPsmLoginIntf=hpnicfFcPsmLoginIntf, hpnicfFcPsmEnableTable=hpnicfFcPsmEnableTable, hpnicfFcPsmEnableEntry=hpnicfFcPsmEnableEntry, hpnicfFcPsmFPortDenyNotify=hpnicfFcPsmFPortDenyNotify, hpnicfFcPsmNotifications=hpnicfFcPsmNotifications, hpnicfFcPsmAutoLearnEnable=hpnicfFcPsmAutoLearnEnable, hpnicfFcPsmLoginCount=hpnicfFcPsmLoginCount, hpnicfFcPsmAllowedLogins=hpnicfFcPsmAllowedLogins, hpnicfFcPsmEnableState=hpnicfFcPsmEnableState, hpnicfFcPsmAutoLearnEntry=hpnicfFcPsmAutoLearnEntry, hpnicfFcPsmRowStatus=hpnicfFcPsmRowStatus, hpnicfFcPsmLoginSWWN=hpnicfFcPsmLoginSWWN, hpnicfFcPsmStatsEntry=hpnicfFcPsmStatsEntry, hpnicfFcPsmStatsClear=hpnicfFcPsmStatsClear, hpnicfFcPsmCopyToConfigTable=hpnicfFcPsmCopyToConfigTable, HpnicfFcPsmClearEntryType=HpnicfFcPsmClearEntryType, hpnicfFcPsmEPortDenyNotify=hpnicfFcPsmEPortDenyNotify)
|
print('=-'*25)
print(f'{"Sequencia de fibonacci": ^50}')
print('=-'*25, '\n')
termos = int(input('Quantos termos voce quer mostrar: '))
controle = 0
fibonacci = 0
n1 = 0
n2 = 1
print(n1, '->', n2, end=' -> ')
while controle != termos - 2:
controle += 1
fibonacci = n1 + n2
n1 = n2
n2 = fibonacci
print(fibonacci, end=' -> ')
print('FIM')
print('\n','=-'*25)
|
def count_and_say(palavra):
dicionario = {}
palavra = palavra.replace(' ', '')
for letra in palavra:
if not letra in dicionario.keys():
dicionario[letra] = 1
else:
dicionario[letra] += 1
retorno = ''
for letra, quantidade in dicionario.items():
retorno += '%d %s ' % (quantidade, letra)
return retorno.rstrip()
|
# https://www.hackerrank.com/challenges/recursive-digit-sum
def super_digit(n, k):
def _compute(num):
num_str = str(num)
total = sum(map(int, num_str))
if len(str(total)) == 1:
return total
else:
return _compute(total)
# n, k = [int(x) for x in raw_input().strip().split()]
concat = int(str(n) * k)
if len(str(concat)) == 1:
return concat
else:
return _compute(concat)
|
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Errors used by the Google Ads API library."""
class GoogleAdsException(Exception):
"""Exception thrown in response to an API error from GoogleAds servers."""
def __init__(self, error, call, failure, request_id):
"""Initializer.
Args:
error: the grpc.RpcError raised by an rpc call.
call: the grpc.Call object containing the details of the rpc call.
failure: the GoogleAdsFailure instance describing how the
GoogleAds API call failed.
request_id: a str request ID associated with the GoogleAds API call.
"""
self.error = error
self.call = call
self.failure = failure
self.request_id = request_id
|
def remove_char(str,n):
first_part = str[:n]
last_part = str[n+1:]
return first_part + last_part
def unify(E1, E2):
E1_Variable = E1[0].isupper()
E2_Variable = E2[0].isupper()
SUBSET = ""
if not E1_Variable and not E2_Variable or(len(E1) == 0 and len(E2) == 0):
if E1[0] == E2[0]:
E1 = remove_char(E1,0)
E2 = remove_char(E2,0)
else:
print("FAIL")
return "FAIL"
if E1_Variable:
if E1[0] in E2[0]:
print("FAIL")
return "FAIL"
else:
SUBSET = E2[0] + "/" + E1[0]
return SUBSET
if E2_Variable:
if E2[0] in E1[0]:
print("FAIL")
return "FAIL"
else:
SUBSET = E1[0] + "/" + E2[0]
return SUBSET
if E1[0] == "" or E2[0] == "":
print("FAIL")
quit()
else:
HE1 = E1[0]
HE2 = E2[0]
SUBS1 = unify(HE1,HE2)
if SUBS1 == "FAIL":
print("SUBS1: FAILED")
quit()
temp = SUBS1.split("/")
if temp[1] == E1[1]:
TE1 = temp[0]
if temp[1] != E1[1]:
TE1 = E1[1]
if temp[1] == E2[1]:
TE2 = temp[0]
if temp[1] != E2[1]:
TE2 = E2[1]
SUBS2 = unify(TE1,TE2)
if SUBS2 == "FAIL":
quit()
else:
print(SUBS1 + ", " + SUBS2 )
list1 = "pXX"
list2 = "pab"
unify(list1, list2)
|
# Create a script that has:
#a function accept a list of grades (i.e. [99, 88, 77])
#and returns a grading report for that list.
# Data
# List of Integers
# blank_list = []
# grades = [99, 75, 89, 45, 68, 94, 87, 86, 80]
# Conditional logic
# A >= 90
# B < 90 and B >= 80
# C < 80 and C >= 70
# D < 70 and D >= 60
# F < 60
#grade = grades[0]
## do logic
#grade = grades[1]
## do logic
# until no more grades left
#ind = 0
#while ind < len(grades):
# grade = grades[ind]
# # do logic
# ind += 1
# def scorer(scores: list):
# accepts a list of scores
# def func_name(param1, param2,...):
def scorer(scores):
class_scores = {"A": 0, "B": 0, "C": 0, "D": 0, "F": 0}
for grade in scores:
if grade >= 90:
print(f"{grade} is an A!")
print(str(grade) + " is an A!")
# class_scores["A"] = class_scores["A"] + 1
class_scores["A"] += 1
elif grade >= 80:
print(f"{grade} is a B!")
class_scores["B"] += 1
elif grade >= 70:
print(f"{grade} is a C!")
class_scores["C"] += 1
elif grade >= 60:
print(f"{grade} is a D!")
class_scores["D"] += 1
else:
print(f"{grade} is a FAILURE!!!")
class_scores["F"] += 1
print(class_scores)
grades = [99, 75, 89, 45, 68, 94, 87, 86, 80]
scorer(grades)
print("mrs_ts_grades")
mrs_ts_grades = [101, 22, 55, 77, 88, 99]
scorer(mrs_ts_grades)
print("mr_s_grades")
mr_s_grades = [99, 76, 56, 65]
scorer(mr_s_grades)
# Expected Output
# print out number of A's, B's, etc..
# OR
# dictionary output { "A": 2, "B": 4 ...}
|
def titulo(txt):
print('-' * 35)
print(f'{txt:^35}')
print('-' * 35)
|
def make_shirt(size='Large', message='I love Python'):
print(f"The size of the shirt is {size} and the message is {message}")
make_shirt()
make_shirt('m')
make_shirt('xs', "I'm okay")
|
def fib(n):
'''Takes in a number n, and returns the nth fibonacci number, starting with: 1, 1, 2, 3, 5,...'''
if n<=1:
return n
else:
f = [0, 1]
for i in range(2,n+1):
f.append(f[i-1] + f[i-2])
return f[n]
|
# Created by MechAviv
# Map ID :: 940011080
# Western Region of Pantheon : Heliseum Hideout
# [SET_DRESS_CHANGED] [00 00 ]
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.forcedInput(0)
sm.forcedInput(2)
sm.sendDelay(60)
sm.forcedInput(0)
sm.setSpeakerID(0)
sm.removeEscapeButton()
sm.flipDialoguePlayerAsSpeaker()
sm.setSpeakerType(3)
sm.sendNext("What am I gonna do?! Maybe I can just hide in here until I die of old age.")
sm.sendDelay(300)
sm.forcedInput(2)
|
class Solution:
# @param root, a tree link node
# @return nothing
def connect(self, root):
if not root or (not root.left and not root.right):
return root
strut = dict()
level_0 = [root]
lv = 0
strut[lv] = level_0
is_last_level = False
while not is_last_level:
new_level = []
last_node = None
is_last_level = True
for ele in strut[lv]:
if last_node:
last_node.next = ele
last_node = ele
is_last_level = is_last_level and (ele.left is None)
new_level.append(ele.left)
is_last_level = is_last_level and (ele.right is None)
new_level.append(ele.right)
lv += 1
strut[lv] = new_level
return root
def has_less_then_one_gen(self, parent):
left = parent.left
right = parent.right
if left and self.has_kids(left):
return False
if right and self.has_kids(right):
return False
return True
def has_kids(self, parent):
return parent.left or parent.right
|
# -*- coding:utf8-
'''
#温度转换
c=float(input(">>"))
f=(9/5)*c+32
print(f)
'''
'''
#圆柱体体积
from math import *
r,h=eval(input(">>"))
a=pow(r,2)*3.141
v=a*h
print(a,'\n',v)
'''
'''
#长度转换
feet=float(input(">>"))
meter=feet*0.305
print(meter)
'''
'''
#计算能量
m=float(input(">>"))
i=float(input(">>"))
f=float(input(">>"))
q=m*(f-i)*4184
print(q)
'''
'''
#计算利息
b,r=eval(input(">>"))
i=b*(r/1200)
print(i)
'''
'''
#计算加速度
from math import *
v0,v1,t=eval(input(">>"))
a=fabs((v0-v1))/t
print(a)
'''
'''
#计算复利
m=float(input(">>"))
f=1.00417
sum=m*f
for i in range(5):
sum+=100
sum*=f
print(sum)
'''
#位数求和
s = float(input(">>"))
if (0<=s<10):
print(s)
elif 10<=s<100:
a=s%10
b=s//10
print(a+b)
else:
a=s%10
b=s//10%10
c=s//100
print(a+b+c)
|
class Solution:
def partition(self, s: str) -> List[List[str]]:
res=[]
self.helper(res,s,[])
return res
def helper(self,res,s,path):
if not s:
res.append(path)
return
for i in range(1,len(s)+1):
if self.check(s[:i])==True:
self.helper(res,s[i:],path+[s[:i]])
def check(self,s):
return s==s[::-1]
|
#entrada
nFuncionarios = int(input())
qEventos = int(input())
#processamento
mesas = []
for i in range(1, nFuncionarios + 1): #inserindo funcionarios nas mesas
mesas.append(i)
for i in range(0, qEventos):
entrada = str(input()).split()
eTipo = int(entrada[0])
a = int(entrada[1])
if eTipo == 1: #update
b = int(entrada[2])
aux = mesas.index(b)
mesas[mesas.index(a)] = b
mesas[aux] = a
else:
flag = 0
indice = a
while mesas[indice - 1] != a:
flag += 1
indice = mesas[indice - 1]
print(flag) #saida
|
#58: Next Day
a=input("Enter the date:")
b=[1,3,5,7,8,10,12]
c=[4,6,9,11]
d=a.split('-')
year=int(d[0])
month=int(d[1])
date=int(d[2])
if year%400==0:
x=True
elif year%100==0:
x=False
elif year%4==0:
x=True
else:
x=False
if 1<=month<=12 and 1<=date<=31:
if month in b:
date+=1
if date>31:
month+=1
date=1
if month>12:
year+=1
month=1
elif month in c:
date+=1
if date>30:
month+=1
date=1
elif month==2:
if x:
date+=1
if date>29:
month+=1
date=1
else:
date+=1
if date>28:
month+=1
date=1
print(year,"-",month,"-",date)
else:
print("Invalid input")
|
class Solution(object):
def checkSubarraySum(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: bool
"""
remainders = {0:-1}
subSum = 0
for i, ni in enumerate(nums):
subSum += ni
if k != 0:
subSum %= k
if subSum in remainders:
if i - remainders[subSum] > 1:
return True
else:
remainders[subSum] = i
return False
|
def get_soundex(token):
temp=''
token=token.upper()
temp+=token[0]
dic={'BFPV':1,'CGJKQSXZ':2,'DT':3,'L':4,'MN':5,'R':6,'AEIOUYHW':''}
for char in token[1:]:
for key in dic.keys():
if char in key:
code=str(dic[key])
break
if temp[-1]!=code:
temp+=code
temp=temp[:4].ljust(4,'0')
return temp
|
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def minDepth(self, root: TreeNode) -> int:
def depth(node, x):
if node == None:
return x-1
if node.left == None and node.right == None:
return x
l = 10**5
r = 10**5
if node.left != None:
l = depth(node.left,x+1)
if node.right != None:
r = depth(node.right,x+1)
return min(l,r)
return depth(root,1)
|
def longest_palin_substring(str1):
"""
dp[size][i] = dp[size-2][i+1] if str[i] == str[j]
else
dp[size][i] = False
where dp[size][i] = If substring of size `size` starting at index `i` is palindrome or not.
Answer = max of all (j-i+1) where dp[i][j] is True.
"""
str_len = len(str1)
is_palin = [[False for j in range(str_len)] for i in range(str_len + 1)]
for i in range(str_len):
is_palin[0][i] = True
is_palin[1][i] = True
ans_idx_left = 0
ans_idx_right = 0
for size in range(2, str_len + 1):
for idx_left in range(0, str_len):
idx_right = idx_left + size - 1
if idx_right >= str_len:
break
if str1[idx_left] == str1[idx_right]:
if is_palin[size - 2][idx_left + 1]:
is_palin[size][idx_left] = True
# Only update if it is strictly greater.
# Which means in case of conflict, the lefmost palindrome
# will be printed.
if idx_right - idx_left > ans_idx_right - ans_idx_left:
ans_idx_left = idx_left
ans_idx_right = idx_right
return (ans_idx_left, ans_idx_right)
def longest_palin__substring_space_optimized(str1):
"""
Find all odd-length palindromes first in O(n*n).
Do this by choosing all the characters as the centre one-by-one and
then expanding outwards.
Next, find all the even-length palindromes in O(n*n).
Do this by taking all the adjacent character pairs and expanding.
Then compute the maximum of both.
"""
pass
|
#!/usr/bin/env python3
# Import data
with open('/home/agaspari/aoc2021/dec_8/dec8_input.txt') as f:
signal_list = f.read().split('\n')
unique_signals_one = {'c', 'f'}
unique_signals_four = {'b', 'c', 'd', 'f'}
unique_signals_seven = {'a', 'c', 'f'}
unique_signals_eight = {'a', 'b', 'c', 'd', 'e', 'f', 'g'}
unique_signals = [
unique_signals_one,
unique_signals_four,
unique_signals_seven,
unique_signals_eight
]
unique_signals_lengths = [len(x) for x in unique_signals]
# Task 1 - How many times is a number with a unique number of segments output?
inputs = [x.split(' | ')[0] for x in signal_list]
outputs = [x.split(' | ')[1] for x in signal_list]
recognized_count = 0
for output in outputs:
signal_patterns = [signal for signal in output.split(' ')]
for signal_pattern in signal_patterns:
if len(signal_pattern) in unique_signals_lengths:
recognized_count += 1
print("Number of unique signal counts:", recognized_count)
# Task 2 - Decode the signals and get the output sum
# Known digits
# one: len == 2
# four: len == 4
# seven: len == 3
# eight: len == 7
# Unknown digits
# zero: len == 6, len(set(4) - set(0)) == 1, len(set(seven) - set(0)) == 0
# two: len == 5, len(set(4) - set(2)) == 2, len(set(7) - set(2)) == 1
# three: len == 5, len(set(4) - set(3)) == 1, len(set(7) - set(3)) == 0
# five: len == 5, len(set(4) - set(5)) == 1, len(set(7) - set(5)) == 1
# six: len == 6, len(set(4) - set(6)) == 1, len(set(7) - set(6)) == 1
# nine: len == 6, len(set(4) - set(9)) == 0, len(set(7) - set(5)) == 0
decoded_outputs = list()
# Loop through inputs
for signal_input, signal_output in zip(inputs, outputs):
known_digits = list()
unknown_digits = list()
# Check for known digits, check for unknown digits
digits = [x for x in signal_input.split(' ')]
for digit in digits:
if len(digit) in unique_signals_lengths:
known_digits.append({x for x in digit})
else:
unknown_digits.append({x for x in digit})
known_digits = sorted(known_digits, key=len)
all_digits = [0] * 10
all_digits[1], all_digits[7], all_digits[4], all_digits[8] = known_digits[0],known_digits[1],known_digits[2],known_digits[3],
for digit in unknown_digits:
if len(digit) == 5:
if len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 0:
all_digits[3] = digit
elif len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 1:
all_digits[5] = digit
else:
all_digits[2] = digit
else:
if len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 0:
all_digits[0] = digit
elif len(all_digits[4] - digit) == 1 and len(all_digits[7] - digit) == 1:
all_digits[6] = digit
else:
all_digits[9] = digit
output_value = ''
signal_outputs = [{x for x in output} for output in signal_output.split(' ')]
for output_digit in signal_outputs:
for index, input_digit in enumerate(all_digits):
if output_digit == input_digit:
output_value += str(index)
break
else:
continue
if len(output_value) < 4:
raise ValueError("Error: not enough output values decoded")
decoded_outputs.append(int(output_value))
print("Sum of output values:", sum(decoded_outputs))
|
x = 1 + 2 * 3 - 3 ** 5 / 2
y = 3 ** 5 - 2
z = x / y
zz = x // y
z -= z
zz += zz
xx = -x
xx %= 10
if type(x) is int:
print(x and y)
|
"""
bender_mc.utils
~~~~~~~~~~~~~~~
Utility tools for bender-mc.
"""
# :copyright: (c) 2020 by Nicholas Repole.
# :license: MIT - See LICENSE for more details.
def deformat_title(formatted_title):
return formatted_title.replace(
"__COLON__", ":").replace(
"__DOT__", ".").replace(
"__DASH__", "-").replace(
"__SPACE__", " ").replace(
"__APOSTROPHE__", "'").replace(
"__UNDERSCORE__", "_")
|
class Queue:
qu = []
size = 0
front = 0
rear = 0
def __init__(self, size):
self.size = size
def en_queue(self, data):
self.qu.append(data)
self.size = self.size + 1
self.rear = self.rear + 1
def de_queue(self):
temp = self.qu[self.front]
del self.qu[self.front]
self.rear = self.rear - 1
self.size = self.size - 1
return temp
def de_que_all(self):
while not self.is_empty():
print(self.de_queue().__str__())
def get_front(self):
return self.qu[self.front]
def get_rear(self):
return self.qu[-1]
def is_full(self):
return self.rear == self.get_size()
def is_empty(self):
return self.rear == 0
def get_size(self):
return self.size
|
class parser(object):
def __call__(self, line):
self.rank = 0
self.in_garbage = False # if False, then we're in garbage
self.ignore = False
self.points = []
self.garbage_count = 0
for char in line:
self._inc(char)
return self.points
def _inc(self, char):
if self.ignore:
self.ignore = False
return
if char == "!":
self.ignore = True
return
if self.in_garbage:
if char == ">":
self.in_garbage = False
return
self.garbage_count += 1
if not self.in_garbage:
if char == "<":
self.in_garbage = True
return
if char == "{" :
self.rank += 1
return
if char == "}" :
self.points.insert(0, self.rank)
self.rank -= 1
return
if __name__ == "__main__":
test1_input = (
('{}', [1]),
('{{{}}}', [1,2,3]),
('{{},{}}', [1,2,2]),
('{{{},{},{{}}}}', [1,2,3,3,3,4]),
('{<a>,<a>,<a>,<a>}', [1]),
('{{<ab>},{<ab>},{<ab>},{<ab>}}', [1,2,2,2,2]),
('{{<!!>},{<!!>},{<!!>},{<!!>}}', [1,2,2,2,2]),
('{{<a!>},{<a!>},{<a!>},{<ab>}}', [1,2])
)
p = parser()
for t in test1_input:
check = p(t[0])
print(t[0], t[1], check)
real_input = open('day9_input.txt').readline()
p(real_input)
print('real1', sum(p.points))
print('real2', p.garbage_count)
|
# -*- coding: utf-8 -*-
"""
>>> import os
>>> import json
>>> from samila import *
>>> from pytest import warns
>>> g = GenerativeImage(lambda x,y: 0, lambda x,y: 0)
>>> g.generate(step=0.1)
>>> result = g.save_data()
>>> g_ = GenerativeImage(data=open('data.json', 'r'))
>>> g_.data1 == g.data1
True
>>> g_.data2 == g.data2
True
>>> with open('data.json', 'w') as fp:
... json.dump({'data1': [0], 'data2': [0], 'matplotlib_version': '0'}, fp)
>>> with warns(RuntimeWarning, match=r"Source matplotlib version(.*) is different from yours, plots may be different."):
... g = GenerativeImage(lambda x,y: 0, lambda x,y: 0, data=open('data.json', 'r'))
>>> with open('config.json', 'w') as fp:
... json.dump({'f1': 'x', 'f2': 'y', 'matplotlib_version': '0'}, fp)
>>> with warns(RuntimeWarning, match=r"Source matplotlib version(.*) is different from yours, plots may be different."):
... g = GenerativeImage(config=open('config.json', 'r'))
>>> os.remove('data.json')
>>> os.remove('config.json')
"""
|
"""Various functions to help deal with exceptions.
Released under the MIT license (https://opensource.org/licenses/MIT).
"""
def raises(callable, args=(), kwargs={}):
"""Check if `callable(*args, **kwargs)` raises an exception.
Returns `True` if an exception is raised, else `False`.
Arguments:
- callable: A callable object.
- args: A list or tuple containing positional arguments to `callable`.
Defaults to an empty tuple.
- kwargs: A dictionary containing keyword arguments to `callable`.
Defaults to an empty dictionary.
"""
try:
callable(*args, **kwargs)
except Exception as exc:
return True
return False
def suppress(*exceptions):
"""Suppress `exceptions` when calling a function.
If an exception is raised and it is not contained in `exceptions`,
it is propagated back to the caller without context. If no exceptions
are raised, return `callable(*args, **kwargs)`.
Arguments:
- *exceptions: The exceptions to suppress.
All exceptions must derive from `BaseException`.
- callable: A callable object.
- *args: Positional arguments to `callable`.
- **kwargs: Keyword arguments to `callable`.
"""
def wrap(callable):
def call(*args, **kwargs):
try:
return callable(*args, **kwargs)
except exceptions:
pass
except Exception as exc:
raise_from_context(exc)
return call
return wrap
def raise_from_context(exception, context=None):
"""Raise `exception` from `context`.
This function is compatible with Python 2 as it sets `__context__`.
Arguments:
- exception: An exception (derived from `BaseException`).
- context: The context from which to raise `exception`.
Defaults to `None`.
"""
exception.__context__ = context
raise exception
|
"""
This demonstrates the use of object properties as a way to give the illusion of private members and
getters/setters per object oriented programming. Variables prefixed by underscore are a signal to other
programmers that they should be changing them directly, but there really isn't any enforcement. There are
still ways around it, but this makes it harder to change members that shouldn't change.
"""
class myThing(object):
def __init__(self, foo=None):
self._foo = foo
# This decorator acts as a getter, accessed with "myFoo.foo"
@property
def foo(self):
return self._foo
# This decorator acts as a setter, but only once
@foo.setter
def foo(self, newFoo):
if self._foo is None:
self._foo = newFoo
else:
raise Exception("Immutable member foo has already been assigned...")
# This decorator protects against inadvertent deletion via "del myFoo.foo"
@foo.deleter
def foo(self):
raise Exception("Cannot remove immutable member foo")
if __name__ == "__main__":
myFoo = myThing()
print(myFoo.foo)
myFoo.foo = "bar"
print(myFoo.foo)
try:
myFoo.foo = "baz"
except Exception as e:
print(e)
print(myFoo.foo)
try:
del myFoo.foo
except Exception as e:
print(e)
|
class Text():
'''text to write to console'''
def __init__(self, text, fg='black', bg='white'):
self.text = text
self.fg = fg
self.bg = bg
class Value():
'''a value for the status bar'''
def __init__(self, name, text, row=0, fg='black', bg='white'):
self.name = name
self.text = text
self.row = row
self.fg = fg
self.bg = bg
|
"""
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
n=int(input())
a=*map(int,input()),
a,b=sorted(a[:n]),sorted(a[n:])
d=[1,-1][a[0]>b[0]]
print('NYOE S'[all(d*x<d*y for x,y in zip(a,b))::2])
|
# ***********************************************************************************
# * Copyright 2010 - 2016 Paulo A. Herrera. All rights reserved *
# * *
# * Redistribution and use in source and binary forms, with or without *
# * modification, are permitted provided that the following conditions are met: *
# * *
# * 1. Redistributions of source code must retain the above copyright notice, *
# * this list of conditions and the following disclaimer. *
# * *
# * 2. Redistributions in binary form must reproduce the above copyright notice, *
# * this list of conditions and the following disclaimer in the documentation *
# * and/or other materials provided with the distribution. *
# * *
# * THIS SOFTWARE IS PROVIDED BY PAULO A. HERRERA ``AS IS'' AND ANY EXPRESS OR *
# * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
# * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO *
# * EVENT SHALL <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, *
# * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
# * BUT NOT LIMITED TO, PROCUREMEN OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
# * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
# * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
# * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
# * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
# ***********************************************************************************
"""Simple class to generate a well-formed XML file."""
class XmlWriter:
"""
xml writer class.
Parameters
----------
filepath : str
Path to the xml file.
addDeclaration : bool, optional
Whether to add the declaration.
The default is True.
"""
def __init__(self, filepath, addDeclaration=True):
self.stream = open(filepath, "wb")
self.openTag = False
self.current = []
if addDeclaration:
self.addDeclaration()
def close(self):
"""Close the file."""
assert not self.openTag
self.stream.close()
def addDeclaration(self):
"""Add xml declaration."""
self.stream.write(b'<?xml version="1.0"?>')
def openElement(self, tag):
"""Open a new xml element."""
if self.openTag:
self.stream.write(b">")
st = "\n<%s" % tag
self.stream.write(str.encode(st))
self.openTag = True
self.current.append(tag)
return self
def closeElement(self, tag=None):
"""
Close the current element.
Parameters
----------
tag : str, optional
Tag of the element.
The default is None.
Returns
-------
XmlWriter
The XmlWriter itself for chained calles.
"""
if tag:
assert self.current.pop() == tag
if self.openTag:
self.stream.write(b">")
self.openTag = False
st = "\n</%s>" % tag
self.stream.write(str.encode(st))
else:
self.stream.write(b"/>")
self.openTag = False
self.current.pop()
return self
def addText(self, text):
"""
Add text.
Parameters
----------
text : str
Text to add.
Returns
-------
XmlWriter
The XmlWriter itself for chained calles.
"""
if self.openTag:
self.stream.write(b">\n")
self.openTag = False
#mp self.stream.write(str.encode(text))
self.stream.write(text.encode())
return self
def addAttributes(self, **kwargs):
"""
Add attributes.
Parameters
----------
**kwargs
keys as attribute names.
Returns
-------
XmlWriter
The XmlWriter itself for chained calles.
"""
assert self.openTag
for key in kwargs:
st = ' %s="%s"' % (key, kwargs[key])
#mp self.stream.write(str.encode(st))
self.stream.write(st.encode())
return self
|
"""django-solo helps working with singletons: things like global settings that you want to edit from the admin site.
"""
__version__ = '1.0.5'
|
m = int(input())
n = int(input()) + 1
for i in range(m, n, ):
if (i % 17 == 0) or (i % 10 == 9) or (i % 3 == 0 and i % 5 == 0):
print(i)
|
edad=input("¿Que edad tienes?")
edad=int(edad)
while True:
if edad < 3:
print("Su boleto es gratis")
break
elif edad >= 3 and edad <=12:
print("Su boleto tiene un valor de $10")
break
else:
print("Su boleto tiene un valor de $15")
break
|
def print_formatted(number):
binlen = len(str(bin(number))) - 2
for i in range(1, number+1):
print("{0} {1} {2} {3}".format(str(i).rjust(binlen), str(oct(i))[1:].rjust(binlen), format(i, 'x').upper().rjust(binlen), bin(i)[2:].rjust(binlen)))
|
"""
程式設計練習題 2.2-2.10 2.12 列印表格.
請撰寫一程式,顯示以下這個表格:
```
a b a ** b
1 2 1
2 3 8
3 4 81
4 5 1024
5 6 15625
```
"""
A_PRINT = 1
B_PRINT = 2
AB = A_PRINT ** B_PRINT
print("a", "b", "a ** b")
print(A_PRINT, B_PRINT, AB)
A_PRINT += 1
B_PRINT += 1
AB = A_PRINT ** B_PRINT
print(A_PRINT, B_PRINT, AB)
A_PRINT += 1
B_PRINT += 1
AB = A_PRINT ** B_PRINT
print(A_PRINT, B_PRINT, AB)
A_PRINT += 1
B_PRINT += 1
AB = A_PRINT ** B_PRINT
print(A_PRINT, B_PRINT, AB)
A_PRINT += 1
B_PRINT += 1
AB = A_PRINT ** B_PRINT
print(A_PRINT, B_PRINT, AB)
A_PRINT += 1
B_PRINT += 1
AB = A_PRINT ** B_PRINT
print(A_PRINT, B_PRINT, AB)
|
class RequestHandler:
def __init__ (self, logger):
self.logger = logger
def log (self, message, type = "info"):
self.logger.log ("%s - %s" % (self.request.uri, message), type)
def log_info (self, message, type='info'):
self.log (message, type)
def trace (self):
self.logger.trace (self.request.uri)
def working (self):
return False
|
#
# PySNMP MIB module HH3C-LOCAL-AAA-SERVER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-LOCAL-AAA-SERVER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:15:00 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion", "ValueRangeConstraint")
hh3cCommon, = mibBuilder.importSymbols("HH3C-OID-MIB", "hh3cCommon")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
ObjectIdentity, Integer32, Counter32, Unsigned32, IpAddress, MibIdentifier, NotificationType, Counter64, iso, Bits, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "Integer32", "Counter32", "Unsigned32", "IpAddress", "MibIdentifier", "NotificationType", "Counter64", "iso", "Bits", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Gauge32")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
hh3cLocAAASvr = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 141))
hh3cLocAAASvr.setRevisions(('2013-07-06 09:45',))
if mibBuilder.loadTexts: hh3cLocAAASvr.setLastUpdated('201307060945Z')
if mibBuilder.loadTexts: hh3cLocAAASvr.setOrganization('Hangzhou H3C Tech. Co., Ltd.')
hh3cLocAAASvrControl = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 1))
hh3cLocAAASvrTables = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 2))
hh3cLocAAASvrTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3))
hh3cLocAAASvrTrapPrex = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3, 0))
hh3cLocAAASvrBillExportFailed = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 141, 3, 0, 1))
if mibBuilder.loadTexts: hh3cLocAAASvrBillExportFailed.setStatus('current')
mibBuilder.exportSymbols("HH3C-LOCAL-AAA-SERVER-MIB", hh3cLocAAASvrControl=hh3cLocAAASvrControl, PYSNMP_MODULE_ID=hh3cLocAAASvr, hh3cLocAAASvrTrap=hh3cLocAAASvrTrap, hh3cLocAAASvr=hh3cLocAAASvr, hh3cLocAAASvrTrapPrex=hh3cLocAAASvrTrapPrex, hh3cLocAAASvrBillExportFailed=hh3cLocAAASvrBillExportFailed, hh3cLocAAASvrTables=hh3cLocAAASvrTables)
|
__version__ = '1.0.1'
default_app_config = (
'django_selectel_storage.apps.'
'DjangoSelectelStorageAppConfig'
)
|
soma = 0
for c in range(0, 6):
x = int(input('Digite 6 números número'))
if x % 2 != 0:
soma = x + soma
print(x)
print(soma)
|
# perguntado os números e os coloocando nas listas
numeros = []
repetidos = []
c = 0
while c < 5:
while True:
n1 = int(input(f'Digíte o {c + 1}° número- '))
if n1 in numeros:
print('Numero duplicado, não sera inserido')
repetidos.append(n1)
break
if n1 not in numeros:
numeros.append(n1)
c += 1
if c == 5:
break
if c == 5:
break
# colocando as listas em ordem crecente
numeros.sort()
repetidos.sort()
# informando os números digitados
print(f'->Os números digitados foi:', end=' ')
for numero in numeros:
print(numero, end=' ')
# informando os números que se repetiram
print('\n')
if len(repetidos) == 0:
print('\n->Não ouve números repetidos.')
else:
print('->Os números repetidos foram: ', end=' ')
for pos, numero in enumerate(repetidos):
if pos % 2 == 0:
print(numero, end=' ' )
print('\n')
|
class Solution(object):
def findWords(self, words):
"""
:type words: List[str]
:rtype: List[str]
"""
result = []
keyb = {'a': '2', 'b': '3', 'c': '3', 'd': '2', 'e': '1', 'f': '2', 'g': '2', 'h': '2', 'i': '1', 'j': '2', 'k': '2', 'l': '2', 'm': '3', 'n': '3', 'o': '1', 'p': '1', 'q': '1', 'r': '1', 's': '2', 't': '1', 'u': '1', 'v': '3', 'w': '1', 'x': '3', 'y': '1', 'z': '3'}
for i in words:
tmp = keyb[i[0].lower()]
l = True
j = 1
while l and j < len(i):
if keyb[i[j].lower()] != tmp:
l = False
j+=1
if l:
result.append(i)
return(result)
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 JiNong Inc.
#
"""
Reference
* http://stackoverflow.com/questions/36932/how-can-i-represent-an-enum-in-python
"""
def enum(*sequential, **named):
"""
a function to generate enum type
"""
enums = dict(zip(sequential, range(len(sequential))), **named)
reverse = dict((value, key) for key, value in enums.iteritems())
enums['reverse_mapping'] = reverse
return type('Enum', (), enums)
|
XMajor = [[15, 13.333333333333334, 26.666666666666668, 46.666666666666664, 13.333333333333334, 0.0, 0.0, 0.0],[13, 15.384615384615385, 38.46153846153846, 7.6923076923076925, 15.384615384615385, 15.384615384615385, 0.0, 7.6923076923076925],[4, 25.0, 0.0, 25.0, 50.0, 0.0, 0.0, 0.0],[10, 20.0, 30.0, 0.0, 0.0, 0.0, 20.0, 30.0],[6, 0.0, 33.333333333333336, 33.333333333333336, 0.0, 33.333333333333336, 0.0, 0.0],[8, 12.5, 37.5, 12.5, 12.5, 25.0, 0.0, 0.0],[12, 0.0, 41.666666666666664, 0.0, 16.666666666666668, 8.333333333333334, 16.666666666666668, 16.666666666666668],[4, 0.0, 0.0, 0.0, 50.0, 0.0, 50.0, 0.0],[11, 36.36363636363637, 36.36363636363637, 18.181818181818183, 9.090909090909092, 0.0, 0.0, 0.0],[9, 22.22222222222222, 22.22222222222222, 33.333333333333336, 0.0, 0.0, 22.22222222222222, 0.0],[11, 18.181818181818183, 9.090909090909092, 18.181818181818183, 9.090909090909092, 18.181818181818183, 27.272727272727273, 0.0],[9, 22.22222222222222, 44.44444444444444, 33.333333333333336, 0.0, 0.0, 0.0, 0.0],[12, 16.666666666666668, 8.333333333333334, 25.0, 41.666666666666664, 8.333333333333334, 0.0, 0.0],[7, 28.571428571428573, 28.571428571428573, 0.0, 0.0, 14.285714285714286, 28.571428571428573, 0.0],[10, 30.0, 10.0, 10.0, 20.0, 10.0, 10.0, 10.0],[7, 14.285714285714286, 14.285714285714286, 28.571428571428573, 14.285714285714286, 28.571428571428573, 0.0, 0.0],[6, 16.666666666666668, 33.333333333333336, 0.0, 16.666666666666668, 0.0, 33.333333333333336, 0.0],[12, 8.333333333333334, 50.0, 16.666666666666668, 8.333333333333334, 16.666666666666668, 0.0, 0.0],[12, 25.0, 41.666666666666664, 16.666666666666668, 16.666666666666668, 0.0, 0.0, 0.0],[7, 28.571428571428573, 0.0, 14.285714285714286, 14.285714285714286, 14.285714285714286, 14.285714285714286, 14.285714285714286],[13, 23.076923076923077, 7.6923076923076925, 30.76923076923077, 0.0, 15.384615384615385, 23.076923076923077, 0.0],[10, 20.0, 30.0, 20.0, 20.0, 10.0, 0.0, 0.0],[10, 10.0, 30.0, 20.0, 30.0, 0.0, 10.0, 0.0],[15, 20.0, 13.333333333333334, 26.666666666666668, 13.333333333333334, 20.0, 6.666666666666667, 0.0],[7, 28.571428571428573, 42.857142857142854, 0.0, 14.285714285714286, 14.285714285714286, 0.0, 0.0],[6, 33.333333333333336, 0.0, 0.0, 33.333333333333336, 0.0, 16.666666666666668, 16.666666666666668],[7, 14.285714285714286, 28.571428571428573, 14.285714285714286, 28.571428571428573, 0.0, 14.285714285714286, 0.0],[6, 16.666666666666668, 33.333333333333336, 16.666666666666668, 16.666666666666668, 0.0, 16.666666666666668, 0.0],[5, 20.0, 20.0, 0.0, 60.0, 0.0, 0.0, 0.0],[13, 0.0, 15.384615384615385, 15.384615384615385, 38.46153846153846, 15.384615384615385, 7.6923076923076925, 7.6923076923076925],[6, 16.666666666666668, 33.333333333333336, 0.0, 0.0, 33.333333333333336, 16.666666666666668, 0.0],[8, 25.0, 25.0, 25.0, 12.5, 0.0, 12.5, 0.0],[7, 28.571428571428573, 28.571428571428573, 14.285714285714286, 14.285714285714286, 0.0, 14.285714285714286, 0.0],[7, 28.571428571428573, 0.0, 42.857142857142854, 28.571428571428573, 0.0, 0.0, 0.0],[9, 33.333333333333336, 11.11111111111111, 11.11111111111111, 11.11111111111111, 22.22222222222222, 11.11111111111111, 0.0],[8, 12.5, 12.5, 50.0, 0.0, 12.5, 12.5, 0.0],[7, 28.571428571428573, 0.0, 0.0, 57.142857142857146, 14.285714285714286, 0.0, 0.0],[10, 0.0, 20.0, 20.0, 10.0, 10.0, 30.0, 10.0],[7, 28.571428571428573, 28.571428571428573, 0.0, 0.0, 14.285714285714286, 28.571428571428573, 0.0],[14, 7.142857142857143, 21.428571428571427, 14.285714285714286, 14.285714285714286, 42.857142857142854, 0.0, 0.0],[8, 12.5, 37.5, 37.5, 0.0, 12.5, 0.0, 0.0],[7, 0.0, 0.0, 28.571428571428573, 0.0, 28.571428571428573, 42.857142857142854, 0.0],[8, 12.5, 12.5, 12.5, 12.5, 25.0, 25.0, 0.0],[7, 14.285714285714286, 14.285714285714286, 14.285714285714286, 42.857142857142854, 14.285714285714286, 0.0, 0.0],[8, 25.0, 25.0, 12.5, 0.0, 12.5, 0.0, 25.0],[13, 30.76923076923077, 15.384615384615385, 15.384615384615385, 15.384615384615385, 15.384615384615385, 7.6923076923076925, 0.0],[7, 28.571428571428573, 14.285714285714286, 14.285714285714286, 0.0, 0.0, 28.571428571428573, 14.285714285714286],[6, 16.666666666666668, 50.0, 16.666666666666668, 0.0, 0.0, 16.666666666666668, 0.0],[8, 25.0, 37.5, 12.5, 0.0, 0.0, 12.5, 12.5],[9, 22.22222222222222, 0.0, 33.333333333333336, 22.22222222222222, 0.0, 0.0, 22.22222222222222],[6, 50.0, 0.0, 33.333333333333336, 0.0, 0.0, 16.666666666666668, 0.0],[9, 0.0, 22.22222222222222, 22.22222222222222, 22.22222222222222, 22.22222222222222, 11.11111111111111, 0.0],[7, 0.0, 28.571428571428573, 14.285714285714286, 28.571428571428573, 0.0, 0.0, 28.571428571428573],[11, 0.0, 27.272727272727273, 9.090909090909092, 18.181818181818183, 27.272727272727273, 9.090909090909092, 9.090909090909092],[13, 15.384615384615385, 23.076923076923077, 15.384615384615385, 7.6923076923076925, 23.076923076923077, 15.384615384615385, 0.0],[9, 22.22222222222222, 44.44444444444444, 11.11111111111111, 22.22222222222222, 0.0, 0.0, 0.0]]
YMajor = [0, 0, 1, 0, 3, 0, 0, 3, 0, 3, 0, 0, 0, 3, 1, 3, 3, 0, 0, 0, 2, 3, 3, 0, 3, 0, 3, 3, 3, 3, 0, 0, 0, 3, 0, 3, 0, 0, 3, 3, 0, 3, 3, 3, 0, 0, 3, 3, 0, 0, 1, 3, 3, 1, 0, 3]
XMinor = [[11, 9.090909090909092, 36.36363636363637, 18.181818181818183, 9.090909090909092, 9.090909090909092, 9.090909090909092, 9.090909090909092],[7, 28.571428571428573, 14.285714285714286, 28.571428571428573, 14.285714285714286, 0.0, 0.0, 14.285714285714286],[5, 20.0, 40.0, 20.0, 20.0, 0.0, 0.0, 0.0],[8, 12.5, 0.0, 25.0, 37.5, 12.5, 12.5, 0.0],[13, 7.6923076923076925, 30.76923076923077, 15.384615384615385, 30.76923076923077, 7.6923076923076925, 7.6923076923076925, 0.0],[4, 0.0, 50.0, 50.0, 0.0, 0.0, 0.0, 0.0],[3, 0.0, 0.0, 0.0, 33.333333333333336, 33.333333333333336, 33.333333333333336, 0.0],[8, 12.5, 37.5, 25.0, 0.0, 0.0, 25.0, 0.0],[13, 0.0, 7.6923076923076925, 7.6923076923076925, 23.076923076923077, 23.076923076923077, 38.46153846153846, 0.0],[8, 12.5, 50.0, 0.0, 0.0, 25.0, 12.5, 0.0],[7, 14.285714285714286, 42.857142857142854, 28.571428571428573, 14.285714285714286, 0.0, 0.0, 0.0],[14, 35.714285714285715, 14.285714285714286, 14.285714285714286, 0.0, 35.714285714285715, 0.0, 0.0],[12, 50.0, 8.333333333333334, 16.666666666666668, 16.666666666666668, 8.333333333333334, 0.0, 0.0],[10, 10.0, 10.0, 40.0, 30.0, 0.0, 10.0, 0.0],[11, 9.090909090909092, 18.181818181818183, 0.0, 18.181818181818183, 18.181818181818183, 9.090909090909092, 27.272727272727273],[10, 0.0, 40.0, 10.0, 20.0, 20.0, 0.0, 10.0],[8, 37.5, 37.5, 0.0, 0.0, 25.0, 0.0, 0.0],[12, 16.666666666666668, 16.666666666666668, 16.666666666666668, 33.333333333333336, 0.0, 16.666666666666668, 0.0],[9, 11.11111111111111, 33.333333333333336, 22.22222222222222, 0.0, 22.22222222222222, 11.11111111111111, 0.0],[6, 16.666666666666668, 16.666666666666668, 33.333333333333336, 16.666666666666668, 0.0, 16.666666666666668, 0.0],[7, 0.0, 14.285714285714286, 42.857142857142854, 14.285714285714286, 0.0, 0.0, 28.571428571428573],[10, 20.0, 30.0, 30.0, 10.0, 0.0, 10.0, 0.0],[8, 0.0, 37.5, 25.0, 0.0, 25.0, 12.5, 0.0],[11, 9.090909090909092, 0.0, 54.54545454545455, 18.181818181818183, 18.181818181818183, 0.0, 0.0],[6, 0.0, 33.333333333333336, 66.66666666666667, 0.0, 0.0, 0.0, 0.0],[6, 0.0, 33.333333333333336, 33.333333333333336, 16.666666666666668, 16.666666666666668, 0.0, 0.0],[10, 20.0, 20.0, 30.0, 20.0, 0.0, 0.0, 10.0],[10, 20.0, 20.0, 30.0, 20.0, 10.0, 0.0, 0.0],[9, 22.22222222222222, 0.0, 0.0, 55.55555555555556, 22.22222222222222, 0.0, 0.0],[11, 27.272727272727273, 9.090909090909092, 18.181818181818183, 0.0, 18.181818181818183, 9.090909090909092, 18.181818181818183],[10, 40.0, 10.0, 0.0, 10.0, 20.0, 20.0, 0.0],[10, 10.0, 30.0, 10.0, 20.0, 30.0, 0.0, 0.0],[12, 0.0, 8.333333333333334, 16.666666666666668, 41.666666666666664, 16.666666666666668, 16.666666666666668, 0.0],[7, 0.0, 57.142857142857146, 42.857142857142854, 0.0, 0.0, 0.0, 0.0],[11, 0.0, 27.272727272727273, 9.090909090909092, 27.272727272727273, 9.090909090909092, 27.272727272727273, 0.0],[8, 25.0, 37.5, 0.0, 25.0, 0.0, 12.5, 0.0],[9, 0.0, 44.44444444444444, 0.0, 0.0, 22.22222222222222, 11.11111111111111, 22.22222222222222],[11, 18.181818181818183, 27.272727272727273, 9.090909090909092, 18.181818181818183, 9.090909090909092, 9.090909090909092, 9.090909090909092],[11, 0.0, 54.54545454545455, 9.090909090909092, 27.272727272727273, 0.0, 9.090909090909092, 0.0],[4, 25.0, 25.0, 25.0, 25.0, 0.0, 0.0, 0.0],[3, 33.333333333333336, 33.333333333333336, 0.0, 0.0, 0.0, 33.333333333333336, 0.0],[12, 33.333333333333336, 16.666666666666668, 16.666666666666668, 16.666666666666668, 16.666666666666668, 0.0, 0.0],[10, 20.0, 30.0, 40.0, 10.0, 0.0, 0.0, 0.0],[12, 16.666666666666668, 16.666666666666668, 16.666666666666668, 0.0, 33.333333333333336, 16.666666666666668, 0.0],[5, 40.0, 20.0, 20.0, 20.0, 0.0, 0.0, 0.0],[3, 33.333333333333336, 0.0, 0.0, 66.66666666666667, 0.0, 0.0, 0.0],[9, 0.0, 33.333333333333336, 44.44444444444444, 0.0, 11.11111111111111, 11.11111111111111, 0.0]]
YMinor = [2, 1, 2, 1, 1, 1, 3, 2, 1, 1, 2, 2, 2, 3, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 1, 1, 2, 2, 1]
|
# Define Functions
# Function that handles all litre conversions
def litreconv():
print("you have selected Litres")
conversion = int(input("input Litres to convert: "))
print(str(conversion) + " Litres")
converted = 0.21997 * conversion
print(str(round(converted, 4)) + " UK Gallons")
converted = conversion / 3.785
print(str(round(converted, 4)) + "US Gallons")
# Function that handles all UK Gallon conversions
def ukgallonconv():
print("You have selected UK Gallons")
conversion = int(input("Input UK Gallons to convert: "))
print(str(conversion) + " UK Gallons")
converted = conversion / 0.21997
print(str(round(converted, 4)) + " Litres")
converted = conversion * 1.201
print(str(round(converted, 4)) + "US Gallons")
# Function that handles all US Gallon conversions
def usgallonconv():
print("You have selected US Gallons")
conversion = int(input("input US Gallons to convert: "))
print(str(conversion) + " US Gallons")
converted = conversion * 3.785
print(str(round(converted, 4)) + " Litres")
converted = conversion / 1.201
print(str(round(converted, 4)) + " UK Gallons")
# Function that handles Pearsons Square calculation. Note: Tidy variable/input names
def pearsonsconv():
pearsontarget = float(input("Please enter your target percentage: "))
print("You entered " + str(pearsontarget))
pearsoninput1 = float(input("Please enter your top left number: "))
print("You entered " + str(pearsoninput1))
pearsoninput2 = float(input("Please enter your bottom left number: "))
print("You entered " + str(pearsoninput2))
if pearsoninput2 > pearsontarget:
pearsonsum2 = pearsoninput2 - pearsontarget
else:
pearsonsum2 = pearsontarget = pearsoninput2
print("Top right: " + str(pearsonsum2))
if pearsoninput1 > pearsontarget:
pearsonsum1 = pearsoninput1 - pearsontarget
else:
pearsonsum1 = pearsontarget - pearsoninput1
print("Bottom right = " + str(pearsonsum1))
pearsonsumtotal = pearsonsum1 + pearsonsum2
print("Total of the two: " + str(pearsonsumtotal))
pearsonsum2 = (pearsonsum2 / pearsonsumtotal) * 100
print("Top right percentage: " + str(pearsonsum2))
pearsonsum1 = (pearsonsum1 / pearsonsumtotal) * 100
print("Bottom right percentage: " + str(pearsonsum1))
# Function that outputs needed amount of Potassium Metabisulphate from desired amount of sulphur dioxide
def sulphurdioxideconv():
print("You have selected Potassium Metabisulphate > Sulphur Dioxide")
so2=float(input("Please input the required amount of Sulphur Dioxide:"))
print("You entered" + str(so2))
so2sum = (so2 / 57) * 100
print("You require " + str(so2sum) + "mg of Potassium Metabisulphate")
# Main Loop
firstrun = 0
run = 1
# On first open shows instructions. Will be redundant after UI added.
while firstrun == 0:
print("Welcome to WineConverter.")
print("Enter 'List' to see the available conversions, and then either enter the number or the name of the measurement you have.")
print("To Quit enter 'Quit' or 'Exit'\nTo see these instructions again enter 'Help'")
firstrun = 1
# Main loop, user inputs command to call function
while run == 1:
command = input("Please enter your command: ")
command.lower()
if command == "list":
print("1. Litres\n2. UK Gallons\n3. US Gallons\n 4. Pearsons Square\n5. Sulphur Dioxide")
elif command == "litres" or command == "1":
litreconv()
elif command == "uk gallons" or command == "2":
ukgallonconv()
elif command == "us gallons" or command == "3":
usgallonconv()
elif command == "pearsons" or command == "4":
pearsonsconv()
elif command =="Sulphur" or command == "5":
sulphurdioxideconv()
elif command == "exit" or command == "quit":
run = 0
else:
print("Command not recognised, please enter List to see a full list of commands")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.