content stringlengths 7 1.05M |
|---|
"""
The field help_text has been renamed into description.
"""
def migrate(data):
if 'version' not in data:
data['version'] = 0
return data
|
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_cuda//cuda:defs.bzl", "requires_cuda_enabled", _cuda_library = "cuda_library")
def cuda_library(name, **kwargs):
"""Macro wrapping a cc_library which can contain CUDA device code.
Args:
name: target name.
**kwargs: forwarded to cuda_library rule from rules_cuda
"""
target_compatible_with = kwargs.pop("target_compatible_with", []) + requires_cuda_enabled()
deps = kwargs.pop("deps", []) + ["@local_config_cuda//cuda:cuda_headers"]
_cuda_library(
name = name,
deps = deps,
target_compatible_with = target_compatible_with,
**kwargs
)
def cuda_binary(name, **kwargs):
target_compatible_with = kwargs.pop("target_compatible_with", []) + requires_cuda_enabled()
srcs = kwargs.pop("srcs", None)
if srcs:
virtual_lib = name + "_virtual"
visibility = kwargs.pop("visibility", None)
prev_deps = kwargs.pop("deps", [])
_cuda_library(
name = virtual_lib,
srcs = srcs,
deps = prev_deps + ["@local_config_cuda//cuda:cuda_headers"],
target_compatible_with = target_compatible_with,
visibility = ["//visibility:private"],
**kwargs
)
cc_binary(
name = name,
deps = prev_deps + [virtual_lib],
visibility = visibility, # Restore visibility
target_compatible_with = target_compatible_with,
**kwargs
)
else:
deps = kwargs.pop("deps", []) + ["@rules_cuda//cuda:cuda_runtime"]
cc_binary(name = name, deps = deps, target_compatible_with = target_compatible_with, **kwargs)
|
"""
《百钱百鸡》问题
百钱百鸡是我国古代数学家张丘建在《算经》一书中提出的数学问题:
鸡翁一值钱五,鸡母一值钱三,鸡雏三值钱一。百钱买百鸡,问鸡翁、鸡母、鸡雏各几何?
翻译成现代文是:公鸡5元一只,母鸡3元一只,小鸡1元三只,
用100块钱买一百只鸡,问公鸡、母鸡、小鸡各有多少只?
Version:0.1
Author:cjp
"""
# 上面使用的方法叫做穷举法,也称为暴力搜索法
for gj in range(0,20): # 公鸡
for mj in range(0,33): # 母鸡
xj = 100 - gj - mj # 小鸡 数量等于100-公鸡数-母鸡数
if 5 * gj + 3 * mj + xj/3 == 100:
print('公鸡: %d只, 母鸡: %d只, 小鸡: %d只' % (gj, mj, xj)) |
# TODO: Threading / Parallel without blocking the UI
class IncrementalSearch:
"""
Universal incremental search within a list of documents.
"""
def __init__(self, documents, extract_fn):
self.query = ""
self.documents = documents
# Extracted texts related to the documents by index
self.extracts = []
# { "query": [result_idx1, ...], "query a": [result_idx2, ...], ...}
self.cache = {}
self.current_results = list(range(len(documents)))
for doc in self.documents:
extract = extract_fn(doc)
self.extracts.append(extract)
def get_normalized_query(self):
"""
Normalize whitespaces and remove duplicates while preserving order
"""
input_terms = self.query.split()
final_terms = []
for term in input_terms:
# Is the current term a prefix of other already present term?
dups = [t for t in final_terms if t.startswith(term)]
if dups:
# Drop term.
continue
final_terms.append(term)
return " ".join(final_terms)
def get_results(self, max_results=2**32):
return [
self.documents[idx]
for idx in self.current_results[:max_results]
]
def _invalidate_cache(self, query):
"Remove cached results not matching the current query"
# Remove non-prefix cached results
for cached_query in list(self.cache.keys()):
if not query.startswith(cached_query):
del self.cache[cached_query]
# TODO: Maybe keep them if there's less than X entries? Or based on time.
def _find_best_cache(self, query):
"Find best cached results to build next search"
# Find best matching base results
for cut in range(len(query), 0, -1):
part = query[:cut]
if part in self.cache:
return self.cache[part], part
return list(range(len(self.documents))), ""
def search(self, new_query):
"""
Add/remove a character in query - usually at the end.
"""
self.query = new_query
query = self.get_normalized_query()
self._invalidate_cache(query)
cache, cached_query = self._find_best_cache(query)
cached_terms = set(cached_query.split())
query_terms = set(query.split())
new_terms = query_terms - cached_terms
if not new_terms:
self.current_results = cache
return
# Prepare terms
terms_sensitive = set()
terms_insensitive = set()
for term in new_terms:
if term == term.lower():
terms_insensitive.add(term)
else:
terms_sensitive.add(term)
new_results = []
for idx in cache:
extract = self.extracts[idx]
extract_lower = extract.lower()
keep = True
for term in terms_sensitive:
if term not in extract:
keep = False
break
if keep:
for term in terms_insensitive:
if term not in extract_lower:
keep = False
break
if keep:
new_results.append(idx)
# Remember result
self.cache[query] = new_results
self.current_results = new_results
@staticmethod
def recursive_extract_fn(document):
"Extract data from dictionary resursively as string"
parts = []
if isinstance(document, dict):
for key, subvalue in document.items():
parts.append(IncrementalSearch.recursive_extract_fn(subvalue))
elif isinstance(document, (list, set)):
for element in document:
parts.append(IncrementalSearch.recursive_extract_fn(element))
elif isinstance(document, (int, float)):
parts.append(str(document))
elif isinstance(document, str):
parts.append(document)
elif document is None:
return ""
else:
raise Exception(f"Type {type(document)} is unhandled")
return " ".join(parts)
|
a = 5
b = 10
def zmien(a,b):
c = a
a = b
b = c
print("a:",a)
print("b:",b)
print("a:",a)
print("b:",b)
zmien(a,b) |
n, k = map(int, input().split())
n_lst = list(map(int, input().split()))
n_lst.sort(reverse=True)
print(sum(n_lst[:k]))
|
obj_map = [["glass", 0.015, [0, 0, 0], [0, 0, 0.05510244]], # 0.06
["donut", 0.01, [0, 0, 0], [0, 0, 0.01466367]],
["heart", 0.0006, [0.70738827, -0.70682518, 0], [0, 0, 0.8]],
["airplane", 1, [0, 0, 0], [0, 0, 2.58596408e-02]],
["alarmclock", 1, [0.70738827, -0.70682518, 0], [0, 0, 2.47049890e-02]],
["apple", 1, [0, 0, 0], [0, 0, 0.04999409]],
["banana", 1, [0, 0, 0], [0, 0, 0.02365614]],
["binoculars", 1, [0.70738827, -0.70682518, 0], [0, 0, 0.07999943]],
["body", 0.1, [0, 0, 0], [0, 0, 0.0145278]],
["bowl", 1, [0, 0, 0], [0, 0, 0.03995771]],
["camera", 1, [0, 0, 0], [0, 0, 0.03483407]],
["coffeemug", 1, [0, 0, 0], [0, 0, 0.05387171]],
["cubelarge", 1, [0, 0, 0], [0, 0, 0.06039196]],
["cubemedium", 1, [0, 0, 0], [0, 0, 0.04103902]],
["cubemiddle", 1, [0, 0, 0], [0, 0, 0.04103902]],
["cubesmall", 1, [0, 0, 0], [0, 0, 0.02072159]],
["cup", 1, [0, 0, 0], [0, 0, 0.05127277]],
["cylinderlarge", 1, [0, 0, 0], [0, 0, 0.06135697]],
["cylindermedium", 1, [0, 0, 0], [0, 0, 0.04103905]],
["cylindersmall", 1, [0, 0, 0], [0, 0, 0.02072279]],
["doorknob", 1, [0, 0, 0], [0, 0, 0.0379012]],
["duck", 1, [0, 0, 0], [0, 0, 0.04917608]],
["elephant", 1, [0, 0, 0], [0, 0, 0.05097572]],
["eyeglasses", 1, [0, 0, 0], [0, 0, 0.02300015]],
["flashlight", 1, [0, 0, 0], [0, 0, 0.07037258]],
["flute", 1, [0, 0, 0], [0, 0, 0.0092959]],
["fryingpan", 0.8, [0, 0, 0], [0, 0, 0.01514528]],
["gamecontroller", 1, [0, 0, 0], [0, 0, 0.02604568]],
["hammer", 1, [0, 0, 0], [0, 0, 0.01267463]],
["hand", 1, [0, 0, 0], [0, 0, 0.07001909]],
["headphones", 1, [0, 0, 0], [0, 0, 0.02992321]],
["knife", 1, [0, 0, 0], [0, 0, 0.00824503]],
["lightbulb", 1, [0, 0, 0], [0, 0, 0.03202522]],
["mouse", 1, [0, 0, 0], [0, 0, 0.0201307]],
["mug", 1, [0, 0, 0], [0, 0, 0.05387171]],
["phone", 1, [0, 0, 0], [0, 0, 0.02552063]],
["piggybank", 1, [0, 0, 0], [0, 0, 0.06923257]],
["pyramidlarge", 1, [0, 0, 0], [0, 0, 0.05123203]],
["pyramidmedium", 1, [0, 0, 0], [0, 0, 0.04103812]],
["pyramidsmall", 1, [0, 0, 0], [0, 0, 0.02072198]],
["rubberduck", 1, [0, 0, 0], [0, 0, 0.04917608]],
["scissors", 1, [0, 0, 0], [0, 0, 0.00802606]],
["spherelarge", 1, [0, 0, 0], [0, 0, 0.05382598]],
["spheremedium", 1, [0, 0, 0], [0, 0, 0.03729011]],
["spheresmall", 1, [0, 0, 0], [0, 0, 0.01897534]],
["stamp", 1, [0, 0, 0], [0, 0, 0.0379012]],
["stanfordbunny", 1, [0, 0, 0], [0, 0, 0.06453102]],
["stapler", 1, [0, 0, 0], [0, 0, 0.02116039]],
["table", 5, [0, 0, 0], [0, 0, 0.01403165]],
["teapot", 1, [0, 0, 0], [0, 0, 0.05761634]],
["toothbrush", 1, [0, 0, 0], [0, 0, 0.00701304]],
["toothpaste", 1, [0.50039816, -0.49999984, -0.49960184], [0, 0, 0.02]],
["toruslarge", 1, [0, 0, 0], [0, 0, 0.02080752]],
["torusmedium", 1, [0, 0, 0], [0, 0, 0.01394647]],
["torussmall", 1, [0, 0, 0], [0, 0, 0.00734874]],
["train", 1, [0, 0, 0], [0, 0, 0.04335064]],
["watch", 1, [0, 0, 0], [0, 0, 0.0424445]],
["waterbottle", 1, [0, 0, 0], [0, 0, 0.08697578]],
["wineglass", 1, [0, 0, 0], [0, 0, 0.0424445]],
["wristwatch", 1, [0, 0, 0], [0, 0, 0.06880109]]]
output_map = {}
for obj in obj_map:
output_map[obj[0]] = obj[2]
print(output_map) |
def AddLinear2TreeBranch(G,v1,v2,l):
vert1 = v1
vert2 = v2
for i in range(l):
vnew = max(G.vertices()) + 1
G.add_edges([[vert1, vnew],[vert2,vnew]])
vert1 = vert2
vert2 = vnew
return G
def Pinwheel(n):
G = Graph()
G.add_edges([[0,1],[1,2],[2,0]])
G = AddLinear2TreeBranch(G,0,1,n)
G = AddLinear2TreeBranch(G,1,2,n)
G = AddLinear2TreeBranch(G,2,0,n)
return G
def APinwheel(n):
G = Graph()
G.add_edges([[0,1],[1,2],[2,0]])
G = AddLinear2TreeBranch(G,0,1,n)
G = AddLinear2TreeBranch(G,1,2,n)
G = AddLinear2TreeBranch(G,0,2,n)
return G
|
####################
# POST /account/ #
####################
def test_create_account(flask_client):
shrek = {
"username": "Shrek",
"email": "ceo@swamp.com"
}
res = flask_client.post('/account/', json=shrek)
assert res.status_code == 200
created_user = res.get_json()
# Assert POST requests returns something in JSON
assert created_user is not None
# Assert that the id field is present
assert created_user.get('id') is not None
# Assert data didn't change
assert created_user.get('username') == shrek['username']
assert created_user.get('email') == shrek['email']
def test_create_account_rejects_urlencoded(flask_client):
res = flask_client.post(
'/account/',
data={"username": "Donkey", "email": "donkey@swamp.com"}
)
assert res.status_code == 400
err_data = res.get_json()
assert "error" in err_data
assert "json" in err_data['error'].lower()
assert "supported" in err_data['error'].lower()
def test_create_account_empty_body(flask_client):
res = flask_client.post('/account/')
assert res.status_code == 400
assert "error" in res.get_json()
def test_create_account_no_username(flask_client):
user_no_name = {
"email": "noname@swamp.com"
}
res = flask_client.post('/account/', json=user_no_name)
err_data = res.get_json()
assert res.status_code == 400
assert "error" in err_data
assert "username" in err_data['error']
assert "required" in err_data['error']
def test_create_account_no_email(flask_client):
user_no_email = {
"username": "no-email-man"
}
res = flask_client.post('/account/', json=user_no_email)
err_data = res.get_json()
assert res.status_code == 400
assert "error" in err_data
assert "email" in err_data['error']
assert "required" in err_data['error']
def test_create_account_existing_email(flask_client):
# Create first user with this email
donkey = {
"username": "Donkey",
"email": "donkey@swamp.com"
}
res = flask_client.post('/account/', json=donkey)
assert res.status_code == 200
# Try to create another user with this same email, but another name
donkey["username"] = 'Dankey'
res = flask_client.post('/account/', json=donkey)
assert res.status_code == 409
err_data = res.get_json()
assert "error" in err_data
assert "email" in err_data['error']
assert "exists" in err_data['error']
######################
# GET /account/ #
######################
def test_get_account(flask_client, user_account):
res = flask_client.get('/account/', headers=[user_account.auth_header])
assert res.status_code == 200
data = res.get_json()
assert data is not None
assert "error" not in data
assert data.get('id') == user_account.id
assert data.get('email') == user_account.email
assert data.get('username') == user_account.username
def test_get_nonexistent_account(flask_client):
res = flask_client.get('/account/', headers=[('Authorization', 'Bearer 1337322696969')])
assert res.status_code == 404
data = res.get_json()
assert "error" in data
assert "account" in data['error'].lower()
assert "not found" in data['error']
def test_get_account_no_auth(flask_client):
# Basically check that we didn't forget to add @auth_required
# Headers, error msg, etc. are covered by test_auth tests
res = flask_client.get('/account/')
assert res.status_code == 401
######################
# DELETE /account/ #
######################
def test_delete_account(flask_client, user_account):
res = flask_client.delete('/account/', headers=[user_account.auth_header])
assert res.status_code == 200
get_deleted_user_res = flask_client.get(f'/users/{user_account.id}')
assert get_deleted_user_res.status_code == 404
def test_repeated_delete_account(flask_client, user_account):
res = flask_client.delete('/account/', headers=[user_account.auth_header])
assert res.status_code == 200
del_again_res = flask_client.delete('/account/', headers=[user_account.auth_header])
assert del_again_res.status_code == 404
assert "error" in del_again_res.get_json()
assert "already deleted" in del_again_res.get_json()['error']
def test_delete_account_no_auth(flask_client):
res = flask_client.delete('/account/')
assert res.status_code == 401
|
def autonomous_setup():
pass
def autonomous_main():
print('Running auto main ...')
def teleop_setup():
pass
def teleop_main():
print('Running teleop main ...')
|
"""
4字典:可变
5集合:
"""
def ba_dict():
fam_info = {'lxy': (25, 'male', 'stu'),
'pjj': (26, 'female', 'tester'),
'tdd': (3, 'female', 'dog')}
# 通过键可以获取字典中对应的值
print(fam_info['lxy'])
# 对字典进行遍历(遍历的其实是键再通过键取对应的值)
for elem in fam_info:
print('{}\t--->\t{}'.format(elem, fam_info[elem]))
# 更新字典中的元素
fam_info['tdd'] = (3, 'female', 'eat and sleep')
fam_info.update(lxy=(26, 'male', 'engineer'))
print(fam_info)
if 'tdd' in fam_info:
print(fam_info['tdd'])
print(fam_info.get('pjj'))
# get方法也是通过键获取对应的值但是可以设置默认值
print(fam_info.get('lxy', ()))
# 删除字典中的元素
print(fam_info.popitem())
print(fam_info.pop('???', 100))
# 清空字典
fam_info.clear()
print(fam_info)
def ba_set():
set1 = {2, 3, 4}
print(set1)
print('Length =', len(set1)) # 元素个数
set2 = set(range(1, 3))
print(set2)
set1.add(1)
print(set1)
set2.update([4, 5])
set2.discard(5) # delete 5
print(set2)
# remove的元素如果不存在会引发KeyError
if 4 in set2:
set2.remove(4)
print(set2)
# 遍历集合容器
for elem in set2:
print(elem ** 2, end=' ')
print()
# 将元组转换成集合
set3 = set((2, 3, 4))
print(set3.pop())
print(set3)
# 集合的交集、并集、差集、对称差运算
print(set1 & set2)
# print(set1.intersection(set2))
print(set1 | set2)
# print(set1.union(set2))
print(set1 - set2)
# print(set1.difference(set2))
print(set1 ^ set2)
# print(set1.symmetric_difference(set2))
# 判断子集和超集
print(set2 <= set1)
# print(set2.issubset(set1))
print(set3 <= set1)
# print(set3.issubset(set1))
print(set2 >= set3)
# print(set1.issuperset(set2))
if __name__ == "__main__":
ba_dict()
ba_set()
|
class APrawcoreException(Exception):
"""Base exception class for exceptions that occur within this package."""
class InvalidInvocation(APrawcoreException):
"""Indicate that the code to execute cannot be completed."""
class RequestException(APrawcoreException):
# yoinked this from praw
def __init__(self, original_exception, request_args, request_kwargs):
self.original_exception = original_exception
self.request_args = request_args
self.request_kwargs = request_kwargs
super(RequestException, self).__init__('error with request {}'
.format(original_exception))
|
expected_output = {
"active_translations": {"dynamic": 1, "extended": 1, "static": 0, "total": 1},
"cef_punted_pkts": 0,
"cef_translated_pkts": 4,
"dynamic_mappings": {
"inside_source": {
"id": {
3: {
"access_list": "99",
"interface": "Serial0/0",
"match": "access-list 99 interface Serial0/0",
"refcount": 1,
}
}
}
},
"expired_translations": 0,
"hits": 3,
"interfaces": {"inside": ["FastEthernet0/0"], "outside": ["Serial0/0"]},
"misses": 1,
"queued_pkts": 0,
}
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazelrio//:deps_utils.bzl", "cc_library_shared")
def setup_ni_2022_2_3_dependencies():
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ni-libraries_chipobject_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ni-libraries/chipobject/2022.2.3/chipobject-2022.2.3-linuxathena.zip",
sha256 = "fdf47ae5ce052edd82ba2b6e007faabf9286f87b079e3789afc3235733d5475c",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ni-libraries_visa_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ni-libraries/visa/2022.2.3/visa-2022.2.3-linuxathena.zip",
sha256 = "014fff5a4684f3c443cbed8c52f19687733dd7053a98a1dad89941801e0b7930",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ni-libraries_runtime_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ni-libraries/runtime/2022.2.3/runtime-2022.2.3-linuxathena.zip",
sha256 = "186d1b41e96c5d761705221afe0b9f488d1ce86e8149a7b0afdc3abc93097266",
build_file_content = cc_library_shared,
)
maybe(
http_archive,
"__bazelrio_edu_wpi_first_ni-libraries_netcomm_linuxathena",
url = "https://frcmaven.wpi.edu/release/edu/wpi/first/ni-libraries/netcomm/2022.2.3/netcomm-2022.2.3-linuxathena.zip",
sha256 = "f56c2fc0943f27f174642664b37fb4529d6f2b6405fe41a639a4c9f31e175c73",
build_file_content = cc_library_shared,
)
|
#
# @lc app=leetcode id=712 lang=python3
#
# [712] Minimum ASCII Delete Sum for Two Strings
#
# @lc code=start
class Solution:
def minimumDeleteSum(self, s1: str, s2: str) -> int:
m, n = len(s1), len(s2)
dp = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(m - 1, -1, -1):
dp[i][n] = dp[i + 1][n] + ord(s1[i])
for j in range(n - 1, -1, -1):
dp[m][j] = dp[m][j + 1] + ord(s2[j])
for i in range(m - 1, -1, -1):
for j in range(n - 1, -1, -1):
if s1[i] == s2[j]:
dp[i][j] = dp[i + 1][j + 1]
else:
dp[i][j] = min(dp[i + 1][j] + ord(s1[i]), dp[i][j + 1] + ord(s2[j]))
return dp[0][0]
# @lc code=end
|
"""Provides the log level constants for the dss.pubsub packackage.
"""
EMERG = 80
ALERT = 70
CRITICAL = 60
ERROR = 50
WARNING = 40
NOTICE = 30
INFO = 20
DEBUG = 10
ALL = 0
_level_names = {
EMERG : 'EMERG',
ALERT : 'ALERT',
CRITICAL : 'CRITICAL',
ERROR : 'ERROR',
WARNING : 'WARNING',
NOTICE : 'NOTICE',
INFO : 'INFO',
DEBUG : 'DEBUG',
ALL : 'ALL',
}
# return the string representation of a numeric log level
get_level_name = _level_names.get
|
"""
Problem Name: Array Rotation
CodeChef Link: https://www.codechef.com/LTIME95C/problems/ARRROT/
Problem Code: ARRROT
"""
n = int(input())
li = list(map(int, input().split()))
q = int(input())
li2 = list(map(int, input().split()))
s = sum(li)
x = 0
for i in li2:
x = (2 * s)
s = x
print(x % (1000000007))
|
#!/usr/bin/env python
# coding: utf-8
"""
Critical value polynomials and related quantities for the bounds test of
Pesaran, M. H., Shin, Y., & Smith, R. J. (2001). Bounds testing approaches
to the analysis of level relationships. Journal of applied econometrics,
16(3), 289-326.
These were computed using 32,000,000 simulations for each key using the
methodology of PSS, who only used 40,000. The asymptotic P-value response
functions were computed based on the simulated value. Critical values
are the point estimates for the respective quantiles. The simulation code
is contained in pss.py. The output files from this function are then
transformed using pss-process.py.
The format of the keys are (k, case, I1) where
* k is is the number of x variables included in the model (0 is an ADF)
* case is 1, 2, 3, 4 or 5 and corresponds to the PSS paper
* I1 is True if X contains I1 variables and False if X is stationary
The parameters are for polynomials of order 3 (large) or 2 (small).
stat_star is the value where the switch between large and small occurs.
Stat values less then stat_star use large_p, while values above use
small_p. In all cases the stat is logged prior to computing the p-value
so that the p-value is
1 - Phi(c[0] + c[1] * x + c[2] * x**2 + c[3] * x**3)
where x = np.log(stat) and Phi() is the normal cdf.
When this the models, the polynomial is evaluated at the natural log of the
test statistic and then the normal CDF of this value is computed to produce
the p-value.
"""
__all__ = ["large_p", "small_p", "crit_vals", "crit_percentiles", "stat_star"]
large_p = {
(1, 1, False): [0.2231, 0.91426, 0.10102, 0.00569],
(1, 1, True): [-0.21766, 0.85933, 0.10411, 0.00661],
(1, 2, False): [-0.60796, 1.48713, 0.15076, 0.04453],
(1, 2, True): [-0.96204, 1.52593, 0.15996, 0.04166],
(1, 3, False): [-0.62883, 0.78991, 0.1, 0.00693],
(1, 3, True): [-0.91895, 0.82086, 0.12921, 0.01076],
(1, 4, False): [-1.50546, 1.79052, 0.05488, 0.06801],
(1, 4, True): [-1.79654, 1.8048, 0.06573, 0.06768],
(1, 5, False): [-1.36367, 0.94126, 0.21556, 0.02473],
(1, 5, True): [-1.60554, 0.93305, 0.2422, 0.03241],
(2, 1, False): [0.20576, 1.18914, 0.15731, 0.01144],
(2, 1, True): [-0.49024, 1.16958, 0.20564, 0.02008],
(2, 2, False): [-0.51799, 1.6368, 0.18955, 0.04317],
(2, 2, True): [-1.13394, 1.71056, 0.20442, 0.04195],
(2, 3, False): [-0.51712, 1.12963, 0.18936, 0.01808],
(2, 3, True): [-1.07441, 1.14964, 0.26066, 0.03338],
(2, 4, False): [-1.29895, 1.88501, 0.11734, 0.06615],
(2, 4, True): [-1.82455, 1.92207, 0.13753, 0.06269],
(2, 5, False): [-1.22263, 1.23208, 0.31401, 0.04495],
(2, 5, True): [-1.67689, 1.17567, 0.33606, 0.05898],
(3, 1, False): [0.1826, 1.39275, 0.19774, 0.01647],
(3, 1, True): [-0.71889, 1.39726, 0.29712, 0.03794],
(3, 2, False): [-0.45864, 1.77632, 0.22125, 0.04372],
(3, 2, True): [-1.28619, 1.88107, 0.23969, 0.04414],
(3, 3, False): [-0.45093, 1.38824, 0.26556, 0.03063],
(3, 3, True): [-1.22712, 1.36564, 0.34942, 0.05555],
(3, 4, False): [-1.15886, 1.99182, 0.16358, 0.06392],
(3, 4, True): [-1.88388, 2.05362, 0.18349, 0.06501],
(3, 5, False): [-1.11221, 1.44327, 0.3547, 0.05263],
(3, 5, True): [-1.75354, 1.37461, 0.3882, 0.07239],
(4, 1, False): [0.16431, 1.56391, 0.22944, 0.02067],
(4, 1, True): [-0.90799, 1.56908, 0.34763, 0.04814],
(4, 2, False): [-0.41568, 1.90715, 0.24783, 0.04407],
(4, 2, True): [-1.42373, 2.03902, 0.26907, 0.04755],
(4, 3, False): [-0.41104, 1.5716, 0.3066, 0.03842],
(4, 3, True): [-1.36194, 1.54043, 0.40145, 0.06846],
(4, 4, False): [-1.05651, 2.10007, 0.20201, 0.06129],
(4, 4, True): [-1.95474, 2.18305, 0.22527, 0.06441],
(4, 5, False): [-1.02502, 1.62605, 0.38203, 0.05565],
(4, 5, True): [-1.83458, 1.555, 0.42888, 0.07459],
(5, 1, False): [0.15015, 1.71718, 0.2584, 0.02507],
(5, 1, True): [-1.0707, 1.72829, 0.39037, 0.05468],
(5, 2, False): [-0.38277, 2.02985, 0.27139, 0.04513],
(5, 2, True): [-1.54974, 2.18631, 0.29592, 0.04967],
(5, 3, False): [-0.38023, 1.72586, 0.33033, 0.04188],
(5, 3, True): [-1.48415, 1.70271, 0.44016, 0.07248],
(5, 4, False): [-0.97676, 2.20429, 0.23233, 0.06543],
(5, 4, True): [-2.03144, 2.31343, 0.25394, 0.0675],
(5, 5, False): [-0.95421, 1.78775, 0.40239, 0.05642],
(5, 5, True): [-1.91679, 1.72031, 0.46434, 0.06641],
(6, 1, False): [0.13913, 1.8581, 0.28528, 0.02931],
(6, 1, True): [-1.21438, 1.87638, 0.42416, 0.05485],
(6, 2, False): [-0.35664, 2.14606, 0.29484, 0.04728],
(6, 2, True): [-1.66532, 2.32448, 0.31723, 0.05528],
(6, 3, False): [-0.35498, 1.86634, 0.35087, 0.04455],
(6, 3, True): [-1.59785, 1.85278, 0.47304, 0.07114],
(6, 4, False): [-0.91274, 2.30752, 0.26053, 0.0644],
(6, 4, True): [-2.10956, 2.43721, 0.2852, 0.06694],
(6, 5, False): [-0.89553, 1.9318, 0.41381, 0.05292],
(6, 5, True): [-1.99931, 1.87789, 0.49842, 0.04135],
(7, 1, False): [0.12974, 1.98503, 0.30606, 0.03218],
(7, 1, True): [-1.34555, 2.01647, 0.45456, 0.05018],
(7, 2, False): [-0.33519, 2.25631, 0.31659, 0.05016],
(7, 2, True): [-1.77496, 2.45806, 0.3372, 0.05741],
(7, 3, False): [-0.33377, 1.99554, 0.36742, 0.04624],
(7, 3, True): [-1.70381, 1.99863, 0.49883, 0.05092],
(7, 4, False): [-0.8596, 2.40762, 0.28334, 0.06401],
(7, 4, True): [-2.18704, 2.55828, 0.30627, 0.07091],
(7, 5, False): [-0.84606, 2.06291, 0.42505, 0.05152],
(7, 5, True): [-2.08097, 2.02139, 0.5348, 0.02343],
(8, 1, False): [0.12244, 2.10698, 0.32849, 0.03596],
(8, 1, True): [-1.46632, 2.1505, 0.48168, 0.04116],
(8, 2, False): [-0.31707, 2.36107, 0.33198, 0.04953],
(8, 2, True): [-1.87722, 2.58105, 0.35963, 0.05848],
(8, 3, False): [-0.31629, 2.11679, 0.38514, 0.04868],
(8, 3, True): [-1.80483, 2.13412, 0.52935, 0.03618],
(8, 4, False): [-0.81509, 2.50518, 0.30456, 0.06388],
(8, 4, True): [-2.26501, 2.67227, 0.33843, 0.06554],
(8, 5, False): [-0.80333, 2.18457, 0.42995, 0.0463],
(8, 5, True): [-2.16125, 2.15208, 0.58319, 0.0],
(9, 1, False): [0.11562, 2.22037, 0.34907, 0.03968],
(9, 1, True): [-1.57878, 2.27626, 0.5124, 0.03164],
(9, 2, False): [-0.30188, 2.46235, 0.35132, 0.05209],
(9, 2, True): [-1.97465, 2.70256, 0.37466, 0.06205],
(9, 3, False): [-0.30097, 2.23118, 0.39976, 0.05001],
(9, 3, True): [-1.90164, 2.26261, 0.56431, 0.0175],
(9, 4, False): [-0.77664, 2.59712, 0.32618, 0.06452],
(9, 4, True): [-2.33996, 2.78253, 0.36072, 0.06644],
(9, 5, False): [-0.76631, 2.2987, 0.43834, 0.04274],
(9, 5, True): [-2.23753, 2.27521, 0.60763, 0.0],
(10, 1, False): [0.10995, 2.3278, 0.36567, 0.04153],
(10, 1, True): [-1.6849, 2.39419, 0.5433, 0.02457],
(10, 2, False): [-0.28847, 2.55819, 0.36959, 0.05499],
(10, 2, True): [-2.06725, 2.81756, 0.38761, 0.0676],
(10, 3, False): [-0.28748, 2.33948, 0.41398, 0.05101],
(10, 3, True): [-1.99259, 2.38061, 0.59433, 0.01114],
(10, 4, False): [-0.74317, 2.68624, 0.345, 0.07032],
(10, 4, True): [-2.41409, 2.8931, 0.37487, 0.07102],
(10, 5, False): [-0.73464, 2.40692, 0.45153, 0.0434],
(10, 5, True): [-2.31364, 2.39092, 0.64313, -0.01012],
}
small_p = {
(1, 1, False): [0.2585, 0.92944, 0.25921],
(1, 1, True): [-0.17399, 0.88425, 0.29947],
(1, 2, False): [-0.45787, 1.15813, 0.37268],
(1, 2, True): [-0.76388, 1.13438, 0.39908],
(1, 3, False): [-0.57887, 0.87657, 0.32929],
(1, 3, True): [-0.88284, 0.81513, 0.366],
(1, 4, False): [-1.1926, 1.21061, 0.40386],
(1, 4, True): [-1.42909, 1.16607, 0.42899],
(1, 5, False): [-1.34428, 0.8756, 0.37809],
(1, 5, True): [-1.56285, 0.80464, 0.40703],
(2, 1, False): [0.23004, 1.12045, 0.31791],
(2, 1, True): [-0.45371, 1.06577, 0.38144],
(2, 2, False): [-0.41191, 1.36838, 0.39668],
(2, 2, True): [-0.9488, 1.32707, 0.44808],
(2, 3, False): [-0.49166, 1.11266, 0.36824],
(2, 3, True): [-1.03636, 1.04019, 0.42589],
(2, 4, False): [-1.08188, 1.42797, 0.42653],
(2, 4, True): [-1.52152, 1.36, 0.47256],
(2, 5, False): [-1.12408, 1.0565, 0.43505],
(2, 5, True): [-1.58614, 1.01208, 0.46796],
(3, 1, False): [0.20945, 1.29304, 0.36292],
(3, 1, True): [-0.60112, 1.139, 0.47837],
(3, 2, False): [-0.37491, 1.53959, 0.42397],
(3, 2, True): [-1.11163, 1.50639, 0.48662],
(3, 3, False): [-0.41411, 1.27093, 0.41524],
(3, 3, True): [-1.14285, 1.18673, 0.4906],
(3, 4, False): [-0.9946, 1.60793, 0.44771],
(3, 4, True): [-1.62609, 1.54566, 0.50619],
(3, 5, False): [-1.04988, 1.31372, 0.44802],
(3, 5, True): [-1.68976, 1.25316, 0.49896],
(4, 1, False): [0.18839, 1.46484, 0.39125],
(4, 1, True): [-0.81822, 1.35949, 0.50619],
(4, 2, False): [-0.35123, 1.705, 0.44075],
(4, 2, True): [-1.2591, 1.67286, 0.52021],
(4, 3, False): [-0.34716, 1.39436, 0.46391],
(4, 3, True): [-1.30728, 1.41428, 0.51292],
(4, 4, False): [-0.92783, 1.77056, 0.46587],
(4, 4, True): [-1.71493, 1.69609, 0.54221],
(4, 5, False): [-0.97468, 1.50704, 0.46661],
(4, 5, True): [-1.7783, 1.4453, 0.53112],
(5, 1, False): [0.17584, 1.60806, 0.424],
(5, 1, True): [-1.00705, 1.5668, 0.52487],
(5, 2, False): [-0.32186, 1.82909, 0.47183],
(5, 2, True): [-1.39492, 1.83145, 0.54756],
(5, 3, False): [-0.32204, 1.55407, 0.4884],
(5, 3, True): [-1.43499, 1.58772, 0.54359],
(5, 4, False): [-0.87005, 1.9128, 0.48361],
(5, 4, True): [-1.81929, 1.8594, 0.56629],
(5, 5, False): [-0.91534, 1.6826, 0.47972],
(5, 5, True): [-1.86297, 1.61238, 0.56196],
(6, 1, False): [0.16642, 1.7409, 0.45235],
(6, 1, True): [-1.15641, 1.72534, 0.55469],
(6, 2, False): [-0.31023, 1.97806, 0.47892],
(6, 2, True): [-1.52248, 1.98657, 0.56855],
(6, 3, False): [-0.30333, 1.70462, 0.50703],
(6, 3, True): [-1.5521, 1.74539, 0.57191],
(6, 4, False): [-0.82345, 2.04624, 0.50026],
(6, 4, True): [-1.90659, 1.99476, 0.59394],
(6, 5, False): [-0.85675, 1.81838, 0.50387],
(6, 5, True): [-1.92708, 1.73629, 0.60069],
(7, 1, False): [0.15013, 1.88779, 0.46397],
(7, 1, True): [-1.28169, 1.85521, 0.58877],
(7, 2, False): [-0.2904, 2.09042, 0.50233],
(7, 2, True): [-1.62626, 2.10378, 0.6013],
(7, 3, False): [-0.29138, 1.8506, 0.52083],
(7, 3, True): [-1.64831, 1.87115, 0.60523],
(7, 4, False): [-0.78647, 2.1757, 0.51247],
(7, 4, True): [-1.98344, 2.10977, 0.62411],
(7, 5, False): [-0.81099, 1.95374, 0.51949],
(7, 5, True): [-1.99875, 1.86512, 0.63051],
(8, 1, False): [0.14342, 2.00691, 0.48514],
(8, 1, True): [-1.3933, 1.97361, 0.62074],
(8, 2, False): [-0.27952, 2.20983, 0.51721],
(8, 2, True): [-1.74485, 2.25435, 0.61354],
(8, 3, False): [-0.28049, 1.98611, 0.53286],
(8, 3, True): [-1.74116, 1.99245, 0.63511],
(8, 4, False): [-0.74797, 2.28202, 0.53356],
(8, 4, True): [-2.07764, 2.25027, 0.64023],
(8, 5, False): [-0.76505, 2.06317, 0.54393],
(8, 5, True): [-2.04872, 1.95334, 0.67177],
(9, 1, False): [0.13505, 2.12341, 0.50439],
(9, 1, True): [-1.49339, 2.07805, 0.65464],
(9, 2, False): [-0.26881, 2.32256, 0.53025],
(9, 2, True): [-1.82677, 2.34223, 0.65004],
(9, 3, False): [-0.26657, 2.09906, 0.55384],
(9, 3, True): [-1.80085, 2.06043, 0.68234],
(9, 4, False): [-0.71672, 2.38896, 0.54931],
(9, 4, True): [-2.17306, 2.39146, 0.65252],
(9, 5, False): [-0.70907, 2.13027, 0.58668],
(9, 5, True): [-2.14411, 2.10595, 0.68478],
(10, 1, False): [0.12664, 2.23871, 0.51771],
(10, 1, True): [-1.59784, 2.19509, 0.67874],
(10, 2, False): [-0.25969, 2.4312, 0.54096],
(10, 2, True): [-1.93843, 2.48708, 0.65741],
(10, 3, False): [-0.25694, 2.21617, 0.56619],
(10, 3, True): [-1.89772, 2.1894, 0.70143],
(10, 4, False): [-0.69126, 2.49776, 0.5583],
(10, 4, True): [-2.24685, 2.4968, 0.67598],
(10, 5, False): [-0.6971, 2.28206, 0.57816],
(10, 5, True): [-2.21015, 2.208, 0.71379],
}
stat_star = {
(1, 1, False): 0.855423425047013,
(1, 1, True): 0.9074438436193457,
(1, 2, False): 2.3148213273461034,
(1, 2, True): 2.727010046970744,
(1, 3, False): 0.846390593107207,
(1, 3, True): 1.157556027201022,
(1, 4, False): 3.220377136548005,
(1, 4, True): 3.6108265020012418,
(1, 5, False): 1.7114703606421378,
(1, 5, True): 2.066325210881278,
(2, 1, False): 1.1268996107665314,
(2, 1, True): 1.3332514927355072,
(2, 2, False): 2.0512213167246456,
(2, 2, True): 2.656191837644102,
(2, 3, False): 1.058908331354388,
(2, 3, True): 1.5313322825819844,
(2, 4, False): 2.7213091542989725,
(2, 4, True): 3.2984645209852856,
(2, 5, False): 2.6006009671146497,
(2, 5, True): 2.661856653261213,
(3, 1, False): 1.263159095916295,
(3, 1, True): 2.4151349732452863,
(3, 2, False): 1.8886043232371843,
(3, 2, True): 2.6028096820968405,
(3, 3, False): 1.4879903191884682,
(3, 3, True): 2.2926969339773926,
(3, 4, False): 2.418527659154858,
(3, 4, True): 3.1039322592065988,
(3, 5, False): 1.9523612040944802,
(3, 5, True): 2.2115727453490757,
(4, 1, False): 1.290890114741129,
(4, 1, True): 2.1296963408410905,
(4, 2, False): 1.7770902061605607,
(4, 2, True): 2.5611885327765402,
(4, 3, False): 1.9340163095801728,
(4, 3, True): 1.9141318638062572,
(4, 4, False): 2.2146739201335466,
(4, 4, True): 2.9701790485477932,
(4, 5, False): 1.7408452994169448,
(4, 5, True): 2.1047247176583914,
(5, 1, False): 1.336967174239227,
(5, 1, True): 1.9131415178585627,
(5, 2, False): 1.6953274259688569,
(5, 2, True): 2.52745981091846,
(5, 3, False): 1.8124340908468068,
(5, 3, True): 1.8520883187848405,
(5, 4, False): 2.0675009559739297,
(5, 4, True): 2.8728076833515552,
(5, 5, False): 1.5978968362839456,
(5, 5, True): 2.1017517002543418,
(6, 1, False): 1.3810422398306446,
(6, 1, True): 1.8993612909227247,
(6, 2, False): 1.6324374150719114,
(6, 2, True): 2.498801004400209,
(6, 3, False): 1.72340094901749,
(6, 3, True): 1.8586513178563737,
(6, 4, False): 1.955819927102859,
(6, 4, True): 2.797145060481245,
(6, 5, False): 1.578613967104358,
(6, 5, True): 2.356249534336445,
(7, 1, False): 1.319436681229134,
(7, 1, True): 1.9955849619883248,
(7, 2, False): 1.5822190052675569,
(7, 2, True): 2.4744987764453055,
(7, 3, False): 1.65578510076754,
(7, 3, True): 2.046536484369615,
(7, 4, False): 1.8684573094851133,
(7, 4, True): 2.737241392502754,
(7, 5, False): 1.571855677342554,
(7, 5, True): 2.6006325210258505,
(8, 1, False): 1.3413558170956845,
(8, 1, True): 2.182981174661154,
(8, 2, False): 1.5416965902808288,
(8, 2, True): 2.4538471213095594,
(8, 3, False): 1.6021238307647196,
(8, 3, True): 2.2031866832480778,
(8, 4, False): 1.797595752125897,
(8, 4, True): 2.688099837236925,
(8, 5, False): 1.6561231184668357,
(8, 5, True): 2.883361281576836,
(9, 1, False): 1.3260368480749927,
(9, 1, True): 2.359689612641543,
(9, 2, False): 1.5074890058192492,
(9, 2, True): 2.435592395931648,
(9, 3, False): 1.5584090417965821,
(9, 3, True): 2.586293446202391,
(9, 4, False): 1.7393454428092985,
(9, 4, True): 2.6470908946956655,
(9, 5, False): 1.8180517504983742,
(9, 5, True): 2.818161371392247,
(10, 1, False): 1.3126519241806318,
(10, 1, True): 2.3499432601613885,
(10, 2, False): 1.4785447632683744,
(10, 2, True): 2.4199239298786215,
(10, 3, False): 1.5219767684407846,
(10, 3, True): 2.55484741648857,
(10, 4, False): 1.6902675233415512,
(10, 4, True): 2.6119272436084637,
(10, 5, False): 1.7372865030759366,
(10, 5, True): 2.7644864472524904,
}
crit_percentiles = (90, 95, 99, 99.9)
crit_vals = {
(1, 1, False): [2.4170317, 3.119659, 4.7510799, 7.0838335],
(1, 1, True): [3.2538509, 4.0643748, 5.8825257, 8.4189144],
(1, 2, False): [3.0235968, 3.6115364, 4.9094056, 6.6859696],
(1, 2, True): [3.4943406, 4.1231394, 5.4961076, 7.3531815],
(1, 3, False): [4.044319, 4.9228967, 6.8609106, 9.5203666],
(1, 3, True): [4.7771822, 5.7217442, 7.7821227, 10.557471],
(1, 4, False): [4.0317707, 4.6921341, 6.1259225, 8.0467248],
(1, 4, True): [4.4725009, 5.169214, 6.668854, 8.6632132],
(1, 5, False): [5.5958071, 6.586727, 8.7355157, 11.6171903],
(1, 5, True): [6.2656898, 7.3133165, 9.5652229, 12.5537707],
(2, 1, False): [2.1562308, 2.6846692, 3.8773621, 5.5425892],
(2, 1, True): [3.1684785, 3.8003954, 5.177742, 7.0453814],
(2, 2, False): [2.6273503, 3.0998243, 4.1327001, 5.528847],
(2, 2, True): [3.3084134, 3.8345125, 4.9642009, 6.4657839],
(2, 3, False): [3.1741284, 3.8022629, 5.1722882, 7.0241224],
(2, 3, True): [4.108262, 4.8116858, 6.3220548, 8.322478],
(2, 4, False): [3.3668869, 3.8887628, 5.0115801, 6.5052326],
(2, 4, True): [4.0126604, 4.5835675, 5.7968684, 7.3887863],
(2, 5, False): [4.1863149, 4.8834936, 6.3813095, 8.3781415],
(2, 5, True): [5.053508, 5.8168869, 7.4384998, 9.565425],
(3, 1, False): [1.998571, 2.4316514, 3.3919322, 4.709226],
(3, 1, True): [3.0729965, 3.6016775, 4.7371358, 6.2398661],
(3, 2, False): [2.3813866, 2.7820412, 3.6486786, 4.8089784],
(3, 2, True): [3.1778198, 3.6364094, 4.6114583, 5.8888408],
(3, 3, False): [2.7295224, 3.2290217, 4.3110408, 5.7599206],
(3, 3, True): [3.7471556, 4.3222818, 5.5425521, 7.1435458],
(3, 4, False): [2.9636218, 3.4007434, 4.3358236, 5.5729155],
(3, 4, True): [3.7234883, 4.2135706, 5.247283, 6.5911207],
(3, 5, False): [3.4742551, 4.0219835, 5.1911046, 6.7348191],
(3, 5, True): [4.4323554, 5.0480574, 6.3448127, 8.0277313],
(4, 1, False): [1.8897829, 2.2616928, 3.0771215, 4.1837434],
(4, 1, True): [2.9925753, 3.4545032, 4.4326745, 5.7123835],
(4, 2, False): [2.2123295, 2.5633388, 3.3177874, 4.321218],
(4, 2, True): [3.0796353, 3.4898084, 4.3536497, 5.4747288],
(4, 3, False): [2.4565534, 2.877209, 3.7798528, 4.9852682],
(4, 3, True): [3.516144, 4.0104999, 5.0504684, 6.4022435],
(4, 4, False): [2.6902225, 3.0699099, 3.877333, 4.9405835],
(4, 4, True): [3.5231152, 3.9578931, 4.867071, 6.0403311],
(4, 5, False): [3.0443998, 3.5009718, 4.4707539, 5.7457746],
(4, 5, True): [4.0501255, 4.5739556, 5.6686684, 7.0814031],
(5, 1, False): [1.8104326, 2.1394999, 2.8541086, 3.8114409],
(5, 1, True): [2.9267613, 3.3396521, 4.2078599, 5.3342038],
(5, 2, False): [2.0879588, 2.40264, 3.0748083, 3.9596152],
(5, 2, True): [3.002768, 3.3764374, 4.1585099, 5.1657752],
(5, 3, False): [2.2702787, 2.6369717, 3.4203738, 4.4521021],
(5, 3, True): [3.3535243, 3.7914038, 4.7060983, 5.8841151],
(5, 4, False): [2.4928973, 2.831033, 3.5478855, 4.4836677],
(5, 4, True): [3.3756681, 3.7687148, 4.587147, 5.6351487],
(5, 5, False): [2.7536425, 3.149282, 3.985975, 5.0799181],
(5, 5, True): [3.7890425, 4.2501858, 5.2074857, 6.4355821],
(6, 1, False): [1.7483313, 2.0453753, 2.685931, 3.5375009],
(6, 1, True): [2.8719403, 3.2474515, 4.0322637, 5.0451946],
(6, 2, False): [1.9922451, 2.2792144, 2.8891314, 3.690865],
(6, 2, True): [2.9399824, 3.2851357, 4.0031551, 4.9247226],
(6, 3, False): [2.1343676, 2.4620175, 3.1585901, 4.0720179],
(6, 3, True): [3.2311014, 3.6271964, 4.4502999, 5.5018575],
(6, 4, False): [2.3423792, 2.6488947, 3.2947623, 4.1354724],
(6, 4, True): [3.2610813, 3.6218989, 4.3702232, 5.3232767],
(6, 5, False): [2.5446232, 2.8951601, 3.633989, 4.5935586],
(6, 5, True): [3.5984454, 4.0134462, 4.8709448, 5.9622726],
(7, 1, False): [1.6985327, 1.9707636, 2.5536649, 3.3259272],
(7, 1, True): [2.825928, 3.1725169, 3.8932738, 4.8134085],
(7, 2, False): [1.9155946, 2.1802812, 2.7408759, 3.4710326],
(7, 2, True): [2.8879427, 3.2093335, 3.8753322, 4.724748],
(7, 3, False): [2.0305429, 2.3281704, 2.9569345, 3.7788337],
(7, 3, True): [3.136325, 3.4999128, 4.2519893, 5.2075305],
(7, 4, False): [2.2246175, 2.5055486, 3.0962182, 3.86164],
(7, 4, True): [3.1695552, 3.5051856, 4.1974421, 5.073436],
(7, 5, False): [2.3861201, 2.7031072, 3.3680435, 4.2305443],
(7, 5, True): [3.4533491, 3.8323234, 4.613939, 5.6044399],
(8, 1, False): [1.6569223, 1.9092423, 2.4470718, 3.1537838],
(8, 1, True): [2.7862884, 3.1097259, 3.7785302, 4.6293176],
(8, 2, False): [1.8532862, 2.0996872, 2.6186041, 3.2930359],
(8, 2, True): [2.8435812, 3.1459955, 3.769165, 4.5623681],
(8, 3, False): [1.9480198, 2.2215083, 2.7979659, 3.54771],
(8, 3, True): [3.0595184, 3.3969531, 4.0923089, 4.9739178],
(8, 4, False): [2.1289147, 2.3893773, 2.9340882, 3.6390988],
(8, 4, True): [3.094188, 3.4085297, 4.0545165, 4.8699787],
(8, 5, False): [2.2616596, 2.5515168, 3.1586476, 3.9422645],
(8, 5, True): [3.3374076, 3.6880139, 4.407457, 5.3152095],
(9, 1, False): [1.6224492, 1.8578787, 2.3580077, 3.0112501],
(9, 1, True): [2.7520721, 3.0557346, 3.6811682, 4.4739536],
(9, 2, False): [1.8008993, 2.0320841, 2.5170871, 3.1451424],
(9, 2, True): [2.8053707, 3.091422, 3.6784683, 4.4205306],
(9, 3, False): [1.8811231, 2.1353897, 2.6683796, 3.358463],
(9, 3, True): [2.9957112, 3.3114482, 3.9596061, 4.7754473],
(9, 4, False): [2.0498497, 2.2930641, 2.8018384, 3.4543646],
(9, 4, True): [3.0308611, 3.3269185, 3.9347618, 4.6993614],
(9, 5, False): [2.1610306, 2.4296727, 2.98963, 3.7067719],
(9, 5, True): [3.2429533, 3.5699095, 4.2401975, 5.0823119],
(10, 1, False): [1.5927907, 1.8145253, 2.2828013, 2.8927966],
(10, 1, True): [2.7222721, 3.009471, 3.5990544, 4.3432975],
(10, 2, False): [1.756145, 1.9744492, 2.4313123, 3.0218681],
(10, 2, True): [2.7724339, 3.0440412, 3.6004793, 4.3015151],
(10, 3, False): [1.8248841, 2.0628201, 2.5606728, 3.2029316],
(10, 3, True): [2.9416094, 3.239357, 3.8484916, 4.6144906],
(10, 4, False): [1.9833587, 2.2124939, 2.690228, 3.3020807],
(10, 4, True): [2.9767752, 3.2574924, 3.8317161, 4.5512138],
(10, 5, False): [2.0779589, 2.3285481, 2.8499681, 3.5195753],
(10, 5, True): [3.1649384, 3.4725945, 4.1003673, 4.8879723],
}
|
installed_apps = (
'core',
'resources',
'arenas',
'sciences',
'military',
'profiles',
'matches',
'combat',
)
|
sayi=int(input("bir sayı girin: "))#5
fak=1
for i in range(2,sayi+1): #2,3,4,5
fak*=i #2 6 24 120
print("faktoriyel=",fak) |
cont = 0
param = 10
while True:
cont = 0
num = int(input('Quer ver a tabuada de qual valor? '))
if num < 0:
break
while cont < 10:
cont = cont + 1
tab = num * cont
print(f'{num} x {cont} = {tab}')
print('PROGRAMA ENCERRADO')
|
"""
import main_menu
# Pack of def for checking files:
def readfile(filename): # Read a file and print what's in there.
try:
a = open(filename, 'rt')
except:
print(f"File couldn't be ready")
else:
return f'\033[1:34m{a.read()}\033[m'
def appending(filename, info): # Append a new item in a file.
try:
a = open(filename, 'at')
except:
raise FileNotFoundError
else:
a.write(f'{info}\n')
a.close()
def checkduplication(filename, info):
# Check for duplications in a file and break to the menu if info is existent.
with open(filename, 'rt') as a:
if info in a.read():
print(f'\033[1:31mAlready registered in the system\033[m')
a.close()
main_menu.SubMenu(1)
else:
confirm = ''
while True:
confirm = str(input(f'Confirm registering "\033[1m{info}\033[m"? [Y/N]')).strip().lower()
if confirm == 'y' or confirm == 'n':
break
if confirm == 'y':
appending(filename, info)
print('\033[1mSuccessfully registered\033[m')
main_menu.SubMenu(1)
elif confirm == 'n':
main_menu.SubMenu(1)
""" |
class Node():
"""this is the Node class that will be used for heap data structures"""
def __init__(self, value, parent=None):
self.value = value
self.parent = parent
self.children = []
def __str__(self):
return "Value: " + str(self.value)
def add_children(self, value):
if len(self.children) < 2:
self.children.append(value)
else:
# do nothing since a node cannot
# have more than two children
pass
def get_parent(self):
"""It returns the parent node"""
return self.parent
def get_left_child(self):
"""returns the left child"""
return self.children[0]
def get_right_child(self):
return self.children[1]
class MinHeap():
"""
A Min-Heap is a complete binary tree in which the value in each parent
node is smaller than or equal to the values in the children of that node.
5 13
/ \ / \
10 15 16 31
/ / \ / \
30 41 51 100 41
"""
def __init__(self):
self.heap = []
self.root = Node(0, None)
self.heap.append(self.root)
def get_root(self):
"""It returns the root element of Min Heap."""
return self.root
def add_children(self, new_child_node_value):
for i in range(len(self.heap)):
# check if the current node is full (has two children)
if len(self.heap[i].children) == 2:
# if has 2 child than move to the next child Node by iterating
# the loop iteration variable & check if parent is smaller than
# the children for min heap
continue
elif len(self.heap[i].children) < 2:
# if the current node has less than 2 child than add the value
# to the current node & check if parent is smaller than the
# children for min heap
if self.heap[i].value <= new_child_node_value:
new_node = Node(new_child_node_value, self.heap[i])
self.heap[i].children.append(new_node)
self.heap.append(new_node)
break
else:
continue # parent value is bigger
def update_children(self):
pass
def delete_children(self):
pass
def print_heap(self):
pass
class MaxHeap():
"""
pass
"""
"""
I DID NOT FINISH THIS DATA STRUCTURE BECAUSE I GOT FCKN BORED
"""
|
# ler o Primeiro Termo e a Razão de uma PA. Mostrar os 10 primeiros termos dessa progressão.
pa = [int(input('Digite o primeiro termo de sua PA: '))]
r = int(input('E qual seria a razão?: '))
for f in range(1, 10):
pan = pa[0] + f * r
pa.append(pan)
print(f'Números da PA: {pa}')
|
frase = 'Curso em Vídeo Python'
print(frase.title())
print('''Welcome! Are you completely new to programming?
If not then blablablablablabla blabl ablabal abkabakbak
hahushkjsjkhsjsh sjhhsks hskjhsjkhs sjhkshkhsks
skhskdjskhjd sjkhskjh jdkldj dhkdhkd dkjdkjd dkdlkd''') |
#
# MacOS Packaging logic
#
# This is intended as the first step in comprehensive package build on MacOS. It replaces the
# following style of command:
#
# pkgbuild \
# --identifier (domain).$(PKG_NAME) \
# --component-plist $(PLIST) \
# --scripts $(SCRIPTS) \
# --version $(VER_BAZELISK) \
# --root $(STAGE) \
# $(DESTDIR)/$(PKG_UPPERNAME)-$(VER_BAZELISK).pkg:
#
# Identifiers refs:
# - https://en.wikipedia.org/wiki/Uniform_Type_Identifier
# - https://en.wikipedia.org/wiki/Reverse_domain_name_notation
#
# As with the command it replaces, this isintended to be installable in a simple CLI such as:
#
# sudo installer -pkg bazel-out/darwin-fastbuild/bin/chickenandbazel.pkg -target /
def _pkgbuild_tars_impl(ctx):
"""Completes a "pkgbuild --root" but pre-deployed the "tars" to that given "root".
Args:
name: A unique name for this rule.
component_plist: location of a plist file.
identifier: an Apple UTI -- ie Reverse-DNS Notation name for the package: Defaults to
com.example.{name} but watch for the expected namespace/name clash this default
can cause.
package_name: (optional) Target package name, defaulting to (name).pkg.
tars: One or more tar archives representing deliverables that should be extracted in "root"
before packaging.
version: a version string for the package; recommending Semver for simplicity. Comparing
two versions of matching identifier can be used to determine whether one package
upgrades or downgrades another.
"""
component_plist_opt = ""
if ctx.attr.component_plist:
component_plist_opt = "--component-plist \"{}\"".format(ctx.file.component_plist)
identifier = ctx.attr.identifier or "com.example.{}".format(ctx.attr.name)
package_name = ctx.attr.package_name or "{}.pkg".format(ctx.attr.name)
pkg = ctx.actions.declare_file(package_name)
inputs = [] + ctx.files.tars # TODO: plus pkgbuild, plus template, plus plist
#pkgbuild_toolchain = ctx.toolchains["@rules_pkg//toolchains/macos:pkgbuild_toolchain_type"].pkgbuild.path
# Generate a script from hydrating a template so that we can review the script to diagnose/debug
script_file = ctx.actions.declare_file("{}_pkgbuild".format(ctx.label.name))
ctx.actions.expand_template(
template = ctx.file._script_template,
output = script_file,
is_executable = True,
substitutions = {
"{IDENTIFIER}": identifier,
"{OPT_COMPONENT_PLIST}": component_plist_opt,
"{OPT_SCRIPTS_DIR}": "",
"{OUTPUT}": pkg.path,
#"{PKGBUILD}": pkgbuild_toolchain,
"{TARS}": " ".join([ f.path for f in ctx.files.tars ]),
"{VERSION}": ctx.attr.version,
},
)
ctx.actions.run(
inputs = inputs,
outputs = [pkg],
arguments = [],
executable = script_file,
execution_requirements = {
"local": "1",
"no-remote": "1",
"no-remote-exec": "1",
},
)
return [
DefaultInfo(
files = depset([pkg]),
),
]
pkgbuild_tars = rule(
implementation = _pkgbuild_tars_impl,
attrs = {
"tars": attr.label_list(
#allow_files = True,
mandatory = True,
doc = "One or more tar archives that should be extracted in 'root' before packaging",
),
"package_name": attr.string(
mandatory = False,
doc = "resulting filename.pkg, defaults to (name).pkg, analogous to the 'package-output-path'",
),
"identifier": attr.string(
mandatory = False,
doc = "An Apple Uniform Type Identifier (similar to a Reverse-DNS Notation) as a unique identifier for this package"
),
"component_plist": attr.label(allow_files = True, mandatory = False),
"version": attr.string(
mandatory = True,
default = "0",
doc = "A version for the package; used to compare against different versions of the 'identifier' to see whether this upgrades or downgrades an existing install",
),
"_script_template": attr.label(
allow_single_file = True,
default = ":pkgbuild_tars.sh.tpl",
),
},
doc = "Package a complete destination root. For example, the 'xcodebuild' tool with the 'install' action creates a destination root. This rule is intended to package up a destination root that would be given as 'pkgbuild --root' except that it wants to lay out the given 'tars' into that 'root' before packaging",
)
# NOTES
#
# full paths? https://github.com/bazelbuild/rules_python/blob/main/python/defs.bzl#L76
|
pipe = make_pipeline(preprocessor, LinearRegression())
res = -cross_val_score(
pipe, with_age, with_age['Age'], n_jobs=1, cv=100,
scoring='neg_mean_absolute_error'
)
sns.distplot(res)
sns.distplot(with_age.Age)
print(f'{res.mean()} +/- {res.std()}')
|
# Traer la lista de tareas:
lista_tareas = [ [6, "Distribución"],
[2, "Diseño"],
[1, "Concepción"],
[7, "Mantenimiento"],
[4, "Producción"],
[3, "Planificación"],
[5, "Pruebas"] ]
# Comando para ordenar la lista:
lista_tareas.sort()
# definir una variable que almacene el índice y el número asociado
# Imprimir los pasos sin el número:
for element in lista_tareas:
print(element[1])
|
#Finding the percentage
if __name__ == '__main__':
n = int(raw_input())
student_marks = {}
for _ in range(n):
line = raw_input().split()
name, scores = line[0], line[1:]
scores = map(float, scores)
student_marks[name] = scores
query_name = raw_input()
scores=student_marks[query_name]
#scores=scores.split()
sum1=scores[0]+scores[1]+scores[2]
avg=round(sum1/3,2)
print("%.2f" % avg)
|
# Problem : https://codeforces.com/problemset/problem/855/B
n, p, q, r = map(int, input().split())
arr = [int(i) for i in input().split()]
Pmax = [-10**9] * n
Pmax[0] = p * arr[0]
for i in range(1, n):
Pmax[i] = max(Pmax[i-1], p * arr[i])
Smax = [-10**9] * n
Smax[n-1] = r * arr[n-1]
for i in range(n-2, -1, -1):
Smax[i] = max(Smax[i+1], r * arr[i])
ans = Pmax[0] + q * arr[0] + Smax[0]
for i in range(1, n):
ans = max(ans, Pmax[i] + q * arr[i] + Smax[i])
print(ans)
|
#Exercício Python 023: Faça um programa que leia um número de 0 a 9999 e
# mostre na tela cada um dos dígitos separados.
n = int((input('Digite um numero! ')))
print('Unidade:', (n[3]))
print('Dezena:', (n[2]))
print('Centena:',(n[1]))
print('Milhar:', (n[0]))
|
class WhatThePatchException(Exception):
pass
class HunkException(WhatThePatchException):
def __init__(self, msg, hunk=None):
self.hunk = hunk
if hunk is not None:
super(HunkException, self).__init__(
"{msg}, in hunk #{n}".format(msg=msg, n=hunk)
)
else:
super(HunkException, self).__init__(msg)
class ApplyException(WhatThePatchException):
pass
class SubprocessException(ApplyException):
def __init__(self, msg, code):
super(SubprocessException, self).__init__(msg)
self.code = code
class HunkApplyException(HunkException, ApplyException, ValueError):
pass
class ParseException(HunkException, ValueError):
pass
|
'''
Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length.
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
Example 1:
Given nums = [1,1,1,2,2,3],
Your function should return length = 5, with the first five elements of nums being 1, 1, 2, 2 and 3 respectively.
It doesn't matter what you leave beyond the returned length.
'''
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) <= 2:
return len(nums)
prev, curr = 1, 2
while curr < len(nums):
if nums[prev] == nums[curr] and nums[curr] == nums[prev-1]:
curr += 1
else:
prev += 1
nums[prev] = nums[curr]
curr += 1
return prev+1
|
#Project Euler Question 18
#By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.
#3
#7 4
#2 4 6
#8 5 9 3
#That is, 3 + 7 + 4 + 9 = 23.
#Find the maximum total from top to bottom of the triangle below:
grid = """75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91 43 58 50 27 29 48
63 66 04 68 89 53 67 30 73 16 69 87 40 31
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23"""
grid = grid.replace("00", "0")
grid = grid.replace("01", "1")
grid = grid.replace("02", "2")
grid = grid.replace("03", "3")
grid = grid.replace("04", "4")
grid = grid.replace("05", "5")
grid = grid.replace("06", "6")
grid = grid.replace("07", "7")
grid = grid.replace("08", "8")
grid = grid.replace("09", "9")
grid = [(row.split(" ")) for row in grid.split("\n")]
for row in grid:
for term in row:
intterm = int(term)
row[row.index(term)] = intterm
y = 1
high_term = []
for row in grid[-1:-2:-1]:
#print (row)
for term in row:
#print (term)
#print (row[y])
if term >= row[y]:
high_term.append(term)
else:
high_term.append(row[y])
y += 1
if y >= len(row):
break
y = 1
y = 1
#print (high_term)
old_high_term = high_term.copy()
new_high_term = []
#new_high_list = []
z = 0
for row in grid[-2::-1]:
#print (row, "is the current row")
if len(new_high_term) == 1:
highest_sum = new_high_term
highest_sum.append(row[0])
highest_sum = sum(highest_sum)
break
else:
new_high_term.clear()
for term in row:
#print (term)
check1 = (term + old_high_term[z])
check2 = (row[y] + old_high_term[z+1])
if check1 >= check2:
new_high_term.append(check1)
else:
new_high_term.append(check2)
y += 1
z += 1
if z >= (len(old_high_term)-1):
break
#print (new_high_term, "is the current list of high sums")
old_high_term.clear()
old_high_term = new_high_term.copy()
y = 1
z = 0
print (highest_sum, "is the highest sum") |
class Request:
pickup_deadline = 0
def __init__(self, request_id, start_lon, start_lat, end_lon, end_lat, start_node_id, end_node_id, release_time=None, delivery_deadline=None, pickup_deadline=None):
self.request_id = request_id
self.start_lon = start_lon
self.start_lat = start_lat
self.end_lon = end_lon
self.end_lat = end_lat
self.start_node_id = start_node_id
self.end_node_id = end_node_id
self.release_time = release_time
self.delivery_deadline = delivery_deadline
def config_pickup_deadline(self, t):
self.pickup_deadline = t
|
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified).
__all__ = ['do_something']
# Cell
def do_something():
print('brztt') |
class C1:
def __init__(self, value):
self.value = value
def __bytes__(self):
return self.value
c1 = C1(b"class 1")
print(bytes(c1))
|
###############################################################
############# FIND THE LAND LORDS ###############
###############################################################
#Residential props ['100','113','150','160','210','220','230','240','330']
#df_tcad['res'] = (df_tcad.res | df_tcad.land_use.isin(res_code))
#df_tcad = df_tcad.loc[df_tcad.res]
df_tcad.address.fillna('MISSING ADDRESS',inplace=True) #change to 0 for fuzz match
df_tcad.owner_add.fillna('NO ADDRESS FOUND',inplace=True) #change to 0 for fuzz match
#Determine landlord criteria
df_tcad['single_unit'] = np.where(df_tcad.units_x>1, False, True)
#See if mailing address and address match up is 75 too HIGH???
df_tcad['score'] = df_tcad.apply(lambda x: fuzz.partial_ratio(x.address,x.owner_add),axis=1)
df_tcad['add_match'] = np.where((df_tcad.score > 70), True, False)
#Multiple property owner
df_tcad['multi_own'] = df_tcad.duplicated(subset='py_owner_i') #multiple owner ids
df_tcad['multi_own1'] = df_tcad.duplicated(subset='prop_owner') #multiple owner names
#df_tcad['multi_own2'] = df_tcad.duplicated(subset='mail_add_2') #multiple owner_add subsets
df_tcad['multi_own3'] = df_tcad.duplicated(subset='owner_add') #multiple owner_add
#props with no address should be nan
df_tcad.address.replace('MISSING ADDRESS',np.nan,inplace=True)
df_tcad.owner_add.replace('NO ADDRESS FOUND',np.nan,inplace=True) #change to 0 for fuzz match
#If single unit addresses match zips match not a biz and not a multi owner
#maybe include hs figure out how to use to get corner cases?
df_ll = df_tcad.loc[df_tcad.res & (~((df_tcad.single_unit)&(df_tcad.add_match)&(~(df_tcad.multi_own|df_tcad.multi_own1|df_tcad.multi_own3))))]
#Drop non residential locations and city properties that slipped through the algorithm
df_ll = df_ll.loc[~(df_ll.address=='VARIOUS LOCATIONS')] #No idea what these are but they dont belong
df_ll = df_ll.loc[~(df_ll.address=='*VARIOUS LOCATIONS')] #No idea what these are but they dont belong
df_ll = df_ll.loc[~(df_ll.owner_add.str.contains('PO BOX 1088 ',na=False))] #City of Austin
df_ll = df_ll.loc[~(df_ll.owner_add.str.contains('PO BOX 1748 ',na=False))] #Travis County
df_ll = df_ll.loc[df_ll.address.str.len()>=5] #get rid of properties with bad addresses as they all have none type prop_owner (cant filter out weird bug?)
df_ll = df_ll.loc[~(df_ll.owner_add.str.contains('PO BOX 15426',na=False))] #State of Texas
df_ll = df_ll.loc[~(df_ll.owner_add.str.contains('PO BOX 17126',na=False))] #Land Fills why are these coded res?
df_ll = df_ll.loc[df_ll.land_use!=640] #schools
com_type = ['OFF/RETAIL (SFR)', 'COMMERCIAL SPACE CONDOS', 'SM OFFICE CONDO', 'LG OFFICE CONDO', 'OFFICE (SMALL)','SM STORE <10K SF', 'STRIP CTR <10000', 'WAREHOUSE <20000', "MF'D COMMCL BLDG", 'OFFICE LG >35000', 'MEDICAL OFF <10K','PARKING GARAGE']
df_ll = df_ll.loc[~(df_ll.type1.isin(com_type)&(~df_ll.land_use.isin(res_code)))] #office condos that are not mixed use
#Handle more missing
df_ll.X_x = df_ll.groupby(['st_name','st_number']).X_x.transform('ffill')
df_ll.X_x = df_ll.groupby(['st_name','st_number']).X_x.transform('bfill')
df_ll.Y_x = df_ll.groupby(['st_name','st_number']).Y_x.transform('ffill')
df_ll.Y_x = df_ll.groupby(['st_name','st_number']).Y_x.transform('bfill')
#Combine units with same prop owner and same address
#df_ll.units_x = df_ll.groupby(['address','prop_owner'])['units_x'].transform('sum')
#df_ll.drop_duplicates(['address','prop_owner'],inplace=True)
#Add in values from eviction data
#df_e = pd.read_csv('Evictions_filled_partial_9_26.csv')
#df_e['prop_id'] = df_e['Property ID']
#df_e = df_e.loc[df_e.prop_id.notnull()]
#df_eid = df_e[['prop_id','Lat','Long']]
#df_eid = df_eid.merge(df_tcad,on='prop_id',how='left')
#cols = df_tcad.columns.tolist()
#df_ll = df_eid.merge(df_ll,on=cols,how='outer').drop_duplicates('prop_id')
#df_ll.Y_x.fillna(df_ll.Lat,inplace=True)
#df_ll.X_x.fillna(df_ll.Long,inplace=True)
#df_e.loc[~df_e.prop_id.isin(df_ll.prop_id.values)]
#Fill in imputed values
df_ll.units_x.fillna(df_ll['unit_est'],inplace=True)
#Round it and correct
df_ll.units_x = round(df_ll.units_x)
df_ll.units_x = np.where(df_ll.units_x<1, 1, df_ll.units_x)
#Fill in with property unit estimations on ly where the low of the range estimate is higher then the imputated value
df_ll.units_x = np.where((df_ll.low>df_ll.units_x)&(df_ll.known==False),df_ll.low,df_ll.units_x)
#Get rid of estimates from type that are above 1k
df_ll.units_x = np.where((df_ll.units_x>1000),np.nan,df_ll.units_x)
#Export for dedupe and affiliation clustering
df_ll_dup = df_ll[['prop_owner','py_owner_i','address','owner_add','prop_id','DBA']]
df_ll_dup.to_csv('./land_lords.csv',index=False)
df_ll['land_lord_res'] = (((df_ll.units_x==1)&df_ll.add_match) | ((df_ll.hs=='T')&(df_ll.units_x==1)))
#df_ll.loc[(df_ll.hs=='T')&(df_ll.units_x>2)&(df_ll.known)][['prop_owner','owner_add','address','units_x','type1','low']]
#Export shape file and csv file for prelim check in qGIS
#coor_to_geometry(df_ll,col=['X_x_x','Y_x_x'],out='geometry')
#keep = ['prop_id', 'py_owner_i', 'prop_owner', 'DBA', 'address', 'owner_add','units_x','geometry']
#gdf_ll = geopandas.GeoDataFrame(df_ll,geometry='geometry')
#clean_up(gdf_ll,cols=keep,delete=False)
#gdf_ll.to_file("all_landlords.shp")
#pid= []
#cols = [ 'desc' ,'DBA' ,'address' ,'owner_add' ,'type1']
#for col in cols:
# pid.append(df_tcad.loc[df_tcad[col].str.contains('COMMERCIAL',na=False)].prop_id.tolist())
#
#pid = list(set(pid))
#
#df_tcad.loc[~df_tcad.prop_id.isin(pid)]
|
#
# @lc app=leetcode id=1143 lang=python3
#
# [1143] Longest Common Subsequence
#
# https://leetcode.com/problems/longest-common-subsequence/description/
#
# algorithms
# Medium (58.79%)
# Likes: 4759
# Dislikes: 56
# Total Accepted: 295.2K
# Total Submissions: 502K
# Testcase Example: '"abcde"\n"ace"'
#
# Given two strings text1 and text2, return the length of their longest common
# subsequence. If there is no common subsequence, return 0.
#
# A subsequence of a string is a new string generated from the original string
# with some characters (can be none) deleted without changing the relative
# order of the remaining characters.
#
#
# For example, "ace" is a subsequence of "abcde".
#
#
# A common subsequence of two strings is a subsequence that is common to both
# strings.
#
#
# Example 1:
#
#
# Input: text1 = "abcde", text2 = "ace"
# Output: 3
# Explanation: The longest common subsequence is "ace" and its length is 3.
#
#
# Example 2:
#
#
# Input: text1 = "abc", text2 = "abc"
# Output: 3
# Explanation: The longest common subsequence is "abc" and its length is 3.
#
#
# Example 3:
#
#
# Input: text1 = "abc", text2 = "def"
# Output: 0
# Explanation: There is no such common subsequence, so the result is 0.
#
#
#
# Constraints:
#
#
# 1 <= text1.length, text2.length <= 1000
# text1 and text2 consist of only lowercase English characters.
#
#
#
# @lc code=start
class Solution:
def longestCommonSubsequence(self, text1: str, text2: str) -> int:
m = len(text1)
n = len(text2)
dp = [[0] * (n+1) for _ in range(m+1)]
for i in range(1, m+1):
for j in range(1, n+1):
if text1[i-1] == text2[j-1]:
dp[i][j] = dp[i-1][j-1] + 1
else:
dp[i][j] = max(dp[i][j-1], dp[i-1][j])
return dp[-1][-1]
# def longestCommonSubsequence(self, text1: str, text2: str) -> int:
# m, n = len(text1), len(text2)
# dp = [[0] * n for _ in range(m)]
# for i in range(m):
# if text2[0] in text1[:i+1]:
# dp[i][0] = 1
# for i in range(n):
# if text1[0] in text2[:i+1]:
# dp[0][i] = 1
# for i in range(1, m):
# for j in range(1, n):
# if text1[i] == text2[j]:
# dp[i][j] = dp[i-1][j-1] + 1
# else:
# dp[i][j] = max(dp[i-1][j], dp[i][j-1])
# return dp[-1][-1]
# @lc code=end
|
class Solution:
def closestDivisors(self, num: int) -> List[int]:
def largest(n):
res = [1, n]
for i in range(2, int(n**0.5)+1):
if n % i == 0:
res = [i, n//i]
return res
r1, r2 = largest(num+1)
r3, r4 = largest(num+2)
return [r1, r2] if abs(r1 - r2) < abs(r3- r4) else [r3,r4]
class Solution:
def closestDivisors(self, x):
for a in range(int((x + 2)**0.5), 0, -1):
if (x + 1) % a == 0:
return [a, (x + 1) // a]
if (x + 2) % a == 0:
return [a, (x + 2) // a]
class Solution:
def closestDivisors(self, x):
return next([a, y // a] for a in range(int((x + 2)**0.5), 0, -1) for y in [x + 1, x + 2] if not y % a) |
def new(name):
print("Hi, " + name)
player = {
"name": "Cris",
"age": 40
}
|
LAST_SEEN = {
"Last 1 Hour": 1,
"Last 2 Hours": 2,
"Last 6 Hours": 6,
"Last 12 Hours": 12,
"Last 24 Hours": 24,
"Last 48 Hours": 48,
"Last 72 Hours": 72,
"Last 7 Days": 7,
"Last 14 Days": 14,
"Last 21 Days": 21,
"Last 30 Days": 30,
"Last 60 Days": 60,
"Last 90 Days": 90,
"Last Year": 365
}
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Problem 050
Set .add()
Source : https://www.hackerrank.com/challenges/py-set-add/problem
"""
countries = set()
[countries.add(input()) for country in range(int(input()))]
print(len(countries))
|
"""
geoname
create by judy 2019/08/23
"""
class Geoname(object):
def __init__(self, geonameid, name):
if geonameid is None:
raise Exception('Region geonameid cant be None.')
if name is None:
raise Exception('Region name cant be None.')
self.geonameid = geonameid
self.name = name
self.asciiname = None
self.latitude = None
self.longitude = None
self.feature_class = None
self.featurecode = None
self.population = None
self.timezone = None
self.modification = None
self.continent = None
self.self_admin_code = {}
self.parent_admin_code = {}
def set_parent_admin_code(self, pac: dict):
"""
如果当前这个地区有父级地区,那么就会给父级地区赋值
:param pac:
:return:
"""
self.parent_admin_code = pac
def set_self_admin_code(self, sac: dict):
"""
如果当前这个地区是一级行政区或者二级行政区那么就会有值
:param sac:
:return:
"""
self.self_admin_code = sac
|
#
# PySNMP MIB module TERADICI-PCOIPv2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TERADICI-PCOIPv2-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:15:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Counter64, iso, Unsigned32, ModuleIdentity, IpAddress, Integer32, enterprises, Gauge32, NotificationType, Bits, Counter32, MibIdentifier, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "iso", "Unsigned32", "ModuleIdentity", "IpAddress", "Integer32", "enterprises", "Gauge32", "NotificationType", "Bits", "Counter32", "MibIdentifier", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
teraMibModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 25071))
teraMibModule.setRevisions(('2012-01-28 10:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: teraMibModule.setRevisionsDescriptions(('Version 2 of the PCoIP MIB.',))
if mibBuilder.loadTexts: teraMibModule.setLastUpdated('201201281000Z')
if mibBuilder.loadTexts: teraMibModule.setOrganization('Teradici Corporation')
if mibBuilder.loadTexts: teraMibModule.setContactInfo(' Chris Topp Postal: 101-4621 Canada Way Burnaby, BC V5G 4X8 Canada Tel: +1 604 451 5800 Fax: +1 604 451 5818 E-mail: ctopp@teradici.com')
if mibBuilder.loadTexts: teraMibModule.setDescription('MIB describing PC-over-IP (tm) statistics.')
teraProducts = MibIdentifier((1, 3, 6, 1, 4, 1, 25071, 1))
teraPcoipV2 = MibIdentifier((1, 3, 6, 1, 4, 1, 25071, 1, 2))
teraPcoipGenStats = MibIdentifier((1, 3, 6, 1, 4, 1, 25071, 1, 2, 1))
teraPcoipNetStats = MibIdentifier((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2))
teraPcoipAudioStats = MibIdentifier((1, 3, 6, 1, 4, 1, 25071, 1, 2, 3))
teraPcoipImagingStats = MibIdentifier((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4))
teraPcoipUSBStats = MibIdentifier((1, 3, 6, 1, 4, 1, 25071, 1, 2, 5))
teraPcoipGenDevices = MibIdentifier((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6))
teraPcoipImagingDevices = MibIdentifier((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7))
teraPcoipUSBDevices = MibIdentifier((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8))
pcoipGenStatsTable = MibTable((1, 3, 6, 1, 4, 1, 25071, 1, 2, 1, 1), )
if mibBuilder.loadTexts: pcoipGenStatsTable.setStatus('current')
if mibBuilder.loadTexts: pcoipGenStatsTable.setDescription('The PCoIP General statistics table.')
pcoipGenStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25071, 1, 2, 1, 1, 1), ).setIndexNames((0, "TERADICI-PCOIPv2-MIB", "pcoipGenStatsSessionNumber"))
if mibBuilder.loadTexts: pcoipGenStatsEntry.setStatus('current')
if mibBuilder.loadTexts: pcoipGenStatsEntry.setDescription('An entry in the PCoIP general statistics table.')
pcoipGenStatsSessionNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenStatsSessionNumber.setStatus('current')
if mibBuilder.loadTexts: pcoipGenStatsSessionNumber.setDescription('PCoIP session number used to link PCoIP statistics to session.')
pcoipGenStatsPacketsSent = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 1, 1, 1, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenStatsPacketsSent.setStatus('current')
if mibBuilder.loadTexts: pcoipGenStatsPacketsSent.setDescription('Total number of packets that have been transmitted since the PCoIP session started.')
pcoipGenStatsBytesSent = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 1, 1, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenStatsBytesSent.setStatus('current')
if mibBuilder.loadTexts: pcoipGenStatsBytesSent.setDescription('Total number of bytes that have been transmitted since the PCoIP session started.')
pcoipGenStatsPacketsReceived = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 1, 1, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenStatsPacketsReceived.setStatus('current')
if mibBuilder.loadTexts: pcoipGenStatsPacketsReceived.setDescription('Total number of packets that have been received since the PCoIP session started.')
pcoipGenStatsBytesReceived = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 1, 1, 1, 5), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenStatsBytesReceived.setStatus('current')
if mibBuilder.loadTexts: pcoipGenStatsBytesReceived.setDescription('Total number of bytes that have been received since the PCoIP session started.')
pcoipGenStatsTxPacketsLost = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 1, 1, 1, 6), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenStatsTxPacketsLost.setStatus('current')
if mibBuilder.loadTexts: pcoipGenStatsTxPacketsLost.setDescription('Total number of transmit packets that have been lost since the PCoIP session started.')
pcoipGenStatsSessionDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 1, 1, 1, 7), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenStatsSessionDuration.setStatus('current')
if mibBuilder.loadTexts: pcoipGenStatsSessionDuration.setDescription('An incrementing number that represents the total number of seconds the PCoIP session has been open.')
pcoipNetStatsTable = MibTable((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2, 1), )
if mibBuilder.loadTexts: pcoipNetStatsTable.setStatus('current')
if mibBuilder.loadTexts: pcoipNetStatsTable.setDescription('The PCoIP Network statistics table.')
pcoipNetStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2, 1, 1), ).setIndexNames((0, "TERADICI-PCOIPv2-MIB", "pcoipNetStatsSessionNumber"))
if mibBuilder.loadTexts: pcoipNetStatsEntry.setStatus('current')
if mibBuilder.loadTexts: pcoipNetStatsEntry.setDescription('An entry in the PCoIP network statistics table.')
pcoipNetStatsSessionNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipNetStatsSessionNumber.setStatus('current')
if mibBuilder.loadTexts: pcoipNetStatsSessionNumber.setDescription('PCoIP session number used to link statistics to session.')
pcoipNetStatsRoundTripLatencyMs = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2, 1, 1, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipNetStatsRoundTripLatencyMs.setStatus('current')
if mibBuilder.loadTexts: pcoipNetStatsRoundTripLatencyMs.setDescription('Round trip latency (in milliseconds) between server and client.')
pcoipNetStatsRXBWkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2, 1, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipNetStatsRXBWkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipNetStatsRXBWkbitPersec.setDescription('Average number of kilobits per second that have been received by this device.')
pcoipNetStatsRXBWPeakkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipNetStatsRXBWPeakkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipNetStatsRXBWPeakkbitPersec.setDescription('Peak bandwidth for incoming PCoIP packets within a one second sampling period.')
pcoipNetStatsRXPacketLossPercent = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipNetStatsRXPacketLossPercent.setStatus('current')
if mibBuilder.loadTexts: pcoipNetStatsRXPacketLossPercent.setDescription('Percentage of received packets lost during a one second sampling period.')
pcoipNetStatsTXBWkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2, 1, 1, 6), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipNetStatsTXBWkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipNetStatsTXBWkbitPersec.setDescription('Average number of kilobits per second that have been transmitted by this device.')
pcoipNetStatsTXBWActiveLimitkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipNetStatsTXBWActiveLimitkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipNetStatsTXBWActiveLimitkbitPersec.setDescription('The current estimate of the available network bandwidth, updated every second.')
pcoipNetStatsTXBWLimitkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipNetStatsTXBWLimitkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipNetStatsTXBWLimitkbitPersec.setDescription('Transmit bandwidth limit for outgoing packets.')
pcoipNetStatsTXPacketLossPercent = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 2, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipNetStatsTXPacketLossPercent.setStatus('current')
if mibBuilder.loadTexts: pcoipNetStatsTXPacketLossPercent.setDescription('Percentage of transmitted packets lost during the one second sampling period.')
pcoipAudioStatsTable = MibTable((1, 3, 6, 1, 4, 1, 25071, 1, 2, 3, 1), )
if mibBuilder.loadTexts: pcoipAudioStatsTable.setStatus('current')
if mibBuilder.loadTexts: pcoipAudioStatsTable.setDescription('The PCoIP Audio statistics table.')
pcoipAudioStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25071, 1, 2, 3, 1, 1), ).setIndexNames((0, "TERADICI-PCOIPv2-MIB", "pcoipAudioStatsSessionNumber"))
if mibBuilder.loadTexts: pcoipAudioStatsEntry.setStatus('current')
if mibBuilder.loadTexts: pcoipAudioStatsEntry.setDescription('An entry in the PCoIP audio statistics table.')
pcoipAudioStatsSessionNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipAudioStatsSessionNumber.setStatus('current')
if mibBuilder.loadTexts: pcoipAudioStatsSessionNumber.setDescription('PCoIP session number used to link statistics to session.')
pcoipAudioStatsBytesReceived = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 3, 1, 1, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipAudioStatsBytesReceived.setStatus('current')
if mibBuilder.loadTexts: pcoipAudioStatsBytesReceived.setDescription('Total number of audio bytes that have been received since the PCoIP session started.')
pcoipAudioStatsBytesSent = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 3, 1, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipAudioStatsBytesSent.setStatus('current')
if mibBuilder.loadTexts: pcoipAudioStatsBytesSent.setDescription('Total number of audio bytes that have been sent since the PCoIP session started.')
pcoipAudioStatsRXBWkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 3, 1, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipAudioStatsRXBWkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipAudioStatsRXBWkbitPersec.setDescription('Average number of kilobits per second that have been received by the audio channel of this device.')
pcoipAudioStatsTXBWkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 3, 1, 1, 5), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipAudioStatsTXBWkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipAudioStatsTXBWkbitPersec.setDescription('Total number of audio kilobits that have been transmitted since the PCoIP session started.')
pcoipAudioStatsTXBWLimitkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 3, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipAudioStatsTXBWLimitkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipAudioStatsTXBWLimitkbitPersec.setDescription('Transmit bandwidth limit for outgoing audio packets.')
pcoipImagingStatsTable = MibTable((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4, 1), )
if mibBuilder.loadTexts: pcoipImagingStatsTable.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingStatsTable.setDescription('The PCoIP Imaging statistics table.')
pcoipImagingStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4, 1, 1), ).setIndexNames((0, "TERADICI-PCOIPv2-MIB", "pcoipImagingStatsSessionNumber"))
if mibBuilder.loadTexts: pcoipImagingStatsEntry.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingStatsEntry.setDescription('An entry in the PCoIP imaging statistics table.')
pcoipImagingStatsSessionNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingStatsSessionNumber.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingStatsSessionNumber.setDescription('PCoIP session number used to link statistics to session.')
pcoipImagingStatsBytesReceived = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4, 1, 1, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingStatsBytesReceived.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingStatsBytesReceived.setDescription('Total number of imaging bytes that have been received since the PCoIP session started.')
pcoipImagingStatsBytesSent = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4, 1, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingStatsBytesSent.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingStatsBytesSent.setDescription('Total number of imaging bytes that have been sent since the PCoIP session started.')
pcoipImagingStatsRXBWkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4, 1, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingStatsRXBWkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingStatsRXBWkbitPersec.setDescription('Average number of kilobits per second that have been received by the imaging channel of this device.')
pcoipImagingStatsTXBWkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4, 1, 1, 5), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingStatsTXBWkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingStatsTXBWkbitPersec.setDescription('Average number of kilobits per second that have been received by the imaging channel of this device.')
pcoipImagingStatsEncodedFramesPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2400))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingStatsEncodedFramesPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingStatsEncodedFramesPersec.setDescription('The number of imaging frames which were encoded over a one second sampling period.')
pcoipImagingStatsActiveMinimumQuality = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingStatsActiveMinimumQuality.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingStatsActiveMinimumQuality.setDescription('The lowest encoded quality, updated every second.')
pcoipImagingStatsDecoderCapabilitykbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100000))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingStatsDecoderCapabilitykbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingStatsDecoderCapabilitykbitPersec.setDescription('The current estimate of the decoder processing capability.')
pcoipImagingStatsPipelineProcRate = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 4, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 300))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingStatsPipelineProcRate.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingStatsPipelineProcRate.setDescription('The current pipeline processing rate.')
pcoipUSBStatsTable = MibTable((1, 3, 6, 1, 4, 1, 25071, 1, 2, 5, 1), )
if mibBuilder.loadTexts: pcoipUSBStatsTable.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBStatsTable.setDescription('The PCoIP USB statistics table.')
pcoipUSBStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25071, 1, 2, 5, 1, 1), ).setIndexNames((0, "TERADICI-PCOIPv2-MIB", "pcoipUSBStatsSessionNumber"))
if mibBuilder.loadTexts: pcoipUSBStatsEntry.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBStatsEntry.setDescription('An entry in the PCoIP USB statistics table.')
pcoipUSBStatsSessionNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 5, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBStatsSessionNumber.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBStatsSessionNumber.setDescription('PCoIP session number used to link statistics to session.')
pcoipUSBStatsBytesReceived = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 5, 1, 1, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBStatsBytesReceived.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBStatsBytesReceived.setDescription('Total number of USB bytes that have been received since the PCoIP session started.')
pcoipUSBStatsBytesSent = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 5, 1, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBStatsBytesSent.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBStatsBytesSent.setDescription('Total number of USB bytes that have been sent since the PCoIP session started.')
pcoipUSBStatsRXBWkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 5, 1, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBStatsRXBWkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBStatsRXBWkbitPersec.setDescription('Average number of kilobits per second that have been received by the USB channel of this device.')
pcoipUSBStatsTXBWkbitPersec = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 5, 1, 1, 5), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBStatsTXBWkbitPersec.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBStatsTXBWkbitPersec.setDescription('Average number of kilobits per second that have been received by the USB channel of this device.')
pcoipGenDevicesTable = MibTable((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1), )
if mibBuilder.loadTexts: pcoipGenDevicesTable.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesTable.setDescription('The PCoIP General Devices table.')
pcoipGenDevicesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1), ).setIndexNames((0, "TERADICI-PCOIPv2-MIB", "pcoipGenDevicesSessionNumber"))
if mibBuilder.loadTexts: pcoipGenDevicesEntry.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesEntry.setDescription('An entry in the PCoIP general devices table.')
pcoipGenDevicesSessionNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesSessionNumber.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesSessionNumber.setDescription('PCoIP session number used to link imaging devices to statistics.')
pcoipGenDevicesName = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 2), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesName.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesName.setDescription('String containing the PCoIP device name.')
pcoipGenDevicesDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 3), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesDescription.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesDescription.setDescription('String describing the processor.')
pcoipGenDevicesGenericTag = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 4), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesGenericTag.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesGenericTag.setDescription('String describing device generic tag. ')
pcoipGenDevicesPartNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 5), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesPartNumber.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesPartNumber.setDescription('String describing the silicon part number of the device.')
pcoipGenDevicesFwPartNumber = MibScalar((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 6), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesFwPartNumber.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesFwPartNumber.setDescription('String describing the product ID of the device.')
pcoipGenDevicesSerialNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 7), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesSerialNumber.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesSerialNumber.setDescription('String describing device serial number.')
pcoipGenDevicesHardwareVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 8), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesHardwareVersion.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesHardwareVersion.setDescription('String describing the silicon version.')
pcoipGenDevicesFirmwareVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 9), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesFirmwareVersion.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesFirmwareVersion.setDescription('String describing the currently running firmware revision.')
pcoipGenDevicesUniqueID = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 10), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesUniqueID.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesUniqueID.setDescription('String describing the device unique identifier.')
pcoipGenDevicesMAC = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 11), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesMAC.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesMAC.setDescription('String describing the device MAC address.')
pcoipGenDevicesUptime = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 6, 1, 1, 12), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipGenDevicesUptime.setStatus('current')
if mibBuilder.loadTexts: pcoipGenDevicesUptime.setDescription('Integer containing the number of seconds since boot.')
pcoipImagingDevicesTable = MibTable((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1), )
if mibBuilder.loadTexts: pcoipImagingDevicesTable.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesTable.setDescription('The PCoIP Imaging Devices table.')
pcoipImagingDevicesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1), ).setIndexNames((0, "TERADICI-PCOIPv2-MIB", "pcoipImagingDevicesIndex"))
if mibBuilder.loadTexts: pcoipImagingDevicesEntry.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesEntry.setDescription('An entry in the PCoIP imaging devices table.')
pcoipImagingDevicesIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesIndex.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesIndex.setDescription('The auxiliary variable used for identifying instances of the columnar objects in the devices table.')
pcoipImagingDevicesSessionNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesSessionNumber.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesSessionNumber.setDescription('PCoIP session number used to link imaging devices to statistics.')
pcoipImagingDevicesDisplayWidth = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4096))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesDisplayWidth.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesDisplayWidth.setDescription('Display width in pixels.')
pcoipImagingDevicesDisplayHeight = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4096))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesDisplayHeight.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesDisplayHeight.setDescription('Display height in lines.')
pcoipImagingDevicesDisplayRefreshRate = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 600))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesDisplayRefreshRate.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesDisplayRefreshRate.setDescription('Display refresh rate in Hz.')
pcoipImagingDevicesDisplayChangeRate = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 600))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesDisplayChangeRate.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesDisplayChangeRate.setDescription('Display input change rate in Hz over a 1 second sample.')
pcoipImagingDevicesDisplayProcessRate = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 600))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesDisplayProcessRate.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesDisplayProcessRate.setDescription('Display process frame rate in Hz over a 1 second sample.')
pcoipImagingDevicesLimitReason = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 8), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesLimitReason.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesLimitReason.setDescription('String describing the reason for limiting the frame rate of this display.')
pcoipImagingDevicesModel = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 9), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesModel.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesModel.setDescription('String describing the display model name.')
pcoipImagingDevicesStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 10), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesStatus.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesStatus.setDescription('String describing the display device status.')
pcoipImagingDevicesMode = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 11), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesMode.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesMode.setDescription('String describing the display mode.')
pcoipImagingDevicesSerial = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 12), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesSerial.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesSerial.setDescription('String describing the display serial number.')
pcoipImagingDevicesVID = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 13), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesVID.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesVID.setDescription('String describing the display vendor ID.')
pcoipImagingDevicesPID = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 14), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesPID.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesPID.setDescription('String describing the display product ID.')
pcoipImagingDevicesDate = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 7, 1, 1, 15), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipImagingDevicesDate.setStatus('current')
if mibBuilder.loadTexts: pcoipImagingDevicesDate.setDescription('String describing the display date of manufacture.')
pcoipUSBDevicesTable = MibTable((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1), )
if mibBuilder.loadTexts: pcoipUSBDevicesTable.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesTable.setDescription('The PCoIP USB Devices table.')
pcoipUSBDevicesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1), ).setIndexNames((0, "TERADICI-PCOIPv2-MIB", "pcoipUSBDevicesIndex"))
if mibBuilder.loadTexts: pcoipUSBDevicesEntry.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesEntry.setDescription('An entry in the PCoIP USB devices table.')
pcoipUSBDevicesIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 127))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBDevicesIndex.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesIndex.setDescription('The auxiliary variable used for identifying instances of the columnar objects in the devices table.')
pcoipUSBDevicesSessionNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBDevicesSessionNumber.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesSessionNumber.setDescription('PCoIP session number used to link USB devices to statistics.')
pcoipUSBDevicesPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1, 3), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBDevicesPort.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesPort.setDescription('USB device port: OHCI or EHCI.')
pcoipUSBDevicesModel = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1, 4), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBDevicesModel.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesModel.setDescription('String describing the model name of the connected device.')
pcoipUSBDevicesStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1, 5), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBDevicesStatus.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesStatus.setDescription('String describing the USB device status.')
pcoipUSBDevicesDeviceClass = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1, 6), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBDevicesDeviceClass.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesDeviceClass.setDescription('String describing the USB device class.')
pcoipUSBDevicesSubClass = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1, 7), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBDevicesSubClass.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesSubClass.setDescription('String describing the USB sub device class.')
pcoipUSBDevicesProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1, 8), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBDevicesProtocol.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesProtocol.setDescription('String describing the USB protocol used.')
pcoipUSBDevicesSerial = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1, 9), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBDevicesSerial.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesSerial.setDescription('String describing the USB device serial number.')
pcoipUSBDevicesVID = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1, 10), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBDevicesVID.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesVID.setDescription('String describing the USB device vendor ID.')
pcoipUSBDevicesPID = MibTableColumn((1, 3, 6, 1, 4, 1, 25071, 1, 2, 8, 1, 1, 11), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pcoipUSBDevicesPID.setStatus('current')
if mibBuilder.loadTexts: pcoipUSBDevicesPID.setDescription('String describing the USB device product ID.')
mibBuilder.exportSymbols("TERADICI-PCOIPv2-MIB", pcoipImagingStatsActiveMinimumQuality=pcoipImagingStatsActiveMinimumQuality, pcoipGenStatsBytesReceived=pcoipGenStatsBytesReceived, pcoipUSBStatsTable=pcoipUSBStatsTable, pcoipGenDevicesSerialNumber=pcoipGenDevicesSerialNumber, pcoipNetStatsTXBWActiveLimitkbitPersec=pcoipNetStatsTXBWActiveLimitkbitPersec, pcoipNetStatsTXPacketLossPercent=pcoipNetStatsTXPacketLossPercent, pcoipImagingStatsPipelineProcRate=pcoipImagingStatsPipelineProcRate, pcoipUSBDevicesProtocol=pcoipUSBDevicesProtocol, pcoipNetStatsRXBWPeakkbitPersec=pcoipNetStatsRXBWPeakkbitPersec, pcoipImagingDevicesTable=pcoipImagingDevicesTable, teraPcoipUSBStats=teraPcoipUSBStats, pcoipAudioStatsTXBWLimitkbitPersec=pcoipAudioStatsTXBWLimitkbitPersec, pcoipAudioStatsTXBWkbitPersec=pcoipAudioStatsTXBWkbitPersec, pcoipNetStatsEntry=pcoipNetStatsEntry, pcoipGenStatsPacketsReceived=pcoipGenStatsPacketsReceived, pcoipUSBDevicesPort=pcoipUSBDevicesPort, pcoipGenStatsSessionNumber=pcoipGenStatsSessionNumber, pcoipImagingDevicesPID=pcoipImagingDevicesPID, pcoipNetStatsSessionNumber=pcoipNetStatsSessionNumber, pcoipGenDevicesGenericTag=pcoipGenDevicesGenericTag, teraPcoipUSBDevices=teraPcoipUSBDevices, teraPcoipAudioStats=teraPcoipAudioStats, pcoipAudioStatsEntry=pcoipAudioStatsEntry, pcoipImagingStatsRXBWkbitPersec=pcoipImagingStatsRXBWkbitPersec, pcoipGenStatsEntry=pcoipGenStatsEntry, pcoipUSBDevicesSubClass=pcoipUSBDevicesSubClass, pcoipImagingDevicesDisplayProcessRate=pcoipImagingDevicesDisplayProcessRate, pcoipGenDevicesHardwareVersion=pcoipGenDevicesHardwareVersion, pcoipGenDevicesMAC=pcoipGenDevicesMAC, pcoipUSBStatsBytesReceived=pcoipUSBStatsBytesReceived, pcoipImagingDevicesVID=pcoipImagingDevicesVID, teraPcoipImagingStats=teraPcoipImagingStats, pcoipAudioStatsBytesReceived=pcoipAudioStatsBytesReceived, teraPcoipGenStats=teraPcoipGenStats, pcoipImagingStatsDecoderCapabilitykbitPersec=pcoipImagingStatsDecoderCapabilitykbitPersec, pcoipUSBStatsBytesSent=pcoipUSBStatsBytesSent, pcoipUSBDevicesIndex=pcoipUSBDevicesIndex, pcoipImagingStatsTXBWkbitPersec=pcoipImagingStatsTXBWkbitPersec, pcoipImagingDevicesModel=pcoipImagingDevicesModel, pcoipImagingDevicesIndex=pcoipImagingDevicesIndex, pcoipUSBStatsEntry=pcoipUSBStatsEntry, pcoipUSBDevicesStatus=pcoipUSBDevicesStatus, pcoipImagingStatsBytesReceived=pcoipImagingStatsBytesReceived, pcoipGenStatsPacketsSent=pcoipGenStatsPacketsSent, pcoipUSBDevicesTable=pcoipUSBDevicesTable, pcoipGenStatsSessionDuration=pcoipGenStatsSessionDuration, pcoipGenDevicesUptime=pcoipGenDevicesUptime, pcoipNetStatsRoundTripLatencyMs=pcoipNetStatsRoundTripLatencyMs, pcoipImagingDevicesLimitReason=pcoipImagingDevicesLimitReason, pcoipUSBStatsTXBWkbitPersec=pcoipUSBStatsTXBWkbitPersec, pcoipImagingStatsSessionNumber=pcoipImagingStatsSessionNumber, pcoipNetStatsTXBWkbitPersec=pcoipNetStatsTXBWkbitPersec, pcoipAudioStatsRXBWkbitPersec=pcoipAudioStatsRXBWkbitPersec, pcoipUSBDevicesSerial=pcoipUSBDevicesSerial, pcoipImagingStatsTable=pcoipImagingStatsTable, pcoipGenDevicesEntry=pcoipGenDevicesEntry, pcoipNetStatsRXBWkbitPersec=pcoipNetStatsRXBWkbitPersec, pcoipGenDevicesName=pcoipGenDevicesName, pcoipGenDevicesFirmwareVersion=pcoipGenDevicesFirmwareVersion, pcoipGenDevicesSessionNumber=pcoipGenDevicesSessionNumber, pcoipGenDevicesFwPartNumber=pcoipGenDevicesFwPartNumber, teraMibModule=teraMibModule, pcoipGenDevicesUniqueID=pcoipGenDevicesUniqueID, pcoipUSBDevicesVID=pcoipUSBDevicesVID, pcoipAudioStatsTable=pcoipAudioStatsTable, pcoipUSBDevicesEntry=pcoipUSBDevicesEntry, pcoipGenStatsTxPacketsLost=pcoipGenStatsTxPacketsLost, pcoipGenDevicesPartNumber=pcoipGenDevicesPartNumber, pcoipImagingDevicesMode=pcoipImagingDevicesMode, teraProducts=teraProducts, teraPcoipImagingDevices=teraPcoipImagingDevices, pcoipImagingDevicesStatus=pcoipImagingDevicesStatus, pcoipImagingDevicesEntry=pcoipImagingDevicesEntry, pcoipImagingDevicesDate=pcoipImagingDevicesDate, pcoipAudioStatsBytesSent=pcoipAudioStatsBytesSent, pcoipGenStatsBytesSent=pcoipGenStatsBytesSent, pcoipImagingDevicesDisplayChangeRate=pcoipImagingDevicesDisplayChangeRate, pcoipNetStatsRXPacketLossPercent=pcoipNetStatsRXPacketLossPercent, pcoipUSBStatsSessionNumber=pcoipUSBStatsSessionNumber, teraPcoipGenDevices=teraPcoipGenDevices, pcoipNetStatsTXBWLimitkbitPersec=pcoipNetStatsTXBWLimitkbitPersec, pcoipImagingDevicesDisplayHeight=pcoipImagingDevicesDisplayHeight, pcoipGenStatsTable=pcoipGenStatsTable, pcoipImagingDevicesSessionNumber=pcoipImagingDevicesSessionNumber, pcoipNetStatsTable=pcoipNetStatsTable, PYSNMP_MODULE_ID=teraMibModule, pcoipImagingDevicesDisplayWidth=pcoipImagingDevicesDisplayWidth, pcoipGenDevicesTable=pcoipGenDevicesTable, pcoipImagingDevicesDisplayRefreshRate=pcoipImagingDevicesDisplayRefreshRate, pcoipUSBDevicesDeviceClass=pcoipUSBDevicesDeviceClass, teraPcoipV2=teraPcoipV2, pcoipUSBDevicesPID=pcoipUSBDevicesPID, pcoipImagingStatsBytesSent=pcoipImagingStatsBytesSent, pcoipAudioStatsSessionNumber=pcoipAudioStatsSessionNumber, pcoipUSBDevicesSessionNumber=pcoipUSBDevicesSessionNumber, pcoipImagingDevicesSerial=pcoipImagingDevicesSerial, pcoipImagingStatsEncodedFramesPersec=pcoipImagingStatsEncodedFramesPersec, pcoipImagingStatsEntry=pcoipImagingStatsEntry, pcoipUSBStatsRXBWkbitPersec=pcoipUSBStatsRXBWkbitPersec, pcoipGenDevicesDescription=pcoipGenDevicesDescription, teraPcoipNetStats=teraPcoipNetStats, pcoipUSBDevicesModel=pcoipUSBDevicesModel)
|
# Easter Sunday is the first Sun day after the first full moon of spring. To compute
# the date, you can use this algorithm, invented by the mathe matician Carl Friedrich
# Gauss in 1800:
# 1. Let y be the year (such as 1800 or 2001).
# 2. Divide y by 19 and call the remainder a . Ignore the quotient.
# 3. Divide y by 100 to get a quotient b and a remainder c .
# 4. Divide b by 4 to get a quotient d and a remainder e .
# 5. Divide 8 * b + 13 by 25 to get a quotient g . Ignore the remainder.
# 6. Divide 19 * a + b - d - g + 15 by 30 to get a remainder h . Ignore the quotient.
# 7. Divide c by 4 to get a quotient j and a remainder k .
# 8. Divide a + 11 * h by 319 to get a quotient m . Ignore the remainder.
# 9. Divide 2 * e + 2 * j - k - h + m + 32 by 7 to get a remainder r . Ignore the
# quotient.
# 10. Divide h - m + r + 90 by 25 to get a quotient n . Ignore the remainder.
# 11. Divide h - m + r + n + 19 by 32 to get a remainder p . Ignore the quotient.
# Then Easter falls on day p of month n . For example, if y is 2001 :
# a = 6 h = 18 n = 4
# b = 20, c = 1 j = 0, k = 1 p = 15
# d = 5, e = 0 m = 0
# g = 6 r = 6
# Therefore, in 2001, Easter Sun day fell on April 15. Write a program that prompts the
# user for a year and prints out the month and day of Easter Sunday.
# year input
y = int(input("Enter a year: "))
# 2. Divide y by 19 and call the remainder a . Ignore the quotient.
a = y % 19
# 3. Divide y by 100 to get a quotient b and a remainder c .
b = y / 100
c = y % 100
# 4. Divide b by 4 to get a quotient d and a remainder e .
d = b / 4
e = b % 4
# 5. Divide 8 * b + 13 by 25 to get a quotient g . Ignore the remainder.
g = int((8 * b + 13) / 25)
# 6. Divide 19 * a + b - d - g + 15 by 30 to get a remainder h . Ignore the quotient.
h = int((19 * a + b - d - g + 15) % 30)
# 7. Divide c by 4 to get a quotient j and a remainder k.
j = c / 4
k = c % 4
# 8. Divide a + 11 * h by 319 to get a quotient m . Ignore the remainder.
m = int((a + 11 * h) / 319)
# 9. Divide 2 * e + 2 * j - k - h + m + 32 by 7 to get a remainder r . Ignore the quotient.
r = int((2 * e + 2 * j - k - h + m + 32) % 7)
# 10. Divide h - m + r + 90 by 25 to get a quotient n . Ignore the remainder.
n = int((h - m + r + 90) / 25)
# 11. Divide h - m + r + n + 19 by 32 to get a remainder p . Ignore the quotient.
p = int((h - m + r + n + 19) % 32)
print("Easter falls %d.%d.%dy" % (n, p, y)) |
__version__ = "0.1.0"
__name__ = "python-gmail-export"
__description__ = "Python Gmail Export"
__url__ = "https://github.com/rjmoggach/python-gmail-export"
__author__ = "RJ Moggach"
__authoremail__ = "rjmoggach@gmail.com"
__license__ = "The MIT License (MIT)"
__copyright__ = "Copyright 2021 RJ Moggach" |
"""
CSE 103 Tutorial_7
Yubo Cai
31/03/2022
"""
# ######################################################################################################################################
# Exercise 1 - Preconditions and postconditions 前置条件和后置条件
"""
1. x <= 0
2. x = 3
3. x = i
4. x = 3 - y
5. x = 1 ∧ y = 47
6. y > 0 ∧ x = y + 6
"""
# ######################################################################################################################################
# Exercise 2 - Decoding encodings 编码与解码
def adjLstToMat(L):
n = len(L)
G = n * [0]
for i in range(n):
G[i] = n * [0]
for el in L[i]:
G[i][el] = 1
return G
def adjMatToLst(G):
n = len(G)
L = n * [0]
for i in range(n):
L[i] = []
for i in range(n):
for j in range(n):
if G[i][j] == 1:
L[i].append(j)
return L
# ######################################################################################################################################
# Exercise 3 - The list of weighted edges
mat1 = [[-1, 9, 7, 5], [-1, -1, -1, 2], [-1, -1, -1, 1], [3, -1, -1, -1]]
def getEdges(G):
n = len(G)
lis = []
for i in range(n):
for j in range(n):
if G[i][j] != -1:
lis.append((G[i][j], i, j))
return lis
"""
print(getEdges(mat1))
result: [(9, 0, 1), (7, 0, 2), (5, 0, 3), (2, 1, 3), (1, 2, 3), (3, 3, 0)]
"""
# ######################################################################################################################################
# Exercise 4 - Stacks and queues
class stack:
def __init__(self):
self.l = []
def isEmpty(self):
return self.l == []
def push(self, x):
self.l.append(x)
def pop(self):
return self.l.pop()
class queue:
def __init__(self):
self.l = []
def isEmpty(self):
return self.l == []
def push(self, x):
self.l.append(x)
def pop(self):
return self.l.pop(0)
s = stack()
for i in range(5):
s.push(i)
for i in range(5):
print(s.pop(), end=" ")
print(s)
q = queue()
for i in range(5):
q.push(i)
for i in range(5):
print(q.pop(), end=" ")
print(q)
class queue:
def __init__(self):
self.l = []
self.h = 0
def isEmpty(self):
return self.h >= len(self.l)
def push(self, x):
self.l.append(x)
def pop(self):
self.h += 1
return self.l[self.h - 1]
def compress(self):
for i in range(len(self.l) - self.h):
self.l[i] = self.l[i + self.h]
for i in range(self.h):
self.l.pop()
self.h = 0
q = queue()
for i in range(6):
q.push(i)
for i in range(5):
print(q.pop(), end=" ")
print()
print(q.l, q.h)
l = q.l
q.compress()
print(l, q.h)
"""
should print:
0 1 2 3 4
[0 , 1 , 2 , 3 , 4 , 5] 5
[5] 0
result:
4 3 2 1 0 <__main__.stack object at 0x11331aee0>
0 1 2 3 4 <__main__.queue object at 0x11331a580>
1 2 3 4 5
[0, 1, 2, 3, 4, 5] 5
[5, 1, 2, 3, 4, 5]
[5] 0
"""
# ######################################################################################################################################
# Exercise 5 - Traversing a graph 图遍历/图搜索
|
def laceStringsRecur(S1, S2):
"""
s1 and s2 are strings.
Returns a new str with elements of s1 and s2 interlaced,
beginning with s1. If strings are not of same length,
then the extra elements should appear at the end.
"""
def helpLaceStrings(s1, s2, out):
print('s1: ', s1, 's2: ', s2, ' : out:', out + '\n')
if s1 == '':
# print('0000000000s1:::', out)
return out + s2
if s2 == '':
# print('0000000000s2:::', out)
return out + s1
else:
# PLACE A LINE OF CODE HERE
# print('>>>>>>>>>> ' + str(round(len(out) / 2)))
return helpLaceStrings(S1[round(len(out) / 2 + 1):],
S2[round(len(out) / 2 + 1):],
out +
s1[0] +
s2[0])
return helpLaceStrings(S1, S2, '')
s1 = 'abcdef'
s2 = 'ABCDEF'
r = laceStringsRecur(s1, s2)
print('RESULTADO', r)
|
# todas as variaveis vao virar comida pois passa pela global
def comida():
global ovos
ovos = 'comida'
bacon()
def bacon():
ovos = 'bacon'
pimenta()
def pimenta():
print(ovos)
# Programa Principal
ovos = 12
comida()
print(ovos)
|
boletim=[]
while True:
nome=input('Nome:')
nota1=float(input('Nota 1: '))
nota2=float(input('Nota 2: '))
media=(nota1 + nota2)/2
boletim.append([nome,[nota1, nota2],media])
c=input('Continuar[S/N]:').upper().strip()[0]
if c== 'N':
break
print('-='*14)
print(f'{"NO.Aluno":<4} {"Média":^30}')
print('-='*14)
#print(boletim)
for i,x in enumerate(boletim):
print(f'{i} {x[0]} {x[2]:^40}')
while True:
n=int(input('Ver Notas do Aluno(999 para sair):'))
if n == 999:
break
print(f'Notas do Alun@ {boletim[n][0]}: {boletim[n][1]}') |
# Numbers
# Define two integers
x = 12
y = 8
# Define two variables that will hold the result of these equations
sum = x+y
difference = x-y
print(f"{x} plus {y} is {sum}.")
print(f"{x} minus {y} is {difference}.")
# There are other operators, such as "*" for multiplication,
# "/" for division, and "%" for modulus.
|
"""
https://www.practicepython.org
Exercise 33: Birthday Dictionaries
1 chili
This exercise is Part 1 of 4 of the birthday data exercise series. The other exercises are:
Part 2, Part 3, and Part 4.
For this exercise, we will keep track of when our friend’s birthdays are, and be able to
find that information based on their name. Create a dictionary (in your file) of names
and birthdays. When you run your program it should ask the user to enter a name, and return
the birthday of that person back to them. The interaction should look something like this:
>>> Welcome to the birthday dictionary. We know the birthdays of:
Albert Einstein
Benjamin Franklin
Ada Lovelace
>>> Who's birthday do you want to look up?
Benjamin Franklin
>>> Benjamin Franklin's birthday is 01/17/1706.
Happy coding!
# Michele's sample solutions used
# if name in birthdays
# instead of .get(), which makes sense given the list comprehension works
"""
def get_birthdays(file = 'birthdays.txt'):
birthdays = { }
with open(file) as birthday_list_file:
entry = birthday_list_file.readline().split(':')
while len(entry) == 2:
birthdays[str(entry[0])] = str(entry[1])
entry = birthday_list_file.readline().split(':')
return(birthdays)
def tell_birthdays(birthday_dictionary):
while True:
print(">>> Welcome to the birthday dictionary. We know the birthdays of:")
[print(name) for name in birthday_dictionary]
name = input(">>> Who's birthday do you want to look up? (or exit) ")
if name.lower() == "exit":
break
date = birthday_dictionary.get(name, "not found")
if date == "not found":
print("\n\nWe don't have {}'s birthday".format(name))
else:
print("\n\n{}'s birthday is {}".format(name, date))
if __name__ == '__main__':
birthdays = get_birthdays()
tell_birthdays(birthdays)
|
# Ejercicio 2.4.
nro_one = int(input("Ingrese primer nro: "))
nro_two = int(input("Ingrese segundo nro: "))
for i in range(nro_one, nro_two + 1):
if i % 2 == 0:
print(i)
|
n = int(input())
sequencia = [0]
if n > 1:
sequencia.append(1)
for i in range(2, n):
sequencia.append(sequencia[-1] + sequencia[-2])
print(' '.join(str(x) for x in sequencia))
|
"""
Description: instantiate object
"""
class EntityState:
"""
Physical/external base state of all entities.
"""
def __init__(self):
# physical position
self.p_pos = None
# physical velocity
self.p_vel = None
class Entity:
"""
Properties and state of physical world entity.
"""
def __init__(self):
self.name = ''
self.movable = False
self.collide = False
self.color = None
self.max_speed = None
self.state = EntityState()
self.initial_mass = 1.0
class Landmark(Entity):
"""
Properties of landmark entities.
"""
def __init__(self):
super(Landmark, self).__init__()
|
i = 0
def foo():
i = i + 1 # UnboundLocalError: local variable 'i' referenced before assignment
print(i)
foo() # i does not reference to global variable |
#!/usr/bin/env python3
# ~*~ coding: utf-8 ~*~
onetoten = range(1, 11)
for count in onetoten:
print(count)
## Shorter version:
#for count in range(1, 11):
# print(count)
|
class Solution(object):
def TwoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
for i in range(len(nums)):
for j in range(len(nums)):
if i != j:
if nums[i] + nums[j] == target:
return [i, j]
return [0, 0]
nums = [7, 2, 11, 15]
target = 9
p = Solution()
print(p.TwoSum(nums,target)) |
# Exercício 5.12 - Altere o programa anterior de forma a perguntar também o valor
# depositado mensalmente. Esse valor será depositado no início de cada mês, e você
# deve considerá-lo para o cálculo de juros do mês seguinte.
valor_inicial = float(input('\nInforme o valor do depósito inicial: R$'))
deposito_mensal = float(input('Informe o valor que você irá depositar mensalmente: R$'))
taxa_de_juros = float(input('Informe o valor da taxa de juros mensal: '))
mes = 1
juros_total = 0
print('\n')
while mes <= 24:
rendimento = valor_inicial * (taxa_de_juros / 100)
valor_inicial += rendimento + deposito_mensal
print('Acumulado %d° mês: R$%.2f' % (mes, valor_inicial))
juros_total += rendimento
mes += 1
print('\nTotal de ganho com juros no período de 24 meses: R$%.2f\n' % juros_total) |
class Solution:
# @param A : integer
# @return a strings
def convertToTitle(self, A):
alphalist = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
outputstring = ''
base = 26
while A != 0:
quo = A // base
rem = A % base
if rem == 0:
outputstring += 'Z'
A = quo - 1
else:
outputstring += alphalist[rem - 1]
A = quo
returnstring = outputstring[::-1]
return returnstring
A = 943566
# A = 28 * 26
s = Solution()
print(s.convertToTitle(A))
|
#https://galaiko.rocks/posts/2018-07-08/
def f(num):
return 1 if int(num) <= 26 else 0
def count_possibilites(enc):
length = len(enc)
if length == 1:
return 1
elif length == 2:
return f(enc) + 1
else:
return f(enc[:1]) * count_possibilites(enc[1:]) + f(enc[:2]) * count_possibilites(enc[2:])
testCase = '221282229182918928192912195211191212192819813'
print(count_possibilites(testCase)) |
#https://www.codewars.com/kata/convert-boolean-values-to-strings-yes-or-no
def bool_to_word(boolean):
return "Yes" if boolean == True else "No"
|
""" This problem was recently asked by Google.
Given a list of numbers and a number k, return whether any two numbers from the
list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true
since 10 + 7 is 17. Bonus: Can you do this in one pass? """
# BRUT FORCE SOLUTION
#
# arr = [10, 15, 3, 7]
# for i in arr:
# for j in arr:
# if i + j == 17:
# print(True)
# ONE PASS SOLUTION
def check(arr, num):
for i in arr:
needed_num = num - i
if needed_num in arr:
return True
if __name__ == '__main__':
arr = [10, 15, 3, 7]
checked = check(arr,17)
print(checked) |
######################################################################
#
# Copyright (C) 2013
# Associated Universities, Inc. Washington DC, USA,
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
# License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
#
# Correspondence concerning VLA Pipelines should be addressed as follows:
# Please register and submit helpdesk tickets via: https://help.nrao.edu
# Postal address:
# National Radio Astronomy Observatory
# VLA Pipeline Support Office
# PO Box O
# Socorro, NM, USA
#
######################################################################
# CALCULATE DATA WEIGHTS BASED ON ST. DEV. WITHIN EACH SPW
# use statwt
logprint ("Starting EVLA_pipe_statwt.py", logfileout='logs/statwt.log')
time_list=runtiming('checkflag', 'start')
QA2_statwt='Pass'
logprint ("Calculate data weights per spw using statwt", logfileout='logs/statwt.log')
# Run on all calibrators
default(statwt)
vis=ms_active
dorms=False
fitspw=''
fitcorr=''
combine=''
minsamp=2
field=''
spw=''
intent='*CALIBRATE*'
datacolumn='corrected'
statwt()
# Run on all targets
# set spw to exclude strong science spectral lines
# Calculate std excluding edges and middle of SPW
# spw_usechan = ''
# percents = np.array([0.1, 0.3, 0.7, 0.9])
# for idx, spw_num in enumerate(spws):
# perc_chans = np.round(channels[idx] * percents).astype(int)
# spw_usechan += str(idx) + ":{0}~{1};{2}~{3}".format(*perc_chans) + ","
# Here are the channels I would like to use for finding the stand. dev.
# This is now dependent on the instrument setup and should be removed for all
# other purposes?
hi_chans = "0:600~900;2800~3300"
rrl_chans = "10~25;100~110"
all_rrls = ""
for i in [1, 2, 4, 8, 9]:
all_rrls += "{0}:{1},".format(i, rrl_chans)
all_rrls = all_rrls[:-1]
oh_chans = "20~50;200~230"
all_ohs = ""
for i in [3, 5, 6, 7]:
all_ohs += "{0}:{1},".format(i, oh_chans)
all_ohs = all_ohs[:-1]
spw_usechan = "{0},{1},{2}".format(hi_chans, all_rrls, all_ohs)
default(statwt)
vis=ms_active
dorms=False
# fitspw=spw_usechan[:-1] # Use with the percentile finder above
fitspw=spw_usechan # Use with the user-defined channels
fitcorr=''
combine=''
minsamp=2
field=''
spw=''
intent='*TARGET*'
datacolumn='corrected'
statwt()
# Until we understand better the failure modes of this task, leave QA2
# score set to "Pass".
logprint ("QA2 score: "+QA2_statwt, logfileout='logs/statwt.log')
logprint ("Finished EVLA_pipe_statwt.py", logfileout='logs/statwt.log')
time_list=runtiming('targetflag', 'end')
pipeline_save()
######################################################################
|
#!/usr/bin/env python3
def handler(event, context):
print("Hello World!")
print("=====Event=====")
print("{}".format(event))
print("=====Context=====")
print("{}".format(context))
|
# Mackie CU pages
Pan = 0
Stereo = 1
Sends = 2
Effects = 3
Equalizer = 4
Free = 5
|
WIDTH = 800
HEIGHT = 800
BLACK = (60, 60, 60)
WHITE = (255, 255, 255)
HIGHLIGHT = (200, 0, 0)
WINDOW_NAME = 'PyChess'
ROWS = 8
COLUMNS = 8
SQUARE_SIZE = int(WIDTH/ROWS)
|
# BS mark.1-55
# /* coding: utf-8 */
# Author: WithcerGeralt
# Ported from BlackSmith m.2
# (c) simpleApps, 2011
def decodeHTML(data):
data = stripTags(data)
data = uHTML(data)
return data.strip()
def gismeteo(mType, source, body):
if body:
ls = body.split()
Numb = ls.pop(0)
if ls and Numb.isdigit():
City = body[(body.find(Numb) + len(Numb) + 1):].strip()
Numb = int(Numb)
else:
Numb, City = (None, body)
if -1 < Numb < 13 or not Numb:
try:
data = read_url("http://m.gismeteo.ru/citysearch/by_name/?" +\
urlencode({"gis_search": City.encode("utf-8")}), UserAgents["BlackSmith"])
except:
answer = u"Не могу получить доступ к странице."
else:
data = data.decode("utf-8")
data = data = re_search(data, "<a href=\"/weather/", "/(1/)*?\">", "\d+")
if data:
if Numb != None:
data = str.join(chr(47), [data, str(Numb) if Numb != 0 else "weekly"])
try:
data = read_url("http://m.gismeteo.ru/weather/%s/" % data, UserAgents["BlackSmith"])
except:
answer = u"Не могу получить доступ к странице."
else:
data = data.decode("utf-8")
mark = re_search(data, "<th colspan=\"2\">", "</th>")
if Numb != 0:
comp = re.compile('<tr class="tbody">\s+?<th.*?>(.+?)</th>\s+?<td.+?/></td>\s+?</tr>\s+?<tr>\s+?<td.+?>(.+?)</td>\s+?</tr>\s+?<tr class="dl">\s+?<td> </td>\s+?<td class="clpersp"><p>(.*?)</p></td>\s+?</tr>\s+?<tr class="dl"><td class="left">(.+?)</td><td>(.+?)</td></tr>\s+?<tr class="dl"><td class="left">(.+?)</td><td>(.+?)</td></tr>\s+?<tr class="dl bottom"><td class="left">(.+?)</td><td>(.+?)</td></tr>', 16)
list = comp.findall(data)
if list:
ls = [(decodeHTML(mark) if mark else "\->")]
for data in list:
ls.append("{0}:\n\t{2}, {1}\n\t{3} {4}\n\t{5} {6}\n\t{7} {8}".format(*data))
answer = decodeHTML(str.join(chr(10), ls)) + "\n*** Погода предоставлена сайтом GisMeteo.ru"
else:
answer = u"Проблемы с разметкой."
else:
comp = re.compile('<tr class="tbody">\s+?<td class="date" colspan="3"><a.+?>(.+?)</a></td>\s+?</tr>\s+?<tr>\s+?<td rowspan="2"><a.+?/></a></td>\s+?<td class="clpersp"><p>(.+?)</p></td>\s+?</tr>\s+?<tr>\s+?<td.+?>(.+?)</td>', 16)
list = comp.findall(data)
if list:
ls = [(decodeHTML(mark) if mark else "\->")]
for data in list:
ls.append("{0}:\n\t{1}, {2}".format(*data))
answer = decodeHTML(str.join(chr(10), ls)) + "\n*** Погода предоставлена сайтом GisMeteo.ru"
else:
answer = u"Проблемы с разметкой..."
else:
answer = u"Ничего не найдено..."
else:
answer = "SyntaxError: Invalid Syntax"
else:
answer = u"Недостаточно параметров."
reply(mType, source, answer)
command_handler(gismeteo, 10, "gismeteo") |
n=int(input())
s=input()
a=s.split()
sett=set(a)
lis=list(sett)
x=[int(i) for i in lis]
x.remove(max(x))
print(max(x))
|
"""
The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832.
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
66896648950445244523161731856403098711121722383113
62229893423380308135336276614282806444486645238749
30358907296290491560440772390713810515859307960866
70172427121883998797908792274921901699720888093776
65727333001053367881220235421809751254540594752243
52584907711670556013604839586446706324415722155397
53697817977846174064955149290862569321978468622482
83972241375657056057490261407972968652414535100474
82166370484403199890008895243450658541227588666881
16427171479924442928230863465674813919123162824586
17866458359124566529476545682848912883142607690042
24219022671055626321111109370544217506941658960408
07198403850962455444362981230987879927244284909188
84580156166097919133875499200524063689912560717606
05886116467109405077541002256983155200055935729725
71636269561882670428252483600823257530420752963450
Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?
"""
def consecutive_prod(number,string):
max_prod = 0
for i in range(number-1,len(string)):
prod = 1
for j in range(number):
prod *= int(string[i-j])
if prod > max_prod:
max_prod = prod
answer_list = string[i-number+1:i+1]
print(prod)
print(max_prod)
print(answer_list)
string = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963451'
consecutive_prod(13,string) |
# -- Project information -----------------------------------------------------
project = "Sphinx Book Theme"
copyright = "2020, Executable Book Project"
author = "Executable Book Project"
master_doc = "index"
extensions = ["myst_parser"]
html_theme = "sphinx_book_theme"
html_theme_options = {
"home_page_in_toc": True,
}
|
#
# For your reference:
#
# SinglyLinkedListNode:
# int data
# SinglyLinkedListNode next
#
def findMergeNode(head1, head2):
"""
Go forward the lists every time till the end, and
then jumps to the beginning of the opposite list, and
so on. Advance each of the pointers by 1 every time,
until they meet. The number of nodes traveled from
head1 -> tail1 -> head2 -> intersection point and
head2 -> tail2-> head1 -> intersection point will be equal.
"""
node1 = head1
node2 = head2
while node1 != node2:
if node1.next:
node1 = node1.next
else:
node1 = head2
if node2.next:
node2 = node2.next
else:
node2 = head1
return node2.data
|
#
# PySNMP MIB module FNET-OPTIVIEW-WAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FNET-OPTIVIEW-WAN-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:00:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint")
fnetOptiViewGeneric, = mibBuilder.importSymbols("FNET-GLOBAL-REG", "fnetOptiViewGeneric")
ovTrapDescription, ovTrapOffenderSubId, ovTrapSeverity, ovTrapAgentSysName, ovTrapOffenderName, ovTrapStatus, ovTrapOffenderNetAddr = mibBuilder.importSymbols("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription", "ovTrapOffenderSubId", "ovTrapSeverity", "ovTrapAgentSysName", "ovTrapOffenderName", "ovTrapStatus", "ovTrapOffenderNetAddr")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Integer32, MibIdentifier, Counter64, Bits, Counter32, Unsigned32, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, ObjectIdentity, TimeTicks, Gauge32, NotificationType, NotificationType, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "MibIdentifier", "Counter64", "Bits", "Counter32", "Unsigned32", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "ObjectIdentity", "TimeTicks", "Gauge32", "NotificationType", "NotificationType", "IpAddress")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
probSonetLinkDown = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12000)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probSonetErrors = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12001)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probSonetAlarms = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12002)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probAtmLinkDown = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12003)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probAtmErrors = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12004)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probPDUCRCErrors = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12005)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probPosLinkDown = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12006)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probPosErrorsDetected = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12007)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probLinkUtilization = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12008)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probDNSServerNoResp = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12009)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probDNSServerNowUsing = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12010)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probLostDHCPLease = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12011)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probDefaultRouterNoResp = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12012)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probDiscoveryFull = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12013)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probClearCounts = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12014)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probDS1LinkDown = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12015)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probDS1Errors = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12016)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probDS1Alarms = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12017)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probDS3LinkDown = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12018)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probDS3Errors = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12019)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probDS3Alarms = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12020)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probFrLmiLinkDown = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12021)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probFrLmiErrors = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12022)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probFrErrorsDetected = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12023)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probVcDown = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12024)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probInvalidDlci = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12025)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probFrDEUnderCIRUtilization = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12026)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probHdlcLinkDown = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12027)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probHdlcErrorsDetected = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12028)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probFrDteDceReversed = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12029)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
probKeyDevPingLatency = NotificationType((1, 3, 6, 1, 4, 1, 1226, 2, 1) + (0,12030)).setObjects(("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapAgentSysName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapSeverity"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapStatus"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapDescription"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderName"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderNetAddr"), ("FNET-OPTIVIEW-GENERIC-MIB", "ovTrapOffenderSubId"))
mibBuilder.exportSymbols("FNET-OPTIVIEW-WAN-MIB", probFrDteDceReversed=probFrDteDceReversed, probKeyDevPingLatency=probKeyDevPingLatency, probAtmLinkDown=probAtmLinkDown, probDefaultRouterNoResp=probDefaultRouterNoResp, probDS3LinkDown=probDS3LinkDown, probAtmErrors=probAtmErrors, probVcDown=probVcDown, probDNSServerNoResp=probDNSServerNoResp, probDS3Alarms=probDS3Alarms, probPDUCRCErrors=probPDUCRCErrors, probFrLmiErrors=probFrLmiErrors, probClearCounts=probClearCounts, probFrDEUnderCIRUtilization=probFrDEUnderCIRUtilization, probInvalidDlci=probInvalidDlci, probDS1Alarms=probDS1Alarms, probFrErrorsDetected=probFrErrorsDetected, probPosLinkDown=probPosLinkDown, probLinkUtilization=probLinkUtilization, probLostDHCPLease=probLostDHCPLease, probDS1Errors=probDS1Errors, probDiscoveryFull=probDiscoveryFull, probSonetLinkDown=probSonetLinkDown, probPosErrorsDetected=probPosErrorsDetected, probHdlcLinkDown=probHdlcLinkDown, probSonetErrors=probSonetErrors, probDNSServerNowUsing=probDNSServerNowUsing, probSonetAlarms=probSonetAlarms, probHdlcErrorsDetected=probHdlcErrorsDetected, probDS3Errors=probDS3Errors, probFrLmiLinkDown=probFrLmiLinkDown, probDS1LinkDown=probDS1LinkDown)
|
n = int (input('Cuantos numeros de fibonacii?'))
i = 0
a, b = 0, 1
while i < n :
print(a)
a, b = b, a+b
i = i + 1 |
#!/usr/bin/env python3
############################################################################################
# #
# Program purpose: Prints letter 'U' to the console. #
# Program Author : Happi Yvan <ivensteinpoker@gmail.com> #
# Creation Date : January 27, 2019 #
# #
############################################################################################
def print_letter_U():
for x in range(6):
print('*', ' ' * 3, '*')
print(('*' * 5).center(7, ' '))
if __name__ == '__main__':
print_letter_U()
|
__all__ = ('')
"""
Parent class to keep all statistical queries uniform
"""
class StatisticalTechnique():
def __init__(self, freqmap, latest_freqmap):
self.freqmap = freqmap
self.latest_freqmap = latest_freqmap
self.scores = dict()
def get_name(self):
pass
def process(self):
pass
def get_scores(self):
return self.scores
def get_freqmap(self):
return self.freqmap
def get_latest_freqmap(self):
return self.latest_freqmap |
def inc(x):
return x + 1
def catcher(event):
print(event.origin_state)
|
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
def numericals(s):
"""
For each symbol in the string if it's the
first character occurrence, replace it with
a '1', else replace it with the amount of
times you've already seen it.
:param s:
:return:
"""
char_dict = dict()
result = ''
for char in s:
if char in char_dict:
char_dict[char] += 1
else:
char_dict[char] = 1
result += str(char_dict[char])
return result
|
with open("original.txt", 'a') as jabber:
for i in range(2, 13):
for j in range(1, 13):
print(f"{j:>2} times {i} is {i * j}", file=jabber)
print("=" * 40, file=jabber)
|
def all_descendants(class_object, _memo=None):
if _memo is None:
_memo = {}
elif class_object in _memo:
return
yield class_object
for subclass in class_object.__subclasses__():
for descendant in all_descendants(subclass, _memo):
yield descendant
|
# -*- coding: utf-8 -*-
"""
Optimus project for basic.
Contains basic template, assets and settings without i18n enabled.
"""
|
s = float(input('Informe o salário: '))
a = float(input('Informe o aumento em %: '))
t = s + (s * a) / 100
print(f'Novo salário: R$ {t}')
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 2 18:04:28 2020
@author: boscolau
"""
class Buyer:
# Default constructor
def __init__(self, first_name: str, last_name: str, email: str):
"""
Initialize with specific values.
Parameters
----------
last_name : str
first_name : str
email : str
"""
self.last_name = last_name
self.first_name = first_name
self.email = email
def __str__(self):
return str(self.__dict__)
|
# -*- coding: utf-8 -*-
"""
___ _ ___ ___ ___ __ _ _ _
| \(_)__ _ _ _ __ _ ___ | \| _ \ __| / _(_) |___ __ _ ___ _ _ ___ _ _ __ _| |_ ___ _ _
| |) | / _` | ' \/ _` / _ \ | |) | / _| | _| | / -_) / _` / -_) ' \/ -_) '_/ _` | _/ _ \ '_|
|___// \__,_|_||_\__, \___/ |___/|_|_\_| |_| |_|_\___| \__, \___|_||_\___|_| \__,_|\__\___/_|
|__/ |___/ |___/
"""
__title__ = 'Django DRF File Generator'
__version__ = '0.1.15'
__author__ = 'Alexandre Proença'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015 Alexandre Proença'
# Version synonym
VERSION = __version__
# Header encoding (see RFC5987)
HTTP_HEADER_ENCODING = 'iso-8859-1'
# Default datetime input and output formats
ISO_8601 = 'iso-8601'
|
""" Implementa as funcoes personalizadas """
# Retira parenteses, tracos e espacos de um numeo de telefone
def numpurotelefone(textodigitado):
numpuro = textodigitado.replace('+', '')
numpuro = numpuro.replace('(', '')
numpuro = numpuro.replace(')', '')
numpuro = numpuro.replace('-', '')
numpuro = numpuro.replace(' ', '')
return numpuro
# Formata um numero de telefone colocando parenteses, espacos e traco
def format_telefone(str_numero_puro):
numero_formatado = str_numero_puro
n = len(str_numero_puro)
if len(str_numero_puro) >= 11:
# telefone celular
numero_formatado = f'({str_numero_puro[0:2]}) {str_numero_puro[2:7]}-{str_numero_puro[7:n]}'
elif len(str_numero_puro) >= 10:
# telefone fixo
numero_formatado = f'({str_numero_puro[0:2]}) {str_numero_puro[2:7]}-{str_numero_puro[7:n]}'
elif len(str_numero_puro) >= 7:
numero_formatado = f'({str_numero_puro[0:2]}) {str_numero_puro[2:n]}'
return numero_formatado
# Formata uma lista de telefones fornecidos
def format_list_telefone(str_lista_pura):
lista_telefones = [format_telefone(numero_puro) for numero_puro in str_lista_pura]
# for numero_puro in str_lista_pura:
# lista_telefones.append(format_telefone(numero_puro))
return lista_telefones
# Retorna o nome da sequencia de novo orcamento requerida
def nomesequencia(strseq):
if strseq == 1:
result = 'Novo Pré-Orçamento'
elif strseq == 2:
result = 'Nova Visita'
elif strseq == 3:
result = 'Novo Orçamento'
elif strseq == 4:
result = 'Nova Proposta'
else:
result = 'Novo Contrato'
return result
# Retorna texto para filtro conforme opcoes fornecidas
def textofiltro(nomecampo, filtro):
tipofiltro, valor = filtro.split(".")
if tipofiltro == '':
txtfiltro = ''
elif tipofiltro == 'A-B-C':
vlrpar = int(valor)
txtfiltro = ' ((Left(' + nomecampo + ', 1) = ' + chr(39) + chr(65+3*(vlrpar-1)) + chr(39) + ')'
txtfiltro = txtfiltro + ' OR (Left(' + nomecampo + ', 1) = ' + chr(39) + chr(66+3*(vlrpar-1)) + chr(39) + ')'
if vlrpar < 9:
txtfiltro = txtfiltro + ' OR (Left(' + nomecampo + ', 1) = ' + chr(39) + chr(67+3*(vlrpar-1)) + chr(39) + \
')'
txtfiltro = txtfiltro + ')'
else:
txtfiltro = ' (' + nomecampo + ' like %s )'
return txtfiltro
# Retorna lista com codigos superiores ao fornecido
def listacodigossup(codatual):
nivatual = codatual.count('.')
result = []
if nivatual > 1:
numeros = codatual.split('.')
for cont in range(nivatual-1):
if cont > 0:
result.append(result[cont - 1] + numeros[cont] + '.')
else:
result.append(numeros[cont] + '.')
return result
|
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Budgets Management',
'category': 'Accounting',
'description': """
This module allows accountants to manage analytic and crossovered budgets.
==========================================================================
Once the Budgets are defined (in Invoicing/Budgets/Budgets), the Project Managers
can set the planned amount on each Analytic Account.
The accountant has the possibility to see the total of amount planned for each
Budget in order to ensure the total planned is not greater/lower than what he
planned for this Budget. Each list of record can also be switched to a graphical
view of it.
Three reports are available:
----------------------------
1. The first is available from a list of Budgets. It gives the spreading, for
these Budgets, of the Analytic Accounts.
2. The second is a summary of the previous one, it only gives the spreading,
for the selected Budgets, of the Analytic Accounts.
3. The last one is available from the Analytic Chart of Accounts. It gives
the spreading, for the selected Analytic Accounts of Budgets.
""",
'website': 'https://www.odoo.com/page/accounting',
'depends': ['account'],
'data': [
'security/ir.model.access.csv',
'security/account_budget_security.xml',
'views/account_analytic_account_views.xml',
'views/account_budget_views.xml',
],
'demo': ['data/account_budget_demo.xml'],
}
|
# Write a program to take input marks of two subject and print aggregate.
S1=int(input("Enter 1st Marks:"))
S2=int(input("Enter 2nd Marks:"))
Total = S1 + S2;
Avg = Total/2;
print("Total marks = ", Total)
print("Average marks = ", Avg) |
"""
Ticket numbers usually consist of an even number of digits.
A ticket number is considered lucky if the sum of the first
half of the digits is equal to the sum of the second half.
Given a ticket number n, determine if it's lucky or not.
Example
For n = 1230, the output should be
isLucky(n) = true;
For n = 239017, the output should be
isLucky(n) = false.
Input/Output
[execution time limit] 4 seconds (py3)
[input] integer n
A ticket number represented as a positive integer with an even number of digits.
Guaranteed constraints:
10 ≤ n < 106.
[output] boolean
true if n is a lucky ticket number, false otherwise.
"""
def isLucky(n):
res = [int(x) for x in str(n)]
if len(res) % 2 > 0:
return False
sum1 = 0
sum2 = 0
for i in range(len(res)):
if (i < (len(res)//2)):
sum1 += res[i]
print(sum1)
else:
sum2 += res[i]
print(sum2)
if sum1 == sum2:
return True
return False
def isLucky(n):
s = str(n)
pivot = len(s)//2
left, right = s[:pivot], s[pivot:]
return sum(map(int, left)) == sum(map(int, right))
n = 1230
print(isLucky(n)) |
# Take 2 of int, char or string, return the grater of 2
def greater(in_type, two_args):
if in_type == "int":
for i in range(len(two_args)):
two_args[i] = int(two_args[i])
elif in_type == "char":
for i in range(two_args):
two_args[i] = two_args[i][0]
two_args[i].title()
elif in_type == "string":
for i in range(two_args):
two_args[i].title()
else:
pass
result = two_args[0]
for i in range(two_args):
if two_args[i] >= result:
result = two_args[i]
result.title()
return(result)
input_type = input()
input_1 = input()
input_2 = input()
result = greater(input_type, [input_1, input_2])
print(result)
|
class Result:
INDEX = 0
COLUMN = 1
DOCUMENT = 2
|
def class_extensions():
def _additional_used_columns(self, parms):
"""
:return: Start and stop column if specified.
"""
result = []
for col in ["start_column", "stop_column"]:
if col in parms and parms[col] is not None:
result.append(parms[col])
return result
extensions = dict(
__class__=class_extensions,
)
doc = dict(
__class__="""
Trains a Cox Proportional Hazards Model (CoxPH) on an H2O dataset.
"""
)
|
def compute_acc(results):
labels = [pair[1] for pair in results]
predicts = [pair[2] for pair in results]
assert len(labels) == len(predicts)
acc = 0
for label, predict in zip(labels, predicts):
if label == predict:
acc += 1
return acc / len(labels) |
users = {
'juho': {
'name': 'Juho',
'username': 'juho',
'hashed_password': 'ei-selkokielinen-salasana',
'role': 'opettaja'
},
'olli': {
'name': 'Olli Opiskelija',
'username': 'olli',
'hashed_password': 'ei-selkokielinen-salasana',
'role': 'student'
}
}
|
configs = {
"python" :
{
"filesuffix" : ".py",
"commentstart" : "'''",
"commentend" : "'''",
"indent" : " ",
"blockstart" : "",
"blockend" : "",
"function" : "def {fnname}({var}):",
"var" : "{varname}",
"if" : "if {cond}:",
"elseif" : "elif {cond}:",
"else" : "else:",
"switchsupport" : False,
"assignement" : "{var} = {exp}",
"conditional" : "{exp1} if {cond} else {exp2}",
"equal" : "{exp1} == {exp2}",
"and" : "{exp1} and {exp2}",
"or" : "{exp1} or {exp2}",
"charquote" : "'",
"strquote" : "'",
"return" : "return {exp}",
"charatpos" : "{var}[{pos}]",
"leftstr" : "{var}[:{length}]",
"rightstr" : "{var}[-{length}:]",
"lowercase" : "{var}.lower()",
"uppercase" : "{var}.upper()",
"titlecase" : "{var}.title()",
"islowercase" : "{var}.islower()",
"isuppercase" : "{var}.isupper()",
"istitlecase" : "{var}.istitle()",
"concat" : "{str1} + {str2}",
"tuple" : "({exp1}, {exp2})",
"strlen" : "len({var})",
"strnegativepos" : True,
"fetchcharoptimization": True,
"funcdoc" : "\"\"\"Vrací pátý pád jména k prvnímu pádu\n\nArgumenty:\njmeno -- první pád jména\n\"\"\"",
"docinsidefunction" : True,
},
"php" :
{
"filesuffix" : ".php",
"filestart" : "<?php",
"fileend" : "?>",
"commentstart" : "/*",
"commentend" : "*/",
"indent" : "\t",
"blockstart" : "{",
"blockend" : "}",
"function" : "function {fnname}({var}) {{",
"functionend" : "}",
"var" : "${varname}",
"if" : "if ({cond}) {{",
"elseif" : "}} elseif ({cond}) {{",
"else" : "} else {",
"endif" : "}",
"switchsupport" : True,
"switch" : "switch ({var}) {{",
"endswitch" : "}",
"case" : "case {exp}:",
"endcase" : "\tbreak;",
"default" : "default:",
"enddefault" : False,
"assignement" : "{var} = {exp};",
"conditional" : "{cond} ? {exp1} : {exp2}",
"equal" : "{exp1} == {exp2}",
"and" : "{exp1} && {exp2}",
"or" : "{exp1} || {exp2}",
"charquote" : "'",
"strquote" : "\"",
"return" : "return {exp};",
"charatpos" : "{var}[{pos}]",
"strlen" : "strlen({var})",
"leftstr" : "substr({var}, 0, {length})",
"rightstr" : "substr({var}, -{length})",
"lowercase" : "mb_convert_case({var}, MB_CASE_LOWER, \"UTF-8\")",
"uppercase" : "mb_convert_case({var}, MB_CASE_UPPER, \"UTF-8\")",
"titlecase" : "mb_convert_case({var}, MB_CASE_TITLE, \"UTF-8\")",
"islowercase" : "mb_convert_case({var}, MB_CASE_LOWER) == {var}",
"isuppercase" : "mb_convert_case({var}, MB_CASE_UPPER) == {var}",
"istitlecase" : "preg_match(\"/^[A-ZÁČĎÉÍŇÓŘŠŤÚÝŽ][a-záčďéěíňóřšťúůýž]*$/u\", {var})",
"concat" : "{str1} . {str2}",
"tuple" : "[{exp1}, {exp2}]",
# "tuple" : "array({exp1}, {exp2})", # PHP < 5.4
"strnegativepos" : False,
"fetchcharoptimization": True,
"funcdoc" : "/**\n * Vrací pátý pád jména k prvnímu pádu\n * @param string $jmeno první pád jména\n*/",
"docinsidefunction" : False,
},
"javascript" :
{
"filesuffix" : ".js",
"commentstart" : "/*",
"commentend" : "*/",
"indent" : "\t",
"blockstart" : "{",
"blockend" : "}",
"function" : "function {fnname}({var}) {{",
"functionend" : "}",
"var" : "{varname}",
"vardeclaration" : "var {var};",
"if" : "if ({cond}) {{",
"elseif" : "}} else if ({cond}) {{",
"else" : "} else {",
"endif" : "}",
"switchsupport" : True,
"switch" : "switch ({var}) {{",
"endswitch" : "}",
"case" : "case {exp}:",
"endcase" : "\tbreak;",
"default" : "default:",
"enddefault" : False,
"assignement" : "{var} = {exp};",
"conditional" : "{cond} ? {exp1} : {exp2}",
"equal" : "{exp1} == {exp2}",
"and" : "{exp1} && {exp2}",
"or" : "{exp1} || {exp2}",
"charquote" : "'",
"strquote" : "\"",
"return" : "return {exp};",
"charatpos" : "{var}.charAt({pos})",
"strlen" : "{var}.length",
"leftstr" : "{var}.substr(0, {length})",
"rightstr" : "{var}.substr({var}.length - {length})",
"lowercase" : "{var}.toLowerCase()",
"uppercase" : "{var}.toUpperCase()",
"titlecase" : "{var}.replace(/\w\S*/g, function(txt){{return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}})",
"islowercase" : "{var}.toLowerCase() == {var}",
"isuppercase" : "{var}.toUpperCase() == {var}",
"istitlecase" : "{var}.match(/^[A-ZÁČĎÉÍŇÓŘŠŤÚÝŽ][a-záčďéěíňóřšťúůýž]*$/u)",
"concat" : "{str1} + {str2}",
"tuple" : "[{exp1}, {exp2}]",
"strnegativepos" : False,
"fetchcharoptimization": True,
"funcdoc" : "/**\n * Vrací pátý pád jména k prvnímu pádu\n * @param {String} jmeno první pád jména\n*/",
"docinsidefunction" : False,
},
"micropython" :
{
"filesuffix" : ".py",
"commentstart" : "'''",
"commentend" : "'''",
"indent" : " ",
"blockstart" : "",
"blockend" : "",
"function" : "def {fnname}({var}):",
"var" : "{varname}",
"if" : "if {cond}:",
"elseif" : "elif {cond}:",
"else" : "else:",
"switchsupport" : False,
"assignement" : "{var} = {exp}",
"conditional" : "{exp1} if {cond} else {exp2}",
"equal" : "{exp1} == {exp2}",
"and" : "{exp1} and {exp2}",
"or" : "{exp1} or {exp2}",
"charquote" : "'",
"strquote" : "'",
"return" : "return {exp}",
"charatpos" : "{var}[{pos}]",
"leftstr" : "{var}[:{length}]",
"rightstr" : "{var}[-{length}:]",
"lowercase" : "{var}.lower()",
"uppercase" : "{var}.upper()",
"titlecase" : "{var}[0].upper() + {var}[1:].lower()",
"islowercase" : "{var}.islower()",
"isuppercase" : "{var}.isupper()",
"istitlecase" : "{var}[0].isupper() and {var}[1:].islower()",
"concat" : "{str1} + {str2}",
"tuple" : "({exp1}, {exp2})",
"strlen" : "len({var})",
"strnegativepos" : True,
"fetchcharoptimization": True,
"funcdoc" : "\"\"\"Vrací pátý pád jména k prvnímu pádu\n\nArgumenty:\njmeno -- první pád jména\n\"\"\"",
"docinsidefunction" : True,
},
}
|
# Conjuntos são valores que nunca se repetem.
conjunto = {1, 2, 3, 4, 5}
conjunto2 = {5, 6 ,7, 8}
conjunto_uinao = conjunto.union(conjunto2) #une um conjunto ao outro
print('União: {}' .format(conjunto_uinao))
conjunto_interseccao = conjunto.intersection(conjunto2) #faz a intersecção do conjunto.
print('Intersecção: {}' .format (conjunto_interseccao))
conjunto_diferenca1 = conjunto.difference(conjunto2) #mostra os números que estão diferentes
conjunto_diferenca2 = conjunto2.difference(conjunto)
print('Diferença entre 1 e 2: {}'.format (conjunto_diferenca1))
print('Diferença entre 2 e 1: {}'.format (conjunto_diferenca2))
conjunto_diff_simetrica = conjunto.symmetric_difference(conjunto2)
print('Diferença simétrica: {}'.format(conjunto_diff_simetrica)) #traz a diferença entre um e outro conjunto.
#pertinencia
conjunto_a = {1, 2, 3}
conjunto_b = {1, 2, 3, 4, 5}
conjunto_subset = conjunto_a.issubset(conjunto_b)
print('A é subconjunto de B: {}'.format (conjunto_subset))
conjunto_superset = conjunto_b.issuperset(conjunto_a) #superconjunto
print('B é um um superconjunto de A: {}'.format(conjunto_superset))
# se estivermos trabalhando com uma lista, e quisermos tirar a duplicidade dela:
lista = ['cachorro', 'cachorro', 'gato', 'gato', 'elefante']
print(lista)
conjunto_animais = set(lista)
print(conjunto_animais)
lista_animais = list(conjunto_animais)
print(lista_animais)
'''conjunto = {1, 2, 3, 4}
conjunto.add(5) #adiciono elementos no meu conjunto;
conjunto.discard(2) #removo elementos do meu conjunto;
print(conjunto)''' |
# Remove Linear, annual, and semiannual trends
# Note: The keyword annual also removes semiannual trends
# To only remove semiannual but not annual trends,
# replace 'annual' with 'semiannual'
ap_tf_type = AutoList(['linear','annual'])
# Create Trend Filter to remove linear, annual, and semi-annual trend
fl_tf = skdiscovery.data_structure.series.filters.TrendFilter('TrendFilter', [ap_tf_type])
# Create stage container for the trend filter
sc_tf = StageContainer(fl_tf)
|
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""
Functions to manipulate packed binary representations of number sets.
To save space, coverage stores sets of line numbers in SQLite using a packed
binary representation called a numbits. A numbits is a set of positive
integers.
A numbits is stored as a blob in the database. The exact meaning of the bytes
in the blobs should be considered an implementation detail that might change in
the future. Use these functions to work with those binary blobs of data.
"""
def nums_to_numbits(nums):
"""Convert `nums` into a numbits.
Arguments:
nums: a reusable iterable of integers, the line numbers to store.
Returns:
A binary blob.
"""
try:
nbytes = max(nums) // 8 + 1
except ValueError:
# nums was empty.
return b''
bb = bytearray(nbytes)
for num in nums:
bb[num//8] |= 1 << num % 8
return bytes(bb)
def numbits_to_nums(numbits):
"""Convert a numbits into a list of numbers.
Arguments:
numbits: a binary blob, the packed number set.
Returns:
A list of ints.
When registered as a SQLite function by :func:`register_sqlite_functions`,
this returns a string, a JSON-encoded list of ints.
"""
nums = []
for byte_i, byte in enumerate(numbits):
for bit_i in range(8):
if (byte & (1 << bit_i)):
nums.append(byte_i * 8 + bit_i)
return nums
|
class Solution:
def minCostClimbingStairs(self, cost: List[int]) -> int:
n = len(cost)
f = [None] * (n + 1)
f[0] = 0
f[1] = 0
for i in range(2, n + 1):
f[i] = min(f[i - 1] + cost[i - 1], f[i - 2] + cost[i - 2])
return f[n]
|
def selectZb (Zb,fit,xb,t,p,nparticulas):
# Seleciona a melhor forma encontrada pela partícula até o memento
#
# [Zb,xb,t] = selectZb (Zb,fit,xb,t,p,np)
#
# Zb: melhor forma da partícula
# xb: melhor posição da partícula encontrada até o momento
# t: parâmetro para atualização da velocidade
# fit: forma da partícula no momento
# p: posição atual da partícula no enxame
# np: número de partículas
# obj: psoição do objetivo analizado (otimização multiobjetivo)
for i in range(nparticulas):
if fit[i] < Zb[i]:
Zb[i] = fit[i]
xb[i][:] = p[i][:]
t[i]=0
else:
t[i]=1
Zbxbt=[Zb,xb,t]
return Zbxbt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.