content
stringlengths 7
1.05M
|
---|
# Project Euler Problem 7- 10001st prime
# https://projecteuler.net/problem=7
# Answer = 104743
def is_prime(num):
for i in range(2, num):
if (num % i) == 0:
return False
return True
def prime_list():
prime_list = []
num = 2
while True:
if is_prime(num):
prime_list.append(num)
if len(prime_list) == 10001:
return(prime_list[-1])
break
num += 1
print(prime_list())
|
# Approach 2 - Greedy with Stack
# Time: O(N)
# Space: O(N)
class Solution:
def removeKdigits(self, num: str, k: int) -> str:
num_stack = []
for digit in num:
while k and num_stack and num_stack[-1] > digit:
num_stack.pop()
k -= 1
num_stack.append(digit)
final_stack = num_stack[:-k] if k else num_stack
return ''.join(final_stack).lstrip("0") or "0"
|
def get_keys(filename):
with open(filename) as f:
data = f.read()
doc = data.split("\n")
res = []
li = []
for i in doc:
if i != "":
li.append(i)
else:
res.append(li)
li=[]
return res
if __name__=="__main__":
filename = './input.txt'
input = get_keys(filename)
sum = 0
result = []
for i in input:
check = "".join(i)
result.append(list(set(list(check))))
for i in result:
sum+=len(i)
print(f"Your puzzle answer was {sum}.")
|
expected_output = {
"mac_table": {
"vlans": {
"100": {
"mac_addresses": {
"ecbd.1dff.5f92": {
"drop": {"drop": True, "entry_type": "dynamic"},
"mac_address": "ecbd.1dff.5f92",
},
"3820.56ff.6f75": {
"interfaces": {
"Port-channel12": {
"interface": "Port-channel12",
"entry_type": "dynamic",
}
},
"mac_address": "3820.56ff.6f75",
},
"58bf.eaff.e508": {
"interfaces": {
"Vlan100": {"interface": "Vlan100", "entry_type": "static"}
},
"mac_address": "58bf.eaff.e508",
},
},
"vlan": 100,
},
"all": {
"mac_addresses": {
"0100.0cff.9999": {
"interfaces": {
"CPU": {"interface": "CPU", "entry_type": "static"}
},
"mac_address": "0100.0cff.9999",
},
"0100.0cff.999a": {
"interfaces": {
"CPU": {"interface": "CPU", "entry_type": "static"}
},
"mac_address": "0100.0cff.999a",
},
},
"vlan": "all",
},
"20": {
"mac_addresses": {
"aaaa.bbff.8888": {
"drop": {"drop": True, "entry_type": "static"},
"mac_address": "aaaa.bbff.8888",
}
},
"vlan": 20,
},
"10": {
"mac_addresses": {
"aaaa.bbff.8888": {
"interfaces": {
"GigabitEthernet1/0/8": {
"entry": "*",
"interface": "GigabitEthernet1/0/8",
"entry_type": "static",
},
"GigabitEthernet1/0/9": {
"entry": "*",
"interface": "GigabitEthernet1/0/9",
"entry_type": "static",
},
"Vlan101": {
"entry": "*",
"interface": "Vlan101",
"entry_type": "static",
},
},
"mac_address": "aaaa.bbff.8888",
}
},
"vlan": 10,
},
"101": {
"mac_addresses": {
"58bf.eaff.e5f7": {
"interfaces": {
"Vlan101": {"interface": "Vlan101", "entry_type": "static"}
},
"mac_address": "58bf.eaff.e5f7",
},
"3820.56ff.6fb3": {
"interfaces": {
"Port-channel12": {
"interface": "Port-channel12",
"entry_type": "dynamic",
}
},
"mac_address": "3820.56ff.6fb3",
},
"3820.56ff.6f75": {
"interfaces": {
"Port-channel12": {
"interface": "Port-channel12",
"entry_type": "dynamic",
}
},
"mac_address": "3820.56ff.6f75",
},
},
"vlan": 101,
},
}
},
"total_mac_addresses": 10,
}
|
"""
This module contains the default settings that stand unless overridden.
"""
#
## Gateway Daemon Settings
#
# Default port to listen for HTTP uploads on.
GATEWAY_WEB_PORT = 8080
# PUB - Connect
GATEWAY_SENDER_BINDINGS = ["ipc:///tmp/announcer-receiver.sock"]
# If set as a string, this value is used as the salt to create a hash of
# each uploader's IP address. This in turn gets set as the EMDR upload key.
GATEWAY_IP_KEY_SALT = None
#
## ZeroMQ-based Gateway Daemon Settings
#
# PULL - Bind
GATEWAY_ZMQ_RECEIVER_BINDINGS = ["ipc:///tmp/gateway-zmq-receiver.sock"]
# By default, use the same as the HTTP gateway, for easy testing.
# PUB - Connect
GATEWAY_ZMQ_SENDER_BINDINGS = ["ipc:///tmp/announcer-receiver.sock"]
# The number of worker greenlets to listen for data on.
GATEWAY_ZMQ_NUM_WORKERS = 5
#
## Announcer Daemon Settings
#
# SUB - Bind
ANNOUNCER_RECEIVER_BINDINGS = ["ipc:///tmp/announcer-receiver.sock"]
# PUB - Bind
ANNOUNCER_SENDER_BINDINGS = ["ipc:///tmp/announcer-sender.sock"]
#
## Relay Daemon Settings
#
# SUB - Connect
RELAY_RECEIVER_BINDINGS = ["ipc:///tmp/announcer-sender.sock"]
# PUB - Bind
RELAY_SENDER_BINDINGS = ["ipc:///tmp/relay-sender.sock"]
# If True, outbound messages to subscribers are decompressed.
RELAY_DECOMPRESS_MESSAGES = False
# Default to memcached, as it's fast.
RELAY_DEDUPE_BACKEND = "memcached"
# For dedupe backends that require a connection string of some sort, store it
# here. We'll default to localhost for now. Use a list of strings.
RELAY_DEDUPE_BACKEND_CONN = ["127.0.0.1"]
# For timeout based backends, this determines how long (in seconds) we store
# the message hashes.
RELAY_DEDUPE_STORE_TIME = 300
# For memcached and other key/value stores, this is prefixed to the hash
# to form the cache key. This is useful to avoid clashes for multi-tenant
# situations.
RELAY_DEDUPE_STORE_KEY_PREFIX = 'emdr-relay-dd'
#
## Logging Settings
#
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
'format': '%(name)s -- %(levelname)s -- %(asctime)s: %(message)s'
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
'null': {
'level': 'DEBUG',
'class': 'logging.NullHandler',
},
},
'loggers': {
'': {
'handlers': ['console'],
'level': 'INFO',
'propagate': True,
},
},
}
|
package = FreeDesktopPackage('%{name}', 'pkg-config', '0.27',
configure_flags=["--with-internal-glib"])
if package.profile.name == 'darwin':
package.m64_only = True
|
def task_format():
return {
"actions": ["black .", "isort ."],
"verbosity": 2,
}
def task_test():
return {
"actions": ["tox -e py39"],
"verbosity": 2,
}
def task_fulltest():
return {
"actions": ["tox --skip-missing-interpreters"],
"verbosity": 2,
}
def task_build():
return {
"actions": ["flit build"],
"task_dep": ["precommit"],
"verbosity": 2,
}
def task_publish():
return {
"actions": ["flit publish"],
"task_dep": ["build"],
"verbosity": 2,
}
def task_precommit():
return {"actions": None, "task_dep": ["format", "fulltest"]}
|
'''
This class takes a dictionnary as arg
Converts it into a list
This list will contain args that will be given to FileConstructor class
This list allows to build the core of the new file
'''
class RecursivePackager:
'''
arg_dict argument = dictionnary
This dictionnary has to be built by ParseIntoCreate.creating_new_dicts function
'''
def __init__(self, arg_dict):
# arg_dict is self.realdict that comes from ParseIntoCreate.creating_new_dicts function
self.arg_dict = arg_dict
# This list is going to be returned with all informations parsed
self.returned_list = []
# This list contains all widgets that are on the same tree place.
# It first contains self.arg_dict, then will contain any child
# arg_dict has.
self.running_list = [arg_dict]
# self.master_list works with self.running_list.
# It helps giving master widget to recursive_list_creator function
self.master_list = [""]
#Launching recursive function
self.recursive_list_creator(self.running_list[0], self.master_list)
def recursive_list_creator(self, curr_dict_iteration, master_widget):
"""This is the main function of the class. It allows to convert
curr_iteration into a list.
master_widget is the master's widget id. Usefull for writing objects.
List datas renders like this:
returned_list = [["master_id",
"id",
"class_valor",
["properties_valors"],
["layout_valors"]],
[etc...]
]
properties_valors comes like this : ["borderwidth='3', height='100',
text={},
width='465'", "text_of_property",
"some text"]
layout_valors comes like this : ["grid(column='0', row='4', sticky='w')",
"grid_propagate(0)"]
layout_valors are always lists, even if there is only one valor
properties_valors are always lists, even if there is no text.
"""
# Check if it's dictionnary or list
if isinstance(curr_dict_iteration, list):
for args in curr_dict_iteration:
# List for current iteration
current_iteration = []
# Adding master's widget. Default = none
current_iteration.append(master_widget)
# If it's a dict
list_temp = self.widget_list_compacter(args["object"])
for val in list_temp:
current_iteration.append(val)
# Adding informations to returned_list
self.returned_list.append(current_iteration)
elif isinstance(curr_dict_iteration, dict):
if "object" in curr_dict_iteration:
curr_dict_iteration = curr_dict_iteration["object"]
list_temp = self.widget_list_compacter(curr_dict_iteration)
# List for current iteration
current_iteration = []
# Adding master's widget. Default = none
current_iteration.append(master_widget)
for val in list_temp:
current_iteration.append(val)
# Adding informations to returned_list
self.returned_list.append(current_iteration)
# deleting current iteration
del self.running_list[0]
del self.master_list[0]
# Recursive loop launched
while self.running_list:
self.recursive_list_creator(self.running_list[0], self.master_list[0])
def widget_list_compacter(self, dictio):
"""This function take dictio as arg, and creates a fully fonctionnal
list out of it.
dictio should be one full instance of a widget and contain "id"
and "layout" valors.
"""
# Temporary list that will stock informations and return them once
# gathered
list_for_current_iteration = []
# Add id valor
if "id" not in dictio:
list_for_current_iteration.append("")
elif "id" in dictio:
list_for_current_iteration.append(dictio["id"])
# Add class valor
list_for_current_iteration.append(dictio["class"])
# Add properties valors
if "property" in dictio:
list_for_current_iteration.append(self.creating_properties_valors(dictio["property"]))
elif not "property" in dictio:
list_for_current_iteration.append([])
if "layout" in dictio:
list_for_current_iteration.append(self.creating_layout_valors(dictio["layout"]))
elif not "layout" in dictio:
list_for_current_iteration.append([])
# Adding to running_list and master_list dictionnaries / lists to
# continue the recursive loop
if "child" in dictio:
self.running_list.append(dictio["child"])
self.master_list.append(dictio["id"])
# Returning temporary dictionnary
return list_for_current_iteration
def creating_properties_valors(self, dict_or_list):
"""This function converts dictionnary "properties" into writable
code."""
# list that will stock informations and give it to list_for_current_iteration
creating_properties = []
#check if dict_or_list is a dict or list
if isinstance(dict_or_list, list):
#If it's a list
for properties in dict_or_list:
# if list is not empty and properties does NOT contain text
if creating_properties and properties["name"] != "text":
creating_properties[0] += ", {}='{}'".format(properties["name"],
properties["property"])
# if list is not empty and properties does contain text
elif creating_properties and properties["name"] == "text":
creating_properties[0] += ", " + properties["name"] + "={}"
creating_properties.append(properties["property"])
# If list is empty and properties does NOT contain text
elif not creating_properties and properties["name"] != "text":
creating_properties.append("({}='{}'".format(properties["name"],
properties["property"]))
#if list is empty and properties contains text
elif not creating_properties and properties["name"] == "text":
creating_properties.append("(" + properties["name"] + "={}")
creating_properties.append(properties["property"])
#After the loop, returns the list
creating_properties[0] += ")"
return creating_properties
# if dict_or_list is a dict and name contains text
if dict_or_list["name"] == "text":
creating_properties.append("(" + dict_or_list["name"] + "={})")
creating_properties.append(dict_or_list["property"])
# if dict_or_list is a dict and name does NOT contains text
else:
creating_properties.append("({}='{}')".format(dict_or_list["name"],
dict_or_list["property"]))
#After giving all informations from the dict, returning the list
return creating_properties
def creating_layout_valors(self, layout_data):
"""This function converts dictionnary/list "valors" into writable
code."""
# list that will stock informations and give it to
# list_for_current_iteration
creating_layout = []
# Adding grid, place or pack on top of returning list
creating_layout.append(layout_data["manager"])
if "property" in layout_data:
if isinstance(layout_data["property"], list):
creating_layout[0] += "("
for properties in layout_data["property"]:
if properties["name"] == "propagate":
if properties["property"] == "False":
creating_layout.append("{}_propagate(0)".format(layout_data["manager"]))
elif properties["name"] != "propagate":
if creating_layout:
creating_layout[0] += "{}='{}', ".format(properties["name"],
properties["property"])
# Finally close ) of creating_layout[0]
# Remove , and space from loop above
creating_layout[0] = creating_layout[0][:-2] + ")"
elif isinstance(layout_data["property"], dict):
if layout_data["property"]["name"] == "propagate":
# If propagate = True
if layout_data["property"]["property"] == "True":
creating_layout[0] += "()"
# If propagate = False
elif layout_data["property"]["property"] == "False":
creating_layout[0] += "()"
creating_layout.append("{}_propagate(0)".format(layout_data["manager"]))
# If name is not propagate
elif layout_data["property"]["name"] != "propagate":
creating_layout[0] += "({}='{}')".format(layout_data["property"]["name"],
layout_data["property"]["property"])
# If no properties for layout, then close args
if not "property" in layout_data:
creating_layout[0] += "()"
# After fulfilling informations, returning the list
return creating_layout
def return_converted_list(self):
"""This function returns self.returned_list."""
return self.returned_list
if __name__ == '__main__':
pass
|
vezesInput = 0
valoresPositivos = 0
soma = 0
for c in range(0, 6, 1):
valor = float(input())
if valor > 0:
valoresPositivos += 1
soma += valor
print(f'{valoresPositivos} valores positivos')
print(f'{soma/valoresPositivos:.1f}')
'''lista = list()
vezesInput = 0
while vezesInput < 6:
valor = float(input())
if valor > 0:
lista.append(valor)
vezesInput += 1
quantidadeNumeros = len(lista)
print(f'{quantidadeNumeros} valores positivos')
print(f'{sum(lista)/quantidadeNumeros:.1f}')
SÓ PARA TREINAR LISTAS
'''
|
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This class is auto generated by the jdcloud code generator program.
class UserInfo(object):
def __init__(self, pin=None, updateTime=None, createTime=None, userType=None, balanceAmount=None, totalCallAmount=None, totalBuyAmount=None, resourceAmount=None, following=None):
"""
:param pin: (Optional) 用户pin
:param updateTime: (Optional) 更新时间, yyyy-mm-dd hh:mm:ss格式
:param createTime: (Optional) 创建时间, yyyy-mm-dd hh:mm:ss格式
:param userType: (Optional) 用户类型
:param balanceAmount: (Optional) 剩余调用量
:param totalCallAmount: (Optional) 累计调用量
:param totalBuyAmount: (Optional) 总购买量
:param resourceAmount: (Optional) 资源包数量
:param following: (Optional) 跟踪描述
"""
self.pin = pin
self.updateTime = updateTime
self.createTime = createTime
self.userType = userType
self.balanceAmount = balanceAmount
self.totalCallAmount = totalCallAmount
self.totalBuyAmount = totalBuyAmount
self.resourceAmount = resourceAmount
self.following = following
|
class Solution:
def setZeroes(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
firstRowHasZero = not all(matrix[0])
for i in range(1,len(matrix)):
for j in range(len(matrix[0])):
if matrix[i][j] == 0:
matrix[0][j] = 0
matrix[i][0] = 0
for i in range(1,len(matrix)):
for j in range(len(matrix[0])-1,-1,-1):
if matrix[0][j] == 0 or matrix[i][0] == 0:
matrix[i][j] = 0
if firstRowHasZero:
matrix[0] = [0]*len(matrix[0])
|
# Python Functions
# Three types of functions
# Built in functions
# User-defined functions
# Anonymous functions
# i.e. lambada functions; not declared with def():
# Method vs function
# Method --> function that is part of a class
#can only access said method with an instance or object of said class
# A straight function does not have the above limitation; insert logical proof here about how all methods are functions
# but not all functions are methods
# Straight function
# block of code that is called by name
# can be passed parameters (data)
# can return values (return value)
def straightSwitch(item1,item2):
return item2,item1
class SwitchClass(object):
# Method
def methodSwitch(self,item1,item2):
# First argument of EVERY class method is reference to current instance
# of the class (i.e. itself, thus 'self')
self.contents = item2, item1
return self.contents
# in order to access methodSwitch(), instance or object needs to be defined:
#instance declared of SwitchClass object
instance = SwitchClass()
#method methodSwitch() called upon instance of the above object
print(instance.methodSwitch(1,2))
# functions ---> data is explicitly passed
# methods ---> data is implicitly passed
# classes ---> are blueprints for creating objects
# function arguments
# default, required, keyword, and variable number arguments
# default: take a specified default value if no arguement is passed during the call
# required: need to be passed during call in specific order
# keyword: identify arguments by parameter name to call in specified order
# variable argument: *args (used to accept a variable number of arguements)
#P4E 14.4
#Examining the methods of an object using the dir() function:
#dir() lists the methods and attributes of a python object
stuff = list()
print(dir(stuff))
|
# Copyright (c) OpenMMLab. All rights reserved.
model = dict(
type='DBNet',
backbone=dict(
type='mmdet.ResNet',
depth=18,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=-1,
norm_cfg=dict(type='BN', requires_grad=True),
init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet18'),
norm_eval=False,
style='caffe'),
neck=dict(type='FPNC', in_channels=[2, 4, 8, 16], lateral_channels=8),
bbox_head=dict(
type='DBHead',
text_repr_type='quad',
in_channels=8,
loss=dict(type='DBLoss', alpha=5.0, beta=10.0, bbce_loss=True)),
train_cfg=None,
test_cfg=None)
dataset_type = 'IcdarDataset'
data_root = 'tests/test_codebase/test_mmocr/data'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
test_pipeline = [
dict(type='LoadImageFromFile', color_type='color_ignore_orientation'),
dict(
type='MultiScaleFlipAug',
img_scale=(128, 64),
flip=False,
transforms=[
dict(type='Resize', img_scale=(256, 128), keep_ratio=True),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img']),
])
]
data = dict(
samples_per_gpu=16,
test_dataloader=dict(samples_per_gpu=1),
test=dict(
type=dataset_type,
ann_file=data_root + '/text_detection.json',
img_prefix=data_root,
pipeline=test_pipeline))
evaluation = dict(interval=100, metric='hmean-iou')
|
class HttpRequest:
""" HTTP request class.
Attributes:
method (str): the HTTP method.
request_uri (str): the request URI.
query_string (str): the query string.
http_version (str): the HTTP version.
headers (dict of str: str): a `dict` containing the headers.
body (str): the body.
"""
def __init__(self, client):
""" The constructor parses the HTTP request.
Args:
client (socket.socket): the client socket.
Raises:
BadRequestException: If the request cannot be parsed.
"""
self.method = None
self.request_uri = None
self.query_string = None
self.http_version = None
self.headers = dict()
self.body = None
if client is not None:
with client.makefile() as request_file:
try:
line = request_file.readline()
line_split = line.split(" ")
self.method = line_split[0]
full_uri = line_split[1].split("?")
self.request_uri = full_uri[0]
self.query_string = "" if len(full_uri) <= 1 else full_uri[1]
self.http_version = line_split[2]
line = request_file.readline()
while line != "\r\n" and line != "\n":
line_split = line.split(": ")
self.headers[line_split[0]] = line_split[1].strip()
line = request_file.readline()
if "Content-Length" in self.headers:
self.body = request_file.read(int(self.headers["Content-Length"]))
except IndexError:
raise HttpRequestParseErrorException()
class HttpRequestParseErrorException(Exception):
""" An exception to raise if the HTTP request is not well formed.
"""
pass
|
for i in range(1, 6):
for j in range(1, 6):
if(i == 1 or i == 5):
print(j, end="")
elif(j == 6 - i):
print(6 - i, end="")
else:
print(" ", end="")
print()
|
#!/usr/bin/env python3.4
#
# Copyright 2016 - Google
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################
# TIMERS
###############################################
# Max time to wait for phone data/network connection state update
MAX_WAIT_TIME_CONNECTION_STATE_UPDATE = 20
# Max time to wait for network reselection
MAX_WAIT_TIME_NW_SELECTION = 120
# Max time to wait for call drop
MAX_WAIT_TIME_CALL_DROP = 60
# Max time to wait after caller make a call and before
# callee start ringing
MAX_WAIT_TIME_CALLEE_RINGING = 30
# Max time to wait after caller make a call and before
# callee start ringing
MAX_WAIT_TIME_ACCEPT_CALL_TO_OFFHOOK_EVENT = 30
# Max time to wait for "onCallStatehangedIdle" event after reject or ignore
# incoming call
MAX_WAIT_TIME_CALL_IDLE_EVENT = 60
# Max time to wait after initiating a call for telecom to report in-call
MAX_WAIT_TIME_CALL_INITIATION = 25
# Max time to wait after toggle airplane mode and before
# get expected event
MAX_WAIT_TIME_AIRPLANEMODE_EVENT = 90
# Max time to wait after device sent an SMS and before
# get "onSmsSentSuccess" event
MAX_WAIT_TIME_SMS_SENT_SUCCESS = 60
# Max time to wait after MT SMS was sent and before device
# actually receive this MT SMS.
MAX_WAIT_TIME_SMS_RECEIVE = 120
# Max time to wait for IMS registration
MAX_WAIT_TIME_IMS_REGISTRATION = 120
# TODO: b/26338156 MAX_WAIT_TIME_VOLTE_ENABLED and MAX_WAIT_TIME_WFC_ENABLED should only
# be used for wait after IMS registration.
# Max time to wait for VoLTE enabled flag to be True
MAX_WAIT_TIME_VOLTE_ENABLED = MAX_WAIT_TIME_IMS_REGISTRATION + 20
# Max time to wait for WFC enabled flag to be True
MAX_WAIT_TIME_WFC_ENABLED = MAX_WAIT_TIME_IMS_REGISTRATION + 50
# Max time to wait for WFC enabled flag to be False
MAX_WAIT_TIME_WFC_DISABLED = 60
# Max time to wait for WiFi Manager to Connect to an AP
MAX_WAIT_TIME_WIFI_CONNECTION = 30
# Max time to wait for Video Session Modify Messaging
MAX_WAIT_TIME_VIDEO_SESSION_EVENT = 10
# Max time to wait after a network connection for ConnectivityManager to
# report a working user plane data connection
MAX_WAIT_TIME_USER_PLANE_DATA = 20
# Max time to wait for tethering entitlement check
MAX_WAIT_TIME_TETHERING_ENTITLEMENT_CHECK = 15
# Max time to wait for voice mail count report correct result.
MAX_WAIT_TIME_VOICE_MAIL_COUNT = 30
# Max time to wait for data SIM change
MAX_WAIT_TIME_DATA_SUB_CHANGE = 150
# Max time to wait for telecom Ringing status after receive ringing event
MAX_WAIT_TIME_TELECOM_RINGING = 5
# Max time to wait for phone get provisioned.
MAX_WAIT_TIME_PROVISIONING = 300
# Time to wait after call setup before declaring
# that the call is actually successful
WAIT_TIME_IN_CALL = 15
# (For IMS, e.g. VoLTE-VoLTE, WFC-WFC, VoLTE-WFC test only)
# Time to wait after call setup before declaring
# that the call is actually successful
WAIT_TIME_IN_CALL_FOR_IMS = 30
# Time to wait after phone receive incoming call before phone reject this call.
WAIT_TIME_REJECT_CALL = 2
# Time to leave a voice message after callee reject the incoming call
WAIT_TIME_LEAVE_VOICE_MAIL = 30
# Time to wait after accept video call and before checking state
WAIT_TIME_ACCEPT_VIDEO_CALL_TO_CHECK_STATE = 2
# Time delay to ensure user actions are performed in
# 'human' time rather than at the speed of the script
WAIT_TIME_ANDROID_STATE_SETTLING = 1
# Time to wait after registration to ensure the phone
# has sufficient time to reconfigure based on new network
WAIT_TIME_BETWEEN_REG_AND_CALL = 5
# Time to wait for 1xrtt voice attach check
# After DUT voice network type report 1xrtt (from unknown), it need to wait for
# several seconds before the DUT can receive incoming call.
WAIT_TIME_1XRTT_VOICE_ATTACH = 30
# Time to wait for data status change during wifi tethering,.
WAIT_TIME_DATA_STATUS_CHANGE_DURING_WIFI_TETHERING = 30
# Time to wait for rssi calibration.
# This is the delay between <WiFi Connected> and <Turn on Screen to get RSSI>.
WAIT_TIME_WIFI_RSSI_CALIBRATION_WIFI_CONNECTED = 10
# This is the delay between <Turn on Screen> and <Call API to get WiFi RSSI>.
WAIT_TIME_WIFI_RSSI_CALIBRATION_SCREEN_ON = 2
# Time to wait for each operation on voice mail box.
WAIT_TIME_VOICE_MAIL_SERVER_RESPONSE = 10
# Time to wait for radio to up and running after reboot
WAIT_TIME_AFTER_REBOOT = 10
# Time to wait for tethering test after reboot
WAIT_TIME_TETHERING_AFTER_REBOOT = 10
# Time to wait after changing data sub id
WAIT_TIME_CHANGE_DATA_SUB_ID = 30
# These are used in phone_number_formatter
PHONE_NUMBER_STRING_FORMAT_7_DIGIT = 7
PHONE_NUMBER_STRING_FORMAT_10_DIGIT = 10
PHONE_NUMBER_STRING_FORMAT_11_DIGIT = 11
PHONE_NUMBER_STRING_FORMAT_12_DIGIT = 12
# MAX screen-on time during test (in unit of second)
MAX_SCREEN_ON_TIME = 1800
# In Voice Mail box, press this digit to delete one message.
VOICEMAIL_DELETE_DIGIT = '7'
# MAX number of saved voice mail in voice mail box.
MAX_SAVED_VOICE_MAIL = 25
# SIM1 slot index
SIM1_SLOT_INDEX = 0
# SIM2 slot index
SIM2_SLOT_INDEX = 1
# invalid Subscription ID
INVALID_SUB_ID = -1
# invalid SIM slot index
INVALID_SIM_SLOT_INDEX = -1
# WiFI RSSI is -127 if WiFi is not connected
INVALID_WIFI_RSSI = -127
# MAX and MIN value for attenuator settings
ATTEN_MAX_VALUE = 90
ATTEN_MIN_VALUE = 0
MAX_RSSI_RESERVED_VALUE = 100
MIN_RSSI_RESERVED_VALUE = -200
# cellular weak RSSI value
CELL_WEAK_RSSI_VALUE = -120
# cellular strong RSSI value
CELL_STRONG_RSSI_VALUE = -70
# WiFi weak RSSI value
WIFI_WEAK_RSSI_VALUE = -80
# Emergency call number
EMERGENCY_CALL_NUMBER = "911"
AOSP_PREFIX = "aosp_"
INCALL_UI_DISPLAY_FOREGROUND = "foreground"
INCALL_UI_DISPLAY_BACKGROUND = "background"
INCALL_UI_DISPLAY_DEFAULT = "default"
NETWORK_CONNECTION_TYPE_WIFI = 'wifi'
NETWORK_CONNECTION_TYPE_CELL = 'cell'
NETWORK_CONNECTION_TYPE_MMS = 'mms'
NETWORK_CONNECTION_TYPE_HIPRI = 'hipri'
NETWORK_CONNECTION_TYPE_UNKNOWN = 'unknown'
TETHERING_MODE_WIFI = 'wifi'
NETWORK_SERVICE_VOICE = 'voice'
NETWORK_SERVICE_DATA = 'data'
CARRIER_VZW = 'vzw'
CARRIER_ATT = 'att'
CARRIER_TMO = 'tmo'
CARRIER_SPT = 'spt'
CARRIER_EEUK = 'eeuk'
CARRIER_VFUK = 'vfuk'
CARRIER_UNKNOWN = 'unknown'
RAT_FAMILY_CDMA = 'cdma'
RAT_FAMILY_CDMA2000 = 'cdma2000'
RAT_FAMILY_IDEN = 'iden'
RAT_FAMILY_GSM = 'gsm'
RAT_FAMILY_WCDMA = 'wcdma'
RAT_FAMILY_UMTS = RAT_FAMILY_WCDMA
RAT_FAMILY_WLAN = 'wlan'
RAT_FAMILY_LTE = 'lte'
RAT_FAMILY_TDSCDMA = 'tdscdma'
RAT_FAMILY_UNKNOWN = 'unknown'
CAPABILITY_PHONE = 'phone'
CAPABILITY_VOLTE = 'volte'
CAPABILITY_VT = 'vt'
CAPABILITY_WFC = 'wfc'
CAPABILITY_MSIM = 'msim'
CAPABILITY_OMADM = 'omadm'
# Constant for operation direction
DIRECTION_MOBILE_ORIGINATED = "MO"
DIRECTION_MOBILE_TERMINATED = "MT"
# Constant for call teardown side
CALL_TEARDOWN_PHONE = "PHONE"
CALL_TEARDOWN_REMOTE = "REMOTE"
WIFI_VERBOSE_LOGGING_ENABLED = 1
WIFI_VERBOSE_LOGGING_DISABLED = 0
"""
Begin shared constant define for both Python and Java
"""
# Constant for WiFi Calling WFC mode
WFC_MODE_WIFI_ONLY = "WIFI_ONLY"
WFC_MODE_CELLULAR_PREFERRED = "CELLULAR_PREFERRED"
WFC_MODE_WIFI_PREFERRED = "WIFI_PREFERRED"
WFC_MODE_DISABLED = "DISABLED"
WFC_MODE_UNKNOWN = "UNKNOWN"
# Constant for Video Telephony VT state
VT_STATE_AUDIO_ONLY = "AUDIO_ONLY"
VT_STATE_TX_ENABLED = "TX_ENABLED"
VT_STATE_RX_ENABLED = "RX_ENABLED"
VT_STATE_BIDIRECTIONAL = "BIDIRECTIONAL"
VT_STATE_TX_PAUSED = "TX_PAUSED"
VT_STATE_RX_PAUSED = "RX_PAUSED"
VT_STATE_BIDIRECTIONAL_PAUSED = "BIDIRECTIONAL_PAUSED"
VT_STATE_STATE_INVALID = "INVALID"
# Constant for Video Telephony Video quality
VT_VIDEO_QUALITY_DEFAULT = "DEFAULT"
VT_VIDEO_QUALITY_UNKNOWN = "UNKNOWN"
VT_VIDEO_QUALITY_HIGH = "HIGH"
VT_VIDEO_QUALITY_MEDIUM = "MEDIUM"
VT_VIDEO_QUALITY_LOW = "LOW"
VT_VIDEO_QUALITY_INVALID = "INVALID"
# Constant for Call State (for call object)
CALL_STATE_ACTIVE = "ACTIVE"
CALL_STATE_NEW = "NEW"
CALL_STATE_DIALING = "DIALING"
CALL_STATE_RINGING = "RINGING"
CALL_STATE_HOLDING = "HOLDING"
CALL_STATE_DISCONNECTED = "DISCONNECTED"
CALL_STATE_PRE_DIAL_WAIT = "PRE_DIAL_WAIT"
CALL_STATE_CONNECTING = "CONNECTING"
CALL_STATE_DISCONNECTING = "DISCONNECTING"
CALL_STATE_UNKNOWN = "UNKNOWN"
CALL_STATE_INVALID = "INVALID"
# Constant for PRECISE Call State (for call object)
PRECISE_CALL_STATE_ACTIVE = "ACTIVE"
PRECISE_CALL_STATE_ALERTING = "ALERTING"
PRECISE_CALL_STATE_DIALING = "DIALING"
PRECISE_CALL_STATE_INCOMING = "INCOMING"
PRECISE_CALL_STATE_HOLDING = "HOLDING"
PRECISE_CALL_STATE_DISCONNECTED = "DISCONNECTED"
PRECISE_CALL_STATE_WAITING = "WAITING"
PRECISE_CALL_STATE_DISCONNECTING = "DISCONNECTING"
PRECISE_CALL_STATE_IDLE = "IDLE"
PRECISE_CALL_STATE_UNKNOWN = "UNKNOWN"
PRECISE_CALL_STATE_INVALID = "INVALID"
# Constant for DC POWER STATE
DC_POWER_STATE_LOW = "LOW"
DC_POWER_STATE_HIGH = "HIGH"
DC_POWER_STATE_MEDIUM = "MEDIUM"
DC_POWER_STATE_UNKNOWN = "UNKNOWN"
# Constant for Audio Route
AUDIO_ROUTE_EARPIECE = "EARPIECE"
AUDIO_ROUTE_BLUETOOTH = "BLUETOOTH"
AUDIO_ROUTE_SPEAKER = "SPEAKER"
AUDIO_ROUTE_WIRED_HEADSET = "WIRED_HEADSET"
AUDIO_ROUTE_WIRED_OR_EARPIECE = "WIRED_OR_EARPIECE"
# Constant for Call Capability
CALL_CAPABILITY_HOLD = "HOLD"
CALL_CAPABILITY_SUPPORT_HOLD = "SUPPORT_HOLD"
CALL_CAPABILITY_MERGE_CONFERENCE = "MERGE_CONFERENCE"
CALL_CAPABILITY_SWAP_CONFERENCE = "SWAP_CONFERENCE"
CALL_CAPABILITY_UNUSED_1 = "UNUSED_1"
CALL_CAPABILITY_RESPOND_VIA_TEXT = "RESPOND_VIA_TEXT"
CALL_CAPABILITY_MUTE = "MUTE"
CALL_CAPABILITY_MANAGE_CONFERENCE = "MANAGE_CONFERENCE"
CALL_CAPABILITY_SUPPORTS_VT_LOCAL_RX = "SUPPORTS_VT_LOCAL_RX"
CALL_CAPABILITY_SUPPORTS_VT_LOCAL_TX = "SUPPORTS_VT_LOCAL_TX"
CALL_CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL = "SUPPORTS_VT_LOCAL_BIDIRECTIONAL"
CALL_CAPABILITY_SUPPORTS_VT_REMOTE_RX = "SUPPORTS_VT_REMOTE_RX"
CALL_CAPABILITY_SUPPORTS_VT_REMOTE_TX = "SUPPORTS_VT_REMOTE_TX"
CALL_CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL = "SUPPORTS_VT_REMOTE_BIDIRECTIONAL"
CALL_CAPABILITY_SEPARATE_FROM_CONFERENCE = "SEPARATE_FROM_CONFERENCE"
CALL_CAPABILITY_DISCONNECT_FROM_CONFERENCE = "DISCONNECT_FROM_CONFERENCE"
CALL_CAPABILITY_SPEED_UP_MT_AUDIO = "SPEED_UP_MT_AUDIO"
CALL_CAPABILITY_CAN_UPGRADE_TO_VIDEO = "CAN_UPGRADE_TO_VIDEO"
CALL_CAPABILITY_CAN_PAUSE_VIDEO = "CAN_PAUSE_VIDEO"
CALL_CAPABILITY_UNKOWN = "UNKOWN"
# Constant for Call Property
CALL_PROPERTY_HIGH_DEF_AUDIO = "HIGH_DEF_AUDIO"
CALL_PROPERTY_CONFERENCE = "CONFERENCE"
CALL_PROPERTY_GENERIC_CONFERENCE = "GENERIC_CONFERENCE"
CALL_PROPERTY_WIFI = "WIFI"
CALL_PROPERTY_EMERGENCY_CALLBACK_MODE = "EMERGENCY_CALLBACK_MODE"
CALL_PROPERTY_UNKNOWN = "UNKNOWN"
# Constant for Call Presentation
CALL_PRESENTATION_ALLOWED = "ALLOWED"
CALL_PRESENTATION_RESTRICTED = "RESTRICTED"
CALL_PRESENTATION_PAYPHONE = "PAYPHONE"
CALL_PRESENTATION_UNKNOWN = "UNKNOWN"
# Constant for Network Generation
GEN_2G = "2G"
GEN_3G = "3G"
GEN_4G = "4G"
GEN_UNKNOWN = "UNKNOWN"
# Constant for Network RAT
RAT_IWLAN = "IWLAN"
RAT_LTE = "LTE"
RAT_4G = "4G"
RAT_3G = "3G"
RAT_2G = "2G"
RAT_WCDMA = "WCDMA"
RAT_UMTS = "UMTS"
RAT_1XRTT = "1XRTT"
RAT_EDGE = "EDGE"
RAT_GPRS = "GPRS"
RAT_HSDPA = "HSDPA"
RAT_HSUPA = "HSUPA"
RAT_CDMA = "CDMA"
RAT_EVDO = "EVDO"
RAT_EVDO_0 = "EVDO_0"
RAT_EVDO_A = "EVDO_A"
RAT_EVDO_B = "EVDO_B"
RAT_IDEN = "IDEN"
RAT_EHRPD = "EHRPD"
RAT_HSPA = "HSPA"
RAT_HSPAP = "HSPAP"
RAT_GSM = "GSM"
RAT_TD_SCDMA = "TD_SCDMA"
RAT_GLOBAL = "GLOBAL"
RAT_UNKNOWN = "UNKNOWN"
# Constant for Phone Type
PHONE_TYPE_GSM = "GSM"
PHONE_TYPE_NONE = "NONE"
PHONE_TYPE_CDMA = "CDMA"
PHONE_TYPE_SIP = "SIP"
# Constant for SIM State
SIM_STATE_READY = "READY"
SIM_STATE_UNKNOWN = "UNKNOWN"
SIM_STATE_ABSENT = "ABSENT"
SIM_STATE_PUK_REQUIRED = "PUK_REQUIRED"
SIM_STATE_PIN_REQUIRED = "PIN_REQUIRED"
SIM_STATE_NETWORK_LOCKED = "NETWORK_LOCKED"
SIM_STATE_NOT_READY = "NOT_READY"
SIM_STATE_PERM_DISABLED = "PERM_DISABLED"
SIM_STATE_CARD_IO_ERROR = "CARD_IO_ERROR"
# Constant for Data Connection State
DATA_STATE_CONNECTED = "CONNECTED"
DATA_STATE_DISCONNECTED = "DISCONNECTED"
DATA_STATE_CONNECTING = "CONNECTING"
DATA_STATE_SUSPENDED = "SUSPENDED"
DATA_STATE_UNKNOWN = "UNKNOWN"
# Constant for Telephony Manager Call State
TELEPHONY_STATE_RINGING = "RINGING"
TELEPHONY_STATE_IDLE = "IDLE"
TELEPHONY_STATE_OFFHOOK = "OFFHOOK"
TELEPHONY_STATE_UNKNOWN = "UNKNOWN"
# Constant for TTY Mode
TTY_MODE_FULL = "FULL"
TTY_MODE_HCO = "HCO"
TTY_MODE_OFF = "OFF"
TTY_MODE_VCO = "VCO"
# Constant for Service State
SERVICE_STATE_EMERGENCY_ONLY = "EMERGENCY_ONLY"
SERVICE_STATE_IN_SERVICE = "IN_SERVICE"
SERVICE_STATE_OUT_OF_SERVICE = "OUT_OF_SERVICE"
SERVICE_STATE_POWER_OFF = "POWER_OFF"
SERVICE_STATE_UNKNOWN = "UNKNOWN"
# Constant for VoLTE Hand-over Service State
VOLTE_SERVICE_STATE_HANDOVER_STARTED = "STARTED"
VOLTE_SERVICE_STATE_HANDOVER_COMPLETED = "COMPLETED"
VOLTE_SERVICE_STATE_HANDOVER_FAILED = "FAILED"
VOLTE_SERVICE_STATE_HANDOVER_CANCELED = "CANCELED"
VOLTE_SERVICE_STATE_HANDOVER_UNKNOWN = "UNKNOWN"
# Constant for precise call state state listen level
PRECISE_CALL_STATE_LISTEN_LEVEL_FOREGROUND = "FOREGROUND"
PRECISE_CALL_STATE_LISTEN_LEVEL_RINGING = "RINGING"
PRECISE_CALL_STATE_LISTEN_LEVEL_BACKGROUND = "BACKGROUND"
# Constants used to register or de-register for video call callback events
EVENT_VIDEO_SESSION_MODIFY_REQUEST_RECEIVED = "EVENT_VIDEO_SESSION_MODIFY_REQUEST_RECEIVED"
EVENT_VIDEO_SESSION_MODIFY_RESPONSE_RECEIVED = "EVENT_VIDEO_SESSION_MODIFY_RESPONSE_RECEIVED"
EVENT_VIDEO_SESSION_EVENT = "EVENT_VIDEO_SESSION_EVENT"
EVENT_VIDEO_PEER_DIMENSIONS_CHANGED = "EVENT_VIDEO_PEER_DIMENSIONS_CHANGED"
EVENT_VIDEO_QUALITY_CHANGED = "EVENT_VIDEO_QUALITY_CHANGED"
EVENT_VIDEO_DATA_USAGE_CHANGED = "EVENT_VIDEO_DATA_USAGE_CHANGED"
EVENT_VIDEO_CAMERA_CAPABILITIES_CHANGED = "EVENT_VIDEO_CAMERA_CAPABILITIES_CHANGED"
EVENT_VIDEO_INVALID = "EVENT_VIDEO_INVALID"
# Constant for Video Call Session Event Name
SESSION_EVENT_RX_PAUSE = "SESSION_EVENT_RX_PAUSE"
SESSION_EVENT_RX_RESUME = "SESSION_EVENT_RX_RESUME"
SESSION_EVENT_TX_START = "SESSION_EVENT_TX_START"
SESSION_EVENT_TX_STOP = "SESSION_EVENT_TX_STOP"
SESSION_EVENT_CAMERA_FAILURE = "SESSION_EVENT_CAMERA_FAILURE"
SESSION_EVENT_CAMERA_READY = "SESSION_EVENT_CAMERA_READY"
SESSION_EVENT_UNKNOWN = "SESSION_EVENT_UNKNOWN"
NETWORK_MODE_WCDMA_PREF = "NETWORK_MODE_WCDMA_PREF"
NETWORK_MODE_GSM_ONLY = "NETWORK_MODE_GSM_ONLY"
NETWORK_MODE_WCDMA_ONLY = "NETWORK_MODE_WCDMA_ONLY"
NETWORK_MODE_GSM_UMTS = "NETWORK_MODE_GSM_UMTS"
NETWORK_MODE_CDMA = "NETWORK_MODE_CDMA"
NETWORK_MODE_CDMA_NO_EVDO = "NETWORK_MODE_CDMA_NO_EVDO"
NETWORK_MODE_EVDO_NO_CDMA = "NETWORK_MODE_EVDO_NO_CDMA"
NETWORK_MODE_GLOBAL = "NETWORK_MODE_GLOBAL"
NETWORK_MODE_LTE_CDMA_EVDO = "NETWORK_MODE_LTE_CDMA_EVDO"
NETWORK_MODE_LTE_GSM_WCDMA = "NETWORK_MODE_LTE_GSM_WCDMA"
NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA = "NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA"
NETWORK_MODE_LTE_ONLY = "NETWORK_MODE_LTE_ONLY"
NETWORK_MODE_LTE_WCDMA = "NETWORK_MODE_LTE_WCDMA"
NETWORK_MODE_TDSCDMA_ONLY = "NETWORK_MODE_TDSCDMA_ONLY"
NETWORK_MODE_TDSCDMA_WCDMA = "NETWORK_MODE_TDSCDMA_WCDMA"
NETWORK_MODE_LTE_TDSCDMA = "NETWORK_MODE_LTE_TDSCDMA"
NETWORK_MODE_TDSCDMA_GSM = "NETWORK_MODE_TDSCDMA_GSM"
NETWORK_MODE_LTE_TDSCDMA_GSM = "NETWORK_MODE_LTE_TDSCDMA_GSM"
NETWORK_MODE_TDSCDMA_GSM_WCDMA = "NETWORK_MODE_TDSCDMA_GSM_WCDMA"
NETWORK_MODE_LTE_TDSCDMA_WCDMA = "NETWORK_MODE_LTE_TDSCDMA_WCDMA"
NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA = "NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA"
NETWORK_MODE_TDSCDMA_CDMA_EVDO_WCDMA = "NETWORK_MODE_TDSCDMA_CDMA_EVDO_WCDMA"
NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = "NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA"
# Constant for Messaging Event Name
EventSmsDeliverSuccess = "SmsDeliverSuccess"
EventSmsDeliverFailure = "SmsDeliverFailure"
EventSmsSentSuccess = "SmsSentSuccess"
EventSmsSentFailure = "SmsSentFailure"
EventSmsReceived = "SmsReceived"
EventMmsSentSuccess = "MmsSentSuccess"
EventMmsSentFailure = "MmsSentFailure"
EventMmsDownloaded = "MmsDownloaded"
EventWapPushReceived = "WapPushReceived"
EventDataSmsReceived = "DataSmsReceived"
EventCmasReceived = "CmasReceived"
EventEtwsReceived = "EtwsReceived"
# Constant for Telecom Call Event Name
EventTelecomCallStateChanged = "TelecomCallStateChanged"
EventTelecomCallParentChanged = "TelecomCallParentChanged"
EventTelecomCallChildrenChanged = "TelecomCallChildrenChanged"
EventTelecomCallDetailsChanged = "TelecomCallDetailsChanged"
EventTelecomCallCannedTextResponsesLoaded = "TelecomCallCannedTextResponsesLoaded"
EventTelecomCallPostDialWait = "TelecomCallPostDialWait"
EventTelecomCallVideoCallChanged = "TelecomCallVideoCallChanged"
EventTelecomCallDestroyed = "TelecomCallDestroyed"
EventTelecomCallConferenceableCallsChanged = "TelecomCallConferenceableCallsChanged"
# Constant for Video Call Event Name
EventTelecomVideoCallSessionModifyRequestReceived = "TelecomVideoCallSessionModifyRequestReceived"
EventTelecomVideoCallSessionModifyResponseReceived = "TelecomVideoCallSessionModifyResponseReceived"
EventTelecomVideoCallSessionEvent = "TelecomVideoCallSessionEvent"
EventTelecomVideoCallPeerDimensionsChanged = "TelecomVideoCallPeerDimensionsChanged"
EventTelecomVideoCallVideoQualityChanged = "TelecomVideoCallVideoQualityChanged"
EventTelecomVideoCallDataUsageChanged = "TelecomVideoCallDataUsageChanged"
EventTelecomVideoCallCameraCapabilities = "TelecomVideoCallCameraCapabilities"
# Constant for Other Event Name
EventCallStateChanged = "CallStateChanged"
EventPreciseStateChanged = "PreciseStateChanged"
EventDataConnectionRealTimeInfoChanged = "DataConnectionRealTimeInfoChanged"
EventDataConnectionStateChanged = "DataConnectionStateChanged"
EventServiceStateChanged = "ServiceStateChanged"
EventSignalStrengthChanged = "SignalStrengthChanged"
EventVolteServiceStateChanged = "VolteServiceStateChanged"
EventMessageWaitingIndicatorChanged = "MessageWaitingIndicatorChanged"
EventConnectivityChanged = "ConnectivityChanged"
# Constant for Packet Keep Alive Call Back
EventPacketKeepaliveCallback = "PacketKeepaliveCallback"
PacketKeepaliveCallbackStarted = "Started"
PacketKeepaliveCallbackStopped = "Stopped"
PacketKeepaliveCallbackError = "Error"
PacketKeepaliveCallbackInvalid = "Invalid"
# Constant for Network Call Back
EventNetworkCallback = "NetworkCallback"
NetworkCallbackPreCheck = "PreCheck"
NetworkCallbackAvailable = "Available"
NetworkCallbackLosing = "Losing"
NetworkCallbackLost = "Lost"
NetworkCallbackUnavailable = "Unavailable"
NetworkCallbackCapabilitiesChanged = "CapabilitiesChanged"
NetworkCallbackSuspended = "Suspended"
NetworkCallbackResumed = "Resumed"
NetworkCallbackLinkPropertiesChanged = "LinkPropertiesChanged"
NetworkCallbackInvalid = "Invalid"
class SignalStrengthContainer:
SIGNAL_STRENGTH_GSM = "gsmSignalStrength"
SIGNAL_STRENGTH_GSM_DBM = "gsmDbm"
SIGNAL_STRENGTH_GSM_LEVEL = "gsmLevel"
SIGNAL_STRENGTH_GSM_ASU_LEVEL = "gsmAsuLevel"
SIGNAL_STRENGTH_GSM_BIT_ERROR_RATE = "gsmBitErrorRate"
SIGNAL_STRENGTH_CDMA_DBM = "cdmaDbm"
SIGNAL_STRENGTH_CDMA_LEVEL = "cdmaLevel"
SIGNAL_STRENGTH_CDMA_ASU_LEVEL = "cdmaAsuLevel"
SIGNAL_STRENGTH_CDMA_ECIO = "cdmaEcio"
SIGNAL_STRENGTH_EVDO_DBM = "evdoDbm"
SIGNAL_STRENGTH_EVDO_ECIO = "evdoEcio"
SIGNAL_STRENGTH_LTE = "lteSignalStrength"
SIGNAL_STRENGTH_LTE_DBM = "lteDbm"
SIGNAL_STRENGTH_LTE_LEVEL = "lteLevel"
SIGNAL_STRENGTH_LTE_ASU_LEVEL = "lteAsuLevel"
SIGNAL_STRENGTH_DBM = "dbm"
SIGNAL_STRENGTH_LEVEL = "level"
SIGNAL_STRENGTH_ASU_LEVEL = "asuLevel"
class MessageWaitingIndicatorContainer:
IS_MESSAGE_WAITING = "isMessageWaiting"
class CallStateContainer:
INCOMING_NUMBER = "incomingNumber"
SUBSCRIPTION_ID = "subscriptionId"
CALL_STATE = "callState"
class PreciseCallStateContainer:
TYPE = "type"
CAUSE = "cause"
SUBSCRIPTION_ID = "subscriptionId"
PRECISE_CALL_STATE = "preciseCallState"
class DataConnectionRealTimeInfoContainer:
TYPE = "type"
TIME = "time"
SUBSCRIPTION_ID = "subscriptionId"
DATA_CONNECTION_POWER_STATE = "dataConnectionPowerState"
class DataConnectionStateContainer:
TYPE = "type"
DATA_NETWORK_TYPE = "dataNetworkType"
STATE_CODE = "stateCode"
SUBSCRIPTION_ID = "subscriptionId"
DATA_CONNECTION_STATE = "dataConnectionState"
class ServiceStateContainer:
VOICE_REG_STATE = "voiceRegState"
VOICE_NETWORK_TYPE = "voiceNetworkType"
DATA_REG_STATE = "dataRegState"
DATA_NETWORK_TYPE = "dataNetworkType"
OPERATOR_NAME = "operatorName"
OPERATOR_ID = "operatorId"
IS_MANUAL_NW_SELECTION = "isManualNwSelection"
ROAMING = "roaming"
IS_EMERGENCY_ONLY = "isEmergencyOnly"
NETWORK_ID = "networkId"
SYSTEM_ID = "systemId"
SUBSCRIPTION_ID = "subscriptionId"
SERVICE_STATE = "serviceState"
class PacketKeepaliveContainer:
ID = "id"
PACKET_KEEPALIVE_EVENT = "packetKeepaliveEvent"
class NetworkCallbackContainer:
ID = "id"
NETWORK_CALLBACK_EVENT = "networkCallbackEvent"
MAX_MS_TO_LIVE = "maxMsToLive"
RSSI = "rssi"
"""
End shared constant define for both Python and Java
"""
|
# Fit image to screen height, optionally stretched horizontally
def fit_to_screen(image, loaded_image, is_full_width):
# Resize to fill height and width
image_w, image_h = loaded_image.size
target_w = image_w
target_h = image_h
image_ratio = float(image_w / image_h)
if target_h > image.height:
target_h = image.height
target_w = round(image_ratio * target_h)
# If full width requested
if is_full_width == True:
target_w = image.width
target_h = round(target_w / image_ratio)
# Apply resize
return loaded_image.resize((target_w, target_h))
|
def setup_parser(common_parser, subparsers):
parser = subparsers.add_parser("genotype", parents=[common_parser])
parser.add_argument(
"-i",
"--gram_dir",
help="Directory containing outputs from gramtools `build`",
dest="gram_dir",
type=str,
required=True,
)
parser.add_argument(
"-o",
"--genotype_dir",
help="Directory to hold this command's outputs.",
type=str,
dest="geno_dir",
required=True,
)
parser.add_argument(
"--reads",
help="One or more read files.\n"
"Valid formats: fastq, sam/bam/cram, fasta, txt; compressed or uncompressed; fuzzy extensions (eg fq, fsq for fastq).\n"
"Read files can be given after one or several '--reads' argument:"
"Eg '--reads rf_1.fq rf_2.fq.gz --reads rf_3.bam '",
nargs="+",
action="append",
type=str,
required=True,
)
parser.add_argument(
"--sample_id",
help="A name for your dataset.\n" "Appears in the genotyping outputs.",
required=True,
)
parser.add_argument(
"--ploidy",
help="The expected ploidy of the sample.\n" "Default: haploid",
choices=["haploid", "diploid"],
required=False,
default="haploid",
)
parser.add_argument(
"--max_threads",
help="Run with more threads than the default of one.",
type=int,
default=1,
required=False,
)
parser.add_argument(
"--seed",
help="Fixing the seed will produce the same read mappings across different runs."
"By default, seed is randomly generated so this is not the case.",
type=int,
default=0,
required=False,
)
|
#coding=utf-8
class Solution:
def longestCommonPrefix(self, strs):
res = ""
strs.sort(key=lambda i: len(i))
# print(strs)
for i in range(len(strs[0])):
tmp = res + strs[0][i]
# print("tmp=",tmp)
for each in strs:
if each.startswith(tmp) == False:
return res
res = tmp
return res
if __name__ == '__main__':
s = Solution()
res = s.longestCommonPrefix( ["flower","flow","flight"])
print(res)
res = s.longestCommonPrefix( ["dog","racecar","car"])
print(res)
|
FILE_NAME = 1 # Імя файла для запису даних
SHOW_INFO = True
DISPLAY_POSITION = (50,30)
DISPLAY_SIZE = (1700, 1030)
DISPLAY_COLOR = (48, 189, 221)
FPS = 240
MAX_COUNTER = 3000 # Кількість циклів в 1 еопосі
MAX_EPOCH = 1000 # Кількість епох
START_POPULATION = 10 # Кількість осіб взагалі
COUNT_OF_ALIVE_AFTER_EPOCH = 10 # Кількість виживших пісял того як закінчився минулий раунд
MUTATION_PROBABILITY = 0.01 # Ймовірність мутації гена межі [0 до 1]
CROSSOVER_POINT_NUMBER = 2 # Кількість точко кросовера, зазвичай 1, можна до 10
NUMBER_OF_PARENTS_COUPLES = START_POPULATION
WEB_LAYERS = [6,4]#[6+9, 6, 4]#[6+3*3,4]#[6,4]#[6,6,4]
#----------------- CAR ------------------
CAR_CAMERA_MOVE_SPEED = [2, 0]#[0, 0]
CAR_FLOOR_POSITION = 100
CAR_CEILING_POSITION = 900
CAR_LAZER_OF_DEATH_POSITION = 50
CAR_LAZER_OF_DEATH_POSITION_REVERSE = 50
CAR_ENEMIES_NUMBER = 14
CAR_COUNT_OF_IMPORTANT_ENEMIES_TO_NEURO = 0
CAR_BALL_POSITION_DEFAULT = [800,500]
CAR_BALL_POSITION_DEFAULT_OFFSET = [200, 200]
CAR_HOW_MANY_COST_ALIVE = 10000
CAR_HOW_MANY_COST_BE_IN_MIDDLE = 0.0001
CAR_HOW_MANY_COST_BE_FAR_FROM_ENEMIES = 0.0001
#----------------------------------------
|
def da_sort(lst):
count = 0
# replica = [x for x in lst]
result = sorted(array)
for char in lst:
if char != result[0]:
count += 1
else:
result.pop(0)
return count
T = int(input())
for _ in range(T):
k, n = map(int, input().split())
array = []
if n % 10 == 0:
iterange = n//10
else:
iterange = n//10 + 1
for _ in range(iterange):
array.extend([int(x) for x in input().split()])
print(k, da_sort(array))
|
# Aula 10 - Operadores relacionais + IF/ELIF/ELSE
# == > >= < <= !=
# == comparação de Igualdade, perguntando se uma coisa é igual a outra.
numero1 = 2
numero2 = 2
print(2 == 2)
print(2 == 1)
print(2 == '2')
expressao = numero1 == numero2
print(f'numero1 == numero2: {expressao}')
# > ver numero1 é 'maior que' numero 2
expressao = numero1 > numero2
print(f'numero1 > numero2: {expressao}')
# >= ver numero1 é 'maior que ou igual que' numero 2
expressao = numero1 >= numero2
print(f'numero1 >= numero2: {expressao}')
# < ver numero1 é 'menor que' numero 2
expressao = numero1 < numero2
print(f'numero1 < numero2: {expressao}')
# <= ver numero1 é 'menor que ou igual que' numero 2
expressao = numero1 <= numero2
print(f'numero1 < numero2: {expressao}')
# != ver numero1 é 'diferente' numero 2 -> Se for diferente retorna true ! simbolo de negação
expressao = numero1 != numero2
print(f'numero1 != numero2: {expressao}')
var1 = 'Luiz'
var2 = 'teste'
expressao = var1 != var2
print(f'{var1} != {var2}: {expressao}')
nome = input('Qual seu nome: ')
idade = int(input('Idade: '))
limiteMenor = 20
limiteMaior = 30
if limiteMenor <= idade <= limiteMaior: # idade >= limiteMenor and idade <= limiteMaior
print(f'\n{nome} pode pegar o Empréstimo. ')
else:
print(f'\n{nome} não pode pegar o Empréstimo. ')
|
def netmiko_config(device, configuration=None, **kwargs):
if configuration:
output = device['nc'].send_config_set(configuration)
else:
output = "No configuration to send."
return output
|
# funcao1.py, definimos uma função chamada multiplica, que multiplica a variável global valor por um fator passado como parâmetro.
# O valor do resultado é atribuído à variável valor novamente (linha 5), que é impresso em seguida (linha 6).
# Ao chamarmos a função multiplica(3) pela primeira vez (linha 8), obtemos a saída “Resultado 60”.
# Como modificamos a própria variável global valor no corpo da função, ao chamarmos novamente a função multiplica(3) (linha 9), obtemos um resultado diferente para a saída: “Resultado 180”.
# Além de não depender apenas dos parâmetros, essa função não retorna valor algum. A função multiplica deste script não é pura.
# EXEMPLO ABAIXO DE FUNÇÃO NÃO PURA:
valor = 20
def multiplica(multiplicador):
global valor
valor = valor * multiplicador
print('FUNÇÃO NÃO PURA - Resultado: ', valor)
multiplica(3)
multiplica(3)
print('-=' * 30)
# EXEMPLO ABAIXO DE UMA FUNÇÃO PURA:
# A função multiplica deste script é um exemplo de função pura, pois depende apenas de seus parâmetros para gerar o resultado,
# e não acessa ou modifica nenhuma variável externa à função e retorna um valor.
valor1 = 10
def multiplica(valor, multiplicador):
valor = valor * multiplicador
return valor
print('FUNÇÃO PURA - Resultado: ', multiplica(valor1, 3))
print('FUNÇÃO PURA - Resultado: ', multiplica(valor1, 3))
print('-=' * 30)
# DADOS MUTÁVEIS: ELE MODIFICA A LISTA ORIGINAL ATRAVES DO MÉTODO alterar_lista NA SEGUNDA POSIÇÃO
valores = [10, 20, 30]
valores1 = [40, 50, 60]
def alterar_lista(lista):
lista[2] = lista[2] + 10
return lista
print('A nova lista é :', alterar_lista(valores))
print('A nova lista é :', alterar_lista(valores1))
print(valores)
print('-=' * 30)
# DADOS IMUTÁVEIS: CRIADO UMA LISTA DENTRO DO MÉTODO PARA NÃO ALTERAR A LISTA ORIGINAL
def alterar_lista(lista):
nova_lista = list(lista)
nova_lista[2] = nova_lista[2] + 10
return nova_lista
print('Nova lista', alterar_lista(valores))
print(valores)
|
class SmTransferPriorityEnum(basestring):
"""
low|normal
Possible values:
<ul>
<li> "low" ,
<li> "normal"
</ul>
"""
@staticmethod
def get_api_name():
return "sm-transfer-priority-enum"
|
# x = 5
#
#
# def print_x():
# print(f'Print {x}')
#
#
# print(x)
# print_x()
#
#
# def f1():
# def nested_f1():
# # nonlocal y
# # y += 1
# y = 88
# ll.append(3)
# # ll = [3]
# z = 7
# print('From nested f1')
# print(x)
# print(y)
# print(z)
# print(abs(-x - y - z))
#
# global name
# name = 'Pesho'
# global x
# x += 5
# y = 6
# ll = []
# print(f'Before: {y}')
# print(ll)
# nested_f1()
# print(ll)
# print(f'After: {y}')
# return 'Pesho'
#
#
# f1()
# print(name)
# # print(y)
def get_my_print():
count = 0
def my_print(x):
nonlocal count
count += 1
print(f'My ({count}): {x}')
return my_print
my_print = get_my_print()
my_print('1')
my_print('Pesho')
my_print('Apples')
|
def get_int_value(text):
text = text.strip()
if len(text) > 1 and text[:1] == '0':
second_char = text[1:2]
if second_char == 'x' or second_char == 'X':
# hexa-decimal value
return int(text[2:], 16)
elif second_char == 'b' or second_char == 'B':
# binary value
return int(text[2:], 2)
else:
# octal value
return int(text[2:], 8)
else:
# decimal value
return int(text)
def get_float_value(text):
text = text.strip()
return float(text)
def get_bool_value(text):
text = text.strip()
if text == '1' or text.lower() == 'true':
return True
else:
return False
def get_string_value(text):
return text.strip()
|
"""Exercício Python 37: Escreva um programa em Python que leia um número inteiro qualquer e peça para o usuário
escolher qual será a base de conversão: 1 para binário, 2 para octal e 3 para hexadecimal."""
num = int(input('Digite um numero inteiro: '))
print('ESCOLHA 1 DAS 3 OPÇÕES ABAIXO:')
print('[ 1 ] converte para N° BINÁRIO')
print('[ 2 ] converte para N° OCTAL')
print('[ 3 ] converte para N° HEXADECIMAL')
escolha = int(input('Sua escolha foi: '))
if escolha == 1:
binario = (bin(num)[2:])
print('\033[1;33mConvesão do número inteiro {} para BINÁRIO foi de {} \033[m'.format(num, binario))
elif escolha == 2:
octal = (oct(num)[2:])
print('\033[1;35mConvesão do número inteiro {} para OCTAL foi de {} \033[m'.format(num, octal))
elif escolha == 3:
hexagonal = (hex(num)[2:])
print('\033[1;36mA convesão do número inteiro {} para HEXADECIMAL foi de {}\033[m'.format(num, hexagonal))
|
class AdvancedArithmetic(object):
def divisorSum(n):
raise NotImplementedError
class Calculator(AdvancedArithmetic):
def getDivisors(self, n):
if n == 1:
return [1]
maximum, num = n, 2
result = [1, n]
while num < maximum:
if not n % num:
if num != n/num:
result.extend([num, n//num])
else:
result.append(num)
maximum = n//num
num += 1
return result
def divisorSum(self, n):
return sum(self.getDivisors(n))
n = int(input())
my_calculator = Calculator()
s = my_calculator.divisorSum(n)
print("I implemented: " + type(my_calculator).__bases__[0].__name__)
print(s)
|
class Node:
def __init__(self, item, next=None):
self.value = item
self.next = next
def linked_list_to_array(LList):
item = []
if LList is None:
return []
item = item + [LList.value]
zz = LList
while zz.next is not None:
item = item + [zz.next.value]
zz = zz.next
return item
def reverse_linked_list(LList):
if LList.next is None:
return LList
prev_node = None
current_node = LList
while current_node is not None:
next_node = current_node.next
current_node.next = prev_node
prev_node = current_node
if next_node is None:
return current_node
else:
current_node = next_node
def insert_front(LList, node):
node.next = LList
return node
|
# /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 expandtab : */
class d:
def __init__(i, tag, txt, nl="", kl=None):
i.tag, i.nl, i.kl, i.txt = tag, nl, kl, txt
def __repr__(i):
s=""
if isinstance(i.txt,(list,tuple)):
s = ''.join([str(x) for x in i.txt])
else:
s = str(i.txt)
kl = " class=\"%s\"" % i.kl if i.kl else ""
return "%s<%s%s>%s</%s>" % (
i.nl,i.tag,kl,s,i.tag)
def dnl(tag,txt,kl=None): return d(tag, txt,kl=kl,nl="\n")
# n different licences
# sidenav
# top nav
# news
# all the following should be sub-classed
class Page:
def page(i,t,x): return dnl("html", [i.head(t), i.body( i.div(x, "wrapper"))])
def body(i,x, kl=None) : return dnl( "body", x, kl=kl)
def head(i,t, kl=None) : return dnl( "head", i.title(t), kl=kl)
def title(i,x,kl=None) : return dnl( "title",x, kl=kl)
def div(i,x, kl=None) : return dnl( "div", x, kl=kl)
def ul(i,x, kl=None) : return d( "ul", x, kl=kl)
def i(i,x, kl=None) : return d( "em", x, kl=kl)
def b(i,x, kl=None) : return d( "b" , x, kl=kl)
def p(i,x, kl=None) : return dnl( "p" , x, kl=kl)
def li(i,x, kl=None) : return dnl( "li", x, kl=kl)
def ol(i,*l, kl=None) : return dnl( "ol", [i.li(y) for y in l], kl=kl)
def ul(i,*l, kl=None) : return dnl( "ul", [i.li(y) for y in l], kl=kl)
def uls(i,*l, kl=None, odd="li0", even="li1"):
return i.ls(*l,what="ul",kl=None,odd=odd,even=even)
def ols(i,*l, kl=None, odd="li0", even="li1"):
return i.ls(*l,what="ol",kl=None,odd=odd,even=even)
def ls(i,*l, what="ul", kl=None, odd="li0", even="li1"):
oddp=[False]
def show(x):
oddp[0] = not oddp[0]
return dnl("li", x, kl = odd if oddp[0] else even)
return dnl( what, [show(y) for y in l],kl=kl)
p=Page()
print(p.page("love",p.uls("asdas",["sdasas", p.b("bols")], "dadas","apple",
"banana","ws","white",odd="odd", even="even")))
|
# Nosso time de futebol terminou o campeonato. O resultado de cada correspondência é semelhante a "x: y".
# Os resultados de todas as partidas são registrados na coleção.
# Escreva uma função que leve essa arrecadação e conte os pontos da nossa
# equipe no campeonato. Regras para contagem de pontos para cada partida:
def pontos_time(pontos, totPoints):
pontosNew = list(pontos.values())
for i in range(0, len(pontosNew)):
if (pontosNew[i][0] > pontosNew[i][1]):
totPoints += 3
elif (pontosNew[i][0] == pontosNew[i][1]):
totPoints += 1
# (x < y):
else:
totPoints += 0
print(totPoints)
# - há 10 partidas no campeonato
pontos = {('partida1'): (4, 1),
('partida2'): (3, 1),
('partida3'): (2, 1), # 9
('partida4'): (1, 5),
('partida5'): (1, 1), # 10
('partida6'): (0, 1),
('partida7'): (0, 0), # 11
('partida8'): (2, 1), # 14
('partida9'): (0, 0),
('partida10'): (0, 0)} # 16
# pontos atual da equipe
totPoints = 0
#pontos[('Brazil', 'Agentina')]
# print(pontos)
print(list(pontos.values()))
pontosNew = list(pontos.values())
print('---')
print(pontosNew[7][0])
print(pontosNew)
#print(pontos.get('nossaEquipe', 'outroTime')[1])
pontos_time(pontos, totPoints)
|
print('\033[1;32m APRENDENDO FUNÇÕES EM PYTHON\033[m')
def escreva(msg):
print('-' * (len(msg) + 2))
print(f'{ msg}')
print('-' * (len(msg) + 2))
x = str(input('Digite uma frase: '))
escreva(x)
|
"""
数据暂存
"""
class DataPool:
def __init__(self):
self.data = dict()
def save(self, key, value):
self.data[key] = value
def remove(self, key):
self.data.pop(key)
def exist(self, key):
return key in self.data
|
students = [
{
"name": "John Doe",
"age": 15,
"sex": "male"
},
{
"name": "Jane Doe",
"age": 12,
"sex": "female"
},
{
"name": "Lockle Rory",
"age": 18,
"sex": "male"
},
{
"name": "Seyi Pedro",
"age": 10,
"sex": "female"
}
]
|
# 66. 加一
class Solution:
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
for i in range(len(digits)-1, -1, -1):
if digits[i] != 9:
digits[i] += 1
return digits
digits[i] = 0
digits[0] = 1
digits.append(0)
return digits
|
# 832 SLoC
v = FormValidator(
firstname=Unicode(),
surname=Unicode(required="Please enter your surname"),
age=Int(greaterthan(18, "You must be at least 18 to proceed"), required=False),
)
input_data = {
'firstname': u'Fred',
'surname': u'Jones',
'age': u'21',
}
v.process(input_data) == {'age': 21, 'firstname': u'Fred', 'surname': u'Jones'}
input_data = {
'firstname': u'Fred',
'age': u'16',
}
v.process(input_data) # raises ValidationError
# ValidationError([('surname', 'Please enter your surname'), ('age', 'You must be at least 18 to proceed')])
#assert_true # raise if not value
#assert_false # raise if value
#test # raise if callback(value)
#minlen
#maxlen
#greaterthan
#lessthan
#notempty
#matches # regex
#equals
#is_in
looks_like_email # basic, but kudos for not using a regex!
maxwords
minwords
CustomType # for subclassing
PassThrough # return value
Int # int(value) or raise ValidationError
Float # as Int
Decimal # as Int
Unicode # optionally strip, unicode(value), no encoding
Bool # default (undefined) is False by default
Calculated # return callback(*source_fields)
DateTime
Date
|
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate Leakage': 0.00662954,
'Peak Dynamic': 0.0,
'Runtime Dynamic': 0.0,
'Subthreshold Leakage': 0.0691322,
'Subthreshold Leakage with power gating': 0.0259246},
'Core': [{'Area': 32.6082,
'Execution Unit/Area': 8.2042,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.31626,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.451093,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 1.81823,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.122718,
'Execution Unit/Instruction Scheduler/Area': 2.17927,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.328073,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.00115349,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.20978,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.759535,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.017004,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00962066,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00730101,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 1.00996,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00529112,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 2.07911,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 1.31524,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0800117,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0455351,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 4.84781,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.841232,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.000856399,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.55892,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.754327,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.0178624,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00897339,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 2.8291,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.114878,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.0641291,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.472009,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 9.01815,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.343502,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.0275337,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.313021,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.203629,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.656523,
'Execution Unit/Register Files/Runtime Dynamic': 0.231163,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0442632,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00607074,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.84303,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 1.88478,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.0920413,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0345155,
'Execution Unit/Runtime Dynamic': 5.80152,
'Execution Unit/Subthreshold Leakage': 1.83518,
'Execution Unit/Subthreshold Leakage with power gating': 0.709678,
'Gate Leakage': 0.372997,
'Instruction Fetch Unit/Area': 5.86007,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.0011616,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.0011616,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.00101462,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.000394344,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.00292514,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00626296,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.0110348,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0590479,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.195754,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 6.43323,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.402603,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.664867,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 8.96874,
'Instruction Fetch Unit/Runtime Dynamic': 1.28052,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932587,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.408542,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.0693417,
'L2/Runtime Dynamic': 0.0136607,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80969,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 6.69495,
'Load Store Unit/Data Cache/Runtime Dynamic': 2.62506,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0351387,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.176574,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.176574,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 7.53217,
'Load Store Unit/Runtime Dynamic': 3.67243,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.435401,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.870803,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591622,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283406,
'Memory Management Unit/Area': 0.434579,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.154525,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.155561,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00813591,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.399995,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0660188,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.825638,
'Memory Management Unit/Runtime Dynamic': 0.221579,
'Memory Management Unit/Subthreshold Leakage': 0.0769113,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0399462,
'Peak Dynamic': 30.9757,
'Renaming Unit/Area': 0.369768,
'Renaming Unit/FP Front End RAT/Area': 0.168486,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00489731,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 3.33511,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 1.1984,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0437281,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.024925,
'Renaming Unit/Free List/Area': 0.0414755,
'Renaming Unit/Free List/Gate Leakage': 4.15911e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0401324,
'Renaming Unit/Free List/Runtime Dynamic': 0.0532591,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000670426,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000377987,
'Renaming Unit/Gate Leakage': 0.00863632,
'Renaming Unit/Int Front End RAT/Area': 0.114751,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.00038343,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.86945,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.373546,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00611897,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00348781,
'Renaming Unit/Peak Dynamic': 4.56169,
'Renaming Unit/Runtime Dynamic': 1.62521,
'Renaming Unit/Subthreshold Leakage': 0.070483,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0362779,
'Runtime Dynamic': 12.6149,
'Subthreshold Leakage': 6.21877,
'Subthreshold Leakage with power gating': 2.58311},
{'Area': 32.0201,
'Execution Unit/Area': 7.68434,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.0495849,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.241635,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 0.261666,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.120359,
'Execution Unit/Instruction Scheduler/Area': 1.66526,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.216426,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.349086,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.176207,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 0.741719,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.207411,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 4.69332,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.0494344,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00907786,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.0844564,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0671363,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.133891,
'Execution Unit/Register Files/Runtime Dynamic': 0.0762142,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.190325,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.469552,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543,
'Execution Unit/Runtime Dynamic': 1.9345,
'Execution Unit/Subthreshold Leakage': 1.79543,
'Execution Unit/Subthreshold Leakage with power gating': 0.688821,
'Gate Leakage': 0.368936,
'Instruction Fetch Unit/Area': 5.85939,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.00193701,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.00193701,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.00172701,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.000690364,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.000964419,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00656545,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.0171471,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0589979,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0645399,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 4.10529,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.220422,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.219206,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 6.52304,
'Instruction Fetch Unit/Runtime Dynamic': 0.52788,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932286,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.0687005,
'L2/Runtime Dynamic': 0.0149604,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80901,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 3.61072,
'Load Store Unit/Data Cache/Runtime Dynamic': 1.1518,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0350888,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.0767916,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0767917,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 3.97335,
'Load Store Unit/Runtime Dynamic': 1.6073,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.189355,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.37871,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591321,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283293,
'Memory Management Unit/Area': 0.4339,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.0672027,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0679998,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00808595,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.255252,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0368303,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.526803,
'Memory Management Unit/Runtime Dynamic': 0.10483,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 19.3747,
'Renaming Unit/Area': 0.303608,
'Renaming Unit/FP Front End RAT/Area': 0.131045,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.130039,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885,
'Renaming Unit/Free List/Area': 0.0340654,
'Renaming Unit/Free List/Gate Leakage': 2.5481e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0306032,
'Renaming Unit/Free List/Runtime Dynamic': 0.0113471,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064,
'Renaming Unit/Gate Leakage': 0.00708398,
'Renaming Unit/Int Front End RAT/Area': 0.0941223,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.107479,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.248866,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 4.43833,
'Subthreshold Leakage': 6.16288,
'Subthreshold Leakage with power gating': 2.55328},
{'Area': 32.0201,
'Execution Unit/Area': 7.68434,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.0,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.202689,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 0.0,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.120359,
'Execution Unit/Instruction Scheduler/Area': 1.66526,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.0619241,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.0998813,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.0504167,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 0.212222,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.0708235,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 3.9613,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.0,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00259738,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.0187824,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0192092,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.0187824,
'Execution Unit/Register Files/Runtime Dynamic': 0.0218066,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.0395692,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.111314,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543,
'Execution Unit/Runtime Dynamic': 0.953409,
'Execution Unit/Subthreshold Leakage': 1.79543,
'Execution Unit/Subthreshold Leakage with power gating': 0.688821,
'Gate Leakage': 0.368936,
'Instruction Fetch Unit/Area': 5.85939,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.00062807,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.00062807,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.000552209,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.000216592,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.000275942,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00208429,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.0058375,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0589979,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0184663,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 1.17461,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0835913,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.0627198,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 3.45013,
'Instruction Fetch Unit/Runtime Dynamic': 0.172699,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932286,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.030093,
'L2/Runtime Dynamic': 0.0091679,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80901,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 1.55146,
'Load Store Unit/Data Cache/Runtime Dynamic': 0.165561,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0350888,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.0101696,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0101696,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 1.59948,
'Load Store Unit/Runtime Dynamic': 0.225883,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.0250765,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.050153,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591321,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283293,
'Memory Management Unit/Area': 0.4339,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.00889971,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.00935155,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00808595,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.073033,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0137039,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.24443,
'Memory Management Unit/Runtime Dynamic': 0.0230554,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 12.8749,
'Renaming Unit/Area': 0.303608,
'Renaming Unit/FP Front End RAT/Area': 0.131045,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.0,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885,
'Renaming Unit/Free List/Area': 0.0340654,
'Renaming Unit/Free List/Gate Leakage': 2.5481e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0306032,
'Renaming Unit/Free List/Runtime Dynamic': 0.00279385,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064,
'Renaming Unit/Gate Leakage': 0.00708398,
'Renaming Unit/Int Front End RAT/Area': 0.0941223,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.0318851,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.0346789,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 1.41889,
'Subthreshold Leakage': 6.16288,
'Subthreshold Leakage with power gating': 2.55328},
{'Area': 32.0201,
'Execution Unit/Area': 7.68434,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.0,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.202689,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 0.0,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.120359,
'Execution Unit/Instruction Scheduler/Area': 1.66526,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.244148,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.393802,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.198778,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 0.836729,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.279235,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 4.36938,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.0,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.0102407,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.0740531,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0757361,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.0740531,
'Execution Unit/Register Files/Runtime Dynamic': 0.0859768,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.156009,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.467161,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543,
'Execution Unit/Runtime Dynamic': 1.99793,
'Execution Unit/Subthreshold Leakage': 1.79543,
'Execution Unit/Subthreshold Leakage with power gating': 0.688821,
'Gate Leakage': 0.368936,
'Instruction Fetch Unit/Area': 5.85939,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.00201571,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.00201571,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.00179321,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.00071471,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.00108796,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00691258,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.0179854,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0589979,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0728071,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 4.63115,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.243379,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.247286,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 7.07443,
'Instruction Fetch Unit/Runtime Dynamic': 0.58837,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932286,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.0567864,
'L2/Runtime Dynamic': 0.0161194,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80901,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 3.66987,
'Load Store Unit/Data Cache/Runtime Dynamic': 1.19043,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0350888,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.0787053,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0787054,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 4.04154,
'Load Store Unit/Runtime Dynamic': 1.65728,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.194074,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.388148,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591321,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283293,
'Memory Management Unit/Area': 0.4339,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.0688775,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0697277,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00808595,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.287948,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0399064,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.562376,
'Memory Management Unit/Runtime Dynamic': 0.109634,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 19.694,
'Renaming Unit/Area': 0.303608,
'Renaming Unit/FP Front End RAT/Area': 0.131045,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.0,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885,
'Renaming Unit/Free List/Area': 0.0340654,
'Renaming Unit/Free List/Gate Leakage': 2.5481e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0306032,
'Renaming Unit/Free List/Runtime Dynamic': 0.0110153,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064,
'Renaming Unit/Gate Leakage': 0.00708398,
'Renaming Unit/Int Front End RAT/Area': 0.0941223,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.127029,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.138044,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 4.50738,
'Subthreshold Leakage': 6.16288,
'Subthreshold Leakage with power gating': 2.55328}],
'DRAM': {'Area': 0,
'Gate Leakage': 0,
'Peak Dynamic': 1.9369935276373202,
'Runtime Dynamic': 1.9369935276373202,
'Subthreshold Leakage': 4.252,
'Subthreshold Leakage with power gating': 4.252},
'L3': [{'Area': 61.9075,
'Gate Leakage': 0.0484137,
'Peak Dynamic': 0.161329,
'Runtime Dynamic': 0.0792786,
'Subthreshold Leakage': 6.80085,
'Subthreshold Leakage with power gating': 3.32364}],
'Processor': {'Area': 191.908,
'Gate Leakage': 1.53485,
'Peak Dynamic': 83.0806,
'Peak Power': 116.193,
'Runtime Dynamic': 23.0588,
'Subthreshold Leakage': 31.5774,
'Subthreshold Leakage with power gating': 13.9484,
'Total Cores/Area': 128.669,
'Total Cores/Gate Leakage': 1.4798,
'Total Cores/Peak Dynamic': 82.9193,
'Total Cores/Runtime Dynamic': 22.9795,
'Total Cores/Subthreshold Leakage': 24.7074,
'Total Cores/Subthreshold Leakage with power gating': 10.2429,
'Total L3s/Area': 61.9075,
'Total L3s/Gate Leakage': 0.0484137,
'Total L3s/Peak Dynamic': 0.161329,
'Total L3s/Runtime Dynamic': 0.0792786,
'Total L3s/Subthreshold Leakage': 6.80085,
'Total L3s/Subthreshold Leakage with power gating': 3.32364,
'Total Leakage': 33.1122,
'Total NoCs/Area': 1.33155,
'Total NoCs/Gate Leakage': 0.00662954,
'Total NoCs/Peak Dynamic': 0.0,
'Total NoCs/Runtime Dynamic': 0.0,
'Total NoCs/Subthreshold Leakage': 0.0691322,
'Total NoCs/Subthreshold Leakage with power gating': 0.0259246}}
|
def most_frequent_days(year):
days=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
if year==2000: return ['Saturday', 'Sunday']
check=2000
if year>check:
day=6
while check<year:
check+=1
day+=2 if leap(check) else 1
if day%7==0:
return [days[(day)%7], days[(day-1)%7]] if leap(year) else [days[day%7]]
return [days[(day-1)%7], days[(day)%7]] if leap(year) else [days[day%7]]
elif year<check:
day=5
while check>year:
check-=1
day-=2 if leap(check) else 1
if (day+1)%7==0:
return [days[(day+1)%7], days[day%7]] if leap(year) else [days[day%7]]
return [days[day%7], days[(day+1)%7]] if leap(year) else [days[day%7]]
def leap(year):
if year%400==0:
return True
elif year%100==0:
return False
elif year%4==0:
return True
return False
|
class Solution:
# @param {integer[]} nums
# @return {string}
def largestNumber(self, nums):
nums = sorted(nums, cmp=self.compare)
res, j = '', 0
for i in range(len(nums) - 1):
if nums[i] != 0:
break
else:
j += 1
for k in range(j, len(nums)):
res += str(nums[k])
return res
def compare(self, x, y):
tmp1, tmp2 = str(x) + str(y), str(y) + str(x)
res = 0
if tmp1 > tmp2:
res = -1
elif tmp1 < tmp2:
res = 1
return res
|
n = int(input())
sequence = []
for i in range(n):
sequence.append(int(input()))
print(f"Max number: {max(sequence)}\nMin number: {min(sequence)}")
|
#python
evt = lx.args()[0]
if evt == 'onDo':
lx.eval("?kelvin.quickScale")
elif evt == 'onDrop':
pass
|
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def largestBSTSubtree(self, root):
"""
:type root: TreeNode
:rtype: int
"""
def find(root):
# return True if the root is a BST, and num the number of max subtree found under root, and lo and high of this tree
if not root:
return (True, 0, None, None)
l,r=find(root.left),find(root.right)
if l[0] and r[0] and (l[3]<root.val if l[3] else True) and (root.val<r[2] if r[2] else True):
return (True, l[1]+r[1]+1, l[2] if l[2] else root.val, r[3] if r[3] else root.val)
else:
return (False, max(l[1],r[1],1), None, None)
return find(root)[1]
|
"""
An implementation of a very simple Twitter Standard v1.1 API client based on
:mod:`requests`.
See https://developer.twitter.com/en/docs/twitter-api/v1 for more information.
"""
|
class Solution:
def lexicalOrder(self, n: int) -> List[int]:
ans = [1]
while len(ans) < n:
nxt = ans[-1] * 10
while nxt > n:
nxt //= 10
nxt += 1
while nxt % 10 == 0:
nxt //= 10
ans.append(nxt)
return ans
|
# Advent of Code - Day 2
# day_2_advent_2020.py
# 2020.12.02
# Jimmy Taylor
# Reading data from text file, spliting each value as separate lines without line break
input_data = open('inputs/day2.txt').read().splitlines()
# Cleaning up the data in each row to make it easier to parse later as individual rows
modified_data = [line.replace('-',' ').replace(':','').replace(' ',',') for line in input_data]
# Tracking good and bad passwords
valid_passwords_part_1 = 0
bad_passwords_part_1 = 0
valid_passwords_part_2 = 0
bad_passwords_part_2 = 0
for row in modified_data:
row = list(row.split(','))
# Part 1
min_val = int(row[0])
max_val = int(row[1])
letter = row[2]
password = row[3]
# Counting instances of the letter in the password
letter_count = password.count(letter)
# Checking if letter count is within the range
if (letter_count >= min_val) and (letter_count <= max_val):
valid_passwords_part_1 += 1
else:
bad_passwords_part_1 +=1
# Part 2
# Subtracting by 1 to calibrate character position
first_pos = int(row[0]) - 1
second_pos = int(row[1]) - 1
letter = row[2]
password = row[3]
# Looking through the characters and capturing their positions
positions = [pos for pos, char in enumerate(password) if char == letter]
# Looking if letter is in both positions; if so, bad password
if (first_pos in positions) and (second_pos in positions):
bad_passwords_part_2 +=1
# If letter in one position, valid password
elif (first_pos in positions):
valid_passwords_part_2 += 1
elif (second_pos in positions):
valid_passwords_part_2 += 1
# If letter is not in any position, bad password
else:
bad_passwords_part_2 +=1
print(f"Part 1 Valid Passwords: {valid_passwords_part_1}")
print(f"Part 1 Bad Passwords: {bad_passwords_part_1}")
print(f"Part 2 Valid Passwords: {valid_passwords_part_2}")
print(f"Part 2 Bad Passwords: {bad_passwords_part_2}")
|
for t in range(int(input())):
G = int(input())
for g in range(G):
I,N,Q = map(int,input().split())
if I == 1 :
if N%2:
heads = N//2
tails = N - N//2
if Q == 1:
print(heads)
else:
print(tails)
else:
print(N//2)
else:
if N%2:
heads = N - N//2
tails = N//2
if Q == 1:
print(heads)
else:
print(tails)
else:
print(N//2)
|
class Tile():
def __init__(self, pos):
self.white = True
self.pos = pos
def flip(self):
self.white = not self.white
def get_new_coord(from_tile, instructions):
curr = [from_tile.pos[0], from_tile.pos[1]]
for instruction in instructions:
if instruction == "ne":
curr[1] += 1
elif instruction == "e":
curr[0] += 1
elif instruction == "se":
curr[0] += 1
curr[1] -= 1
elif instruction == "sw":
curr[1] -= 1
elif instruction == "w":
curr[0] -= 1
elif instruction == "nw":
curr[0] -= 1
curr[1] += 1
return (curr[0], curr[1])
def part_1():
file = open('input.txt', 'r')
tiles = {}
starting_tile = Tile((0,0))
tiles[starting_tile.pos] = starting_tile
for line in file:
line = line.strip("\n")
instructions_on_line = []
index = 0
while index < len(line):
if line[index] == "w" or line[index] == "e":
instructions_on_line.append(line[index])
else:
if line[index+1] == "w" or line[index+1] == "e":
instructions_on_line.append(line[index:index+2])
index += 1
else:
instructions_on_line.append(line[index])
index += 1
line_coord = get_new_coord(starting_tile,instructions_on_line)
if line_coord in tiles:
tiles[line_coord].flip()
else:
new_tile = Tile(line_coord)
new_tile.flip()
tiles[line_coord] = new_tile
black_tiles = 0
for coord in tiles:
if tiles[coord].white == False:
black_tiles += 1
return black_tiles
print(part_1())
|
# Example 1:
# Input: digits = "23"
# Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"]
# Example 2:
# Input: digits = ""
# Output: []
# Example 3:
# Input: digits = "2"
# Output: ["a","b","c"]
class Solution:
def letterCombinations(self, digits: str) -> List[str]:
phone_keyboard = {2: 'abc', 3: 'def', 4: 'ghi',
5: 'jkl', 6: 'mno', 7: 'pqrs',
8: 'tuv', 9: 'wxyz'}
answer = [''] if digits else []
for x in digits:
answer = [i + j for i in answer for j in phone_keyboard[int(x)]]
return answer
|
class Solution(object):
def productExceptSelf(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
res = [1] * (len(nums))
prefix = 1
for i in range(len(nums)):
res[i] = prefix
prefix *= nums[i]
postfix = 1
for i in range(len(nums) - 1, -1, -1):
res[i] *= postfix
postfix *= nums[i]
return res
|
# Write a program to read through the mbox-short.txt and figure out who has sent
# the greatest number of mail messages. The program looks for 'From ' lines and
# takes the second word of those lines as the person who sent the mail
# The program creates a Python dictionary that maps the sender's mail address to a ' \
# 'count of the number of times they appear in the file.
# After the dictionary is produced, the program reads through the dictionary using
# a maximum loop to find the most prolific committer.
md = dict()
name = input("Enter file:")
if len(name) < 1: name = "mbox-short.txt"
handle = open(name)
for linem in handle:
if linem.startswith("From "):
key = linem.split()[1]
md[key] = md.get(key, 0) + 1
# count calculation
bigcnt = None
bigwd = None
for wd, cnt in md.items():
if bigcnt is None or cnt > bigcnt:
bigcnt = cnt
bigwd = wd
print(bigwd, bigcnt)
|
class FindAnswer:
def __init__(self, db):
self.db = db
# 검색 쿼리 생성
def _make_query(self, intent_name, ner_tags):
sql = "select * from chatbot_train_data"
if intent_name != None and ner_tags == None:
sql = sql + " where intent='{}' ".format(intent_name)
elif intent_name != None and ner_tags != None:
where = ' where intent="%s" ' % intent_name
if (len(ner_tags) > 0):
where += 'and ('
for ne in ner_tags:
where += " ner like '%{}%' or ".format(ne)
where = where[:-3] + ')'
sql = sql + where
# 동일한 답변이 2개 이상인 경우, 랜덤으로 선택
sql = sql + " order by RANDOM() limit 1"
return sql
# 답변 검색
def search(self, intent_name, ner_tags):
# 의도명, 개체명으로 답변 검색
sql = self._make_query(intent_name, ner_tags)
answer = self.db.select_one(sql)
# 검색되는 답변이 없으면 의도명만 검색
if answer is None:
sql = self._make_query(intent_name, None)
answer = self.db.select_one(sql)
else:
answer = {
"answer": answer[4],
"answer_image" : answer[5]
}
return answer['answer'], answer['answer_image']
# NER 태그를 실제 입력된 단어로 변환
def tag_to_word(self, ner_predicts, answer):
for word, tag in ner_predicts:
# 변환해야하는 태그가 있는 경우 추가
if tag == 'B_FOOD' or tag == 'B_DT' or tag == 'B_TI':
answer = answer.replace(tag, word)
answer = answer.replace('{', '')
answer = answer.replace('}', '')
return answer
|
#List of Numbers
list1 = [12, -7, 5, 64, -14]
#Iterating each number in the lsit
for i in list1:
#checking the condition
if i >= 0:
print(i, end = " ")
|
def Rotate2DArray(arr):
n = len(arr[0])
for i in range(0, n//2):
for j in range(i, n-i-1):
temp = arr[i][j]
arr[i][j] = arr[n-1-j][i]
arr[n-j-1][i] = arr[n-1-i][n-j-1]
arr[n-i-1][n-j-1] = arr[j][n-i-1]
arr[j][n-i-1] = temp
return arr
arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
newarr = Rotate2DArray(arr)
print(newarr)
|
class Scene:
def __init__(self, name="svg", height=400, width=400):
self.name = name
self.items = []
self.height = height
self.width = width
return
def add(self, item): self.items.append(item)
def strarray(self):
var = ["<?xml version=\"1.0\"?>\n",
"<svg height=\"%d\" width=\"%d\" >\n" % (
self.height, self.width),
" <g style=\"fill-opacity:1.0; stroke:black;\n",
" stroke-width:1;\">\n"]
for item in self.items:
var += item.strarray()
var += [" </g>\n</svg>\n"]
return var
def write_svg(self, filename=None):
if filename:
self.svgname = filename
else:
self.svgname = self.name + ".svg"
file = open(self.svgname, 'w')
file.writelines(self.strarray())
file.close()
return self.strarray()
class Line:
def __init__(self, start, end):
self.start = start # xy tuple
self.end = end # xy tuple
return
def strarray(self):
return [" <line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" />\n" %
(self.start[0], self.start[1], self.end[0], self.end[1])]
class Rectangle:
def __init__(self, origin, height, width, color=(255, 255, 255)):
self.origin = origin
self.height = height
self.width = width
self.color = color
return
def strarray(self):
return [" <rect x=\"%d\" y=\"%d\" height=\"%d\"\n" %
(self.origin[0], self.origin[1], self.height),
" width=\"%d\" style=\"fill:%s;\" />\n" %
(self.width, colorstr(self.color))]
class Text:
def __init__(self, origin, text, size=18, align_horizontal="middle", align_vertical="auto"):
self.origin = origin
self.text = text
self.size = size
self.align_horizontal = align_horizontal
self.align_vertical = align_vertical
return
def strarray(self):
return [" <text x=\"%d\" y=\"%d\" font-size=\"%d\"" %
(self.origin[0], self.origin[1],
self.size), " text-anchor=\"", self.align_horizontal, "\"",
" dominant-baseline=\"", self.align_vertical, "\">\n",
" %s\n" % self.text,
" </text>\n"]
class Textbox:
def __init__(self, origin, height, width, text, color=(255, 255, 255), text_size=16):
self.Outer = Rectangle(origin, height, width, color)
self.Inner = Text((origin[0]+width//2, origin[1]+height//2),
text, text_size, align_horizontal="middle", align_vertical="middle")
return
def strarray(self):
return self.Outer.strarray() + self.Inner.strarray()
def colorstr(rgb): return "rgb({}, {}, {})".format(rgb[0], rgb[1], rgb[2])
|
#Leia uma temperatura em graus celsius e apresente-a convertida em fahrenheit.
# A formula da conversao eh: F=C*(9/5)+32,
# sendo F a temperatura em fahrenheit e c a temperatura em celsius.
C=float(input("Informe a temperatura em Celsius: "))
F=C*(9/5)+32
print(f"A temperatura em Fahrenheit eh {round(F,1)}")
|
def main(j, args, params, tags, tasklet):
page = args.page
action = args.requestContext.params.get('action')
domain = args.requestContext.params.get('domain')
name = args.requestContext.params.get('name')
version = args.requestContext.params.get('version')
nid = args.requestContext.params.get('nid')
if not nid:
nid = j.application.whoAmI.nid
message = j.apps.system.packagemanager.action(nid=nid, domain=domain, pname=name, version=version, action=action)
page.addHTML(message)
params.result = page
return params
def match(j, args, params, tags, tasklet):
return True
|
STATS = [
{
"num_node_expansions": 25,
"plan_length": 20,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 22,
"plan_length": 18,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 24,
"plan_length": 21,
"search_time": 0.33,
"total_time": 0.33
},
{
"num_node_expansions": 26,
"plan_length": 20,
"search_time": 0.41,
"total_time": 0.41
},
{
"num_node_expansions": 19,
"plan_length": 14,
"search_time": 0.44,
"total_time": 0.44
},
{
"num_node_expansions": 28,
"plan_length": 24,
"search_time": 0.76,
"total_time": 0.76
},
{
"num_node_expansions": 22,
"plan_length": 18,
"search_time": 0.15,
"total_time": 0.15
},
{
"num_node_expansions": 19,
"plan_length": 17,
"search_time": 0.15,
"total_time": 0.15
},
{
"num_node_expansions": 19,
"plan_length": 17,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 16,
"plan_length": 12,
"search_time": 0.02,
"total_time": 0.02
},
{
"num_node_expansions": 13,
"plan_length": 11,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 17,
"plan_length": 15,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 18,
"plan_length": 15,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 12,
"plan_length": 10,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 18,
"plan_length": 16,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 15,
"plan_length": 13,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 27,
"plan_length": 23,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 31,
"plan_length": 27,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 28,
"plan_length": 24,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 18,
"plan_length": 16,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 17,
"plan_length": 13,
"search_time": 0.15,
"total_time": 0.15
},
{
"num_node_expansions": 20,
"plan_length": 16,
"search_time": 0.19,
"total_time": 0.19
},
{
"num_node_expansions": 16,
"plan_length": 13,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 28,
"plan_length": 24,
"search_time": 0.21,
"total_time": 0.21
},
{
"num_node_expansions": 13,
"plan_length": 11,
"search_time": 0.01,
"total_time": 0.01
},
{
"num_node_expansions": 19,
"plan_length": 16,
"search_time": 0.02,
"total_time": 0.02
},
{
"num_node_expansions": 17,
"plan_length": 13,
"search_time": 0.22,
"total_time": 0.22
},
{
"num_node_expansions": 16,
"plan_length": 14,
"search_time": 0.23,
"total_time": 0.23
},
{
"num_node_expansions": 20,
"plan_length": 15,
"search_time": 0.13,
"total_time": 0.13
},
{
"num_node_expansions": 16,
"plan_length": 13,
"search_time": 0.12,
"total_time": 0.12
},
{
"num_node_expansions": 27,
"plan_length": 22,
"search_time": 0.2,
"total_time": 0.2
},
{
"num_node_expansions": 21,
"plan_length": 16,
"search_time": 0.13,
"total_time": 0.13
},
{
"num_node_expansions": 19,
"plan_length": 16,
"search_time": 0.15,
"total_time": 0.15
},
{
"num_node_expansions": 22,
"plan_length": 20,
"search_time": 0.18,
"total_time": 0.18
},
{
"num_node_expansions": 25,
"plan_length": 19,
"search_time": 0.09,
"total_time": 0.09
},
{
"num_node_expansions": 21,
"plan_length": 19,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 17,
"plan_length": 14,
"search_time": 0.34,
"total_time": 0.34
},
{
"num_node_expansions": 38,
"plan_length": 33,
"search_time": 0.62,
"total_time": 0.62
},
{
"num_node_expansions": 17,
"plan_length": 14,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 23,
"plan_length": 20,
"search_time": 0.15,
"total_time": 0.15
},
{
"num_node_expansions": 21,
"plan_length": 17,
"search_time": 0.17,
"total_time": 0.17
},
{
"num_node_expansions": 9,
"plan_length": 7,
"search_time": 0.09,
"total_time": 0.09
},
{
"num_node_expansions": 18,
"plan_length": 13,
"search_time": 0.17,
"total_time": 0.17
},
{
"num_node_expansions": 29,
"plan_length": 27,
"search_time": 0.3,
"total_time": 0.3
},
{
"num_node_expansions": 15,
"plan_length": 13,
"search_time": 0.42,
"total_time": 0.42
},
{
"num_node_expansions": 35,
"plan_length": 26,
"search_time": 0.91,
"total_time": 0.91
},
{
"num_node_expansions": 18,
"plan_length": 16,
"search_time": 0.14,
"total_time": 0.14
},
{
"num_node_expansions": 22,
"plan_length": 19,
"search_time": 0.2,
"total_time": 0.2
},
{
"num_node_expansions": 24,
"plan_length": 19,
"search_time": 0.39,
"total_time": 0.39
},
{
"num_node_expansions": 17,
"plan_length": 15,
"search_time": 0.28,
"total_time": 0.28
},
{
"num_node_expansions": 10,
"plan_length": 8,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 17,
"plan_length": 14,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 28,
"plan_length": 25,
"search_time": 1.05,
"total_time": 1.05
},
{
"num_node_expansions": 19,
"plan_length": 14,
"search_time": 0.74,
"total_time": 0.74
},
{
"num_node_expansions": 11,
"plan_length": 9,
"search_time": 0.61,
"total_time": 0.61
},
{
"num_node_expansions": 39,
"plan_length": 34,
"search_time": 0.97,
"total_time": 0.97
},
{
"num_node_expansions": 15,
"plan_length": 13,
"search_time": 0.01,
"total_time": 0.01
},
{
"num_node_expansions": 25,
"plan_length": 19,
"search_time": 0.02,
"total_time": 0.02
},
{
"num_node_expansions": 20,
"plan_length": 18,
"search_time": 0.19,
"total_time": 0.19
},
{
"num_node_expansions": 27,
"plan_length": 21,
"search_time": 0.25,
"total_time": 0.25
},
{
"num_node_expansions": 14,
"plan_length": 11,
"search_time": 0.05,
"total_time": 0.05
},
{
"num_node_expansions": 31,
"plan_length": 24,
"search_time": 0.13,
"total_time": 0.13
},
{
"num_node_expansions": 9,
"plan_length": 7,
"search_time": 0.37,
"total_time": 0.37
},
{
"num_node_expansions": 33,
"plan_length": 31,
"search_time": 0.87,
"total_time": 0.87
},
{
"num_node_expansions": 18,
"plan_length": 15,
"search_time": 0.26,
"total_time": 0.26
},
{
"num_node_expansions": 18,
"plan_length": 15,
"search_time": 0.18,
"total_time": 0.18
},
{
"num_node_expansions": 18,
"plan_length": 16,
"search_time": 0.06,
"total_time": 0.06
},
{
"num_node_expansions": 18,
"plan_length": 13,
"search_time": 0.06,
"total_time": 0.06
},
{
"num_node_expansions": 11,
"plan_length": 9,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 10,
"plan_length": 8,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 18,
"plan_length": 14,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 28,
"plan_length": 21,
"search_time": 0.06,
"total_time": 0.06
},
{
"num_node_expansions": 22,
"plan_length": 17,
"search_time": 0.12,
"total_time": 0.12
},
{
"num_node_expansions": 12,
"plan_length": 10,
"search_time": 0.09,
"total_time": 0.09
},
{
"num_node_expansions": 15,
"plan_length": 13,
"search_time": 0.0,
"total_time": 0.0
},
{
"num_node_expansions": 13,
"plan_length": 10,
"search_time": 0.0,
"total_time": 0.0
},
{
"num_node_expansions": 22,
"plan_length": 20,
"search_time": 0.5,
"total_time": 0.5
},
{
"num_node_expansions": 27,
"plan_length": 25,
"search_time": 0.57,
"total_time": 0.57
},
{
"num_node_expansions": 19,
"plan_length": 14,
"search_time": 0.12,
"total_time": 0.12
},
{
"num_node_expansions": 13,
"plan_length": 10,
"search_time": 0.11,
"total_time": 0.11
},
{
"num_node_expansions": 13,
"plan_length": 11,
"search_time": 0.0,
"total_time": 0.0
},
{
"num_node_expansions": 20,
"plan_length": 18,
"search_time": 0.01,
"total_time": 0.01
},
{
"num_node_expansions": 20,
"plan_length": 17,
"search_time": 0.21,
"total_time": 0.21
},
{
"num_node_expansions": 28,
"plan_length": 21,
"search_time": 0.23,
"total_time": 0.23
},
{
"num_node_expansions": 13,
"plan_length": 10,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 17,
"plan_length": 15,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 23,
"plan_length": 18,
"search_time": 0.08,
"total_time": 0.08
},
{
"num_node_expansions": 19,
"plan_length": 17,
"search_time": 0.08,
"total_time": 0.08
},
{
"num_node_expansions": 22,
"plan_length": 17,
"search_time": 0.09,
"total_time": 0.09
},
{
"num_node_expansions": 22,
"plan_length": 18,
"search_time": 0.09,
"total_time": 0.09
},
{
"num_node_expansions": 16,
"plan_length": 12,
"search_time": 0.02,
"total_time": 0.02
},
{
"num_node_expansions": 14,
"plan_length": 10,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 19,
"plan_length": 14,
"search_time": 0.01,
"total_time": 0.01
},
{
"num_node_expansions": 17,
"plan_length": 14,
"search_time": 0.01,
"total_time": 0.01
},
{
"num_node_expansions": 22,
"plan_length": 20,
"search_time": 0.17,
"total_time": 0.17
},
{
"num_node_expansions": 19,
"plan_length": 17,
"search_time": 0.15,
"total_time": 0.15
},
{
"num_node_expansions": 15,
"plan_length": 12,
"search_time": 0.09,
"total_time": 0.09
},
{
"num_node_expansions": 21,
"plan_length": 18,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 28,
"plan_length": 25,
"search_time": 1.75,
"total_time": 1.75
},
{
"num_node_expansions": 25,
"plan_length": 20,
"search_time": 1.54,
"total_time": 1.54
},
{
"num_node_expansions": 9,
"plan_length": 7,
"search_time": 0.0,
"total_time": 0.0
},
{
"num_node_expansions": 9,
"plan_length": 7,
"search_time": 0.01,
"total_time": 0.01
},
{
"num_node_expansions": 14,
"plan_length": 11,
"search_time": 0.02,
"total_time": 0.02
},
{
"num_node_expansions": 19,
"plan_length": 15,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 17,
"plan_length": 15,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 26,
"plan_length": 20,
"search_time": 0.13,
"total_time": 0.13
},
{
"num_node_expansions": 13,
"plan_length": 10,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 15,
"plan_length": 12,
"search_time": 0.11,
"total_time": 0.11
},
{
"num_node_expansions": 35,
"plan_length": 33,
"search_time": 0.69,
"total_time": 0.69
},
{
"num_node_expansions": 33,
"plan_length": 28,
"search_time": 0.64,
"total_time": 0.64
},
{
"num_node_expansions": 20,
"plan_length": 17,
"search_time": 0.07,
"total_time": 0.07
},
{
"num_node_expansions": 13,
"plan_length": 10,
"search_time": 0.05,
"total_time": 0.05
},
{
"num_node_expansions": 16,
"plan_length": 12,
"search_time": 1.02,
"total_time": 1.02
},
{
"num_node_expansions": 24,
"plan_length": 19,
"search_time": 1.73,
"total_time": 1.73
},
{
"num_node_expansions": 17,
"plan_length": 14,
"search_time": 0.08,
"total_time": 0.08
},
{
"num_node_expansions": 24,
"plan_length": 18,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 32,
"plan_length": 25,
"search_time": 0.4,
"total_time": 0.4
},
{
"num_node_expansions": 25,
"plan_length": 19,
"search_time": 0.29,
"total_time": 0.29
},
{
"num_node_expansions": 21,
"plan_length": 17,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 22,
"plan_length": 17,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 21,
"plan_length": 17,
"search_time": 0.0,
"total_time": 0.0
},
{
"num_node_expansions": 22,
"plan_length": 20,
"search_time": 0.0,
"total_time": 0.0
},
{
"num_node_expansions": 14,
"plan_length": 12,
"search_time": 0.13,
"total_time": 0.13
},
{
"num_node_expansions": 31,
"plan_length": 28,
"search_time": 0.28,
"total_time": 0.28
},
{
"num_node_expansions": 17,
"plan_length": 14,
"search_time": 0.09,
"total_time": 0.09
},
{
"num_node_expansions": 26,
"plan_length": 20,
"search_time": 0.13,
"total_time": 0.13
},
{
"num_node_expansions": 18,
"plan_length": 14,
"search_time": 0.23,
"total_time": 0.23
},
{
"num_node_expansions": 16,
"plan_length": 12,
"search_time": 0.18,
"total_time": 0.18
},
{
"num_node_expansions": 16,
"plan_length": 12,
"search_time": 0.02,
"total_time": 0.02
},
{
"num_node_expansions": 25,
"plan_length": 19,
"search_time": 0.02,
"total_time": 0.02
},
{
"num_node_expansions": 17,
"plan_length": 12,
"search_time": 0.0,
"total_time": 0.0
},
{
"num_node_expansions": 16,
"plan_length": 14,
"search_time": 0.0,
"total_time": 0.0
},
{
"num_node_expansions": 19,
"plan_length": 15,
"search_time": 0.11,
"total_time": 0.11
},
{
"num_node_expansions": 18,
"plan_length": 13,
"search_time": 0.1,
"total_time": 0.1
},
{
"num_node_expansions": 21,
"plan_length": 19,
"search_time": 0.01,
"total_time": 0.01
},
{
"num_node_expansions": 23,
"plan_length": 17,
"search_time": 0.02,
"total_time": 0.02
},
{
"num_node_expansions": 19,
"plan_length": 13,
"search_time": 0.07,
"total_time": 0.07
},
{
"num_node_expansions": 15,
"plan_length": 12,
"search_time": 0.06,
"total_time": 0.06
},
{
"num_node_expansions": 23,
"plan_length": 19,
"search_time": 0.09,
"total_time": 0.09
},
{
"num_node_expansions": 20,
"plan_length": 18,
"search_time": 0.08,
"total_time": 0.08
},
{
"num_node_expansions": 21,
"plan_length": 16,
"search_time": 0.26,
"total_time": 0.26
},
{
"num_node_expansions": 20,
"plan_length": 15,
"search_time": 0.29,
"total_time": 0.29
},
{
"num_node_expansions": 18,
"plan_length": 16,
"search_time": 1.07,
"total_time": 1.07
},
{
"num_node_expansions": 25,
"plan_length": 23,
"search_time": 1.64,
"total_time": 1.64
},
{
"num_node_expansions": 14,
"plan_length": 10,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 17,
"plan_length": 13,
"search_time": 0.05,
"total_time": 0.05
},
{
"num_node_expansions": 24,
"plan_length": 19,
"search_time": 0.05,
"total_time": 0.05
},
{
"num_node_expansions": 22,
"plan_length": 18,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 15,
"plan_length": 12,
"search_time": 0.02,
"total_time": 0.02
},
{
"num_node_expansions": 11,
"plan_length": 8,
"search_time": 0.01,
"total_time": 0.01
},
{
"num_node_expansions": 20,
"plan_length": 18,
"search_time": 0.01,
"total_time": 0.01
},
{
"num_node_expansions": 27,
"plan_length": 23,
"search_time": 0.01,
"total_time": 0.01
},
{
"num_node_expansions": 20,
"plan_length": 17,
"search_time": 0.35,
"total_time": 0.35
},
{
"num_node_expansions": 17,
"plan_length": 14,
"search_time": 0.28,
"total_time": 0.28
},
{
"num_node_expansions": 15,
"plan_length": 12,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 17,
"plan_length": 12,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 19,
"plan_length": 14,
"search_time": 0.22,
"total_time": 0.22
},
{
"num_node_expansions": 39,
"plan_length": 33,
"search_time": 0.43,
"total_time": 0.43
},
{
"num_node_expansions": 16,
"plan_length": 13,
"search_time": 0.14,
"total_time": 0.14
},
{
"num_node_expansions": 25,
"plan_length": 20,
"search_time": 0.19,
"total_time": 0.19
},
{
"num_node_expansions": 21,
"plan_length": 16,
"search_time": 0.02,
"total_time": 0.02
},
{
"num_node_expansions": 27,
"plan_length": 19,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 18,
"plan_length": 14,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 16,
"plan_length": 14,
"search_time": 0.03,
"total_time": 0.03
},
{
"num_node_expansions": 29,
"plan_length": 27,
"search_time": 0.05,
"total_time": 0.05
},
{
"num_node_expansions": 19,
"plan_length": 14,
"search_time": 0.04,
"total_time": 0.04
},
{
"num_node_expansions": 21,
"plan_length": 18,
"search_time": 0.24,
"total_time": 0.24
},
{
"num_node_expansions": 16,
"plan_length": 14,
"search_time": 0.28,
"total_time": 0.28
},
{
"num_node_expansions": 14,
"plan_length": 12,
"search_time": 0.01,
"total_time": 0.01
},
{
"num_node_expansions": 17,
"plan_length": 14,
"search_time": 0.0,
"total_time": 0.0
},
{
"num_node_expansions": 20,
"plan_length": 17,
"search_time": 0.51,
"total_time": 0.51
},
{
"num_node_expansions": 14,
"plan_length": 12,
"search_time": 0.39,
"total_time": 0.39
}
]
num_timeouts = 0
num_timeouts = 0
num_problems = 172
|
# -*- coding: utf-8 -*-
# @Author: 何睿
# @Create Date: 2019-01-20 21:12:46
# @Last Modified by: 何睿
# @Last Modified time: 2019-01-20 21:23:10
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def removeElements(self, head, val):
"""
:type head: ListNode
:type val: int
:rtype: ListNode
"""
# 添加一个辅助节点
node = ListNode(0)
node.next = head
res = node
while node and node.next:
if node.next.val == val:
temp = node.next
node.next = temp.next
del temp
else:
node = node.next
return res.next
|
def rotate(angle):
"""Rotates the context"""
raise NotImplementedError("rotate() is not implemented")
def translate(x, y):
"""Translates the context by x and y"""
raise NotImplementedError("translate() is not implemented")
def scale(factor):
"""Scales the context by the provided factor"""
raise NotImplementedError("scale() is not implemented")
def save():
"""Saves the current context's translation, rotation and scaling"""
raise NotImplementedError("save() is not implemented")
def restore():
"""Restores the context's translation, rotation and scaling to that of the latest save"""
raise NotImplementedError("restore() is not implemented")
def reset_style():
"""Resets PyPen's current setting surrounding style to their default_values, which includes fill_color, stroke_color, stroke_width"""
raise NotImplementedError("reset_style() is not implemented")
def clear_screen():
"""Clears the screen"""
raise NotImplementedError("clear_screen() not implemented")
def clear():
"""Clears the screen"""
raise NotImplementedError("clear() not implemented")
def fill_screen(color="default_background_color"):
"""Fills the screen with the specified color"""
raise NotImplementedError("fill_screen() not implemented")
def fill():
"""Fills the current path"""
raise NotImplementedError("fill() not implemented")
def begin_shape():
"""Tells PyPen that a shape is a bout to be created"""
raise NotImplementedError("begin_shape() not implemented")
def vertex(x, y):
"""Adds a vertex to current shape at (x, y)"""
raise NotImplementedError("vertex() not implemented")
def end_shape(fill_color="", stroke_color="", stroke_width=-1):
"""Ends shape and styles it"""
raise NotImplementedError("end_shape() not implemented")
def rectangle(x, y, width, height, fill_color="", stroke_color="", stroke_width=-1):
"""Draws a rectangle on the given coordinate with the given width, height and color"""
raise NotImplementedError("rectangle() not implemented")
def circle(x, y, radius, fill_color="", stroke_color="", stroke_width=-1):
"""Draws a circle on the given coordinate with the given radius and color"""
raise NotImplementedError("circle() not implemented")
def ellipse(x, y, width, height, fill_color="", stroke_color="", stroke_width=-1):
"""Draws an ellipse on the given coordinate with the given width, height and color"""
raise NotImplementedError("ellipse() not implemented")
def arc(x, y, radius, start_angle, stop_angle, fill_color="", stroke_color="", stroke_width=-1):
"""Draws an arc on the given coordinate with the given radius, angles and color"""
raise NotImplementedError("arc() not implemented")
def triangle(x1, y1, x2, y2, x3, y3, fill_color="", stroke_color="", stroke_width=-1):
"""Draws a triangle between the supplied coordinates with the given color"""
raise NotImplementedError("triangle() not implemented")
def line(x1, y1, x2, y2, stroke_color="", stroke_width=-1):
"""Draws a line between the supplied coordinates with the given stroke_color and stroke_width"""
raise NotImplementedError("triangle() not implemented")
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'WEB编程的练习'
__author__ = 'Jacklee'
"""
WSGI(Web Server Gateway Interface)
是一个接口规范
包括了Server端、Middleware中间件、Applicatioin客户端
1. 使用WSGI规范开发的简单的WEB处理程序
hello.py
myserver.py
2. Web App
就是一个WSGI的处理函数,针对每种HTTP请求进行响应
A. 对不同HTTP请求(GET、PUT、POST、DELETE)进行处理
B. 对不同的请求路径PATH_INFO进行处理
而且随着页面数量和请求类型的增多,该函数难于维护
3. 使用框架
从大量的HTTP处理工作中解脱出来
一般的框架都是使用注入模式JAVA/装饰器模式Python
本案例中使用flask
安装: pip3 install flask
4. 使用模板
简化生成HTML页面的处理
使用带有变量和指令的HTML,后台根据这些变量和指令,将相关的数据和内容填充进去
避免了大量的字符串的拼接工作,提高了工作效率,降低了出错的概率
常用的模式MVC就是使用模板进行页面的渲染render
本案例使用与Flask配套的jinja2
安装: pip3 install jinja2
"""
|
print(14514)
for i in range(3, 121):
for j in range(1, i + 1):
print(i, j, -1)
print(i, j, 1)
|
obj_row, obj_col = 2978, 3083
first_code = 20151125
def generate(obj_row, obj_col):
x_row= obj_row + obj_col - 1
x_n = sum(range(1, x_row + 1)) - (x_row - obj_col)
print(x_n)
previous = first_code
aux = first_code
for i in range(1, x_n) :
aux = (previous * 252533) % 33554393
previous = aux
return aux
print("RESULT: ", generate(obj_row, obj_col))
|
def wait(t, c):
while c < t:
c += c
return c
s, t, n = [int(i) for i in raw_input().split()]
d = map(int, raw_input().split())
b = map(int, raw_input().split())
c = map(int, raw_input().split())
time = s
time += d[0]
for i in range(n):
time = wait(time, c[i])
time += b[i]
time += d[i+1]
print('yes' if time < t else 'no')
|
#Grantham, R. Science. 185, 862–864 (1974)
#(amino acid side chain composition, polarity and molecular volume)
grantham = {
'ALA': 0.000,
'ARG': 0.650,
'ASN': 1.330,
'ASP': 1.380,
'CYS': 2.750,
'GLN': 0.890,
'GLU': 0.920,
'GLY': 0.740,
'HIS': 0.580,
'ILE': 0.000,
'LEU': 0.000,
'LYS': 0.330,
'MET': 0.000,
'PHE': 0.000,
'PRO': 0.390,
'SER': 1.420,
'THR': 0.710,
'TRP': 0.130,
'TYR': 0.000,
'VAL': 0.000
}
|
class Config:
SECRET_KEY = 'a22912297e93845c6cf4776991df63ec'
SQLALCHEMY_DATABASE_URI = 'sqlite:///site.db'
MAIL_SERVER = 'smtp.gmail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = "[email protected]"
MAIL_PASSWORD = "#@1234abcd"
|
# https://practice.geeksforgeeks.org/problems/circular-tour-1587115620/1
# 4 6 7 4
# 6 5 3 5
# -2 1 4 -1
class Solution:
def tour(self, lis, n):
sum = 0
j = 0
for i in range(len(lis)):
pair = lis[i]
sum += pair[0]-pair[1]
if sum < 0:
sum = 0
j = i+1
if j>=n:
return -1
else:
return j
if __name__ == '__main__':
t = int(input())
for i in range(t):
n = int(input())
arr = list(map(int, input().strip().split()))
lis = []
for i in range(1, 2 * n, 2):
lis.append([arr[i - 1], arr[i]])
print(Solution().tour(lis, n))
|
MESSAGES = {
# name -> (message send, expected response)
"ping request":
(b'd1:ad2:id20:\x16\x01\xfb\xa7\xca\x18P\x9e\xe5\x1d\xcc\x0e\xf8\xc6Z\x1a\xfe<s\x81e1:q4:ping1:t2:aa1:y1:qe',
b'^d1:t2:aa1:y1:r1:rd2:id20:.{20}ee$'),
"ping request missing id":
(b'd1:ade1:q4:ping1:t2:XX1:y1:qe', b'^d1:t2:XX1:y1:e1:eli203e14:Protocol Erroree$'),
"find_node request":
(b'd1:ad2:id20:abcdefghij01234567896:target20:mnopqrstuvwxyz123456e1:q9:find_node1:t2:aa1:y1:qe',
b'^d1:t2:aa1:y1:r1:rd5:nodesl(26|38):.*ee$'),
}
|
#!/usr/bin/env python
# PoC1.py
junk = "A"*1000
payload = junk
f = open('exploit.plf','w')
f.write(payload)
f.close()
|
"""
Misc ASCII art
"""
WARNING = r"""
_mBma
sQf "QL
jW( -$g.
jW' -$m,
.y@' _aa. 4m,
.mD` ]QQWQ. 4Q,
_mP` ]QQQQ ?Q/
_QF )WQQ@ ?Qc
<QF QQQF )Qa
jW( QQQf "QL
jW' ]H8' -Q6.
.y@' _as. -$m.
.m@` ]QQWQ. -4m,
_mP` -?$8! 4Q,
mE $m
?$gyygggggggggwywgyygggggggygggggD(
"""
|
"""
summary: code to be run right after IDAPython initialization
description:
The `idapythonrc.py` file:
* %APPDATA%\Hex-Rays\IDA Pro\idapythonrc.py (on Windows)
* ~/.idapro/idapythonrc.py (on Linux & Mac)
can contain any IDAPython code that will be run as soon as
IDAPython is done successfully initializing.
"""
# Add your favourite script to ScriptBox for easy access
# scriptbox.addscript("/here/is/my/favourite/script.py")
# Uncomment if you want to set Python as default interpreter in IDA
# import ida_idaapi
# ida_idaapi.enable_extlang_python(True)
# Disable the Python from interactive command-line
# import ida_idaapi
# ida_idaapi.enable_python_cli(False)
# Set the timeout for the script execution cancel dialog
# import ida_idaapi
# ida_idaapi.set_script_timeout(10)
|
#coding: utf-8
number = []
print("1부터 100사이의 숫자를 입력하시오.")
for i in range(10):
while(True):
newnum = int(input(str(i+1)+"번째 숫자를 입력하시오. "))
if not newnum in number:
number.append(newnum)
break
else:
print("잘못 입력하셨습니다. 다시 입력하세요.")
for i in range(10):
print(str(i+1)+"번째 숫자는",number[i],"입니다.")
|
'''
Created on 22 Oct 2019
@author: Yvo
'''
name = "Rom Filter";
|
class State:
MOTION_STATIONARY = 0
MOTION_WALKING = 1
MOTION_RUNNING = 2
MOTION_DRIVING = 3
MOTION_BIKING = 4
LOCATION_HOME = 0
LOCATION_WORK = 1
LOCATION_OTHER = 2
RINGER_MODE_SILENT = 0
RINGER_MODE_VIBRATE = 1
RINGER_MODE_NORMAL = 2
SCREEN_STATUS_ON = 0
SCREEN_STATUS_OFF = 1
def __init__(self, timeOfDay, dayOfWeek, motion, location,
notificationTimeElapsed, ringerMode, screenStatus):
assert 0.0 <= timeOfDay and timeOfDay <= 1.0
assert 0.0 <= dayOfWeek and dayOfWeek <= 1.0
assert motion in State.allMotionValues()
assert location in State.allLocationValues()
assert 0.0 <= notificationTimeElapsed
assert ringerMode in State.allRingerModeValues()
assert screenStatus in State.allScreenStatusValues()
self.timeOfDay = timeOfDay
self.dayOfWeek = dayOfWeek
self.motion = motion
self.location = location
self.notificationTimeElapsed = notificationTimeElapsed
self.ringerMode = ringerMode
self.screenStatus = screenStatus
@staticmethod
def allMotionValues():
return [
State.MOTION_STATIONARY,
State.MOTION_WALKING,
State.MOTION_RUNNING,
State.MOTION_DRIVING,
State.MOTION_BIKING,
]
@staticmethod
def allLocationValues():
return [
State.LOCATION_HOME,
State.LOCATION_WORK,
State.LOCATION_OTHER,
]
@staticmethod
def allRingerModeValues():
return [
State.RINGER_MODE_SILENT,
State.RINGER_MODE_VIBRATE,
State.RINGER_MODE_NORMAL,
]
@staticmethod
def allScreenStatusValues():
return [
State.SCREEN_STATUS_ON,
State.SCREEN_STATUS_OFF,
]
@staticmethod
def getExampleState():
return State(
timeOfDay=0.,
dayOfWeek=0.,
motion=State.MOTION_STATIONARY,
location=State.LOCATION_HOME,
notificationTimeElapsed=1.,
ringerMode=State.RINGER_MODE_SILENT,
screenStatus=State.SCREEN_STATUS_ON,
)
def __eq__(self, other):
return all([
self.timeOfDay == other.timeOfDay,
self.dayOfWeek == other.dayOfWeek,
self.motion == other.motion,
self.location == other.location,
self.notificationTimeElapsed == other.notificationTimeElapsed,
self.ringerMode == other.ringerMode,
self.screenStatus == other.screenStatus,
])
|
num1 =int(input('Primeiro Numero'))
num2 = int(input('Segundo Numero'))
if num1 > num2:
print('O Primeiro numero é maior')
elif num1 < num2:
print('O Segundo Numero é maior')
else:
print('Os Dois São o Mesmo Valor')
|
class Shortener():
"""
The shortner API provides three functions, create, retrive and update shortened URL token.
"""
def __init__(self, shortener, store, validator) -> None:
self.__shortener = shortener
self.__store = store
self.__validator = validator
self.__default_protocol = 'http://'
def create(self, url, user = '') -> str:
shortened_str = ''
#use the validator to validate the original URL
if self.__validator(url):
#add default protocol
if '://' not in url:
url = f'{self.__default_protocol}{url}'
#for each user we will create a differnt short URL token
input_url = f'{url}{user}'
#create using the shortener function
shortened_str = self.__shortener(input_url)
i = 0
#try store the pair, if got collision, re-create by adding a trailing number
while not self.__store.add(shortened_str, url, user):
#3 is an arbitrary number here to prevent collision, if SHA256 bits are evenly distributed, the chance of collision is very low
if i == 3:
raise ValueError('Failed to shorten the URL.')
i += 1
shortened_str = self.__shortener(input_url, i)
else:
raise ValueError("URL is invalid.")
return shortened_str
def retrieve(self, shortened_str) -> str:
url = ''
url = self.__store.get(shortened_str)
if not url:
raise ValueError('Failed to find the URL.')
return url
def update(self, shortened_str, url, user) -> bool:
#basic check to ensure no infinite redirection
if url.endswith(shortened_str):
raise ValueError('Short URL and Original URL cannot be the same.')
if self.__validator(url):
#add default protocol
if '://' not in url:
url = f'{self.__default_protocol}{url}'
return self.__store.update(shortened_str, url, user)
else:
raise ValueError("URL is invalid.")
|
"""
FILE: read_switches.py
AUTHOR: Ben Simcox
PROJECT: verbose-waffle (github.com/bnsmcx/verbose-waffle)
PURPOSE: Currently simulates reading of switches. This functionality will change when
prototyping moves to hardware but the use of a list of lists to capture the
switch positions will be the same.
"""
def read_switches() -> list:
"""This function will ultimately interact with the hardware, now it returns a test list"""
test_list = [
[0, 1, 0, 0, 1, 0, 0, 0],
[0, 1, 0, 0, 1, 0, 0, 1],
[0, 0, 1, 0, 1, 1, 0, 0],
[0, 1, 0, 1, 0, 1, 1, 1],
[0, 1, 0, 0, 1, 0, 0, 1],
[0, 1, 0, 0, 1, 1, 0, 0],
[0, 1, 0, 0, 1, 1, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 1]
]
return test_list
|
# -*- coding: utf-8 -*-
TVS = [{
'number': 1,
'title': 'Asteroid Blues',
'airdate': 'October 24, 1998',
'content': """In a flashback, Spike Spiegel is shown waiting near a church holding a bouquet of flowers, before leaving as the church bell rings. As he walks away, images of a gunfight he participated in are shown. In the present, Spike, currently a bounty hunter, and his partner Jet Black head to the Tijuana asteroid colony on their ship, the Bebop, to track down a bounty-head named Asimov Solensan. Asimov is wanted for killing members of his own crime syndicate and for stealing a cache of a dangerous combat drug known as Bloody-Eye. On the colony, Asimov and his girlfriend, Katerina, are ambushed at a bar by his former syndicate while attempting to sell a vial of Bloody-Eye, but Asimov manages to fight his way out by using the drug himself. Spike later encounters Katerina and reveals to her that he is a bounty hunter searching for Asimov; Spike is promptly assaulted by Asimov and is nearly killed before Katerina intervenes. In the confusion, Spike is able to steal Asimov's Bloody-Eye vial before the two leave. Spike later confronts Asimov at a staged drug deal with the stolen vial, but Asimov escapes with Katerina in a ship when the two are interrupted by an attack from Asimov's former syndicate. With Spike giving chase in his own ship, Asimov attempts to take another dose of Bloody-Eye, but a horrified Katerina shoots him before he can. As Spike approaches Asimov's ship, it is destroyed by attacking police cruisers, forcing Spike to pull away. The episode ends with Spike and Jet once again traveling through space on the Bebop.""",
}, {
'number': 2,
'title': 'Stray Dog Strut',
'airdate': 'October 31, 1998',
'content': """Spike and Jet's next bounty takes them to Mars, where their target, Abdul Hakim, is wanted for stealing a valuable lab animal. To avoid capture, Hakim has had plastic surgery to change his appearance. At a bar, Hakim loses the briefcase containing the animal when it is stolen behind his back. Spike discovers the thief attempting to sell the animal at a pet store and, mistaking him for Hakim, holds him at gunpoint. Spike orders the store owner to open the case, revealing the animal to be a Welsh corgi. As Spike leaves the pet store, the real Hakim appears and attempts to take the dog back; the dog manages to escape, prompting Hakim, Spike, and the group of scientists who had illegally experimented on the dog to give chase. Spike ultimately loses Hakim but gains possession of the dog, whom he brings back to the Bebop. Jet suggests that Spike take the dog for a walk in order to lure Hakim into trying to take it back. However, the scientists activate a dog whistle to find their "data dog", resulting in the corgi escaping from Spike. Hakim uses a stolen car and manages to grab the dog, while Spike and the scientists pursue him in their ship and truck, respectively. The dog manipulates the car's controls to open the doors and jumps out, causing Spike to reluctantly save it by having it land on top of his ship. Meanwhile, Hakim and the scientists crash their vehicles and are apprehended by the police. The dog, named Ein, is shown to now be living on the Bebop, much to Spike's chagrin.""",
}, {
'number': 3,
'title': 'Honky Tonk Women',
'airdate': 'November 7, 1998',
'content': """With Ein as a new companion, the crew of the Bebop cross paths with Faye Valentine, a wanted fugitive drowning in debt, who ends up being forced to act as a middle-woman for an illegal transaction at a space station casino.""",
}, {
'number': 4,
'title': 'Gateway Shuffle',
'airdate': 'November 14, 1998',
'content': """After gambling away all the money she obtained, Faye ends up getting her hands on a mysterious suitcase while exploring the wreckage of a derelict spaceship. Meanwhile, Spike and Jet pursue a bounty on the leader of the Space Warriors, a group of eco-terrorists armed with a terrifying biological weapon.""",
}, {
'number': 5,
'title': 'Ballad of Fallen Angels',
'airdate': 'November 21, 1998',
'content': """While pursuing the bounty on an executive of the Red Dragon Syndicate, Spike ends up confronting Vicious, an old enemy of his.""",
}, {
'number': 6,
'title': 'Sympathy for the Devil',
'airdate': 'November 28, 1998',
'content': """Spike and Jet chase a dangerous enemy who, despite having the appearance of a little boy, is actually more than eighty years old.""",
}, {
'number': 7,
'title': 'Heavy Metal Queen',
'airdate': 'December 5, 1998',
'content': """The crew of the Bebop chase a bounty named Decker, who is running a load of high explosives. While nursing a hangover at a diner, Spike meets a cargo hauler pilot named V.T., who hates bounty hunters, but ends up lending him a hand.""",
}, {
'number': 8,
'title': 'Waltz for Venus',
'airdate': 'December 12, 1998',
'content': """While the crew hunts down a Venusian mobster, Spike meets Rocco Bonnaro, who is on the run from the same mobster the crew is tracking for stealing a very rare and valuable plant, which he plans to sell to pay for surgery to restore his sister's eyesight.""",
}, {
'number': 9,
'title': 'Jamming with Edward',
'airdate': 'December 19, 1998',
'content': """The crew enlists the help of an elite computer hacker nicknamed "Radical Edward" to help them track down a bounty-head who has been vandalizing Earth's surface with hacked laser satellites. However, when they finally meet Edward face-to-face, the hacker's true identity proves to be a surprise for everybody.""",
}, {
'number': 10,
'title': 'Ganymede Elegy',
'airdate': 'December 26, 1998',
'content': """Jet is even more taciturn than usual as the Bebop lands on Ganymede, his last post before leaving the ISSP and the home of his ex-girlfriend, Alisa, whom he has never quite left behind. Meanwhile, Spike pursues bounty Rhint Celonias, who just happens to be Alisa's new boyfriend.""",
}, {
'number': 11,
'title': 'Toys in the Attic',
'airdate': 'January 2, 1999',
'content': """A strange blob-like creature with a venomous bite infiltrates the Bebop and incapacitates Jet, Faye and Ein. With half the crew out of action, it's up to Spike and Ed to destroy the creature and find out where it came from. This episode makes reference to the movie Alien, with Spike using a motion tracker and a flamethrower and by having the characters slowly attacked by an unknown alien one by one. The scene where Spike ejects the refrigerator into space was inspired by the scene in Aliens where Ripley gets rid of the Alien queen. The episode's use of Waltz of the Flowers from the Nutcracker is reminiscent of the movie 2001: A Space Odyssey's use of well-known classical music.""",
}, {
'number': 12,
'title': 'Jupiter Jazz (Part 1)',
'airdate': 'January 9, 1999',
'content': """Faye cleans out the crew's safe and leaves the Bebop for Callisto, one of Jupiter's moons. While Jet chases after her, Spike decides to follow up on some clues about the location of his ex-girlfriend Julia, which leads him to another confrontation with Vicious.""",
}, {
'number': 13,
'title': 'Jupiter Jazz (Part 2)',
'airdate': 'January 16, 1999',
'content': """Faye is helped by Gren, a man who holds a grudge against Vicious. After explaining his story to Faye, he chases after Vicious, and when he and Spike end up reaching him at the same time, a three-way battle takes place.""",
}, {
'number': 14,
'title': 'Bohemian Rapusodi',
'airdate': 'January 23, 1999',
'content': """The Bebop crew hunts for Chessmaster Hex, the rumored mastermind behind a series of robberies at hyperspace gate tollbooths. However, while trying to dig up dirt on their target, they unearth some very valuable data regarding the gate accident that devastated Earth fifty years earlier.""",
}, {
'number': 15,
'title': 'My Funny Valentine',
'airdate': 'January 30, 1999',
'content': """Faye ends up meeting an important man from her past, and part of her origin is revealed, including the source of her massive debt.""",
}, {
'number': 16,
'title': 'Black Dog Serenade',
'airdate': 'February 13, 1999',
'content': """An ISSP prison ship has undergone a mechanical malfunction, and has been taken over by the prisoners it was transporting, led by Udai Taxim, the Syndicate assassin who took Jet's arm. Jet's former partner, Fad, enlists him for the retrieval operation, but Fad's motivations might not be as noble as they seem.""",
}, {
'number': 17,
'title': 'Mushroom Samba',
'airdate': 'February 20, 1999',
'content': """The Bebop, out of food and fuel, is sideswiped in a hit-and-run off of Europa and crash-lands on Io. Ed, with Ein by her side, is sent out to procure food, and ends up running across Domino Walker, a bounty-head who is smuggling hallucinogenic mushrooms.""",
}, {
'number': 18,
'title': 'Speak Like a Child',
'airdate': 'February 27, 1999',
'content': """While Faye wastes money betting on horse racing, a package addressed to her arrives on the Bebop containing an old Betamax tape, prompting Spike and Jet to look for an appropriate device to view its contents.""",
}, {
'number': 19,
'title': 'Wild Horses',
'airdate': 'March 6, 1999',
'content': """While Spike takes his mono-racer in for maintenance, Jet and Faye take on a group of pirates who use computer viruses to terrorize cargo ships.""",
}, {
'number': 20,
'title': 'Pierrot le Fou',
'airdate': 'March 13, 1999',
'content': """Spike is targeted by an insane, seemingly indestructible assassin named Mad Pierrot after accidentally witnessing the killer in action.""",
}, {
'number': 21,
'title': 'Boogie Woogie Feng Shui',
'airdate': 'March 20, 1999',
'content': """Jet, spurred on by a cryptic e-mail, tries to find an old acquaintance but discovers only his grave—he disappeared under mysterious circumstances. His daughter, Mei-Fa, an expert in feng shui, asks for his help finding a "sun stone" that can lead them to her father's location.""",
}, {
'number': 22,
'title': 'Cowboy Funk',
'airdate': 'March 27, 1999',
'content': """A terrorist known as the "Teddy Bomber" has been using explosives hidden in teddy bears to bring down high-rise buildings in protest of humanity's excesses. Spike attempts to stop him, but constantly runs afoul of "Cowboy Andy", a fellow bounty hunter who is far more similar to Spike than either would care to admit.""",
}, {
'number': 23,
'title': 'Brain Scratch',
'airdate': 'April 3, 1999',
'content': """Unbeknownst to the rest of the crew, Faye goes undercover to infiltrate SCRATCH, a cult that believes in achieving eternal life by digitizing the soul and uploading it into the Internet, in order to collect the bounty on the cult's leader, Dr. Londes. Faye soon finds herself in danger, however, and while Spike goes looking for her, Jet and Ed try to track down Dr. Londes themselves.""",
}, {
'number': 24,
'title': 'Hard Luck Woman',
'airdate': 'April 10, 1999',
'content': """While heading to Mars, the Bebop is diverted to Earth (unplanned, of course). After arriving, Faye decides to investigate her past by traveling to the landmarks she sees in the video she recorded as a child, taking Ed along with her. She and Ed manage to find what looks like an orphanage where Ed had stayed at previously, where it is revealed that Ed's father had been looking for her several months back. Faye and Ed manage to find one of the locations in the video, whereupon Faye is surprised by an old schoolmate. Jet and Spike notice a bounty on their computer which looks to be a lucrative payoff. After having returned to the Bebop and dwelling on what has happened, Faye leaves again. Jet and Spike find their bounty, but are interrupted by Ed maneuvering the Bebop by remote control, whereupon it's discovered that their bounty is not only just a measly fifty woolongs (instead of the fifty million they mistakenly thought it was), but is Ed's father. Ed's father asks if she wants to stay with him, but before Ed can answer, he and his assistant see another meteorite strike the Earth's surface in the distance and they hastily and absent-mindedly speed off, leaving Ed behind, dumbfounded. Faye manages to find herself at the bottom of the hill from her old house and runs to the top, like she did when she was younger, only to find ruins where her home used to be. After having briefly seen her father again, Ed decides to leave the Bebop, and Ein leaves with her.""",
}, {
'number': 25,
'title': 'The Real Folk Blues (Part 1)',
'airdate': 'April 17, 1999',
'content': """Left alone by the rest of the crew, Spike and Jet are ambushed by members of the Red Dragon syndicate. They are saved by Lin's brother, Shin, who explains that Vicious has tried to seize control of the organization and was sentenced to death. He also states that all people connected to him are also being hunted down, and Spike rushes to find Julia.""",
}, {
'number': 26,
'title': 'The Real Folk Blues (Part 2)',
'airdate': 'April 24, 1999',
'content': """Reunited, Spike and Julia pick up where they left off in their plans to escape the Red Dragon syndicate, but Julia ends up being shot and killed. Spike returns to the Bebop for a meal with Jet and Faye, and then storms the Red Dragon's headquarters to confront Vicious for one last battle. Shin helps him, but is killed, managing to reveal that if Vicious is killed, Spike will be the new leader of the syndicate. Spike fights his way to the top floor of the Red Dragon syndicate skyscraper, but is badly wounded, and then fights Vicious, getting wounded during the battle. The pair manages to get the other's weapons and they trade, with a brief struggle, in which Spike manages to shoot Vicious in the chest, killing him. As Spike stumbles down a set of stairs and faces the syndicate members that rushed to the scene, he makes a gun with his fingers and says "Bang" before collapsing.""",
}
]
|
class LinkParserResult:
uri: str = ""
relationship: str = ""
link_type: str = ""
datetime: str = ""
title: str = ""
link_from: str = ""
link_until: str = ""
def __init__(self, uri: str = "",
relationship: str = "",
link_type: str = "",
datetime: str = "",
title: str = "",
link_from: str = "",
link_until: str = ""):
self.uri = uri.strip()
self.relationship = relationship
self.datetime = datetime
self.link_type = link_type
self.title = title
self.link_from = link_from
self.link_until = link_until
class LinkParser:
def parse(self, link_header: str) -> list[LinkParserResult]:
"""
Parses given link header string into link parser results.
:param link_header: link header as string.
:return: List containing link parser results.
"""
pass
|
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def getIntersectionNode(self, headA, headB):
"""
:type head1, head1: ListNode
:rtype: ListNode
"""
p1, p2 = headA, headB
len1, len2 = 1, 1
while p1 != None and p2 != None:
if p1 == p2: # Intersect
return p1
else:
p1 = p1.next
len1 += 1
p2 = p2.next
len2 += 1
while p1 != None:
p1 = p1.next
len1 += 1
while p2 != None:
p2 = p2.next
len2 += 1
# The second iteration
diff = abs(len1 - len2)
p1, p2 = headA, headB
while p1 != None and p2 != None:
if len1 >= len2 and diff > 0:
p1 = p1.next
diff -= 1
elif len1 < len2 and diff > 0:
p2 = p2.next
diff -= 1
else: # find the intersection
if p1 == p2:
return p1
else:
p1 = p1.next
p2 = p2.next
|
class Solution:
def confusingNumberII(self, N: int) -> int:
table = {0:0, 1:1, 6:9, 8:8, 9:6}
keys = [0, 1, 6, 8, 9]
def dfs(num, rotation, base):
count = 0
if num != rotation:
count += 1
for d in keys:
if num == 0 and d == 0:
continue
if num * 10 + d > N:
break
count += dfs(num * 10 + d, table[d] * base + rotation, base * 10)
return count
return dfs(0, 0, 1)
|
# -*- coding: utf-8 -*-
APPLIANCE_SECTION_START = '# BEGIN AUTOGENERATED'
APPLIANCE_SECTION_END = '# END AUTOGENERATED'
class UpScript(object):
"""
Parser and generator for tinc-up scripts.
This is pretty basic:
It assumes that somewhere in the script, there is a section initiated by '# BEGIN AUTOGENERATED'
and concluded by '# END AUTOGENERATED'. Everything before this section is the "prolog", everything
below this section is the "epilog". Both prolog and epilog can be freely modified by
the user.
Upon saving, this ensures that the prolog begins with a shebang.
"""
def __init__(self, io, filename):
self.io = io
self.filename = filename
self._clear()
self._open()
def _clear(self):
self.prolog = []
self.appliance_section = []
self.epilog = []
def _open(self):
self._clear()
if self.io.exists(self.filename):
with self.io.open(self.filename, 'r') as f:
# read:
# lines up to "# BEGIN AUTOGENERATED" into self.prolog
# everything up to "# END AUTOGENERATED" into self.appliance_section
# everything after it into self.epilog
current_part = self.prolog
for line in f.readlines():
line = line.strip()
if line == APPLIANCE_SECTION_START:
current_part = self.appliance_section
elif current_part is self.appliance_section and line == APPLIANCE_SECTION_END:
current_part = self.epilog
else:
current_part.append(line)
def _generate(self):
lst = []
lst.extend(self.prolog)
lst.append(APPLIANCE_SECTION_START)
lst.extend(self.appliance_section)
lst.append(APPLIANCE_SECTION_END)
lst.extend(self.epilog)
return '\n'.join(lst)
def save(self):
# ensure that we have a shebang
if not self.prolog or not self.prolog[0].startswith('#!'):
self.prolog.insert(0, '#!/bin/sh')
with self.io.open(self.filename, 'w') as f:
f.write(self._generate())
f.write('\n')
|
# 无法访问:
# class Base(object):
# __secret = "受贿"
#
# class Foo(Base):
# def func(self):
# print(self.__secret)
# print(Foo.__secret)
#
# obj = Foo()
# obj.func()
# 可以访问:
class Base(object):
__secret = "受贿"
def zt(self):
print(Base.__secret)
class Foo(Base):
def func(self):
print(self.__secret)
print(Foo.__secret)
obj = Foo()
obj.zt()
|
def or_else(lhs, rhs):
if lhs != None:
return lhs
else:
return rhs
def fold(function, arguments, initializer, accumulator = None):
if len(arguments) == 0:
return accumulator
else:
return fold(
function,
arguments[1:],
initializer,
function(
or_else(accumulator, initializer),
arguments[0]))
add = lambda lhs, rhs: lhs + rhs
sum = lambda *xs: fold(add, xs, 0)
print(sum(2, 3, 5))
|
lst = """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"""
lst = lst.split()
lst2 = []
x=1
tym = []
for a in lst:
a = int(a)
tym.append(a)
if len(tym) == x:
lst2.append(tym)
tym = []
x+=1
ind1 = len(lst2)-1
while ind1>=0:
for a in range(0,len(lst2[ind1])-1):
if lst2[ind1][a]>lst2[ind1][a+1]:
lst2[ind1-1][a]+=lst2[ind1][a]
else:
lst2[ind1-1][a]+=lst2[ind1][a+1]
ind1-=1
print(lst2[0][0])
|
## https://leetcode.com/problems/path-sum
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def hasPathSum(self, root: Optional[TreeNode], targetSum: int) -> bool:
if root is None:
return False
if root.left is None and root.right is None:
return root.val == targetSum
left = self.hasPathSum(root.left, targetSum - root.val)
right = self.hasPathSum(root.right, targetSum - root.val)
return left or right
|
class Solution:
def groupAnagrams(self, strs: 'List[str]') -> 'List[List[str]]':
dic = {}
for anagram in strs:
key = ''.join(sorted(anagram))
if key in dic.keys():
dic[key].append(anagram)
else:
dic[key] = [anagram]
result = []
for key in dic.keys():
result.append(dic[key])
return result
|
"""
https://leetcode-cn.com/explore/interview/card/top-interview-questions-easy/23/dynamic-programming/57/
题目:打家劫舍
你是一个专业的小偷,计划偷窃沿街的房屋。每间房内都藏有一定的现金,影响你偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警。
给定一个代表每个房屋存放金额的非负整数数组,计算你在不触动警报装置的情况下,能够偷窃到的最高金额。
示例 1:
输入: [1,2,3,1]
输出: 4
解释: 偷窃 1 号房屋 (金额 = 1) ,然后偷窃 3 号房屋 (金额 = 3)。
偷窃到的最高金额 = 1 + 3 = 4 。
@author Niefy
@date 2018-10-11
"""
class Rob:
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
length=len(nums)
if length<1:
return 0
elif length==1:
return nums[0]
elif length==2:
return max(nums[0],nums[1])
#长度大于3
sum1=nums[0]
sum2=max(nums[0],nums[1])
for i in range(2,length):
sumI=max(sum1+nums[i],sum2)
sum1=sum2
sum2=sumI
return sum2
#测试代码
t=Rob()
nums=[2,7,9,3,1]
print(t.rob(nums))
|
class unknown_dungeon():
@staticmethod
def on_entry(user_id):
db.add_rating(user_id, -5)
text = '🔥Ты упал в это подземелье. Не очень верится, что ты сможешь выйти отсюда живым, но удачи.'
text += '\nПервое что ты тут встречаешь, это развилка. Выбирай куда ступишь, налево или направо.'
button = [['Налево'], ['Направо']]
text = adventure.header(user_id) + text
send_message(user_id, text, button)
set_hand(user_id, unknown_dungeon().handler)
temp[str(user_id) + '_1'] = {}
temp[str(user_id) + '_1']['room'] = 0
@staticmethod
def in_maze(user_id):
text = 'Ты снова стоишь перед развилкой. Выбирай свой путь. Лево или право.'
button = [['Налево'], ['Направо']]
text = adventure.header(user_id) + text
send_message(user_id, text, button)
set_hand(user_id, unknown_dungeon().handler)
@staticmethod
def handler(user_id, message):
_skill = db.get_skill(user_id)
if message.lower() in ['налево', 'направо']:
set_hand(user_id, unknown_dungeon().waiting)
_random = random.random()
send_message(user_id, 'Ты пошел {}.'.format(message.lower()))
if (_random < 0.05 and temp[str(user_id) + '_1']['room'] > 5) or temp[str(user_id) + '_1']['room'] > 15:
bd_adventure2.append(['unknown_dungeon().on_exit', 15, [user_id]])
return
if _random < 0.25 and temp[str(user_id) + '_1']['room'] > 0:
temp[str(user_id) + '_1']['room'] += 1
bd_adventure2.append(['unknown_dungeon().in_maze', 15, [user_id]])
return
else:
temp[str(user_id) + '_1']['room'] += 1
bd_adventure2.append(['unknown_dungeon().pve_battle', 15, [user_id]])
return
else:
pass
@staticmethod
def pve_battle(user_id):
_mob = random.choice(['witch', 'skeletons', 'troll', 'witch', 'ghost', 'rats'])
text = adventure.header(user_id)
text += '`' + monsters[_mob]['text'] + '`'
send_message(user_id, text, [['Навалять мобу']], parse_mode='markdown')
set_hand(user_id, unknown_dungeon().waiting)
bd_adventure2.append(['monster_battle', 15, [user_id, _mob]])
#monster_battle(user_id, _mob)
@staticmethod
def on_exit(user_id):
_inventory = db.get_inventory(user_id)
text = 'Ты смог выйти из этого приключения. Не каждый может его пройти без потерь.'
text += '\n\nВ сундуке ты нашел :'
if len(_inventory) < 0:
text += '\n' + i_get_equip(user_id)
_getting_gold = i_get_gold(user_id) + i_get_gold(user_id) + i_get_gold(user_id) + i_get_gold(user_id) + i_get_gold(user_id) + i_get_gold(user_id) + i_get_gold(user_id) + i_get_gold(user_id)
text += '\nЗолота : ' + str(_getting_gold)
text += '\nАлмазов : ' + str(i_get_diamond(user_id) + i_get_diamond(user_id))
text += '\nРесурсов : ' + i_get_inventory(user_id) + ', ' + i_get_inventory(user_id) + ', ' + i_get_inventory(user_id)
text = adventure_header(user_id) + text
db.add_rating(user_id, 10)
set_hand(user_id, start_game_hand)
send_message(user_id, text, get_start_button(user_id))
return
@staticmethod
def waiting(user_id, message):
text = 'Ты занят. Ожидай.'
send_message(user_id, text)
monsters['skeletons'] = {
'name' : 'Скелеты',
'level': 'easy',
'gold' : False,
'diamond' : False,
'loot' : False,
'room' : 'unknown_dungeon().in_maze',
'text' : 'Кости... Столько костей! Не, ну здесь точно обитает тролль. А вон там что за горка... А, нет, опять кости. Ну и где же его носит? Подождите-ка...\nКогда ты наступил на кость, ты допустил большую ошибку. И, возможно, последнюю в своей жизни. Эти кости живые. Удачи в бою со скелетами!'
}
monsters['troll'] = {
'name' : 'Тролль',
'level': 'easy',
'gold' : False,
'diamond' : False,
'loot' : False,
'room' : 'unknown_dungeon().in_maze',
'text' : 'Ого, какая большая дверь... Что внутри? Сейчас проверим...\nТолько приоткрыв дверь, нечто зловонное двумя пальцами взяло и отшвырнуло тебя в стену. Судя по всему, бой тебе предстоит непростой, ведь это - Тролль!'
}
monsters['witch'] = {
'name' : 'Ведьма',
'level': 'easy',
'gold' : False,
'diamond' : False,
'loot' : False,
'room' : 'unknown_dungeon().in_maze',
'text' : 'Как же тут воняет... Может, здесь обитает тролль? Да вроде непохоже на него... нет ни экскрементов, ни обглоданных костей... А? Что это за смех доносится до тебя из конца комнаты? \nВсё-таки, запахи готовящихся зелий и кала гигантских троллей немного похожи друг на друга. А тебя я поздравляю. Ты наткнулся на Ведьму.'
}
monsters['ghost'] = {
'name' : 'Призрак',
'level': 'easy',
'gold' : False,
'diamond' : False,
'loot' : False,
'room' : 'unknown_dungeon().in_maze',
'text' : 'Тут так... пусто. Будто здесь никогда и ничего не было, никакой мебели или картин, вообще не похоже, что по этому полу хоть раз ступала нога человека. Лишь толстый слой пыли, образовавшийся в результате пустования этого помещения много, много веков... Не слышно ничего, кроме биения твоего сердца... Но только пока твоего. Берегись, ты попался в ловушку бестелесного монстра - призрака!'
}
monsters['rats'] = {
'name' : 'Крысы',
'level': 'easy',
'gold' : False,
'diamond' : False,
'loot' : False,
'room' : 'unknown_dungeon().in_maze',
'text' : 'По комнате к тебе напрямую бежит крыса. Причём, бежит очень бодро. Ты с искренним удивлением на лице принялся наблюдать, как она пытается как-то навредить тебе и твоим доспехам. Ты отшвырнул её одним ударом ботинка. Обычная крыса. Может, слегка глупая. Ничем особенным не отличается от других своих собратьев, стопившихся возле двери, через которую ты и вошел сюда... "Ага, отрезали путь к отступлению, значит? Да вы же всего лишь крысы, как вы можете навредить латным..." - хотел было произнести ты, как, внезапно, вся орава крыс с обоих концов комнаты побежала к тебе. Угадай, кто завтра не вернётся к ужину, если ты хоть раз споткнёшься или остановишься по пути к другой двери?'
}
|
# Stream are lazy linked list
# A stream is a linked list, but the rest of the list is computed on demand
'''
Link- First element is anything
- second element is a Link instance or Link.empty
Stream -First element can be anything
- Second element is a zero-argument function that returns a Stream or Stream.empty
Once Created, the Link and Stream can be used interchangeable
namely first, rest
'''
class Stream:
class empty:
def __repr__(self):
return 'Stream.empty'
empty = empty()
# Singleton Class
def __init__(self,first,compute_rest = lambda: Stream.empty):
assert callable(compute_rest), 'compute_rest must be callable.' # Zero Argument
self.first = first
self._compute_rest = compute_rest
@property
def rest(self):
if self._compute_rest is not None:
self._rest = self._compute_rest()
self._compute_rest = None
return self._rest
def __repr__(self):
return 'Stream({0}, <...>)'.format(repr(self.first))
# An integer stream is a stream of consecutive integers
# Start with first. Constructed from first and a function compute_rest that returns the integer stream starting at first+1
def integer_stream(first):
def compute_rest():
return integer_stream(first+1)
return Stream(first,compute_rest)
# same as
def int_stream(first):
return Stream(first, lambda: int_stream(first+1))
def first_k(s,k):
values = []
while s is not Stream.empty and k>0:
values.append(s.first)
s, k = s.rest, k-1
return values
def square_stream(s):
first = s.first*s.first
return Stream(first, lambda: square_stream(s.rest))
def add_stream(s,t):
first = s.first + t.first
return Stream(first, lambda: add_stream(s.rest,t.rest))
#same
def added_stream(s,t):
first = s.first + t.first
def compute_rest():
return added_stream(s.rest,t.rest)
return Stream(first,compute_rest)
ones = Stream(1, lambda: ones)
ints = Stream(1, lambda: add_stream(ones,ints))
# Mapping a function over a stream
'''
Mapping a function over a stream applies a function only to the first element right away,
the rest is computed lazily
'''
def map_stream(fn,s):
"Map a function fn over the elements of a stream."""
if s is Stream.empty:
return s
def compute_rest():
return map_stream(fn, s.rest)
return Stream(fn(s.first),compute_rest)
# Filtering a Stream
# When filtering a stream, processing continues until a element is kept in the output
def filter_stream(fn,s):
'Filter stream s with predicate function fn.'
if s is Stream.empty:
return s
def compute_rest():
return filter_stream(fn,s.rest)
if fn(s.first):
return Stream(s.first,compute_rest)
else:
return compute_rest()
odds = lambda x: x % 2 == 1
odd = filter_stream(odds, ints)
def primes(s):
' Return a stream of primes, given a stream of postive integers.'
def not_divisible(x):
return x % s.first != 0
def compute_rest():
return primes(filter_stream(not_divisible, s.rest))
return Stream(s.first, compute_rest)
p = primes(int_stream(2))
|
def help(update, context):
text = "Внимание! Все действия происходят для активной команды.\n\n"\
\
\
"/add_question [QUESTION]\n"\
"Добавить новый вопрос.\n"\
"Параметр [QUESTION] - текст вопроса.\n\n"\
\
\
"/question_list\n"\
"Список всех вопросов команды.\n\n"\
\
\
"/new_team\n"\
"Регистрация новой команды.\n\n"\
\
\
"/set_id [ID]\n"\
"Регистрация в существующей команде.\n\n"\
\
\
"/answer [Q_NUM] [ANS]\n"\
"Отправить ответ на вопрос.\n"\
"Параметр [Q_NUM] - номер вопроса.\n"\
"Параметр [ANS] - текст с ответом.\n\n"\
\
\
"/set_standups [DAY] [TIME] [PERIOD] [DAY] [TIME] [PERIOD]\n" \
"Назначить расписание стендапов.\n" \
"[DAY] может быть sunday, monday, tuesday, wednesday, thursday, friday, saturday),\n"\
"[TIME] записывается в формате hh:mm, "\
"[PERIOD] - количество недель между стендапами в указанный день недели.\n\n"\
\
\
"/set_name [NAME]\n" \
"Изменить название активной команды.\n\n"\
\
\
"/set_active_team\n"\
"Выбрать активную команду.\n\n"\
\
\
"/show_standups [NUM]\n"\
"Вывести последние стендапы.\n"\
"Параметр [NUM] задает их количество.\n"\
"Без параметров - весь список.\n\n"\
\
\
"/standup_info [S_NUM]\n"\
"Вывести информацию о стендапе (дата, вопросы, ответы участников).\n"\
"Параметр [S_NUM] - номер стендапа.\n\n"\
\
\
"/remove_question\n"\
"Удалить вопрос активной команды.\n\n"\
\
\
"/remove_team\n"\
"Удалить команду.\n\n"\
\
\
"/leave_team\n"\
"Покинуть команду.\n\n"\
\
\
"/join_connect_chats\n"\
"Получать результаты стендапов команды.\n\n"\
\
\
"/leave_connect_chats\n"\
"Прекратить получать результаты стендапов команды.\n\n"\
\
\
"/timezone [+-hh:mm]\n"\
"Установить таймзону.\n"\
"Параметр [hh:mm] - сдвиг по UTC.\n\n"\
\
\
"/set_owner\n"\
"Смена владельца команды.\n\n"\
\
\
"/duration [hh:mm]\n"\
"Установить продолжительность стендапа.\n"\
context.bot.send_message(chat_id=update.effective_chat.id, text=text)
|
#!/usr/bin/env python3
def format_log_level(level):
return [
'DEBUG',
'INFO ',
'WARN ',
'ERROR',
'FATAL',
][level]
def format_log_type(log_type):
return log_type.lstrip('TI')
def format_log_entry(log_entry):
return '{} {} {}:{} {}'.format(
log_entry['log_time'],
format_log_level(log_entry['log_level']),
log_entry['file_name'],
log_entry['file_line'],
log_entry['content'],
)
def format_log_entry_with_type(log_entry):
return '{} {} {} {}:{} {}'.format(
format_log_type(log_entry['log_type']),
log_entry['log_time'],
format_log_level(log_entry['log_level']),
log_entry['file_name'],
log_entry['file_line'],
log_entry['content'],
)
|
def sieve(max):
primes = []
for n in range(2, max + 1):
if any(n % p > 0 for p in primes):
primes.append(n)
return primes
"""
Sieve of Eratosthenes
prime-sieve
Input:
max: A positive int representing an upper bound.
Output:
A list containing all primes up to and including max
"""
|
print('==== PROGRAMA PARA DESCOBRIR ANTECESSOR E SUCESSOR DE UM NUMERO ====')
num = int(input('\033[30;7m Digite um número:\033[m'))
anter = num - 1
suces = num + 1
print(' O número \033[1m{}\033[m tem como o antecessor '
'o numero \033[1m{}\033[m e sucessor o número \033[1;3m{}.'.format(num, anter,suces,))
|
# app/utils.py
def make_step_iter(step, max_):
num = 0
while True:
yield num
num = (num + step) % max_
|
PASILLO_DID = "A1"
CUARTO_ESTE_DID = "A2"
CUARTO_OESTE_DID = "A4"
SALON_DID = "A5"
HEATER_DID = "C1"
HEATER_PROTOCOL = "X10"
HEATER_API = "http://localhost"
HEATER_USERNAME = "raton"
HEATER_PASSWORD = "xxxx"
HEATER_MARGIN = 0.0
HEATER_INCREMENT = 0.5
AWS_CREDS_PATH = "/etc/aws.keys"
AWS_ZONE = "us-east-1"
MINUTES_AFTER_SUNRISE_FOR_DAY = 60
MINUTES_AFTER_SUNSET_FOR_DAY = 60
#INTERNAL_TEMPERATURE_URI = "http://raspberry/therm/temperature"
#INTERNAL_TEMPERATURE_URI = "http://localhost:8000/therm/temperature"
LIST_THERMOMETERS_API = "http://172.27.225.2/thermometer/thermometers?"
#TEMPERATURES_API = "http://raspberry/therm/temperature_api/thermometers"
#THERMOMETER_API = "http://raspberry/therm/temperature_api/thermometer/"
FLAME_STATS = True
FLAME_STATS_PATH = "./flame_stats.log"
FLAME_STATS_DATE_FORMAT = "%d.%m.%Y %H:%M:%S"
|
# best solution:
# https://leetcode.com/problems/merge-two-sorted-lists/discuss/9735/Python-solutions-(iteratively-recursively-iteratively-in-place).
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
dummy = ListNode(0)
tmp = dummy
while l1 and l2:
dummy.next = ListNode(min(l1.val, l2.val))
dummy = dummy.next
if l1.val < l2.val:
l1 = l1.next
else:
l2 = l2.next
dummy.next = l1 or l2
# dummy.next = l1 if l1 else l2
return tmp.next
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Copyright 2021, Yutong Xie, UIUC.
Using for loop to find maximum product of three numbers
'''
class Solution(object):
def maximumProduct(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
min1, min2 = float("inf"), float("inf")
max1, max2, max3 = -float("inf"), -float("inf"), -float("inf")
for i in range(len(nums)):
n = nums[i]
if n <= min1:
min1, min2 = n, min1
elif n <= min2:
min2 = n
if n >= max3:
max1, max2, max3 = max2, max3, n
elif n >= max2:
max1, max2 = max2, n
elif n >= max1:
max1 = n
return max(min1*min2*max3, max1*max2*max3)
|
class Article():
def __init__(self, title, description, author, site, link):
"""Init the article model"""
self.title = title
self.description = description
self.author = author
self.site = site
self.link = link
|
# Given an array, rotate the array to the right by k steps, where k is non-negative.
# Example 1:
# Input: [1,2,3,4,5,6,7] and k = 3
# Output: [5,6,7,1,2,3,4]
# Explanation:
# rotate 1 steps to the right: [7,1,2,3,4,5,6]
# rotate 2 steps to the right: [6,7,1,2,3,4,5]
# rotate 3 steps to the right: [5,6,7,1,2,3,4]
class Solution(object):
def rotate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void Do not return anything, modify nums in-place instead.
"""
i = 0
while i < k :
a = nums.pop()
nums.insert(0,a)
i += 1
# Time: O(k)
# Space: O(k)
# Difficulty: medium
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.