content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# GET /app/hello_world
print("hello world!")
| print('hello world!') |
# Time: O(n + w^2), n = w * l,
# n is the length of S,
# w is the number of word,
# l is the average length of word
# Space: O(n)
# A sentence S is given, composed of words separated by spaces.
# Each word consists of lowercase and uppercase letters only.
#
# We would like to convert the sentence to "Goat Latin"
# (a made-up language similar to Pig Latin.)
#
# The rules of Goat Latin are as follows:
#
# If a word begins with a vowel (a, e, i, o, or u), append "ma" to the end of
# the word.
# For example, the word 'apple' becomes 'applema'.
#
# If a word begins with a consonant (i.e. not a vowel),
# remove the first letter and append it to the end, then add "ma".
# For example, the word "goat" becomes "oatgma".
#
# Add one letter 'a' to the end of each word per its word index in the
# sentence,
# starting with 1.
# For example, the first word gets "a" added to the end,
# the second word gets "aa" added to the end and so on.
# Return the final sentence representing the conversion from S to Goat Latin.
#
# Example 1:
#
# Input: "I speak Goat Latin"
# Output: "Imaa peaksmaaa oatGmaaaa atinLmaaaaa"
# Example 2:
#
# Input: "The quick brown fox jumped over the lazy dog"
# Output: "heTmaa uickqmaaa rownbmaaaa oxfmaaaaa umpedjmaaaaaa
# overmaaaaaaa hetmaaaaaaaa azylmaaaaaaaaa ogdmaaaaaaaaaa"
#
# Notes:
# - S contains only uppercase, lowercase and spaces. Exactly one space between
# each word.
# - 1 <= S.length <= 100.
class Solution(object):
def toGoatLatin(self, S):
"""
:type S: str
:rtype: str
"""
def convert(S):
vowel = set('aeiouAEIOU')
for i, word in enumerate(S.split(), 1):
if word[0] not in vowel:
word = word[1:] + word[:1]
yield word + 'ma' + 'a'*i
return " ".join(convert(S))
| class Solution(object):
def to_goat_latin(self, S):
"""
:type S: str
:rtype: str
"""
def convert(S):
vowel = set('aeiouAEIOU')
for (i, word) in enumerate(S.split(), 1):
if word[0] not in vowel:
word = word[1:] + word[:1]
yield (word + 'ma' + 'a' * i)
return ' '.join(convert(S)) |
class Solution(object):
def combinationSum(self, candidates, target):
return self.helper(candidates, target, [], set())
def helper(self, arr, target, comb, result):
for num in arr:
if target - num == 0:
result.add(tuple(sorted(comb[:] + [num])))
elif target - num > 0:
self.helper(arr, target-num, comb[:]+[num], result)
return result
| class Solution(object):
def combination_sum(self, candidates, target):
return self.helper(candidates, target, [], set())
def helper(self, arr, target, comb, result):
for num in arr:
if target - num == 0:
result.add(tuple(sorted(comb[:] + [num])))
elif target - num > 0:
self.helper(arr, target - num, comb[:] + [num], result)
return result |
# Consider a list (list = []).
# You can perform the following commands:
# insert i e: Insert integer 'e' at position 'i'.
# print: Print the list.
# remove e: Delete the first occurrence of integer .
# append e: Insert integer at the end of the list.
# sort: Sort the list.
# pop: Pop the last element from the list.
# reverse: Reverse the list.
# Initialize your list and read in the value of 'n' followed
# by 'n' lines of commands where each command will be of the
# 7 types listed above.
# Iterate through each command in order and perform the
# corresponding operation on your list.
if __name__ == '__main__':
N = int(input())
my_list = []
# 3 sub problems:
# - reading inputs
# - parsing input strings
# - mapping command string to logic
for _ in range(0,N):
command = input()
command_parts = command.split()
key_word = command_parts[0]
if key_word == "insert":
index = int(command_parts[1])
value = int(command_parts[2])
my_list.insert(index, value)
elif key_word == "remove":
value = int(command_parts[1])
my_list.remove(value)
elif key_word == "append":
value = int(command_parts[1])
my_list.append(value)
elif key_word == "print":
print(my_list)
elif key_word == "reverse":
my_list.reverse()
elif key_word == "pop":
my_list.pop()
elif key_word == "sort":
my_list.sort()
| if __name__ == '__main__':
n = int(input())
my_list = []
for _ in range(0, N):
command = input()
command_parts = command.split()
key_word = command_parts[0]
if key_word == 'insert':
index = int(command_parts[1])
value = int(command_parts[2])
my_list.insert(index, value)
elif key_word == 'remove':
value = int(command_parts[1])
my_list.remove(value)
elif key_word == 'append':
value = int(command_parts[1])
my_list.append(value)
elif key_word == 'print':
print(my_list)
elif key_word == 'reverse':
my_list.reverse()
elif key_word == 'pop':
my_list.pop()
elif key_word == 'sort':
my_list.sort() |
n = int(input())
arr = input().split()
for i in range(0,len(arr)):
arr[i] = int(arr[i])
count = 0
Max = max(arr)
for i in range(0,len(arr)):
if(arr[i]==Max):
count +=1
print(str(count))
| n = int(input())
arr = input().split()
for i in range(0, len(arr)):
arr[i] = int(arr[i])
count = 0
max = max(arr)
for i in range(0, len(arr)):
if arr[i] == Max:
count += 1
print(str(count)) |
def alphabet_position(character):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
lower = character.lower()
return alphabet.index(lower)
def rotate_string_13(text):
rotated = ''
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for char in text:
rotated_idx = (alphabet_position(char) + 13) % 26
if char.isupper():
rotated = rotated + alphabet[rotated_idx].upper()
else:
rotated = rotated + alphabet[rotated_idx]
return rotated
def rotate_character(char, rot):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
rotated_idx = (alphabet_position(char) + rot) % 26
if char.isupper():
return alphabet[rotated_idx].upper()
else:
return alphabet[rotated_idx]
def rotate_string(text, rot):
rotated = ''
for char in text:
if (char.isalpha()):
rotated = rotated + rotate_character(char, rot)
else:
rotated = rotated + char
return rotated | def alphabet_position(character):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
lower = character.lower()
return alphabet.index(lower)
def rotate_string_13(text):
rotated = ''
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for char in text:
rotated_idx = (alphabet_position(char) + 13) % 26
if char.isupper():
rotated = rotated + alphabet[rotated_idx].upper()
else:
rotated = rotated + alphabet[rotated_idx]
return rotated
def rotate_character(char, rot):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
rotated_idx = (alphabet_position(char) + rot) % 26
if char.isupper():
return alphabet[rotated_idx].upper()
else:
return alphabet[rotated_idx]
def rotate_string(text, rot):
rotated = ''
for char in text:
if char.isalpha():
rotated = rotated + rotate_character(char, rot)
else:
rotated = rotated + char
return rotated |
description = 'Additional rotation table'
group = 'optional'
tango_base = 'tango://motorbox05.stressi.frm2.tum.de:10000/box/'
devices = dict(
addphi_m = device('nicos.devices.entangle.Motor',
tangodevice = tango_base + 'channel4/motor',
fmtstr = '%.2f',
visibility = (),
speed = 4,
),
addphi = device('nicos.devices.generic.Axis',
description = 'Additional rotation table',
motor = 'addphi_m',
precision = 0.01,
),
)
| description = 'Additional rotation table'
group = 'optional'
tango_base = 'tango://motorbox05.stressi.frm2.tum.de:10000/box/'
devices = dict(addphi_m=device('nicos.devices.entangle.Motor', tangodevice=tango_base + 'channel4/motor', fmtstr='%.2f', visibility=(), speed=4), addphi=device('nicos.devices.generic.Axis', description='Additional rotation table', motor='addphi_m', precision=0.01)) |
NEW2OLD = {'AD': 'ADCY8', 'DP': 'DPYS', 'GA': 'GARL1', 'HA9': 'HOXA9',
'GR': 'GRM6', 'H12': 'HOXD12', 'HD9': 'HOXD9', 'PR': 'PRAC',
'PT': 'PTGDR', 'SA': 'SALL3', 'SI': 'SIX6', 'SL': 'SLC6A2',
'TL': 'TLX3', 'TR': 'TRIM58', 'ZF': 'ZFP41'}
OLD2NEW = {NEW2OLD[i]: i for i in NEW2OLD.keys() if NEW2OLD[i] is not None}
def short_2_full(short):
return NEW2OLD[short.strip().upper()]
def full_2_short(full):
return OLD2NEW[full.strip().upper()]
| new2_old = {'AD': 'ADCY8', 'DP': 'DPYS', 'GA': 'GARL1', 'HA9': 'HOXA9', 'GR': 'GRM6', 'H12': 'HOXD12', 'HD9': 'HOXD9', 'PR': 'PRAC', 'PT': 'PTGDR', 'SA': 'SALL3', 'SI': 'SIX6', 'SL': 'SLC6A2', 'TL': 'TLX3', 'TR': 'TRIM58', 'ZF': 'ZFP41'}
old2_new = {NEW2OLD[i]: i for i in NEW2OLD.keys() if NEW2OLD[i] is not None}
def short_2_full(short):
return NEW2OLD[short.strip().upper()]
def full_2_short(full):
return OLD2NEW[full.strip().upper()] |
# Single Responsibility Principle (SRP) or Separation Of Concerns (SOC)
class Journal():
def __init__(self):
self.entries = []
self.count = 0
def add_entry(self, text):
self.count += 1
self.entries.append(f'{self.count}: {text}')
def remove_entry(self, index):
self.count -= 1
self.entries.pop(index)
def __str__(self):
return '\n'.join(self.entries)
# def save(self, filename):
# with open(filename, 'w') as f:
# f.write(str(self))
# def load(self):
# pass
# def load_from_web(self):
# pass
class PersistanceManager:
@staticmethod
def save_to_file(filename, journal):
with open(filename, 'w+') as f:
f.write(str(journal))
journal = Journal()
journal.add_entry('I love programming')
journal.add_entry('I always ask right questions')
# journal.save('sample.txt')
print(journal)
PersistanceManager.save_to_file('sample.txt', journal) | class Journal:
def __init__(self):
self.entries = []
self.count = 0
def add_entry(self, text):
self.count += 1
self.entries.append(f'{self.count}: {text}')
def remove_entry(self, index):
self.count -= 1
self.entries.pop(index)
def __str__(self):
return '\n'.join(self.entries)
class Persistancemanager:
@staticmethod
def save_to_file(filename, journal):
with open(filename, 'w+') as f:
f.write(str(journal))
journal = journal()
journal.add_entry('I love programming')
journal.add_entry('I always ask right questions')
print(journal)
PersistanceManager.save_to_file('sample.txt', journal) |
# why=None
# what=why
# while what is why:
# try:
# what=int (input ("what? " ) )
# except ValueError :
# print( "no.")
# def abc(z):
# if(z<=1):return False
# for(x)in(range(2 ,int(z**.5)+1)) :
# if z % x==0:
# return False
# return True
# for who in range (1 ,what+ 1):
# how=abc (who)
# if how :
# print("{}???".format(who),":)")
# else:
# print ("{}???" . format(who) , ":(")
"""This program will check all integers up to a specified limit for primality"""
max_number = None
# letting user input a number up to which to check
while max_number is None:
try:
# try to convert user input to integer
max_number = int(input("Up to which number would you like to check? "))
except ValueError:
# if input is invalid, let them try again
print("Please enter an integer.")
def is_prime(n):
"""Checks if the argument n is a prime number. Returns True if it is, False otherwise."""
# 1 is not prime by definition
if n <= 1:
return False
# check up to sqrt(n) + 1 if there exists a number that divides n
for divisor in range(2, int(n ** 0.5) + 1):
if n % divisor == 0:
# if divisor is found, n is not prime
return False
# if all checks up to here fail, n is prime
return True
# check all numbers up to max_number and print result
for n in range(1, max_number + 1):
if is_prime(n):
print(n, "is a prime number!")
else:
print(n, "is NOT a prime number.")
| """This program will check all integers up to a specified limit for primality"""
max_number = None
while max_number is None:
try:
max_number = int(input('Up to which number would you like to check? '))
except ValueError:
print('Please enter an integer.')
def is_prime(n):
"""Checks if the argument n is a prime number. Returns True if it is, False otherwise."""
if n <= 1:
return False
for divisor in range(2, int(n ** 0.5) + 1):
if n % divisor == 0:
return False
return True
for n in range(1, max_number + 1):
if is_prime(n):
print(n, 'is a prime number!')
else:
print(n, 'is NOT a prime number.') |
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.0648189,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.2536,
'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.381762,
'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.189343,
'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': 0.327873,
'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.188044,
'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': 0.70526,
'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.128628,
'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': 5.77849,
'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.0721231,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00686382,
'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.0726115,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0507621,
'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.144735,
'Execution Unit/Register Files/Runtime Dynamic': 0.0576259,
'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.193217,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.542007,
'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': 1.96387,
'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.000127827,
'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.000127827,
'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.000110579,
'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': 4.23925e-05,
'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.000729202,
'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.00109543,
'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.00125267,
'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.0487989,
'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': 3.10403,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.117802,
'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.165743,
'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': 5.4755,
'Instruction Fetch Unit/Runtime Dynamic': 0.334692,
'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.139584,
'L2/Runtime Dynamic': 0.0373435,
'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': 3.28224,
'Load Store Unit/Data Cache/Runtime Dynamic': 1.02999,
'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.0661645,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0661645,
'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.59596,
'Load Store Unit/Runtime Dynamic': 1.42245,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.16315,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.326301,
'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.0579026,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0599921,
'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.192997,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0193326,
'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.451598,
'Memory Management Unit/Runtime Dynamic': 0.0793248,
'Memory Management Unit/Subthreshold Leakage': 0.0769113,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0399462,
'Peak Dynamic': 20.0028,
'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': 0.251621,
'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.0127098,
'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.0953364,
'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': 0.359667,
'Renaming Unit/Subthreshold Leakage': 0.070483,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0362779,
'Runtime Dynamic': 4.19735,
'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.0236579,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.22127,
'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.135499,
'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.0547817,
'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.0883609,
'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.0446016,
'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.187744,
'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.0418806,
'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.13895,
'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.0255986,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00229779,
'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.0251584,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0169936,
'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.050757,
'Execution Unit/Register Files/Runtime Dynamic': 0.0192914,
'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.0589175,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.162657,
'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.99634,
'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': 4.58393e-05,
'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': 4.58393e-05,
'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': 4.00752e-05,
'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': 1.55954e-05,
'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.000244114,
'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.000375868,
'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.000434173,
'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.0163364,
'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.03913,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0400109,
'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.0554856,
'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.30808,
'Instruction Fetch Unit/Runtime Dynamic': 0.112643,
'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.0430097,
'L2/Runtime Dynamic': 0.0128205,
'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.92916,
'Load Store Unit/Data Cache/Runtime Dynamic': 0.350503,
'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.0223891,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.022389,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 2.03488,
'Load Store Unit/Runtime Dynamic': 0.483307,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.0552077,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.110415,
'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.0195934,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0202369,
'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.0646095,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0065664,
'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.254376,
'Memory Management Unit/Runtime Dynamic': 0.0268033,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 13.3688,
'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.0673379,
'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.00329109,
'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.0269533,
'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.0975823,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 1.7295,
'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.0234066,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.221073,
'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.132683,
'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.0535458,
'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.0863674,
'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.0435954,
'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.183509,
'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.0408985,
'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.1329,
'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.0250666,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00224595,
'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.0247487,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0166102,
'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.0498153,
'Execution Unit/Register Files/Runtime Dynamic': 0.0188561,
'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.0579915,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.159175,
'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.98799,
'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': 4.43237e-05,
'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': 4.43237e-05,
'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': 3.87605e-05,
'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': 1.50894e-05,
'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.000238607,
'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.000366015,
'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.000419445,
'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.0159678,
'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.01569,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0389099,
'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.0542338,
'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.2835,
'Instruction Fetch Unit/Runtime Dynamic': 0.109897,
'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.0418086,
'L2/Runtime Dynamic': 0.0124139,
'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.91422,
'Load Store Unit/Data Cache/Runtime Dynamic': 0.342888,
'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.0219057,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0219056,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 2.01766,
'Load Store Unit/Runtime Dynamic': 0.472824,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.0540158,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.108031,
'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.0191704,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0197958,
'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.063152,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.006386,
'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.252192,
'Memory Management Unit/Runtime Dynamic': 0.0261818,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 13.3175,
'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.0659386,
'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.0032183,
'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.0263421,
'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.095499,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 1.70481,
'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.0233442,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.221024,
'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.132974,
'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.0534981,
'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.0862904,
'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.0435565,
'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.183345,
'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.0408007,
'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.13286,
'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.0251216,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00224395,
'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.0246857,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0165954,
'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.0498073,
'Execution Unit/Register Files/Runtime Dynamic': 0.0188393,
'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.0578433,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.159149,
'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.987734,
'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': 4.47676e-05,
'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': 4.47676e-05,
'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': 3.91457e-05,
'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': 1.52378e-05,
'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.000238394,
'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.000367075,
'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.000423753,
'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.0159536,
'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.01478,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0390004,
'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.0541855,
'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.28255,
'Instruction Fetch Unit/Runtime Dynamic': 0.10993,
'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.0420224,
'L2/Runtime Dynamic': 0.0125557,
'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.91408,
'Load Store Unit/Data Cache/Runtime Dynamic': 0.343009,
'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.0219013,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0219014,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 2.0175,
'Load Store Unit/Runtime Dynamic': 0.472921,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.0540048,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.10801,
'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.0191665,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0197953,
'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.0630956,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.00640077,
'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.252129,
'Memory Management Unit/Runtime Dynamic': 0.026196,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 13.3165,
'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.0660832,
'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.0032179,
'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.0263098,
'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.0956109,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 1.70495,
'Subthreshold Leakage': 6.16288,
'Subthreshold Leakage with power gating': 2.55328}],
'DRAM': {'Area': 0,
'Gate Leakage': 0,
'Peak Dynamic': 8.547924110383947,
'Runtime Dynamic': 8.547924110383947,
'Subthreshold Leakage': 4.252,
'Subthreshold Leakage with power gating': 4.252},
'L3': [{'Area': 61.9075,
'Gate Leakage': 0.0484137,
'Peak Dynamic': 0.455911,
'Runtime Dynamic': 0.177455,
'Subthreshold Leakage': 6.80085,
'Subthreshold Leakage with power gating': 3.32364}],
'Processor': {'Area': 191.908,
'Gate Leakage': 1.53485,
'Peak Dynamic': 60.4616,
'Peak Power': 93.5738,
'Runtime Dynamic': 9.51406,
'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': 60.0057,
'Total Cores/Runtime Dynamic': 9.3366,
'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.455911,
'Total L3s/Runtime Dynamic': 0.177455,
'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}} | 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.0648189, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.2536, '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.381762, '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.189343, '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': 0.327873, '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.188044, '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': 0.70526, '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.128628, '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': 5.77849, '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.0721231, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00686382, '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.0726115, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0507621, '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.144735, 'Execution Unit/Register Files/Runtime Dynamic': 0.0576259, '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.193217, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.542007, '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': 1.96387, '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.000127827, '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.000127827, '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.000110579, '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': 4.23925e-05, '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.000729202, '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.00109543, '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.00125267, '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.0487989, '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': 3.10403, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.117802, '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.165743, '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': 5.4755, 'Instruction Fetch Unit/Runtime Dynamic': 0.334692, '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.139584, 'L2/Runtime Dynamic': 0.0373435, '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': 3.28224, 'Load Store Unit/Data Cache/Runtime Dynamic': 1.02999, '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.0661645, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0661645, '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.59596, 'Load Store Unit/Runtime Dynamic': 1.42245, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.16315, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.326301, '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.0579026, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0599921, '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.192997, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.0193326, '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.451598, 'Memory Management Unit/Runtime Dynamic': 0.0793248, 'Memory Management Unit/Subthreshold Leakage': 0.0769113, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0399462, 'Peak Dynamic': 20.0028, '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': 0.251621, '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.0127098, '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.0953364, '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': 0.359667, 'Renaming Unit/Subthreshold Leakage': 0.070483, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0362779, 'Runtime Dynamic': 4.19735, '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.0236579, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.22127, '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.135499, '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.0547817, '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.0883609, '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.0446016, '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.187744, '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.0418806, '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.13895, '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.0255986, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00229779, '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.0251584, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0169936, '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.050757, 'Execution Unit/Register Files/Runtime Dynamic': 0.0192914, '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.0589175, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.162657, '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.99634, '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': 4.58393e-05, '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': 4.58393e-05, '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': 4.00752e-05, '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': 1.55954e-05, '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.000244114, '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.000375868, '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.000434173, '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.0163364, '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.03913, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0400109, '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.0554856, '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.30808, 'Instruction Fetch Unit/Runtime Dynamic': 0.112643, '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.0430097, 'L2/Runtime Dynamic': 0.0128205, '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.92916, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.350503, '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.0223891, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.022389, 'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961, 'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918, 'Load Store Unit/Peak Dynamic': 2.03488, 'Load Store Unit/Runtime Dynamic': 0.483307, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0552077, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.110415, '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.0195934, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0202369, '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.0646095, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.0065664, '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.254376, 'Memory Management Unit/Runtime Dynamic': 0.0268033, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 13.3688, '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.0673379, '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.00329109, '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.0269533, '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.0975823, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 1.7295, '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.0234066, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.221073, '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.132683, '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.0535458, '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.0863674, '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.0435954, '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.183509, '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.0408985, '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.1329, '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.0250666, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00224595, '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.0247487, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0166102, '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.0498153, 'Execution Unit/Register Files/Runtime Dynamic': 0.0188561, '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.0579915, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.159175, '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.98799, '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': 4.43237e-05, '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': 4.43237e-05, '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': 3.87605e-05, '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': 1.50894e-05, '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.000238607, '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.000366015, '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.000419445, '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.0159678, '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.01569, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0389099, '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.0542338, '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.2835, 'Instruction Fetch Unit/Runtime Dynamic': 0.109897, '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.0418086, 'L2/Runtime Dynamic': 0.0124139, '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.91422, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.342888, '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.0219057, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0219056, 'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961, 'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918, 'Load Store Unit/Peak Dynamic': 2.01766, 'Load Store Unit/Runtime Dynamic': 0.472824, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0540158, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.108031, '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.0191704, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0197958, '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.063152, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.006386, '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.252192, 'Memory Management Unit/Runtime Dynamic': 0.0261818, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 13.3175, '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.0659386, '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.0032183, '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.0263421, '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.095499, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 1.70481, '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.0233442, 'Execution Unit/Complex ALUs/Runtime Dynamic': 0.221024, '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.132974, '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.0534981, '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.0862904, '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.0435565, '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.183345, '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.0408007, '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.13286, '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.0251216, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00224395, '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.0246857, 'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0165954, '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.0498073, 'Execution Unit/Register Files/Runtime Dynamic': 0.0188393, '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.0578433, 'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.159149, '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.987734, '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': 4.47676e-05, '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': 4.47676e-05, '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': 3.91457e-05, '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': 1.52378e-05, '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.000238394, '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.000367075, '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.000423753, '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.0159536, '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.01478, 'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.0390004, '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.0541855, '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.28255, 'Instruction Fetch Unit/Runtime Dynamic': 0.10993, '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.0420224, 'L2/Runtime Dynamic': 0.0125557, '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.91408, 'Load Store Unit/Data Cache/Runtime Dynamic': 0.343009, '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.0219013, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0219014, 'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961, 'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918, 'Load Store Unit/Peak Dynamic': 2.0175, 'Load Store Unit/Runtime Dynamic': 0.472921, 'Load Store Unit/StoreQ/Area': 0.322079, 'Load Store Unit/StoreQ/Gate Leakage': 0.00329971, 'Load Store Unit/StoreQ/Peak Dynamic': 0.0540048, 'Load Store Unit/StoreQ/Runtime Dynamic': 0.10801, '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.0191665, 'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0197953, '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.0630956, 'Memory Management Unit/Itlb/Runtime Dynamic': 0.00640077, '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.252129, 'Memory Management Unit/Runtime Dynamic': 0.026196, 'Memory Management Unit/Subthreshold Leakage': 0.0766103, 'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333, 'Peak Dynamic': 13.3165, '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.0660832, '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.0032179, '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.0263098, '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.0956109, 'Renaming Unit/Subthreshold Leakage': 0.0552466, 'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461, 'Runtime Dynamic': 1.70495, 'Subthreshold Leakage': 6.16288, 'Subthreshold Leakage with power gating': 2.55328}], 'DRAM': {'Area': 0, 'Gate Leakage': 0, 'Peak Dynamic': 8.547924110383947, 'Runtime Dynamic': 8.547924110383947, 'Subthreshold Leakage': 4.252, 'Subthreshold Leakage with power gating': 4.252}, 'L3': [{'Area': 61.9075, 'Gate Leakage': 0.0484137, 'Peak Dynamic': 0.455911, 'Runtime Dynamic': 0.177455, 'Subthreshold Leakage': 6.80085, 'Subthreshold Leakage with power gating': 3.32364}], 'Processor': {'Area': 191.908, 'Gate Leakage': 1.53485, 'Peak Dynamic': 60.4616, 'Peak Power': 93.5738, 'Runtime Dynamic': 9.51406, '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': 60.0057, 'Total Cores/Runtime Dynamic': 9.3366, '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.455911, 'Total L3s/Runtime Dynamic': 0.177455, '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}} |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
# Override to dynamically link the cras (ChromeOS audio) library.
'use_cras%': 0,
# Option e.g. for Linux distributions to link pulseaudio directly
# (DT_NEEDED) instead of using dlopen. This helps with automated
# detection of ABI mismatches and prevents silent errors.
'linux_link_pulseaudio%': 0,
'conditions': [
['OS == "android" or OS == "ios"', {
# Android and iOS don't use ffmpeg.
'media_use_ffmpeg%': 0,
# Android and iOS don't use libvpx.
'media_use_libvpx%': 0,
}, { # 'OS != "android" and OS != "ios"'
'media_use_ffmpeg%': 1,
'media_use_libvpx%': 1,
}],
# Screen capturer works only on Windows, OSX and Linux (with X11).
['OS=="win" or OS=="mac" or (OS=="linux" and use_x11==1)', {
'screen_capture_supported%': 1,
}, {
'screen_capture_supported%': 0,
}],
# ALSA usage.
['OS=="linux" or OS=="freebsd" or OS=="solaris"', {
'use_alsa%': 1,
}, {
'use_alsa%': 0,
}],
['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android" and chromeos != 1', {
'use_pulseaudio%': 1,
}, {
'use_pulseaudio%': 0,
}],
],
},
'targets': [
{
'target_name': 'media',
'type': '<(component)',
'dependencies': [
'../base/base.gyp:base',
'../build/temp_gyp/googleurl.gyp:googleurl',
'../crypto/crypto.gyp:crypto',
'../skia/skia.gyp:skia',
'../third_party/opus/opus.gyp:opus',
'../ui/ui.gyp:ui',
],
'defines': [
'MEDIA_IMPLEMENTATION',
],
'include_dirs': [
'..',
],
'sources': [
'audio/android/audio_manager_android.cc',
'audio/android/audio_manager_android.h',
'audio/android/opensles_input.cc',
'audio/android/opensles_input.h',
'audio/android/opensles_output.cc',
'audio/android/opensles_output.h',
'audio/async_socket_io_handler.h',
'audio/async_socket_io_handler_posix.cc',
'audio/async_socket_io_handler_win.cc',
'audio/audio_buffers_state.cc',
'audio/audio_buffers_state.h',
'audio/audio_device_name.cc',
'audio/audio_device_name.h',
'audio/audio_device_thread.cc',
'audio/audio_device_thread.h',
'audio/audio_input_controller.cc',
'audio/audio_input_controller.h',
'audio/audio_input_device.cc',
'audio/audio_input_device.h',
'audio/audio_input_ipc.cc',
'audio/audio_input_ipc.h',
'audio/audio_input_stream_impl.cc',
'audio/audio_input_stream_impl.h',
'audio/audio_io.h',
'audio/audio_manager.cc',
'audio/audio_manager.h',
'audio/audio_manager_base.cc',
'audio/audio_manager_base.h',
'audio/audio_output_controller.cc',
'audio/audio_output_controller.h',
'audio/audio_output_device.cc',
'audio/audio_output_device.h',
'audio/audio_output_dispatcher.cc',
'audio/audio_output_dispatcher.h',
'audio/audio_output_dispatcher_impl.cc',
'audio/audio_output_dispatcher_impl.h',
'audio/audio_output_ipc.cc',
'audio/audio_output_ipc.h',
'audio/audio_output_proxy.cc',
'audio/audio_output_proxy.h',
'audio/audio_output_resampler.cc',
'audio/audio_output_resampler.h',
'audio/audio_silence_detector.cc',
'audio/audio_silence_detector.h',
'audio/audio_source_diverter.h',
'audio/audio_util.cc',
'audio/audio_util.h',
'audio/cras/audio_manager_cras.cc',
'audio/cras/audio_manager_cras.h',
'audio/cras/cras_input.cc',
'audio/cras/cras_input.h',
'audio/cras/cras_unified.cc',
'audio/cras/cras_unified.h',
'audio/cross_process_notification.cc',
'audio/cross_process_notification.h',
'audio/cross_process_notification_posix.cc',
'audio/cross_process_notification_win.cc',
'audio/fake_audio_consumer.cc',
'audio/fake_audio_consumer.h',
'audio/fake_audio_input_stream.cc',
'audio/fake_audio_input_stream.h',
'audio/fake_audio_output_stream.cc',
'audio/fake_audio_output_stream.h',
'audio/ios/audio_manager_ios.h',
'audio/ios/audio_manager_ios.mm',
'audio/ios/audio_session_util_ios.h',
'audio/ios/audio_session_util_ios.mm',
'audio/linux/alsa_input.cc',
'audio/linux/alsa_input.h',
'audio/linux/alsa_output.cc',
'audio/linux/alsa_output.h',
'audio/linux/alsa_util.cc',
'audio/linux/alsa_util.h',
'audio/linux/alsa_wrapper.cc',
'audio/linux/alsa_wrapper.h',
'audio/linux/audio_manager_linux.cc',
'audio/linux/audio_manager_linux.h',
'audio/mac/aggregate_device_manager.cc',
'audio/mac/aggregate_device_manager.h',
'audio/mac/audio_auhal_mac.cc',
'audio/mac/audio_auhal_mac.h',
'audio/mac/audio_device_listener_mac.cc',
'audio/mac/audio_device_listener_mac.h',
'audio/mac/audio_input_mac.cc',
'audio/mac/audio_input_mac.h',
'audio/mac/audio_low_latency_input_mac.cc',
'audio/mac/audio_low_latency_input_mac.h',
'audio/mac/audio_low_latency_output_mac.cc',
'audio/mac/audio_low_latency_output_mac.h',
'audio/mac/audio_manager_mac.cc',
'audio/mac/audio_manager_mac.h',
'audio/mac/audio_synchronized_mac.cc',
'audio/mac/audio_synchronized_mac.h',
'audio/mac/audio_unified_mac.cc',
'audio/mac/audio_unified_mac.h',
'audio/null_audio_sink.cc',
'audio/null_audio_sink.h',
'audio/openbsd/audio_manager_openbsd.cc',
'audio/openbsd/audio_manager_openbsd.h',
'audio/pulse/audio_manager_pulse.cc',
'audio/pulse/audio_manager_pulse.h',
'audio/pulse/pulse_output.cc',
'audio/pulse/pulse_output.h',
'audio/pulse/pulse_input.cc',
'audio/pulse/pulse_input.h',
'audio/pulse/pulse_unified.cc',
'audio/pulse/pulse_unified.h',
'audio/pulse/pulse_util.cc',
'audio/pulse/pulse_util.h',
'audio/sample_rates.cc',
'audio/sample_rates.h',
'audio/scoped_loop_observer.cc',
'audio/scoped_loop_observer.h',
'audio/simple_sources.cc',
'audio/simple_sources.h',
'audio/virtual_audio_input_stream.cc',
'audio/virtual_audio_input_stream.h',
'audio/virtual_audio_output_stream.cc',
'audio/virtual_audio_output_stream.h',
'audio/win/audio_device_listener_win.cc',
'audio/win/audio_device_listener_win.h',
'audio/win/audio_low_latency_input_win.cc',
'audio/win/audio_low_latency_input_win.h',
'audio/win/audio_low_latency_output_win.cc',
'audio/win/audio_low_latency_output_win.h',
'audio/win/audio_manager_win.cc',
'audio/win/audio_manager_win.h',
'audio/win/audio_unified_win.cc',
'audio/win/audio_unified_win.h',
'audio/win/avrt_wrapper_win.cc',
'audio/win/avrt_wrapper_win.h',
'audio/win/device_enumeration_win.cc',
'audio/win/device_enumeration_win.h',
'audio/win/core_audio_util_win.cc',
'audio/win/core_audio_util_win.h',
'audio/win/wavein_input_win.cc',
'audio/win/wavein_input_win.h',
'audio/win/waveout_output_win.cc',
'audio/win/waveout_output_win.h',
'base/android/media_player_manager.cc',
'base/android/media_player_manager.h',
'base/android/media_resource_getter.cc',
'base/android/media_resource_getter.h',
'base/audio_capturer_source.h',
'base/audio_converter.cc',
'base/audio_converter.h',
'base/audio_decoder.cc',
'base/audio_decoder.h',
'base/audio_decoder_config.cc',
'base/audio_decoder_config.h',
'base/audio_fifo.cc',
'base/audio_fifo.h',
'base/audio_hardware_config.cc',
'base/audio_hardware_config.h',
'base/audio_hash.cc',
'base/audio_hash.h',
'base/audio_pull_fifo.cc',
'base/audio_pull_fifo.h',
'base/audio_renderer.cc',
'base/audio_renderer.h',
'base/audio_renderer_sink.h',
'base/audio_renderer_mixer.cc',
'base/audio_renderer_mixer.h',
'base/audio_renderer_mixer_input.cc',
'base/audio_renderer_mixer_input.h',
'base/audio_splicer.cc',
'base/audio_splicer.h',
'base/audio_timestamp_helper.cc',
'base/audio_timestamp_helper.h',
'base/bind_to_loop.h',
'base/bitstream_buffer.h',
'base/bit_reader.cc',
'base/bit_reader.h',
'base/buffers.h',
'base/byte_queue.cc',
'base/byte_queue.h',
'base/channel_mixer.cc',
'base/channel_mixer.h',
'base/clock.cc',
'base/clock.h',
'base/data_buffer.cc',
'base/data_buffer.h',
'base/data_source.cc',
'base/data_source.h',
'base/decoder_buffer.cc',
'base/decoder_buffer.h',
'base/decoder_buffer_queue.cc',
'base/decoder_buffer_queue.h',
'base/decryptor.cc',
'base/decryptor.h',
'base/decrypt_config.cc',
'base/decrypt_config.h',
'base/demuxer.cc',
'base/demuxer.h',
'base/demuxer_stream.cc',
'base/demuxer_stream.h',
'base/djb2.cc',
'base/djb2.h',
'base/filter_collection.cc',
'base/filter_collection.h',
'base/media.cc',
'base/media.h',
'base/media_log.cc',
'base/media_log.h',
'base/media_log_event.h',
'base/media_posix.cc',
'base/media_switches.cc',
'base/media_switches.h',
'base/media_win.cc',
'base/multi_channel_resampler.cc',
'base/multi_channel_resampler.h',
'base/pipeline.cc',
'base/pipeline.h',
'base/pipeline_status.cc',
'base/pipeline_status.h',
'base/ranges.cc',
'base/ranges.h',
'base/scoped_histogram_timer.h',
'base/seekable_buffer.cc',
'base/seekable_buffer.h',
'base/serial_runner.cc',
'base/serial_runner.h',
'base/sinc_resampler.cc',
'base/sinc_resampler.h',
'base/stream_parser.cc',
'base/stream_parser.h',
'base/stream_parser_buffer.cc',
'base/stream_parser_buffer.h',
'base/video_decoder.cc',
'base/video_decoder.h',
'base/video_decoder_config.cc',
'base/video_decoder_config.h',
'base/video_frame.cc',
'base/video_frame.h',
'base/video_renderer.cc',
'base/video_renderer.h',
'base/video_util.cc',
'base/video_util.h',
'crypto/aes_decryptor.cc',
'crypto/aes_decryptor.h',
'ffmpeg/ffmpeg_common.cc',
'ffmpeg/ffmpeg_common.h',
'filters/audio_decoder_selector.cc',
'filters/audio_decoder_selector.h',
'filters/audio_file_reader.cc',
'filters/audio_file_reader.h',
'filters/audio_renderer_algorithm.cc',
'filters/audio_renderer_algorithm.h',
'filters/audio_renderer_impl.cc',
'filters/audio_renderer_impl.h',
'filters/blocking_url_protocol.cc',
'filters/blocking_url_protocol.h',
'filters/chunk_demuxer.cc',
'filters/chunk_demuxer.h',
'filters/decrypting_audio_decoder.cc',
'filters/decrypting_audio_decoder.h',
'filters/decrypting_demuxer_stream.cc',
'filters/decrypting_demuxer_stream.h',
'filters/decrypting_video_decoder.cc',
'filters/decrypting_video_decoder.h',
'filters/fake_demuxer_stream.cc',
'filters/fake_demuxer_stream.h',
'filters/ffmpeg_audio_decoder.cc',
'filters/ffmpeg_audio_decoder.h',
'filters/ffmpeg_demuxer.cc',
'filters/ffmpeg_demuxer.h',
'filters/ffmpeg_glue.cc',
'filters/ffmpeg_glue.h',
'filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc',
'filters/ffmpeg_h264_to_annex_b_bitstream_converter.h',
'filters/ffmpeg_video_decoder.cc',
'filters/ffmpeg_video_decoder.h',
'filters/file_data_source.cc',
'filters/file_data_source.h',
'filters/gpu_video_decoder.cc',
'filters/gpu_video_decoder.h',
'filters/h264_to_annex_b_bitstream_converter.cc',
'filters/h264_to_annex_b_bitstream_converter.h',
'filters/in_memory_url_protocol.cc',
'filters/in_memory_url_protocol.h',
'filters/opus_audio_decoder.cc',
'filters/opus_audio_decoder.h',
'filters/skcanvas_video_renderer.cc',
'filters/skcanvas_video_renderer.h',
'filters/source_buffer_stream.cc',
'filters/source_buffer_stream.h',
'filters/stream_parser_factory.cc',
'filters/stream_parser_factory.h',
'filters/video_decoder_selector.cc',
'filters/video_decoder_selector.h',
'filters/video_frame_stream.cc',
'filters/video_frame_stream.h',
'filters/video_renderer_base.cc',
'filters/video_renderer_base.h',
'filters/vpx_video_decoder.cc',
'filters/vpx_video_decoder.h',
'video/capture/android/video_capture_device_android.cc',
'video/capture/android/video_capture_device_android.h',
'video/capture/fake_video_capture_device.cc',
'video/capture/fake_video_capture_device.h',
'video/capture/linux/video_capture_device_linux.cc',
'video/capture/linux/video_capture_device_linux.h',
'video/capture/mac/video_capture_device_mac.h',
'video/capture/mac/video_capture_device_mac.mm',
'video/capture/mac/video_capture_device_qtkit_mac.h',
'video/capture/mac/video_capture_device_qtkit_mac.mm',
'video/capture/screen/differ.cc',
'video/capture/screen/differ.h',
'video/capture/screen/differ_block.cc',
'video/capture/screen/differ_block.h',
'video/capture/screen/mac/desktop_configuration.h',
'video/capture/screen/mac/desktop_configuration.mm',
'video/capture/screen/mac/scoped_pixel_buffer_object.cc',
'video/capture/screen/mac/scoped_pixel_buffer_object.h',
'video/capture/screen/mouse_cursor_shape.h',
'video/capture/screen/screen_capture_device.cc',
'video/capture/screen/screen_capture_device.h',
'video/capture/screen/screen_capture_frame_queue.cc',
'video/capture/screen/screen_capture_frame_queue.h',
'video/capture/screen/screen_capturer.h',
'video/capture/screen/screen_capturer_fake.cc',
'video/capture/screen/screen_capturer_fake.h',
'video/capture/screen/screen_capturer_helper.cc',
'video/capture/screen/screen_capturer_helper.h',
'video/capture/screen/screen_capturer_mac.mm',
'video/capture/screen/screen_capturer_null.cc',
'video/capture/screen/screen_capturer_win.cc',
'video/capture/screen/screen_capturer_x11.cc',
'video/capture/screen/shared_desktop_frame.cc',
'video/capture/screen/shared_desktop_frame.h',
'video/capture/screen/win/desktop.cc',
'video/capture/screen/win/desktop.h',
'video/capture/screen/win/scoped_thread_desktop.cc',
'video/capture/screen/win/scoped_thread_desktop.h',
'video/capture/screen/x11/x_server_pixel_buffer.cc',
'video/capture/screen/x11/x_server_pixel_buffer.h',
'video/capture/video_capture.h',
'video/capture/video_capture_device.h',
'video/capture/video_capture_device_dummy.cc',
'video/capture/video_capture_device_dummy.h',
'video/capture/video_capture_proxy.cc',
'video/capture/video_capture_proxy.h',
'video/capture/video_capture_types.h',
'video/capture/win/capability_list_win.cc',
'video/capture/win/capability_list_win.h',
'video/capture/win/filter_base_win.cc',
'video/capture/win/filter_base_win.h',
'video/capture/win/pin_base_win.cc',
'video/capture/win/pin_base_win.h',
'video/capture/win/sink_filter_observer_win.h',
'video/capture/win/sink_filter_win.cc',
'video/capture/win/sink_filter_win.h',
'video/capture/win/sink_input_pin_win.cc',
'video/capture/win/sink_input_pin_win.h',
'video/capture/win/video_capture_device_mf_win.cc',
'video/capture/win/video_capture_device_mf_win.h',
'video/capture/win/video_capture_device_win.cc',
'video/capture/win/video_capture_device_win.h',
'video/picture.cc',
'video/picture.h',
'video/video_decode_accelerator.cc',
'video/video_decode_accelerator.h',
'webm/webm_audio_client.cc',
'webm/webm_audio_client.h',
'webm/webm_cluster_parser.cc',
'webm/webm_cluster_parser.h',
'webm/webm_constants.cc',
'webm/webm_constants.h',
'webm/webm_content_encodings.cc',
'webm/webm_content_encodings.h',
'webm/webm_content_encodings_client.cc',
'webm/webm_content_encodings_client.h',
'webm/webm_crypto_helpers.cc',
'webm/webm_crypto_helpers.h',
'webm/webm_info_parser.cc',
'webm/webm_info_parser.h',
'webm/webm_parser.cc',
'webm/webm_parser.h',
'webm/webm_stream_parser.cc',
'webm/webm_stream_parser.h',
'webm/webm_tracks_parser.cc',
'webm/webm_tracks_parser.h',
'webm/webm_video_client.cc',
'webm/webm_video_client.h',
],
'direct_dependent_settings': {
'include_dirs': [
'..',
],
},
'conditions': [
['arm_neon == 1', {
'defines': [
'USE_NEON'
],
}],
['OS != "linux" or use_x11 == 1', {
'sources!': [
'video/capture/screen/screen_capturer_null.cc',
]
}],
['OS != "ios"', {
'dependencies': [
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'shared_memory_support',
'yuv_convert',
],
}],
['media_use_ffmpeg == 1', {
'dependencies': [
'../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
],
}, { # media_use_ffmpeg == 0
# Exclude the sources that depend on ffmpeg.
'sources!': [
'base/media_posix.cc',
'ffmpeg/ffmpeg_common.cc',
'ffmpeg/ffmpeg_common.h',
'filters/audio_file_reader.cc',
'filters/audio_file_reader.h',
'filters/blocking_url_protocol.cc',
'filters/blocking_url_protocol.h',
'filters/ffmpeg_audio_decoder.cc',
'filters/ffmpeg_audio_decoder.h',
'filters/ffmpeg_demuxer.cc',
'filters/ffmpeg_demuxer.h',
'filters/ffmpeg_glue.cc',
'filters/ffmpeg_glue.h',
'filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc',
'filters/ffmpeg_h264_to_annex_b_bitstream_converter.h',
'filters/ffmpeg_video_decoder.cc',
'filters/ffmpeg_video_decoder.h',
],
}],
['media_use_libvpx == 1', {
'dependencies': [
'<(DEPTH)/third_party/libvpx/libvpx.gyp:libvpx',
],
}, { # media_use_libvpx == 0
'direct_dependent_settings': {
'defines': [
'MEDIA_DISABLE_LIBVPX',
],
},
# Exclude the sources that depend on libvpx.
'sources!': [
'filters/vpx_video_decoder.cc',
'filters/vpx_video_decoder.h',
],
}],
['OS == "ios"', {
'includes': [
# For shared_memory_support_sources variable.
'shared_memory_support.gypi',
],
'sources': [
'base/media_stub.cc',
# These sources are normally built via a dependency on the
# shared_memory_support target, but that target is not built on iOS.
# Instead, directly build only the files that are needed for iOS.
'<@(shared_memory_support_sources)',
],
'sources/': [
# Exclude everything but iOS-specific files.
['exclude', '\\.(cc|mm)$'],
['include', '_ios\\.(cc|mm)$'],
['include', '(^|/)ios/'],
# Re-include specific pieces.
# iOS support is limited to audio input only.
['include', '^audio/audio_buffers_state\\.'],
['include', '^audio/audio_input_controller\\.'],
['include', '^audio/audio_manager\\.'],
['include', '^audio/audio_manager_base\\.'],
['include', '^audio/audio_parameters\\.'],
['include', '^audio/fake_audio_consumer\\.'],
['include', '^audio/fake_audio_input_stream\\.'],
['include', '^audio/fake_audio_output_stream\\.'],
['include', '^base/audio_bus\\.'],
['include', '^base/channel_layout\\.'],
['include', '^base/media\\.cc$'],
['include', '^base/media_stub\\.cc$'],
['include', '^base/media_switches\\.'],
['include', '^base/vector_math\\.'],
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework',
'$(SDKROOT)/System/Library/Frameworks/AVFoundation.framework',
'$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework',
],
},
}],
['OS == "android"', {
'link_settings': {
'libraries': [
'-lOpenSLES',
],
},
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/media',
],
'dependencies': [
'media_android_jni_headers',
'player_android',
'video_capture_android_jni_headers',
],
'sources': [
'base/media.cc',
'base/media.h',
],
'conditions': [
['android_webview_build == 0', {
'dependencies': [
'media_java',
],
}],
['use_openmax_dl_fft==1', {
# FFT library requires Neon support, so we enable
# WebAudio only if Neon is detected at runtime.
'sources': [
'base/media_android.cc',
],
'includes': [
'../build/android/cpufeatures.gypi',
],
}, {
'sources': [
'base/media_stub.cc',
],
}],
],
}],
# A simple WebM encoder for animated avatars on ChromeOS.
['chromeos==1', {
'dependencies': [
'../third_party/libvpx/libvpx.gyp:libvpx',
'../third_party/libyuv/libyuv.gyp:libyuv',
],
'sources': [
'webm/chromeos/ebml_writer.cc',
'webm/chromeos/ebml_writer.h',
'webm/chromeos/webm_encoder.cc',
'webm/chromeos/webm_encoder.h',
],
}],
['use_alsa==1', {
'link_settings': {
'libraries': [
'-lasound',
],
},
}, { # use_alsa==0
'sources/': [ ['exclude', '/alsa_' ],
['exclude', '/audio_manager_linux' ] ],
}],
['OS!="openbsd"', {
'sources!': [
'audio/openbsd/audio_manager_openbsd.cc',
'audio/openbsd/audio_manager_openbsd.h',
],
}],
['OS=="linux"', {
'variables': {
'conditions': [
['sysroot!=""', {
'pkg-config': '../build/linux/pkg-config-wrapper "<(sysroot)" "<(target_arch)"',
}, {
'pkg-config': 'pkg-config'
}],
],
},
'conditions': [
['use_x11 == 1', {
'link_settings': {
'libraries': [
'-lX11',
'-lXdamage',
'-lXext',
'-lXfixes',
],
},
}],
['use_cras == 1', {
'cflags': [
'<!@(<(pkg-config) --cflags libcras)',
],
'link_settings': {
'libraries': [
'<!@(<(pkg-config) --libs libcras)',
],
},
'defines': [
'USE_CRAS',
],
}, { # else: use_cras == 0
'sources!': [
'audio/cras/audio_manager_cras.cc',
'audio/cras/audio_manager_cras.h',
'audio/cras/cras_input.cc',
'audio/cras/cras_input.h',
'audio/cras/cras_unified.cc',
'audio/cras/cras_unified.h',
],
}],
],
}],
['OS!="linux"', {
'sources!': [
'audio/cras/audio_manager_cras.cc',
'audio/cras/audio_manager_cras.h',
'audio/cras/cras_input.cc',
'audio/cras/cras_input.h',
'audio/cras/cras_unified.cc',
'audio/cras/cras_unified.h',
],
}],
['use_pulseaudio==1', {
'cflags': [
'<!@(pkg-config --cflags libpulse)',
],
'defines': [
'USE_PULSEAUDIO',
],
'conditions': [
['linux_link_pulseaudio==0', {
'defines': [
'DLOPEN_PULSEAUDIO',
],
'variables': {
'generate_stubs_script': '../tools/generate_stubs/generate_stubs.py',
'extra_header': 'audio/pulse/pulse_stub_header.fragment',
'sig_files': ['audio/pulse/pulse.sigs'],
'outfile_type': 'posix_stubs',
'stubs_filename_root': 'pulse_stubs',
'project_path': 'media/audio/pulse',
'intermediate_dir': '<(INTERMEDIATE_DIR)',
'output_root': '<(SHARED_INTERMEDIATE_DIR)/pulse',
},
'include_dirs': [
'<(output_root)',
],
'actions': [
{
'action_name': 'generate_stubs',
'inputs': [
'<(generate_stubs_script)',
'<(extra_header)',
'<@(sig_files)',
],
'outputs': [
'<(intermediate_dir)/<(stubs_filename_root).cc',
'<(output_root)/<(project_path)/<(stubs_filename_root).h',
],
'action': ['python',
'<(generate_stubs_script)',
'-i', '<(intermediate_dir)',
'-o', '<(output_root)/<(project_path)',
'-t', '<(outfile_type)',
'-e', '<(extra_header)',
'-s', '<(stubs_filename_root)',
'-p', '<(project_path)',
'<@(_inputs)',
],
'process_outputs_as_sources': 1,
'message': 'Generating Pulse stubs for dynamic loading.',
},
],
'conditions': [
# Linux/Solaris need libdl for dlopen() and friends.
['OS == "linux" or OS == "solaris"', {
'link_settings': {
'libraries': [
'-ldl',
],
},
}],
],
}, { # else: linux_link_pulseaudio==0
'link_settings': {
'ldflags': [
'<!@(pkg-config --libs-only-L --libs-only-other libpulse)',
],
'libraries': [
'<!@(pkg-config --libs-only-l libpulse)',
],
},
}],
],
}, { # else: use_pulseaudio==0
'sources!': [
'audio/pulse/audio_manager_pulse.cc',
'audio/pulse/audio_manager_pulse.h',
'audio/pulse/pulse_input.cc',
'audio/pulse/pulse_input.h',
'audio/pulse/pulse_output.cc',
'audio/pulse/pulse_output.h',
'audio/pulse/pulse_unified.cc',
'audio/pulse/pulse_unified.h',
'audio/pulse/pulse_util.cc',
'audio/pulse/pulse_util.h',
],
}],
['os_posix == 1', {
'sources!': [
'video/capture/video_capture_device_dummy.cc',
'video/capture/video_capture_device_dummy.h',
],
}],
['OS=="mac"', {
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework',
'$(SDKROOT)/System/Library/Frameworks/AudioUnit.framework',
'$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework',
'$(SDKROOT)/System/Library/Frameworks/CoreVideo.framework',
'$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
'$(SDKROOT)/System/Library/Frameworks/QTKit.framework',
],
},
}],
['OS=="win"', {
'sources!': [
'video/capture/video_capture_device_dummy.cc',
'video/capture/video_capture_device_dummy.h',
],
'link_settings': {
'libraries': [
'-lmf.lib',
'-lmfplat.lib',
'-lmfreadwrite.lib',
'-lmfuuid.lib',
],
},
# Specify delayload for media.dll.
'msvs_settings': {
'VCLinkerTool': {
'DelayLoadDLLs': [
'mf.dll',
'mfplat.dll',
'mfreadwrite.dll',
],
},
},
# Specify delayload for components that link with media.lib.
'all_dependent_settings': {
'msvs_settings': {
'VCLinkerTool': {
'DelayLoadDLLs': [
'mf.dll',
'mfplat.dll',
'mfreadwrite.dll',
],
},
},
},
# TODO(wolenetz): Fix size_t to int truncations in win64. See
# http://crbug.com/171009
'conditions': [
['target_arch == "x64"', {
'msvs_disabled_warnings': [ 4267, ],
}],
],
}],
['proprietary_codecs==1 or branding=="Chrome"', {
'sources': [
'mp4/aac.cc',
'mp4/aac.h',
'mp4/avc.cc',
'mp4/avc.h',
'mp4/box_definitions.cc',
'mp4/box_definitions.h',
'mp4/box_reader.cc',
'mp4/box_reader.h',
'mp4/cenc.cc',
'mp4/cenc.h',
'mp4/es_descriptor.cc',
'mp4/es_descriptor.h',
'mp4/mp4_stream_parser.cc',
'mp4/mp4_stream_parser.h',
'mp4/offset_byte_queue.cc',
'mp4/offset_byte_queue.h',
'mp4/track_run_iterator.cc',
'mp4/track_run_iterator.h',
],
}],
[ 'screen_capture_supported==1', {
'dependencies': [
'../third_party/webrtc/modules/modules.gyp:desktop_capture',
],
}, {
'sources/': [
['exclude', '^video/capture/screen/'],
],
}],
[ 'screen_capture_supported==1 and (target_arch=="ia32" or target_arch=="x64")', {
'dependencies': [
'differ_block_sse2',
],
}],
['toolkit_uses_gtk==1', {
'dependencies': [
'../build/linux/system.gyp:gtk',
],
}],
# ios check is necessary due to http://crbug.com/172682.
['OS != "ios" and (target_arch == "ia32" or target_arch == "x64")', {
'dependencies': [
'media_sse',
],
}],
['google_tv == 1', {
'defines': [
'ENABLE_EAC3_PLAYBACK',
],
}],
],
'target_conditions': [
['OS == "ios"', {
'sources/': [
# Pull in specific Mac files for iOS (which have been filtered out
# by file name rules).
['include', '^audio/mac/audio_input_mac\\.'],
],
}],
],
},
{
'target_name': 'media_unittests',
'type': '<(gtest_target_type)',
'dependencies': [
'media',
'media_test_support',
'../base/base.gyp:base',
'../base/base.gyp:base_i18n',
'../base/base.gyp:test_support_base',
'../skia/skia.gyp:skia',
'../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest',
'../ui/ui.gyp:ui',
],
'sources': [
'audio/async_socket_io_handler_unittest.cc',
'audio/audio_input_controller_unittest.cc',
'audio/audio_input_device_unittest.cc',
'audio/audio_input_unittest.cc',
'audio/audio_input_volume_unittest.cc',
'audio/audio_low_latency_input_output_unittest.cc',
'audio/audio_output_controller_unittest.cc',
'audio/audio_output_device_unittest.cc',
'audio/audio_output_proxy_unittest.cc',
'audio/audio_parameters_unittest.cc',
'audio/audio_silence_detector_unittest.cc',
'audio/cross_process_notification_unittest.cc',
'audio/fake_audio_consumer_unittest.cc',
'audio/ios/audio_manager_ios_unittest.cc',
'audio/linux/alsa_output_unittest.cc',
'audio/mac/audio_auhal_mac_unittest.cc',
'audio/mac/audio_device_listener_mac_unittest.cc',
'audio/mac/audio_low_latency_input_mac_unittest.cc',
'audio/simple_sources_unittest.cc',
'audio/virtual_audio_input_stream_unittest.cc',
'audio/virtual_audio_output_stream_unittest.cc',
'audio/win/audio_device_listener_win_unittest.cc',
'audio/win/audio_low_latency_input_win_unittest.cc',
'audio/win/audio_low_latency_output_win_unittest.cc',
'audio/win/audio_output_win_unittest.cc',
'audio/win/audio_unified_win_unittest.cc',
'audio/win/core_audio_util_win_unittest.cc',
'base/android/media_codec_bridge_unittest.cc',
'base/audio_bus_unittest.cc',
'base/audio_converter_unittest.cc',
'base/audio_fifo_unittest.cc',
'base/audio_hardware_config_unittest.cc',
'base/audio_hash_unittest.cc',
'base/audio_pull_fifo_unittest.cc',
'base/audio_renderer_mixer_input_unittest.cc',
'base/audio_renderer_mixer_unittest.cc',
'base/audio_splicer_unittest.cc',
'base/audio_timestamp_helper_unittest.cc',
'base/bind_to_loop_unittest.cc',
'base/bit_reader_unittest.cc',
'base/channel_mixer_unittest.cc',
'base/clock_unittest.cc',
'base/data_buffer_unittest.cc',
'base/decoder_buffer_queue_unittest.cc',
'base/decoder_buffer_unittest.cc',
'base/djb2_unittest.cc',
'base/gmock_callback_support_unittest.cc',
'base/multi_channel_resampler_unittest.cc',
'base/pipeline_unittest.cc',
'base/ranges_unittest.cc',
'base/run_all_unittests.cc',
'base/scoped_histogram_timer_unittest.cc',
'base/seekable_buffer_unittest.cc',
'base/sinc_resampler_unittest.cc',
'base/test_data_util.cc',
'base/test_data_util.h',
'base/vector_math_testing.h',
'base/vector_math_unittest.cc',
'base/video_frame_unittest.cc',
'base/video_util_unittest.cc',
'base/yuv_convert_unittest.cc',
'crypto/aes_decryptor_unittest.cc',
'ffmpeg/ffmpeg_common_unittest.cc',
'filters/audio_decoder_selector_unittest.cc',
'filters/audio_file_reader_unittest.cc',
'filters/audio_renderer_algorithm_unittest.cc',
'filters/audio_renderer_impl_unittest.cc',
'filters/blocking_url_protocol_unittest.cc',
'filters/chunk_demuxer_unittest.cc',
'filters/decrypting_audio_decoder_unittest.cc',
'filters/decrypting_demuxer_stream_unittest.cc',
'filters/decrypting_video_decoder_unittest.cc',
'filters/fake_demuxer_stream_unittest.cc',
'filters/ffmpeg_audio_decoder_unittest.cc',
'filters/ffmpeg_demuxer_unittest.cc',
'filters/ffmpeg_glue_unittest.cc',
'filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc',
'filters/ffmpeg_video_decoder_unittest.cc',
'filters/file_data_source_unittest.cc',
'filters/h264_to_annex_b_bitstream_converter_unittest.cc',
'filters/pipeline_integration_test.cc',
'filters/pipeline_integration_test_base.cc',
'filters/skcanvas_video_renderer_unittest.cc',
'filters/source_buffer_stream_unittest.cc',
'filters/video_decoder_selector_unittest.cc',
'filters/video_frame_stream_unittest.cc',
'filters/video_renderer_base_unittest.cc',
'video/capture/screen/differ_block_unittest.cc',
'video/capture/screen/differ_unittest.cc',
'video/capture/screen/screen_capture_device_unittest.cc',
'video/capture/screen/screen_capturer_helper_unittest.cc',
'video/capture/screen/screen_capturer_mac_unittest.cc',
'video/capture/screen/screen_capturer_unittest.cc',
'video/capture/video_capture_device_unittest.cc',
'webm/cluster_builder.cc',
'webm/cluster_builder.h',
'webm/tracks_builder.cc',
'webm/tracks_builder.h',
'webm/webm_cluster_parser_unittest.cc',
'webm/webm_content_encodings_client_unittest.cc',
'webm/webm_parser_unittest.cc',
'webm/webm_tracks_parser_unittest.cc',
],
'conditions': [
['arm_neon == 1', {
'defines': [
'USE_NEON'
],
}],
['OS != "ios"', {
'dependencies': [
'shared_memory_support',
'yuv_convert',
],
}],
['media_use_ffmpeg == 1', {
'dependencies': [
'../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
],
}],
['os_posix==1 and OS!="mac" and OS!="ios"', {
'conditions': [
['linux_use_tcmalloc==1', {
'dependencies': [
'../base/allocator/allocator.gyp:allocator',
],
}],
],
}],
['OS == "ios"', {
'sources/': [
['exclude', '.*'],
['include', '^audio/audio_input_controller_unittest\\.cc$'],
['include', '^audio/audio_input_unittest\\.cc$'],
['include', '^audio/audio_parameters_unittest\\.cc$'],
['include', '^audio/ios/audio_manager_ios_unittest\\.cc$'],
['include', '^base/mock_reader\\.h$'],
['include', '^base/run_all_unittests\\.cc$'],
],
}],
['OS=="android"', {
'sources!': [
'audio/audio_input_volume_unittest.cc',
'base/test_data_util.cc',
'base/test_data_util.h',
'ffmpeg/ffmpeg_common_unittest.cc',
'filters/audio_file_reader_unittest.cc',
'filters/blocking_url_protocol_unittest.cc',
'filters/chunk_demuxer_unittest.cc',
'filters/ffmpeg_audio_decoder_unittest.cc',
'filters/ffmpeg_demuxer_unittest.cc',
'filters/ffmpeg_glue_unittest.cc',
'filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc',
'filters/ffmpeg_video_decoder_unittest.cc',
'filters/pipeline_integration_test.cc',
'filters/pipeline_integration_test_base.cc',
'mp4/mp4_stream_parser_unittest.cc',
'webm/webm_cluster_parser_unittest.cc',
],
'conditions': [
['gtest_target_type == "shared_library"', {
'dependencies': [
'../testing/android/native_test.gyp:native_test_native_code',
'player_android',
],
}],
],
}],
['OS == "linux"', {
'conditions': [
['use_cras == 1', {
'sources': [
'audio/cras/cras_input_unittest.cc',
'audio/cras/cras_unified_unittest.cc',
],
'defines': [
'USE_CRAS',
],
}],
],
}],
['use_alsa==0', {
'sources!': [
'audio/linux/alsa_output_unittest.cc',
'audio/audio_low_latency_input_output_unittest.cc',
],
}],
['OS != "ios" and (target_arch=="ia32" or target_arch=="x64")', {
'sources': [
'base/simd/convert_rgb_to_yuv_unittest.cc',
],
'dependencies': [
'media_sse',
],
}],
['screen_capture_supported==1', {
'dependencies': [
'../third_party/webrtc/modules/modules.gyp:desktop_capture',
],
}, {
'sources/': [
['exclude', '^video/capture/screen/'],
],
}],
['proprietary_codecs==1 or branding=="Chrome"', {
'sources': [
'mp4/aac_unittest.cc',
'mp4/avc_unittest.cc',
'mp4/box_reader_unittest.cc',
'mp4/es_descriptor_unittest.cc',
'mp4/mp4_stream_parser_unittest.cc',
'mp4/offset_byte_queue_unittest.cc',
'mp4/track_run_iterator_unittest.cc',
],
}],
# TODO(wolenetz): Fix size_t to int truncations in win64. See
# http://crbug.com/171009
['OS=="win" and target_arch=="x64"', {
'msvs_disabled_warnings': [ 4267, ],
}],
],
},
{
'target_name': 'media_test_support',
'type': 'static_library',
'dependencies': [
'media',
'../base/base.gyp:base',
'../skia/skia.gyp:skia',
'../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest',
],
'sources': [
'audio/mock_audio_manager.cc',
'audio/mock_audio_manager.h',
'audio/test_audio_input_controller_factory.cc',
'audio/test_audio_input_controller_factory.h',
'base/fake_audio_render_callback.cc',
'base/fake_audio_render_callback.h',
'base/gmock_callback_support.h',
'base/mock_audio_renderer_sink.cc',
'base/mock_audio_renderer_sink.h',
'base/mock_data_source_host.cc',
'base/mock_data_source_host.h',
'base/mock_demuxer_host.cc',
'base/mock_demuxer_host.h',
'base/mock_filters.cc',
'base/mock_filters.h',
'base/test_helpers.cc',
'base/test_helpers.h',
'video/capture/screen/screen_capturer_mock_objects.cc',
'video/capture/screen/screen_capturer_mock_objects.h',
],
'conditions': [
[ 'screen_capture_supported == 1', {
'dependencies': [
'../third_party/webrtc/modules/modules.gyp:desktop_capture',
],
}, {
'sources/': [
['exclude', '^video/capture/screen/'],
],
}],
],
},
],
'conditions': [
['OS != "ios" and target_arch != "arm"', {
'targets': [
{
'target_name': 'yuv_convert_simd_x86',
'type': 'static_library',
'include_dirs': [
'..',
],
'sources': [
'base/simd/convert_rgb_to_yuv_c.cc',
'base/simd/convert_rgb_to_yuv_sse2.cc',
'base/simd/convert_rgb_to_yuv_ssse3.asm',
'base/simd/convert_rgb_to_yuv_ssse3.cc',
'base/simd/convert_rgb_to_yuv_ssse3.inc',
'base/simd/convert_yuv_to_rgb_c.cc',
'base/simd/convert_yuv_to_rgb_mmx.asm',
'base/simd/convert_yuv_to_rgb_mmx.inc',
'base/simd/convert_yuv_to_rgb_sse.asm',
'base/simd/convert_yuv_to_rgb_x86.cc',
'base/simd/convert_yuva_to_argb_mmx.asm',
'base/simd/convert_yuva_to_argb_mmx.inc',
'base/simd/empty_register_state_mmx.asm',
'base/simd/filter_yuv.h',
'base/simd/filter_yuv_c.cc',
'base/simd/filter_yuv_sse2.cc',
'base/simd/linear_scale_yuv_to_rgb_mmx.asm',
'base/simd/linear_scale_yuv_to_rgb_mmx.inc',
'base/simd/linear_scale_yuv_to_rgb_sse.asm',
'base/simd/scale_yuv_to_rgb_mmx.asm',
'base/simd/scale_yuv_to_rgb_mmx.inc',
'base/simd/scale_yuv_to_rgb_sse.asm',
'base/simd/yuv_to_rgb_table.cc',
'base/simd/yuv_to_rgb_table.h',
],
'conditions': [
# TODO(jschuh): Get MMX enabled on Win64. crbug.com/179657
[ 'OS!="win" or target_arch=="ia32"', {
'sources': [
'base/simd/filter_yuv_mmx.cc',
],
}],
[ 'target_arch == "x64"', {
# Source files optimized for X64 systems.
'sources': [
'base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm',
'base/simd/scale_yuv_to_rgb_sse2_x64.asm',
],
'variables': {
'yasm_flags': [
'-DARCH_X86_64',
],
},
}],
[ 'os_posix == 1 and OS != "mac" and OS != "android"', {
'cflags': [
'-msse2',
],
}],
[ 'OS == "mac"', {
'configurations': {
'Debug': {
'xcode_settings': {
# gcc on the mac builds horribly unoptimized sse code in
# debug mode. Since this is rarely going to be debugged,
# run with full optimizations in Debug as well as Release.
'GCC_OPTIMIZATION_LEVEL': '3', # -O3
},
},
},
'variables': {
'yasm_flags': [
'-DPREFIX',
'-DMACHO',
],
},
}],
[ 'os_posix==1 and OS!="mac"', {
'variables': {
'conditions': [
[ 'target_arch=="ia32"', {
'yasm_flags': [
'-DX86_32',
'-DELF',
],
}, {
'yasm_flags': [
'-DELF',
'-DPIC',
],
}],
],
},
}],
],
'variables': {
'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/media',
'yasm_flags': [
'-DCHROMIUM',
# In addition to the same path as source asm, let yasm %include
# search path be relative to src/ per Chromium policy.
'-I..',
],
},
'msvs_2010_disable_uldi_when_referenced': 1,
'includes': [
'../third_party/yasm/yasm_compile.gypi',
],
},
], # targets
}],
['OS != "ios"', {
'targets': [
{
# Minimal target for NaCl and other renderer side media clients which
# only need to send audio data across the shared memory to the browser
# process.
'target_name': 'shared_memory_support',
'type': '<(component)',
'dependencies': [
'../base/base.gyp:base',
],
'defines': [
'MEDIA_IMPLEMENTATION',
],
'include_dirs': [
'..',
],
'includes': [
'shared_memory_support.gypi',
],
'sources': [
'<@(shared_memory_support_sources)',
],
'conditions': [
[ 'target_arch == "ia32" or target_arch == "x64"', {
'dependencies': [
'media_sse',
],
}],
['arm_neon == 1', {
'defines': [
'USE_NEON'
],
}],
],
},
{
'target_name': 'yuv_convert',
'type': 'static_library',
'include_dirs': [
'..',
],
'conditions': [
[ 'target_arch == "ia32" or target_arch == "x64"', {
'dependencies': [
'yuv_convert_simd_x86',
],
}],
[ 'target_arch == "arm" or target_arch == "mipsel"', {
'dependencies': [
'yuv_convert_simd_c',
],
}],
],
'sources': [
'base/yuv_convert.cc',
'base/yuv_convert.h',
],
},
{
'target_name': 'yuv_convert_simd_c',
'type': 'static_library',
'include_dirs': [
'..',
],
'sources': [
'base/simd/convert_rgb_to_yuv.h',
'base/simd/convert_rgb_to_yuv_c.cc',
'base/simd/convert_yuv_to_rgb.h',
'base/simd/convert_yuv_to_rgb_c.cc',
'base/simd/filter_yuv.h',
'base/simd/filter_yuv_c.cc',
'base/simd/yuv_to_rgb_table.cc',
'base/simd/yuv_to_rgb_table.h',
],
},
{
'target_name': 'seek_tester',
'type': 'executable',
'dependencies': [
'media',
'../base/base.gyp:base',
],
'sources': [
'tools/seek_tester/seek_tester.cc',
],
},
{
'target_name': 'demuxer_bench',
'type': 'executable',
'dependencies': [
'media',
'../base/base.gyp:base',
],
'sources': [
'tools/demuxer_bench/demuxer_bench.cc',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
},
],
}],
['(OS == "win" or toolkit_uses_gtk == 1) and use_aura != 1', {
'targets': [
{
'target_name': 'shader_bench',
'type': 'executable',
'dependencies': [
'media',
'yuv_convert',
'../base/base.gyp:base',
'../ui/gl/gl.gyp:gl',
'../ui/ui.gyp:ui',
],
'sources': [
'tools/shader_bench/cpu_color_painter.cc',
'tools/shader_bench/cpu_color_painter.h',
'tools/shader_bench/gpu_color_painter.cc',
'tools/shader_bench/gpu_color_painter.h',
'tools/shader_bench/gpu_painter.cc',
'tools/shader_bench/gpu_painter.h',
'tools/shader_bench/painter.cc',
'tools/shader_bench/painter.h',
'tools/shader_bench/shader_bench.cc',
'tools/shader_bench/window.cc',
'tools/shader_bench/window.h',
],
'conditions': [
['toolkit_uses_gtk == 1', {
'dependencies': [
'../build/linux/system.gyp:gtk',
],
'sources': [
'tools/shader_bench/window_linux.cc',
],
}],
['OS=="win"', {
'dependencies': [
'../third_party/angle/src/build_angle.gyp:libEGL',
'../third_party/angle/src/build_angle.gyp:libGLESv2',
],
'sources': [
'tools/shader_bench/window_win.cc',
],
}],
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
},
],
}],
['use_x11 == 1', {
'targets': [
{
'target_name': 'player_x11',
'type': 'executable',
'dependencies': [
'media',
'yuv_convert',
'../base/base.gyp:base',
'../ui/gl/gl.gyp:gl',
'../ui/ui.gyp:ui',
],
'link_settings': {
'libraries': [
'-ldl',
'-lX11',
'-lXrender',
'-lXext',
],
},
'sources': [
'tools/player_x11/data_source_logger.cc',
'tools/player_x11/data_source_logger.h',
'tools/player_x11/gl_video_renderer.cc',
'tools/player_x11/gl_video_renderer.h',
'tools/player_x11/player_x11.cc',
'tools/player_x11/x11_video_renderer.cc',
'tools/player_x11/x11_video_renderer.h',
],
},
],
}],
# Special target to wrap a gtest_target_type==shared_library
# media_unittests into an android apk for execution.
['OS == "android" and gtest_target_type == "shared_library"', {
'targets': [
{
'target_name': 'media_unittests_apk',
'type': 'none',
'dependencies': [
'media_java',
'media_unittests',
],
'variables': {
'test_suite_name': 'media_unittests',
'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)media_unittests<(SHARED_LIB_SUFFIX)',
},
'includes': [ '../build/apk_test.gypi' ],
},
],
}],
['OS == "android"', {
'targets': [
{
'target_name': 'media_player_jni_headers',
'type': 'none',
'variables': {
'jni_gen_package': 'media',
'input_java_class': 'android/media/MediaPlayer.class',
},
'includes': [ '../build/jar_file_jni_generator.gypi' ],
},
{
'target_name': 'media_android_jni_headers',
'type': 'none',
'dependencies': [
'media_player_jni_headers',
],
'sources': [
'base/android/java/src/org/chromium/media/AudioManagerAndroid.java',
'base/android/java/src/org/chromium/media/MediaPlayerBridge.java',
'base/android/java/src/org/chromium/media/MediaPlayerListener.java',
'base/android/java/src/org/chromium/media/WebAudioMediaCodecBridge.java',
],
'variables': {
'jni_gen_package': 'media',
},
'includes': [ '../build/jni_generator.gypi' ],
},
{
'target_name': 'video_capture_android_jni_headers',
'type': 'none',
'sources': [
'base/android/java/src/org/chromium/media/VideoCapture.java',
],
'variables': {
'jni_gen_package': 'media',
},
'includes': [ '../build/jni_generator.gypi' ],
},
{
'target_name': 'media_codec_jni_headers',
'type': 'none',
'variables': {
'jni_gen_package': 'media',
'input_java_class': 'android/media/MediaCodec.class',
},
'includes': [ '../build/jar_file_jni_generator.gypi' ],
},
{
'target_name': 'media_format_jni_headers',
'type': 'none',
'variables': {
'jni_gen_package': 'media',
'input_java_class': 'android/media/MediaFormat.class',
},
'includes': [ '../build/jar_file_jni_generator.gypi' ],
},
{
'target_name': 'player_android',
'type': 'static_library',
'sources': [
'base/android/media_codec_bridge.cc',
'base/android/media_codec_bridge.h',
'base/android/media_jni_registrar.cc',
'base/android/media_jni_registrar.h',
'base/android/media_player_android.cc',
'base/android/media_player_android.h',
'base/android/media_player_bridge.cc',
'base/android/media_player_bridge.h',
'base/android/media_player_listener.cc',
'base/android/media_player_listener.h',
'base/android/webaudio_media_codec_bridge.cc',
'base/android/webaudio_media_codec_bridge.h',
'base/android/webaudio_media_codec_info.h',
],
'conditions': [
['google_tv == 1', {
'sources': [
'base/android/demuxer_stream_player_params.cc',
'base/android/demuxer_stream_player_params.h',
],
}],
],
'dependencies': [
'../base/base.gyp:base',
'media_android_jni_headers',
'media_codec_jni_headers',
'media_format_jni_headers',
],
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/media',
],
},
{
'target_name': 'media_java',
'type': 'none',
'dependencies': [
'../base/base.gyp:base',
],
'export_dependent_settings': [
'../base/base.gyp:base',
],
'variables': {
'java_in_dir': 'base/android/java',
},
'includes': [ '../build/java.gypi' ],
},
],
}],
['media_use_ffmpeg == 1', {
'targets': [
{
'target_name': 'ffmpeg_unittests',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_i18n',
'../base/base.gyp:test_support_base',
'../base/base.gyp:test_support_perf',
'../testing/gtest.gyp:gtest',
'../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
'media',
'media_test_support',
],
'sources': [
'ffmpeg/ffmpeg_unittest.cc',
],
'conditions': [
['toolkit_uses_gtk == 1', {
'dependencies': [
# Needed for the following #include chain:
# base/run_all_unittests.cc
# ../base/test_suite.h
# gtk/gtk.h
'../build/linux/system.gyp:gtk',
],
'conditions': [
['linux_use_tcmalloc==1', {
'dependencies': [
'../base/allocator/allocator.gyp:allocator',
],
}],
],
}],
],
},
{
'target_name': 'ffmpeg_regression_tests',
'type': 'executable',
'dependencies': [
'../base/base.gyp:test_support_base',
'../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest',
'../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
'media',
'media_test_support',
],
'sources': [
'base/run_all_unittests.cc',
'base/test_data_util.cc',
'ffmpeg/ffmpeg_regression_tests.cc',
'filters/pipeline_integration_test_base.cc',
],
'conditions': [
['os_posix==1 and OS!="mac"', {
'conditions': [
['linux_use_tcmalloc==1', {
'dependencies': [
'../base/allocator/allocator.gyp:allocator',
],
}],
],
}],
],
},
{
'target_name': 'ffmpeg_tests',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
'media',
],
'sources': [
'test/ffmpeg_tests/ffmpeg_tests.cc',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
},
{
'target_name': 'media_bench',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'../third_party/ffmpeg/ffmpeg.gyp:ffmpeg',
'media',
],
'sources': [
'tools/media_bench/media_bench.cc',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
},
],
}],
[ 'screen_capture_supported==1 and (target_arch=="ia32" or target_arch=="x64")', {
'targets': [
{
'target_name': 'differ_block_sse2',
'type': 'static_library',
'conditions': [
[ 'os_posix == 1 and OS != "mac"', {
'cflags': [
'-msse2',
],
}],
],
'include_dirs': [
'..',
],
'sources': [
'video/capture/screen/differ_block_sse2.cc',
'video/capture/screen/differ_block_sse2.h',
],
}, # end of target differ_block_sse2
],
}],
# ios check is necessary due to http://crbug.com/172682.
['OS != "ios" and (target_arch=="ia32" or target_arch=="x64")', {
'targets': [
{
'target_name': 'media_sse',
'type': 'static_library',
'cflags': [
'-msse',
],
'include_dirs': [
'..',
],
'defines': [
'MEDIA_IMPLEMENTATION',
],
'sources': [
'base/simd/sinc_resampler_sse.cc',
'base/simd/vector_math_sse.cc',
],
}, # end of target media_sse
],
}],
],
}
| {'variables': {'chromium_code': 1, 'use_cras%': 0, 'linux_link_pulseaudio%': 0, 'conditions': [['OS == "android" or OS == "ios"', {'media_use_ffmpeg%': 0, 'media_use_libvpx%': 0}, {'media_use_ffmpeg%': 1, 'media_use_libvpx%': 1}], ['OS=="win" or OS=="mac" or (OS=="linux" and use_x11==1)', {'screen_capture_supported%': 1}, {'screen_capture_supported%': 0}], ['OS=="linux" or OS=="freebsd" or OS=="solaris"', {'use_alsa%': 1}, {'use_alsa%': 0}], ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android" and chromeos != 1', {'use_pulseaudio%': 1}, {'use_pulseaudio%': 0}]]}, 'targets': [{'target_name': 'media', 'type': '<(component)', 'dependencies': ['../base/base.gyp:base', '../build/temp_gyp/googleurl.gyp:googleurl', '../crypto/crypto.gyp:crypto', '../skia/skia.gyp:skia', '../third_party/opus/opus.gyp:opus', '../ui/ui.gyp:ui'], 'defines': ['MEDIA_IMPLEMENTATION'], 'include_dirs': ['..'], 'sources': ['audio/android/audio_manager_android.cc', 'audio/android/audio_manager_android.h', 'audio/android/opensles_input.cc', 'audio/android/opensles_input.h', 'audio/android/opensles_output.cc', 'audio/android/opensles_output.h', 'audio/async_socket_io_handler.h', 'audio/async_socket_io_handler_posix.cc', 'audio/async_socket_io_handler_win.cc', 'audio/audio_buffers_state.cc', 'audio/audio_buffers_state.h', 'audio/audio_device_name.cc', 'audio/audio_device_name.h', 'audio/audio_device_thread.cc', 'audio/audio_device_thread.h', 'audio/audio_input_controller.cc', 'audio/audio_input_controller.h', 'audio/audio_input_device.cc', 'audio/audio_input_device.h', 'audio/audio_input_ipc.cc', 'audio/audio_input_ipc.h', 'audio/audio_input_stream_impl.cc', 'audio/audio_input_stream_impl.h', 'audio/audio_io.h', 'audio/audio_manager.cc', 'audio/audio_manager.h', 'audio/audio_manager_base.cc', 'audio/audio_manager_base.h', 'audio/audio_output_controller.cc', 'audio/audio_output_controller.h', 'audio/audio_output_device.cc', 'audio/audio_output_device.h', 'audio/audio_output_dispatcher.cc', 'audio/audio_output_dispatcher.h', 'audio/audio_output_dispatcher_impl.cc', 'audio/audio_output_dispatcher_impl.h', 'audio/audio_output_ipc.cc', 'audio/audio_output_ipc.h', 'audio/audio_output_proxy.cc', 'audio/audio_output_proxy.h', 'audio/audio_output_resampler.cc', 'audio/audio_output_resampler.h', 'audio/audio_silence_detector.cc', 'audio/audio_silence_detector.h', 'audio/audio_source_diverter.h', 'audio/audio_util.cc', 'audio/audio_util.h', 'audio/cras/audio_manager_cras.cc', 'audio/cras/audio_manager_cras.h', 'audio/cras/cras_input.cc', 'audio/cras/cras_input.h', 'audio/cras/cras_unified.cc', 'audio/cras/cras_unified.h', 'audio/cross_process_notification.cc', 'audio/cross_process_notification.h', 'audio/cross_process_notification_posix.cc', 'audio/cross_process_notification_win.cc', 'audio/fake_audio_consumer.cc', 'audio/fake_audio_consumer.h', 'audio/fake_audio_input_stream.cc', 'audio/fake_audio_input_stream.h', 'audio/fake_audio_output_stream.cc', 'audio/fake_audio_output_stream.h', 'audio/ios/audio_manager_ios.h', 'audio/ios/audio_manager_ios.mm', 'audio/ios/audio_session_util_ios.h', 'audio/ios/audio_session_util_ios.mm', 'audio/linux/alsa_input.cc', 'audio/linux/alsa_input.h', 'audio/linux/alsa_output.cc', 'audio/linux/alsa_output.h', 'audio/linux/alsa_util.cc', 'audio/linux/alsa_util.h', 'audio/linux/alsa_wrapper.cc', 'audio/linux/alsa_wrapper.h', 'audio/linux/audio_manager_linux.cc', 'audio/linux/audio_manager_linux.h', 'audio/mac/aggregate_device_manager.cc', 'audio/mac/aggregate_device_manager.h', 'audio/mac/audio_auhal_mac.cc', 'audio/mac/audio_auhal_mac.h', 'audio/mac/audio_device_listener_mac.cc', 'audio/mac/audio_device_listener_mac.h', 'audio/mac/audio_input_mac.cc', 'audio/mac/audio_input_mac.h', 'audio/mac/audio_low_latency_input_mac.cc', 'audio/mac/audio_low_latency_input_mac.h', 'audio/mac/audio_low_latency_output_mac.cc', 'audio/mac/audio_low_latency_output_mac.h', 'audio/mac/audio_manager_mac.cc', 'audio/mac/audio_manager_mac.h', 'audio/mac/audio_synchronized_mac.cc', 'audio/mac/audio_synchronized_mac.h', 'audio/mac/audio_unified_mac.cc', 'audio/mac/audio_unified_mac.h', 'audio/null_audio_sink.cc', 'audio/null_audio_sink.h', 'audio/openbsd/audio_manager_openbsd.cc', 'audio/openbsd/audio_manager_openbsd.h', 'audio/pulse/audio_manager_pulse.cc', 'audio/pulse/audio_manager_pulse.h', 'audio/pulse/pulse_output.cc', 'audio/pulse/pulse_output.h', 'audio/pulse/pulse_input.cc', 'audio/pulse/pulse_input.h', 'audio/pulse/pulse_unified.cc', 'audio/pulse/pulse_unified.h', 'audio/pulse/pulse_util.cc', 'audio/pulse/pulse_util.h', 'audio/sample_rates.cc', 'audio/sample_rates.h', 'audio/scoped_loop_observer.cc', 'audio/scoped_loop_observer.h', 'audio/simple_sources.cc', 'audio/simple_sources.h', 'audio/virtual_audio_input_stream.cc', 'audio/virtual_audio_input_stream.h', 'audio/virtual_audio_output_stream.cc', 'audio/virtual_audio_output_stream.h', 'audio/win/audio_device_listener_win.cc', 'audio/win/audio_device_listener_win.h', 'audio/win/audio_low_latency_input_win.cc', 'audio/win/audio_low_latency_input_win.h', 'audio/win/audio_low_latency_output_win.cc', 'audio/win/audio_low_latency_output_win.h', 'audio/win/audio_manager_win.cc', 'audio/win/audio_manager_win.h', 'audio/win/audio_unified_win.cc', 'audio/win/audio_unified_win.h', 'audio/win/avrt_wrapper_win.cc', 'audio/win/avrt_wrapper_win.h', 'audio/win/device_enumeration_win.cc', 'audio/win/device_enumeration_win.h', 'audio/win/core_audio_util_win.cc', 'audio/win/core_audio_util_win.h', 'audio/win/wavein_input_win.cc', 'audio/win/wavein_input_win.h', 'audio/win/waveout_output_win.cc', 'audio/win/waveout_output_win.h', 'base/android/media_player_manager.cc', 'base/android/media_player_manager.h', 'base/android/media_resource_getter.cc', 'base/android/media_resource_getter.h', 'base/audio_capturer_source.h', 'base/audio_converter.cc', 'base/audio_converter.h', 'base/audio_decoder.cc', 'base/audio_decoder.h', 'base/audio_decoder_config.cc', 'base/audio_decoder_config.h', 'base/audio_fifo.cc', 'base/audio_fifo.h', 'base/audio_hardware_config.cc', 'base/audio_hardware_config.h', 'base/audio_hash.cc', 'base/audio_hash.h', 'base/audio_pull_fifo.cc', 'base/audio_pull_fifo.h', 'base/audio_renderer.cc', 'base/audio_renderer.h', 'base/audio_renderer_sink.h', 'base/audio_renderer_mixer.cc', 'base/audio_renderer_mixer.h', 'base/audio_renderer_mixer_input.cc', 'base/audio_renderer_mixer_input.h', 'base/audio_splicer.cc', 'base/audio_splicer.h', 'base/audio_timestamp_helper.cc', 'base/audio_timestamp_helper.h', 'base/bind_to_loop.h', 'base/bitstream_buffer.h', 'base/bit_reader.cc', 'base/bit_reader.h', 'base/buffers.h', 'base/byte_queue.cc', 'base/byte_queue.h', 'base/channel_mixer.cc', 'base/channel_mixer.h', 'base/clock.cc', 'base/clock.h', 'base/data_buffer.cc', 'base/data_buffer.h', 'base/data_source.cc', 'base/data_source.h', 'base/decoder_buffer.cc', 'base/decoder_buffer.h', 'base/decoder_buffer_queue.cc', 'base/decoder_buffer_queue.h', 'base/decryptor.cc', 'base/decryptor.h', 'base/decrypt_config.cc', 'base/decrypt_config.h', 'base/demuxer.cc', 'base/demuxer.h', 'base/demuxer_stream.cc', 'base/demuxer_stream.h', 'base/djb2.cc', 'base/djb2.h', 'base/filter_collection.cc', 'base/filter_collection.h', 'base/media.cc', 'base/media.h', 'base/media_log.cc', 'base/media_log.h', 'base/media_log_event.h', 'base/media_posix.cc', 'base/media_switches.cc', 'base/media_switches.h', 'base/media_win.cc', 'base/multi_channel_resampler.cc', 'base/multi_channel_resampler.h', 'base/pipeline.cc', 'base/pipeline.h', 'base/pipeline_status.cc', 'base/pipeline_status.h', 'base/ranges.cc', 'base/ranges.h', 'base/scoped_histogram_timer.h', 'base/seekable_buffer.cc', 'base/seekable_buffer.h', 'base/serial_runner.cc', 'base/serial_runner.h', 'base/sinc_resampler.cc', 'base/sinc_resampler.h', 'base/stream_parser.cc', 'base/stream_parser.h', 'base/stream_parser_buffer.cc', 'base/stream_parser_buffer.h', 'base/video_decoder.cc', 'base/video_decoder.h', 'base/video_decoder_config.cc', 'base/video_decoder_config.h', 'base/video_frame.cc', 'base/video_frame.h', 'base/video_renderer.cc', 'base/video_renderer.h', 'base/video_util.cc', 'base/video_util.h', 'crypto/aes_decryptor.cc', 'crypto/aes_decryptor.h', 'ffmpeg/ffmpeg_common.cc', 'ffmpeg/ffmpeg_common.h', 'filters/audio_decoder_selector.cc', 'filters/audio_decoder_selector.h', 'filters/audio_file_reader.cc', 'filters/audio_file_reader.h', 'filters/audio_renderer_algorithm.cc', 'filters/audio_renderer_algorithm.h', 'filters/audio_renderer_impl.cc', 'filters/audio_renderer_impl.h', 'filters/blocking_url_protocol.cc', 'filters/blocking_url_protocol.h', 'filters/chunk_demuxer.cc', 'filters/chunk_demuxer.h', 'filters/decrypting_audio_decoder.cc', 'filters/decrypting_audio_decoder.h', 'filters/decrypting_demuxer_stream.cc', 'filters/decrypting_demuxer_stream.h', 'filters/decrypting_video_decoder.cc', 'filters/decrypting_video_decoder.h', 'filters/fake_demuxer_stream.cc', 'filters/fake_demuxer_stream.h', 'filters/ffmpeg_audio_decoder.cc', 'filters/ffmpeg_audio_decoder.h', 'filters/ffmpeg_demuxer.cc', 'filters/ffmpeg_demuxer.h', 'filters/ffmpeg_glue.cc', 'filters/ffmpeg_glue.h', 'filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc', 'filters/ffmpeg_h264_to_annex_b_bitstream_converter.h', 'filters/ffmpeg_video_decoder.cc', 'filters/ffmpeg_video_decoder.h', 'filters/file_data_source.cc', 'filters/file_data_source.h', 'filters/gpu_video_decoder.cc', 'filters/gpu_video_decoder.h', 'filters/h264_to_annex_b_bitstream_converter.cc', 'filters/h264_to_annex_b_bitstream_converter.h', 'filters/in_memory_url_protocol.cc', 'filters/in_memory_url_protocol.h', 'filters/opus_audio_decoder.cc', 'filters/opus_audio_decoder.h', 'filters/skcanvas_video_renderer.cc', 'filters/skcanvas_video_renderer.h', 'filters/source_buffer_stream.cc', 'filters/source_buffer_stream.h', 'filters/stream_parser_factory.cc', 'filters/stream_parser_factory.h', 'filters/video_decoder_selector.cc', 'filters/video_decoder_selector.h', 'filters/video_frame_stream.cc', 'filters/video_frame_stream.h', 'filters/video_renderer_base.cc', 'filters/video_renderer_base.h', 'filters/vpx_video_decoder.cc', 'filters/vpx_video_decoder.h', 'video/capture/android/video_capture_device_android.cc', 'video/capture/android/video_capture_device_android.h', 'video/capture/fake_video_capture_device.cc', 'video/capture/fake_video_capture_device.h', 'video/capture/linux/video_capture_device_linux.cc', 'video/capture/linux/video_capture_device_linux.h', 'video/capture/mac/video_capture_device_mac.h', 'video/capture/mac/video_capture_device_mac.mm', 'video/capture/mac/video_capture_device_qtkit_mac.h', 'video/capture/mac/video_capture_device_qtkit_mac.mm', 'video/capture/screen/differ.cc', 'video/capture/screen/differ.h', 'video/capture/screen/differ_block.cc', 'video/capture/screen/differ_block.h', 'video/capture/screen/mac/desktop_configuration.h', 'video/capture/screen/mac/desktop_configuration.mm', 'video/capture/screen/mac/scoped_pixel_buffer_object.cc', 'video/capture/screen/mac/scoped_pixel_buffer_object.h', 'video/capture/screen/mouse_cursor_shape.h', 'video/capture/screen/screen_capture_device.cc', 'video/capture/screen/screen_capture_device.h', 'video/capture/screen/screen_capture_frame_queue.cc', 'video/capture/screen/screen_capture_frame_queue.h', 'video/capture/screen/screen_capturer.h', 'video/capture/screen/screen_capturer_fake.cc', 'video/capture/screen/screen_capturer_fake.h', 'video/capture/screen/screen_capturer_helper.cc', 'video/capture/screen/screen_capturer_helper.h', 'video/capture/screen/screen_capturer_mac.mm', 'video/capture/screen/screen_capturer_null.cc', 'video/capture/screen/screen_capturer_win.cc', 'video/capture/screen/screen_capturer_x11.cc', 'video/capture/screen/shared_desktop_frame.cc', 'video/capture/screen/shared_desktop_frame.h', 'video/capture/screen/win/desktop.cc', 'video/capture/screen/win/desktop.h', 'video/capture/screen/win/scoped_thread_desktop.cc', 'video/capture/screen/win/scoped_thread_desktop.h', 'video/capture/screen/x11/x_server_pixel_buffer.cc', 'video/capture/screen/x11/x_server_pixel_buffer.h', 'video/capture/video_capture.h', 'video/capture/video_capture_device.h', 'video/capture/video_capture_device_dummy.cc', 'video/capture/video_capture_device_dummy.h', 'video/capture/video_capture_proxy.cc', 'video/capture/video_capture_proxy.h', 'video/capture/video_capture_types.h', 'video/capture/win/capability_list_win.cc', 'video/capture/win/capability_list_win.h', 'video/capture/win/filter_base_win.cc', 'video/capture/win/filter_base_win.h', 'video/capture/win/pin_base_win.cc', 'video/capture/win/pin_base_win.h', 'video/capture/win/sink_filter_observer_win.h', 'video/capture/win/sink_filter_win.cc', 'video/capture/win/sink_filter_win.h', 'video/capture/win/sink_input_pin_win.cc', 'video/capture/win/sink_input_pin_win.h', 'video/capture/win/video_capture_device_mf_win.cc', 'video/capture/win/video_capture_device_mf_win.h', 'video/capture/win/video_capture_device_win.cc', 'video/capture/win/video_capture_device_win.h', 'video/picture.cc', 'video/picture.h', 'video/video_decode_accelerator.cc', 'video/video_decode_accelerator.h', 'webm/webm_audio_client.cc', 'webm/webm_audio_client.h', 'webm/webm_cluster_parser.cc', 'webm/webm_cluster_parser.h', 'webm/webm_constants.cc', 'webm/webm_constants.h', 'webm/webm_content_encodings.cc', 'webm/webm_content_encodings.h', 'webm/webm_content_encodings_client.cc', 'webm/webm_content_encodings_client.h', 'webm/webm_crypto_helpers.cc', 'webm/webm_crypto_helpers.h', 'webm/webm_info_parser.cc', 'webm/webm_info_parser.h', 'webm/webm_parser.cc', 'webm/webm_parser.h', 'webm/webm_stream_parser.cc', 'webm/webm_stream_parser.h', 'webm/webm_tracks_parser.cc', 'webm/webm_tracks_parser.h', 'webm/webm_video_client.cc', 'webm/webm_video_client.h'], 'direct_dependent_settings': {'include_dirs': ['..']}, 'conditions': [['arm_neon == 1', {'defines': ['USE_NEON']}], ['OS != "linux" or use_x11 == 1', {'sources!': ['video/capture/screen/screen_capturer_null.cc']}], ['OS != "ios"', {'dependencies': ['../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', 'shared_memory_support', 'yuv_convert']}], ['media_use_ffmpeg == 1', {'dependencies': ['../third_party/ffmpeg/ffmpeg.gyp:ffmpeg']}, {'sources!': ['base/media_posix.cc', 'ffmpeg/ffmpeg_common.cc', 'ffmpeg/ffmpeg_common.h', 'filters/audio_file_reader.cc', 'filters/audio_file_reader.h', 'filters/blocking_url_protocol.cc', 'filters/blocking_url_protocol.h', 'filters/ffmpeg_audio_decoder.cc', 'filters/ffmpeg_audio_decoder.h', 'filters/ffmpeg_demuxer.cc', 'filters/ffmpeg_demuxer.h', 'filters/ffmpeg_glue.cc', 'filters/ffmpeg_glue.h', 'filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc', 'filters/ffmpeg_h264_to_annex_b_bitstream_converter.h', 'filters/ffmpeg_video_decoder.cc', 'filters/ffmpeg_video_decoder.h']}], ['media_use_libvpx == 1', {'dependencies': ['<(DEPTH)/third_party/libvpx/libvpx.gyp:libvpx']}, {'direct_dependent_settings': {'defines': ['MEDIA_DISABLE_LIBVPX']}, 'sources!': ['filters/vpx_video_decoder.cc', 'filters/vpx_video_decoder.h']}], ['OS == "ios"', {'includes': ['shared_memory_support.gypi'], 'sources': ['base/media_stub.cc', '<@(shared_memory_support_sources)'], 'sources/': [['exclude', '\\.(cc|mm)$'], ['include', '_ios\\.(cc|mm)$'], ['include', '(^|/)ios/'], ['include', '^audio/audio_buffers_state\\.'], ['include', '^audio/audio_input_controller\\.'], ['include', '^audio/audio_manager\\.'], ['include', '^audio/audio_manager_base\\.'], ['include', '^audio/audio_parameters\\.'], ['include', '^audio/fake_audio_consumer\\.'], ['include', '^audio/fake_audio_input_stream\\.'], ['include', '^audio/fake_audio_output_stream\\.'], ['include', '^base/audio_bus\\.'], ['include', '^base/channel_layout\\.'], ['include', '^base/media\\.cc$'], ['include', '^base/media_stub\\.cc$'], ['include', '^base/media_switches\\.'], ['include', '^base/vector_math\\.']], 'link_settings': {'libraries': ['$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework', '$(SDKROOT)/System/Library/Frameworks/AVFoundation.framework', '$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework']}}], ['OS == "android"', {'link_settings': {'libraries': ['-lOpenSLES']}, 'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/media'], 'dependencies': ['media_android_jni_headers', 'player_android', 'video_capture_android_jni_headers'], 'sources': ['base/media.cc', 'base/media.h'], 'conditions': [['android_webview_build == 0', {'dependencies': ['media_java']}], ['use_openmax_dl_fft==1', {'sources': ['base/media_android.cc'], 'includes': ['../build/android/cpufeatures.gypi']}, {'sources': ['base/media_stub.cc']}]]}], ['chromeos==1', {'dependencies': ['../third_party/libvpx/libvpx.gyp:libvpx', '../third_party/libyuv/libyuv.gyp:libyuv'], 'sources': ['webm/chromeos/ebml_writer.cc', 'webm/chromeos/ebml_writer.h', 'webm/chromeos/webm_encoder.cc', 'webm/chromeos/webm_encoder.h']}], ['use_alsa==1', {'link_settings': {'libraries': ['-lasound']}}, {'sources/': [['exclude', '/alsa_'], ['exclude', '/audio_manager_linux']]}], ['OS!="openbsd"', {'sources!': ['audio/openbsd/audio_manager_openbsd.cc', 'audio/openbsd/audio_manager_openbsd.h']}], ['OS=="linux"', {'variables': {'conditions': [['sysroot!=""', {'pkg-config': '../build/linux/pkg-config-wrapper "<(sysroot)" "<(target_arch)"'}, {'pkg-config': 'pkg-config'}]]}, 'conditions': [['use_x11 == 1', {'link_settings': {'libraries': ['-lX11', '-lXdamage', '-lXext', '-lXfixes']}}], ['use_cras == 1', {'cflags': ['<!@(<(pkg-config) --cflags libcras)'], 'link_settings': {'libraries': ['<!@(<(pkg-config) --libs libcras)']}, 'defines': ['USE_CRAS']}, {'sources!': ['audio/cras/audio_manager_cras.cc', 'audio/cras/audio_manager_cras.h', 'audio/cras/cras_input.cc', 'audio/cras/cras_input.h', 'audio/cras/cras_unified.cc', 'audio/cras/cras_unified.h']}]]}], ['OS!="linux"', {'sources!': ['audio/cras/audio_manager_cras.cc', 'audio/cras/audio_manager_cras.h', 'audio/cras/cras_input.cc', 'audio/cras/cras_input.h', 'audio/cras/cras_unified.cc', 'audio/cras/cras_unified.h']}], ['use_pulseaudio==1', {'cflags': ['<!@(pkg-config --cflags libpulse)'], 'defines': ['USE_PULSEAUDIO'], 'conditions': [['linux_link_pulseaudio==0', {'defines': ['DLOPEN_PULSEAUDIO'], 'variables': {'generate_stubs_script': '../tools/generate_stubs/generate_stubs.py', 'extra_header': 'audio/pulse/pulse_stub_header.fragment', 'sig_files': ['audio/pulse/pulse.sigs'], 'outfile_type': 'posix_stubs', 'stubs_filename_root': 'pulse_stubs', 'project_path': 'media/audio/pulse', 'intermediate_dir': '<(INTERMEDIATE_DIR)', 'output_root': '<(SHARED_INTERMEDIATE_DIR)/pulse'}, 'include_dirs': ['<(output_root)'], 'actions': [{'action_name': 'generate_stubs', 'inputs': ['<(generate_stubs_script)', '<(extra_header)', '<@(sig_files)'], 'outputs': ['<(intermediate_dir)/<(stubs_filename_root).cc', '<(output_root)/<(project_path)/<(stubs_filename_root).h'], 'action': ['python', '<(generate_stubs_script)', '-i', '<(intermediate_dir)', '-o', '<(output_root)/<(project_path)', '-t', '<(outfile_type)', '-e', '<(extra_header)', '-s', '<(stubs_filename_root)', '-p', '<(project_path)', '<@(_inputs)'], 'process_outputs_as_sources': 1, 'message': 'Generating Pulse stubs for dynamic loading.'}], 'conditions': [['OS == "linux" or OS == "solaris"', {'link_settings': {'libraries': ['-ldl']}}]]}, {'link_settings': {'ldflags': ['<!@(pkg-config --libs-only-L --libs-only-other libpulse)'], 'libraries': ['<!@(pkg-config --libs-only-l libpulse)']}}]]}, {'sources!': ['audio/pulse/audio_manager_pulse.cc', 'audio/pulse/audio_manager_pulse.h', 'audio/pulse/pulse_input.cc', 'audio/pulse/pulse_input.h', 'audio/pulse/pulse_output.cc', 'audio/pulse/pulse_output.h', 'audio/pulse/pulse_unified.cc', 'audio/pulse/pulse_unified.h', 'audio/pulse/pulse_util.cc', 'audio/pulse/pulse_util.h']}], ['os_posix == 1', {'sources!': ['video/capture/video_capture_device_dummy.cc', 'video/capture/video_capture_device_dummy.h']}], ['OS=="mac"', {'link_settings': {'libraries': ['$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework', '$(SDKROOT)/System/Library/Frameworks/AudioUnit.framework', '$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework', '$(SDKROOT)/System/Library/Frameworks/CoreVideo.framework', '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework', '$(SDKROOT)/System/Library/Frameworks/QTKit.framework']}}], ['OS=="win"', {'sources!': ['video/capture/video_capture_device_dummy.cc', 'video/capture/video_capture_device_dummy.h'], 'link_settings': {'libraries': ['-lmf.lib', '-lmfplat.lib', '-lmfreadwrite.lib', '-lmfuuid.lib']}, 'msvs_settings': {'VCLinkerTool': {'DelayLoadDLLs': ['mf.dll', 'mfplat.dll', 'mfreadwrite.dll']}}, 'all_dependent_settings': {'msvs_settings': {'VCLinkerTool': {'DelayLoadDLLs': ['mf.dll', 'mfplat.dll', 'mfreadwrite.dll']}}}, 'conditions': [['target_arch == "x64"', {'msvs_disabled_warnings': [4267]}]]}], ['proprietary_codecs==1 or branding=="Chrome"', {'sources': ['mp4/aac.cc', 'mp4/aac.h', 'mp4/avc.cc', 'mp4/avc.h', 'mp4/box_definitions.cc', 'mp4/box_definitions.h', 'mp4/box_reader.cc', 'mp4/box_reader.h', 'mp4/cenc.cc', 'mp4/cenc.h', 'mp4/es_descriptor.cc', 'mp4/es_descriptor.h', 'mp4/mp4_stream_parser.cc', 'mp4/mp4_stream_parser.h', 'mp4/offset_byte_queue.cc', 'mp4/offset_byte_queue.h', 'mp4/track_run_iterator.cc', 'mp4/track_run_iterator.h']}], ['screen_capture_supported==1', {'dependencies': ['../third_party/webrtc/modules/modules.gyp:desktop_capture']}, {'sources/': [['exclude', '^video/capture/screen/']]}], ['screen_capture_supported==1 and (target_arch=="ia32" or target_arch=="x64")', {'dependencies': ['differ_block_sse2']}], ['toolkit_uses_gtk==1', {'dependencies': ['../build/linux/system.gyp:gtk']}], ['OS != "ios" and (target_arch == "ia32" or target_arch == "x64")', {'dependencies': ['media_sse']}], ['google_tv == 1', {'defines': ['ENABLE_EAC3_PLAYBACK']}]], 'target_conditions': [['OS == "ios"', {'sources/': [['include', '^audio/mac/audio_input_mac\\.']]}]]}, {'target_name': 'media_unittests', 'type': '<(gtest_target_type)', 'dependencies': ['media', 'media_test_support', '../base/base.gyp:base', '../base/base.gyp:base_i18n', '../base/base.gyp:test_support_base', '../skia/skia.gyp:skia', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', '../ui/ui.gyp:ui'], 'sources': ['audio/async_socket_io_handler_unittest.cc', 'audio/audio_input_controller_unittest.cc', 'audio/audio_input_device_unittest.cc', 'audio/audio_input_unittest.cc', 'audio/audio_input_volume_unittest.cc', 'audio/audio_low_latency_input_output_unittest.cc', 'audio/audio_output_controller_unittest.cc', 'audio/audio_output_device_unittest.cc', 'audio/audio_output_proxy_unittest.cc', 'audio/audio_parameters_unittest.cc', 'audio/audio_silence_detector_unittest.cc', 'audio/cross_process_notification_unittest.cc', 'audio/fake_audio_consumer_unittest.cc', 'audio/ios/audio_manager_ios_unittest.cc', 'audio/linux/alsa_output_unittest.cc', 'audio/mac/audio_auhal_mac_unittest.cc', 'audio/mac/audio_device_listener_mac_unittest.cc', 'audio/mac/audio_low_latency_input_mac_unittest.cc', 'audio/simple_sources_unittest.cc', 'audio/virtual_audio_input_stream_unittest.cc', 'audio/virtual_audio_output_stream_unittest.cc', 'audio/win/audio_device_listener_win_unittest.cc', 'audio/win/audio_low_latency_input_win_unittest.cc', 'audio/win/audio_low_latency_output_win_unittest.cc', 'audio/win/audio_output_win_unittest.cc', 'audio/win/audio_unified_win_unittest.cc', 'audio/win/core_audio_util_win_unittest.cc', 'base/android/media_codec_bridge_unittest.cc', 'base/audio_bus_unittest.cc', 'base/audio_converter_unittest.cc', 'base/audio_fifo_unittest.cc', 'base/audio_hardware_config_unittest.cc', 'base/audio_hash_unittest.cc', 'base/audio_pull_fifo_unittest.cc', 'base/audio_renderer_mixer_input_unittest.cc', 'base/audio_renderer_mixer_unittest.cc', 'base/audio_splicer_unittest.cc', 'base/audio_timestamp_helper_unittest.cc', 'base/bind_to_loop_unittest.cc', 'base/bit_reader_unittest.cc', 'base/channel_mixer_unittest.cc', 'base/clock_unittest.cc', 'base/data_buffer_unittest.cc', 'base/decoder_buffer_queue_unittest.cc', 'base/decoder_buffer_unittest.cc', 'base/djb2_unittest.cc', 'base/gmock_callback_support_unittest.cc', 'base/multi_channel_resampler_unittest.cc', 'base/pipeline_unittest.cc', 'base/ranges_unittest.cc', 'base/run_all_unittests.cc', 'base/scoped_histogram_timer_unittest.cc', 'base/seekable_buffer_unittest.cc', 'base/sinc_resampler_unittest.cc', 'base/test_data_util.cc', 'base/test_data_util.h', 'base/vector_math_testing.h', 'base/vector_math_unittest.cc', 'base/video_frame_unittest.cc', 'base/video_util_unittest.cc', 'base/yuv_convert_unittest.cc', 'crypto/aes_decryptor_unittest.cc', 'ffmpeg/ffmpeg_common_unittest.cc', 'filters/audio_decoder_selector_unittest.cc', 'filters/audio_file_reader_unittest.cc', 'filters/audio_renderer_algorithm_unittest.cc', 'filters/audio_renderer_impl_unittest.cc', 'filters/blocking_url_protocol_unittest.cc', 'filters/chunk_demuxer_unittest.cc', 'filters/decrypting_audio_decoder_unittest.cc', 'filters/decrypting_demuxer_stream_unittest.cc', 'filters/decrypting_video_decoder_unittest.cc', 'filters/fake_demuxer_stream_unittest.cc', 'filters/ffmpeg_audio_decoder_unittest.cc', 'filters/ffmpeg_demuxer_unittest.cc', 'filters/ffmpeg_glue_unittest.cc', 'filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc', 'filters/ffmpeg_video_decoder_unittest.cc', 'filters/file_data_source_unittest.cc', 'filters/h264_to_annex_b_bitstream_converter_unittest.cc', 'filters/pipeline_integration_test.cc', 'filters/pipeline_integration_test_base.cc', 'filters/skcanvas_video_renderer_unittest.cc', 'filters/source_buffer_stream_unittest.cc', 'filters/video_decoder_selector_unittest.cc', 'filters/video_frame_stream_unittest.cc', 'filters/video_renderer_base_unittest.cc', 'video/capture/screen/differ_block_unittest.cc', 'video/capture/screen/differ_unittest.cc', 'video/capture/screen/screen_capture_device_unittest.cc', 'video/capture/screen/screen_capturer_helper_unittest.cc', 'video/capture/screen/screen_capturer_mac_unittest.cc', 'video/capture/screen/screen_capturer_unittest.cc', 'video/capture/video_capture_device_unittest.cc', 'webm/cluster_builder.cc', 'webm/cluster_builder.h', 'webm/tracks_builder.cc', 'webm/tracks_builder.h', 'webm/webm_cluster_parser_unittest.cc', 'webm/webm_content_encodings_client_unittest.cc', 'webm/webm_parser_unittest.cc', 'webm/webm_tracks_parser_unittest.cc'], 'conditions': [['arm_neon == 1', {'defines': ['USE_NEON']}], ['OS != "ios"', {'dependencies': ['shared_memory_support', 'yuv_convert']}], ['media_use_ffmpeg == 1', {'dependencies': ['../third_party/ffmpeg/ffmpeg.gyp:ffmpeg']}], ['os_posix==1 and OS!="mac" and OS!="ios"', {'conditions': [['linux_use_tcmalloc==1', {'dependencies': ['../base/allocator/allocator.gyp:allocator']}]]}], ['OS == "ios"', {'sources/': [['exclude', '.*'], ['include', '^audio/audio_input_controller_unittest\\.cc$'], ['include', '^audio/audio_input_unittest\\.cc$'], ['include', '^audio/audio_parameters_unittest\\.cc$'], ['include', '^audio/ios/audio_manager_ios_unittest\\.cc$'], ['include', '^base/mock_reader\\.h$'], ['include', '^base/run_all_unittests\\.cc$']]}], ['OS=="android"', {'sources!': ['audio/audio_input_volume_unittest.cc', 'base/test_data_util.cc', 'base/test_data_util.h', 'ffmpeg/ffmpeg_common_unittest.cc', 'filters/audio_file_reader_unittest.cc', 'filters/blocking_url_protocol_unittest.cc', 'filters/chunk_demuxer_unittest.cc', 'filters/ffmpeg_audio_decoder_unittest.cc', 'filters/ffmpeg_demuxer_unittest.cc', 'filters/ffmpeg_glue_unittest.cc', 'filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc', 'filters/ffmpeg_video_decoder_unittest.cc', 'filters/pipeline_integration_test.cc', 'filters/pipeline_integration_test_base.cc', 'mp4/mp4_stream_parser_unittest.cc', 'webm/webm_cluster_parser_unittest.cc'], 'conditions': [['gtest_target_type == "shared_library"', {'dependencies': ['../testing/android/native_test.gyp:native_test_native_code', 'player_android']}]]}], ['OS == "linux"', {'conditions': [['use_cras == 1', {'sources': ['audio/cras/cras_input_unittest.cc', 'audio/cras/cras_unified_unittest.cc'], 'defines': ['USE_CRAS']}]]}], ['use_alsa==0', {'sources!': ['audio/linux/alsa_output_unittest.cc', 'audio/audio_low_latency_input_output_unittest.cc']}], ['OS != "ios" and (target_arch=="ia32" or target_arch=="x64")', {'sources': ['base/simd/convert_rgb_to_yuv_unittest.cc'], 'dependencies': ['media_sse']}], ['screen_capture_supported==1', {'dependencies': ['../third_party/webrtc/modules/modules.gyp:desktop_capture']}, {'sources/': [['exclude', '^video/capture/screen/']]}], ['proprietary_codecs==1 or branding=="Chrome"', {'sources': ['mp4/aac_unittest.cc', 'mp4/avc_unittest.cc', 'mp4/box_reader_unittest.cc', 'mp4/es_descriptor_unittest.cc', 'mp4/mp4_stream_parser_unittest.cc', 'mp4/offset_byte_queue_unittest.cc', 'mp4/track_run_iterator_unittest.cc']}], ['OS=="win" and target_arch=="x64"', {'msvs_disabled_warnings': [4267]}]]}, {'target_name': 'media_test_support', 'type': 'static_library', 'dependencies': ['media', '../base/base.gyp:base', '../skia/skia.gyp:skia', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest'], 'sources': ['audio/mock_audio_manager.cc', 'audio/mock_audio_manager.h', 'audio/test_audio_input_controller_factory.cc', 'audio/test_audio_input_controller_factory.h', 'base/fake_audio_render_callback.cc', 'base/fake_audio_render_callback.h', 'base/gmock_callback_support.h', 'base/mock_audio_renderer_sink.cc', 'base/mock_audio_renderer_sink.h', 'base/mock_data_source_host.cc', 'base/mock_data_source_host.h', 'base/mock_demuxer_host.cc', 'base/mock_demuxer_host.h', 'base/mock_filters.cc', 'base/mock_filters.h', 'base/test_helpers.cc', 'base/test_helpers.h', 'video/capture/screen/screen_capturer_mock_objects.cc', 'video/capture/screen/screen_capturer_mock_objects.h'], 'conditions': [['screen_capture_supported == 1', {'dependencies': ['../third_party/webrtc/modules/modules.gyp:desktop_capture']}, {'sources/': [['exclude', '^video/capture/screen/']]}]]}], 'conditions': [['OS != "ios" and target_arch != "arm"', {'targets': [{'target_name': 'yuv_convert_simd_x86', 'type': 'static_library', 'include_dirs': ['..'], 'sources': ['base/simd/convert_rgb_to_yuv_c.cc', 'base/simd/convert_rgb_to_yuv_sse2.cc', 'base/simd/convert_rgb_to_yuv_ssse3.asm', 'base/simd/convert_rgb_to_yuv_ssse3.cc', 'base/simd/convert_rgb_to_yuv_ssse3.inc', 'base/simd/convert_yuv_to_rgb_c.cc', 'base/simd/convert_yuv_to_rgb_mmx.asm', 'base/simd/convert_yuv_to_rgb_mmx.inc', 'base/simd/convert_yuv_to_rgb_sse.asm', 'base/simd/convert_yuv_to_rgb_x86.cc', 'base/simd/convert_yuva_to_argb_mmx.asm', 'base/simd/convert_yuva_to_argb_mmx.inc', 'base/simd/empty_register_state_mmx.asm', 'base/simd/filter_yuv.h', 'base/simd/filter_yuv_c.cc', 'base/simd/filter_yuv_sse2.cc', 'base/simd/linear_scale_yuv_to_rgb_mmx.asm', 'base/simd/linear_scale_yuv_to_rgb_mmx.inc', 'base/simd/linear_scale_yuv_to_rgb_sse.asm', 'base/simd/scale_yuv_to_rgb_mmx.asm', 'base/simd/scale_yuv_to_rgb_mmx.inc', 'base/simd/scale_yuv_to_rgb_sse.asm', 'base/simd/yuv_to_rgb_table.cc', 'base/simd/yuv_to_rgb_table.h'], 'conditions': [['OS!="win" or target_arch=="ia32"', {'sources': ['base/simd/filter_yuv_mmx.cc']}], ['target_arch == "x64"', {'sources': ['base/simd/linear_scale_yuv_to_rgb_mmx_x64.asm', 'base/simd/scale_yuv_to_rgb_sse2_x64.asm'], 'variables': {'yasm_flags': ['-DARCH_X86_64']}}], ['os_posix == 1 and OS != "mac" and OS != "android"', {'cflags': ['-msse2']}], ['OS == "mac"', {'configurations': {'Debug': {'xcode_settings': {'GCC_OPTIMIZATION_LEVEL': '3'}}}, 'variables': {'yasm_flags': ['-DPREFIX', '-DMACHO']}}], ['os_posix==1 and OS!="mac"', {'variables': {'conditions': [['target_arch=="ia32"', {'yasm_flags': ['-DX86_32', '-DELF']}, {'yasm_flags': ['-DELF', '-DPIC']}]]}}]], 'variables': {'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/media', 'yasm_flags': ['-DCHROMIUM', '-I..']}, 'msvs_2010_disable_uldi_when_referenced': 1, 'includes': ['../third_party/yasm/yasm_compile.gypi']}]}], ['OS != "ios"', {'targets': [{'target_name': 'shared_memory_support', 'type': '<(component)', 'dependencies': ['../base/base.gyp:base'], 'defines': ['MEDIA_IMPLEMENTATION'], 'include_dirs': ['..'], 'includes': ['shared_memory_support.gypi'], 'sources': ['<@(shared_memory_support_sources)'], 'conditions': [['target_arch == "ia32" or target_arch == "x64"', {'dependencies': ['media_sse']}], ['arm_neon == 1', {'defines': ['USE_NEON']}]]}, {'target_name': 'yuv_convert', 'type': 'static_library', 'include_dirs': ['..'], 'conditions': [['target_arch == "ia32" or target_arch == "x64"', {'dependencies': ['yuv_convert_simd_x86']}], ['target_arch == "arm" or target_arch == "mipsel"', {'dependencies': ['yuv_convert_simd_c']}]], 'sources': ['base/yuv_convert.cc', 'base/yuv_convert.h']}, {'target_name': 'yuv_convert_simd_c', 'type': 'static_library', 'include_dirs': ['..'], 'sources': ['base/simd/convert_rgb_to_yuv.h', 'base/simd/convert_rgb_to_yuv_c.cc', 'base/simd/convert_yuv_to_rgb.h', 'base/simd/convert_yuv_to_rgb_c.cc', 'base/simd/filter_yuv.h', 'base/simd/filter_yuv_c.cc', 'base/simd/yuv_to_rgb_table.cc', 'base/simd/yuv_to_rgb_table.h']}, {'target_name': 'seek_tester', 'type': 'executable', 'dependencies': ['media', '../base/base.gyp:base'], 'sources': ['tools/seek_tester/seek_tester.cc']}, {'target_name': 'demuxer_bench', 'type': 'executable', 'dependencies': ['media', '../base/base.gyp:base'], 'sources': ['tools/demuxer_bench/demuxer_bench.cc'], 'msvs_disabled_warnings': [4267]}]}], ['(OS == "win" or toolkit_uses_gtk == 1) and use_aura != 1', {'targets': [{'target_name': 'shader_bench', 'type': 'executable', 'dependencies': ['media', 'yuv_convert', '../base/base.gyp:base', '../ui/gl/gl.gyp:gl', '../ui/ui.gyp:ui'], 'sources': ['tools/shader_bench/cpu_color_painter.cc', 'tools/shader_bench/cpu_color_painter.h', 'tools/shader_bench/gpu_color_painter.cc', 'tools/shader_bench/gpu_color_painter.h', 'tools/shader_bench/gpu_painter.cc', 'tools/shader_bench/gpu_painter.h', 'tools/shader_bench/painter.cc', 'tools/shader_bench/painter.h', 'tools/shader_bench/shader_bench.cc', 'tools/shader_bench/window.cc', 'tools/shader_bench/window.h'], 'conditions': [['toolkit_uses_gtk == 1', {'dependencies': ['../build/linux/system.gyp:gtk'], 'sources': ['tools/shader_bench/window_linux.cc']}], ['OS=="win"', {'dependencies': ['../third_party/angle/src/build_angle.gyp:libEGL', '../third_party/angle/src/build_angle.gyp:libGLESv2'], 'sources': ['tools/shader_bench/window_win.cc']}]], 'msvs_disabled_warnings': [4267]}]}], ['use_x11 == 1', {'targets': [{'target_name': 'player_x11', 'type': 'executable', 'dependencies': ['media', 'yuv_convert', '../base/base.gyp:base', '../ui/gl/gl.gyp:gl', '../ui/ui.gyp:ui'], 'link_settings': {'libraries': ['-ldl', '-lX11', '-lXrender', '-lXext']}, 'sources': ['tools/player_x11/data_source_logger.cc', 'tools/player_x11/data_source_logger.h', 'tools/player_x11/gl_video_renderer.cc', 'tools/player_x11/gl_video_renderer.h', 'tools/player_x11/player_x11.cc', 'tools/player_x11/x11_video_renderer.cc', 'tools/player_x11/x11_video_renderer.h']}]}], ['OS == "android" and gtest_target_type == "shared_library"', {'targets': [{'target_name': 'media_unittests_apk', 'type': 'none', 'dependencies': ['media_java', 'media_unittests'], 'variables': {'test_suite_name': 'media_unittests', 'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)media_unittests<(SHARED_LIB_SUFFIX)'}, 'includes': ['../build/apk_test.gypi']}]}], ['OS == "android"', {'targets': [{'target_name': 'media_player_jni_headers', 'type': 'none', 'variables': {'jni_gen_package': 'media', 'input_java_class': 'android/media/MediaPlayer.class'}, 'includes': ['../build/jar_file_jni_generator.gypi']}, {'target_name': 'media_android_jni_headers', 'type': 'none', 'dependencies': ['media_player_jni_headers'], 'sources': ['base/android/java/src/org/chromium/media/AudioManagerAndroid.java', 'base/android/java/src/org/chromium/media/MediaPlayerBridge.java', 'base/android/java/src/org/chromium/media/MediaPlayerListener.java', 'base/android/java/src/org/chromium/media/WebAudioMediaCodecBridge.java'], 'variables': {'jni_gen_package': 'media'}, 'includes': ['../build/jni_generator.gypi']}, {'target_name': 'video_capture_android_jni_headers', 'type': 'none', 'sources': ['base/android/java/src/org/chromium/media/VideoCapture.java'], 'variables': {'jni_gen_package': 'media'}, 'includes': ['../build/jni_generator.gypi']}, {'target_name': 'media_codec_jni_headers', 'type': 'none', 'variables': {'jni_gen_package': 'media', 'input_java_class': 'android/media/MediaCodec.class'}, 'includes': ['../build/jar_file_jni_generator.gypi']}, {'target_name': 'media_format_jni_headers', 'type': 'none', 'variables': {'jni_gen_package': 'media', 'input_java_class': 'android/media/MediaFormat.class'}, 'includes': ['../build/jar_file_jni_generator.gypi']}, {'target_name': 'player_android', 'type': 'static_library', 'sources': ['base/android/media_codec_bridge.cc', 'base/android/media_codec_bridge.h', 'base/android/media_jni_registrar.cc', 'base/android/media_jni_registrar.h', 'base/android/media_player_android.cc', 'base/android/media_player_android.h', 'base/android/media_player_bridge.cc', 'base/android/media_player_bridge.h', 'base/android/media_player_listener.cc', 'base/android/media_player_listener.h', 'base/android/webaudio_media_codec_bridge.cc', 'base/android/webaudio_media_codec_bridge.h', 'base/android/webaudio_media_codec_info.h'], 'conditions': [['google_tv == 1', {'sources': ['base/android/demuxer_stream_player_params.cc', 'base/android/demuxer_stream_player_params.h']}]], 'dependencies': ['../base/base.gyp:base', 'media_android_jni_headers', 'media_codec_jni_headers', 'media_format_jni_headers'], 'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/media']}, {'target_name': 'media_java', 'type': 'none', 'dependencies': ['../base/base.gyp:base'], 'export_dependent_settings': ['../base/base.gyp:base'], 'variables': {'java_in_dir': 'base/android/java'}, 'includes': ['../build/java.gypi']}]}], ['media_use_ffmpeg == 1', {'targets': [{'target_name': 'ffmpeg_unittests', 'type': 'executable', 'dependencies': ['../base/base.gyp:base', '../base/base.gyp:base_i18n', '../base/base.gyp:test_support_base', '../base/base.gyp:test_support_perf', '../testing/gtest.gyp:gtest', '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', 'media', 'media_test_support'], 'sources': ['ffmpeg/ffmpeg_unittest.cc'], 'conditions': [['toolkit_uses_gtk == 1', {'dependencies': ['../build/linux/system.gyp:gtk'], 'conditions': [['linux_use_tcmalloc==1', {'dependencies': ['../base/allocator/allocator.gyp:allocator']}]]}]]}, {'target_name': 'ffmpeg_regression_tests', 'type': 'executable', 'dependencies': ['../base/base.gyp:test_support_base', '../testing/gmock.gyp:gmock', '../testing/gtest.gyp:gtest', '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', 'media', 'media_test_support'], 'sources': ['base/run_all_unittests.cc', 'base/test_data_util.cc', 'ffmpeg/ffmpeg_regression_tests.cc', 'filters/pipeline_integration_test_base.cc'], 'conditions': [['os_posix==1 and OS!="mac"', {'conditions': [['linux_use_tcmalloc==1', {'dependencies': ['../base/allocator/allocator.gyp:allocator']}]]}]]}, {'target_name': 'ffmpeg_tests', 'type': 'executable', 'dependencies': ['../base/base.gyp:base', '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', 'media'], 'sources': ['test/ffmpeg_tests/ffmpeg_tests.cc'], 'msvs_disabled_warnings': [4267]}, {'target_name': 'media_bench', 'type': 'executable', 'dependencies': ['../base/base.gyp:base', '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', 'media'], 'sources': ['tools/media_bench/media_bench.cc'], 'msvs_disabled_warnings': [4267]}]}], ['screen_capture_supported==1 and (target_arch=="ia32" or target_arch=="x64")', {'targets': [{'target_name': 'differ_block_sse2', 'type': 'static_library', 'conditions': [['os_posix == 1 and OS != "mac"', {'cflags': ['-msse2']}]], 'include_dirs': ['..'], 'sources': ['video/capture/screen/differ_block_sse2.cc', 'video/capture/screen/differ_block_sse2.h']}]}], ['OS != "ios" and (target_arch=="ia32" or target_arch=="x64")', {'targets': [{'target_name': 'media_sse', 'type': 'static_library', 'cflags': ['-msse'], 'include_dirs': ['..'], 'defines': ['MEDIA_IMPLEMENTATION'], 'sources': ['base/simd/sinc_resampler_sse.cc', 'base/simd/vector_math_sse.cc']}]}]]} |
def replaceSlice(string, l_index, r_index, replaceable):
string = string[0:l_index] + string[r_index - 1:]
string = string[0:l_index] + replaceable + string[r_index:]
return string
def correctSpaces(expression):
return expression.replace(" ", "")
def replaceAlternateOperationSigns(expression):
return expression.replace("**", "^")
def correctUnaryBraces(expression):
pass | def replace_slice(string, l_index, r_index, replaceable):
string = string[0:l_index] + string[r_index - 1:]
string = string[0:l_index] + replaceable + string[r_index:]
return string
def correct_spaces(expression):
return expression.replace(' ', '')
def replace_alternate_operation_signs(expression):
return expression.replace('**', '^')
def correct_unary_braces(expression):
pass |
def changeFeather(value):
for s in nuke.selectedNodes():
selNode = nuke.selectedNode()
if s.Class() == "Roto" or s.Class() == "RotoPaint":
for item in s['curves'].rootLayer:
attr = item.getAttributes()
attr.set('ff',value)
feather_value = 0
changeFeather(feather_value) | def change_feather(value):
for s in nuke.selectedNodes():
sel_node = nuke.selectedNode()
if s.Class() == 'Roto' or s.Class() == 'RotoPaint':
for item in s['curves'].rootLayer:
attr = item.getAttributes()
attr.set('ff', value)
feather_value = 0
change_feather(feather_value) |
def mongoify(doc):
if 'id' in doc:
doc['_id'] = doc['id']
del doc['id']
return doc
def demongoify(doc):
if "_id" in doc:
doc['id'] = doc['_id']
del doc['_id']
return doc
| def mongoify(doc):
if 'id' in doc:
doc['_id'] = doc['id']
del doc['id']
return doc
def demongoify(doc):
if '_id' in doc:
doc['id'] = doc['_id']
del doc['_id']
return doc |
def main() -> None:
# fermat's little theorem
n, k, m = map(int, input().split())
# m^(k^n)
MOD = 998_244_353
m %= MOD
print(pow(m, pow(k, n, MOD - 1), MOD))
if __name__ == "__main__":
main()
| def main() -> None:
(n, k, m) = map(int, input().split())
mod = 998244353
m %= MOD
print(pow(m, pow(k, n, MOD - 1), MOD))
if __name__ == '__main__':
main() |
class Solution:
def reversePrefix(self, word: str, ch: str) -> str:
try:
idx = word.index(ch) + 1
except Exception:
return word
return ''.join(word[:idx][::-1] + word[idx:]) | class Solution:
def reverse_prefix(self, word: str, ch: str) -> str:
try:
idx = word.index(ch) + 1
except Exception:
return word
return ''.join(word[:idx][::-1] + word[idx:]) |
# -*- coding: utf-8 -*-
"""Top-level package for Crime_term_project."""
__author__ = """Catalina Cardelle"""
__email__ = 'cardelle.c@husky.neu.edu'
__version__ = '0.1.0'
| """Top-level package for Crime_term_project."""
__author__ = 'Catalina Cardelle'
__email__ = 'cardelle.c@husky.neu.edu'
__version__ = '0.1.0' |
rest_days = int(input())
year_in_days = 365
work_days = year_in_days - rest_days
play_time = (work_days * 63 + rest_days * 127)
if play_time <= 30000:
play_time1 = 30000 - play_time
else:
play_time1 = play_time - 30000
hours = play_time1 // 60
minutes = play_time1 % 60
if play_time > 30000:
print(f"Tom will run away\n{hours} hours and {minutes} minutes more for play")
else:
print(f"Tom sleeps well\n{hours} hours and {minutes} minutes less for play")
| rest_days = int(input())
year_in_days = 365
work_days = year_in_days - rest_days
play_time = work_days * 63 + rest_days * 127
if play_time <= 30000:
play_time1 = 30000 - play_time
else:
play_time1 = play_time - 30000
hours = play_time1 // 60
minutes = play_time1 % 60
if play_time > 30000:
print(f'Tom will run away\n{hours} hours and {minutes} minutes more for play')
else:
print(f'Tom sleeps well\n{hours} hours and {minutes} minutes less for play') |
# -*- coding: utf-8 -*-
__author__ = 'guti'
'''
Default configurations for the Web application.
'''
configs = {
'db': {
'host': '127.0.0.1',
'port': 5432,
'user': 'test_usr',
'password': 'test_pw',
'database': 'test_db'
},
'session': {
'secret': '0IH9c71HS86KSnqmQFAbBiwnEUqMYEo9vAQFb+DA9Ns='
}
} | __author__ = 'guti'
'\nDefault configurations for the Web application.\n'
configs = {'db': {'host': '127.0.0.1', 'port': 5432, 'user': 'test_usr', 'password': 'test_pw', 'database': 'test_db'}, 'session': {'secret': '0IH9c71HS86KSnqmQFAbBiwnEUqMYEo9vAQFb+DA9Ns='}} |
class UnetOptions:
def __init__(self):
self.in_channels=1
self.n_classes=2
self.depth=5
self.wf=6
self.padding=False
self.up_mode='upconv'
self.batch_norm=True
self.non_neg = True
self.pose_predict_mode = False
self.pretrained_mode = False
self.weight_map_mode = False
def setto(self):
self.in_channels=3
self.n_classes=6
self.depth=5
self.wf=2
self.padding=True
self.up_mode='upsample'
## TODO: normalizing using std
## TODO: changing length scale
## TODO: batch norm
class LossOptions:
def __init__(self, unetoptions):
self.color_in_cost = False
# self.diff_mode = False
# self.min_grad_mode = True
# self.min_dist_mode = True # distance between functions
# # self.kernalize = True
# self.sparsify_mode = 2 # 1 fix L2 of each pixel, 2 max L2 fix L1 of each channel, 3 min L1, 4 min L2 across channels, 5 fix L1 of each channel,
# # 6 no normalization, no norm output
# self.L_norm = 2 # 1, 2, (1,2) #when using (1,2), sparsify mode 2 or 5 are the same
# ## before 10/23/2019, use L_norm=1, sparsify_mode=5, kernalize=True, batch_norm=False, dist_coef = 0.1
# ## L_norm=1, sparsify_mode=2, kernalize=True, batch_norm=False, dist_coef = 0.1, feat_scale_after_normalize = 1e-1
# ## L_norm=2, sparsify_mode=2, kernalize=True, batch_norm=False, dist_coef = 0.1, feat_scale_after_normalize = 1e1
self.norm_in_loss = False
self.pca_in_loss = False
self.subset_in_loss = False
self.zero_edge_region = True
self.normalize_inprod_over_pts = False
self.data_aug_rotate180 = True
self.keep_scale_consistent = False
self.eval_full_size = False ## This option matters only when keep_scale_consistent is True
self.test_no_log = False
self.trial_mode = False
self.run_eval = False
self.continue_train = False
self.visualize_pcd = False
self.top_k_list = [3000]
self.grid_list = [1]
self.sample_aug_list = [-1]
self.opt_unet = unetoptions
self.dist_coef = {}
self.dist_coef['xyz_align'] = 0.2 # 0.1
self.dist_coef['xyz_noisy'] = 0.2 # 0.1
self.dist_coef['xyz'] = 0.2 # 0.1
self.dist_coef['img'] = 0.5 # originally I used 0.1, but Justin used 0.5 here
# self.dist_coef['feature'] = 0.1 ###?
self.dist_coef_feature = 0.1
self.lr = 1e-5
self.lr_decay_iter = 20000
self.batch_size = 1
self.effective_batch_size = 2
self.iter_between_update = int(self.effective_batch_size / self.batch_size)
self.epochs = 1
self.total_iters = 20000
def set_loss_from_options(self):
self.kernalize = not self.opt_unet.non_neg
if self.keep_scale_consistent:
self.width = 640
self.height = 480
if self.run_eval:
self.height_split = 1
self.width_split = 1
else:
self.height_split = 5
self.width_split = 5
self.effective_width = int(self.width / self.width_split)
self.effective_height = int(self.height / self.height_split)
else:
if self.run_eval:
self.width = 640
self.height = 480
else:
self.width = 128 # (72*96) [[96, 128]] (240, 320)
self.height = 96
self.effective_width = self.width
self.effective_height = self.height
if self.effective_width > 128:
self.no_inner_prod = True
else:
self.no_inner_prod = False
self.source='TUM'
if self.source=='CARLA':
self.root_dir = '/mnt/storage/minghanz_data/CARLA(with_pose)/_out'
elif self.source == 'TUM':
# self.root_dir = '/mnt/storage/minghanz_data/TUM/RGBD'
# self.root_dir = '/media/minghanz/Seagate_Backup_Plus_Drive/TUM/rgbd_dataset/untarred'
self.root_dir = '/home/minghanz/Datasets/TUM/rgbd/untarred'
# if self.run_eval or self.continue_train:
# self.pretrained_weight_path = 'saved_models/with_color_Fri Nov 8 22:21:30 2019/epoch00_20000.pth'
if self.run_eval:
self.folders = ['rgbd_dataset_freiburg1_desk']
else:
self.folders = None
# if self.L_norm == 1:
# self.feat_scale_after_normalize = 1e-2 ## the mean abs of a channel across all selected pixels (pre_gramian)
# elif self.L_norm == 2:
# self.feat_scale_after_normalize = 1e1
# elif self.L_norm == (1,2):
# self.feat_scale_after_normalize = 1e-1
if self.kernalize: # rbf
self.sparsify_mode = 2 # norm_dim=2, centralize, normalize
self.L_norm = 2 # make variance 1 of all channels
self.feat_scale_after_normalize = 1e-1 # sdv 1e-1
self.reg_norm_mode = False
else: # dot product
self.sparsify_mode = 2 # 3, norm_dim=2, centralize, doesn't normalize (use the norm as loss)
self.L_norm = (1,2) # (1,2) # mean L2 norm of all pixel features
if self.self_sparse_mode:
self.feat_scale_after_normalize = 1e-1
else:
self.feat_scale_after_normalize = 1e0
self.reg_norm_mode = False
self.feat_norm_per_pxl = 1 ## the L2 norm of feature vector of a pixel (pre_gramian). 1 means this value has no extra effect
self.set_loss_from_mode()
return
def set_loss_from_mode(self):
## loss function setting
self.loss_item = []
self.loss_weight = []
if self.min_dist_mode:
self.loss_item.extend(["cos_sim", "func_dist"])
if self.normalize_inprod_over_pts:
self.loss_weight.extend([1, 100])
else:
if self.kernalize:
self.loss_weight.extend([1, 1e-5]) # 1e6, 1 # 1e-4: dots, 1e-6: blocks
elif self.self_trans:
self.loss_weight.extend([0,-1e-6])
else:
self.loss_weight.extend([1, 1e-6]) # 1e6, 1
if self.diff_mode:
self.loss_item.extend(["cos_diff", "dist_diff"])
if self.normalize_inprod_over_pts:
self.loss_weight.extend([1, 100])
else:
if self.kernalize:
self.loss_weight.extend([1, 1e-6]) # 1e6, 1
else:
self.loss_weight.extend([1, 1e-4]) # 1e6, 1
if self.min_grad_mode:
self.loss_item.extend(["w_angle", "v_angle"])
self.loss_weight.extend([1, 1])
if self.reg_norm_mode:
self.loss_item.append("feat_norm")
self.loss_weight.append(1e-1) # self.reg_norm_weight
if self.self_sparse_mode:
self.loss_item.extend(["cos_sim", "func_dist"])
self.loss_weight.extend([0, 1]) # 1e6, 1
self.samp_pt = self.min_grad_mode
return
def set_from_manual(self, overwrite_opt):
manual_keys = overwrite_opt.__dict__.keys() # http://www.blog.pythonlibrary.org/2013/01/11/how-to-get-a-list-of-class-attributes/
for key in manual_keys:
vars(self)[key] = vars(overwrite_opt)[key] # https://stackoverflow.com/questions/11637293/iterate-over-object-attributes-in-python
self.dist_coef['feature'] = self.dist_coef_feature
return
def set_eval_full_size(self):
if self.eval_full_size == False:
self.eval_full_size = True
self.no_inner_prod_ori = self.no_inner_prod
self.visualize_pca_chnl_ori = self.visualize_pca_chnl
self.no_inner_prod = True
self.visualize_pca_chnl = False
def unset_eval_full_size(self):
if self.eval_full_size == True:
self.eval_full_size = False
self.no_inner_prod = self.no_inner_prod_ori
self.visualize_pca_chnl = self.visualize_pca_chnl_ori
| class Unetoptions:
def __init__(self):
self.in_channels = 1
self.n_classes = 2
self.depth = 5
self.wf = 6
self.padding = False
self.up_mode = 'upconv'
self.batch_norm = True
self.non_neg = True
self.pose_predict_mode = False
self.pretrained_mode = False
self.weight_map_mode = False
def setto(self):
self.in_channels = 3
self.n_classes = 6
self.depth = 5
self.wf = 2
self.padding = True
self.up_mode = 'upsample'
class Lossoptions:
def __init__(self, unetoptions):
self.color_in_cost = False
self.norm_in_loss = False
self.pca_in_loss = False
self.subset_in_loss = False
self.zero_edge_region = True
self.normalize_inprod_over_pts = False
self.data_aug_rotate180 = True
self.keep_scale_consistent = False
self.eval_full_size = False
self.test_no_log = False
self.trial_mode = False
self.run_eval = False
self.continue_train = False
self.visualize_pcd = False
self.top_k_list = [3000]
self.grid_list = [1]
self.sample_aug_list = [-1]
self.opt_unet = unetoptions
self.dist_coef = {}
self.dist_coef['xyz_align'] = 0.2
self.dist_coef['xyz_noisy'] = 0.2
self.dist_coef['xyz'] = 0.2
self.dist_coef['img'] = 0.5
self.dist_coef_feature = 0.1
self.lr = 1e-05
self.lr_decay_iter = 20000
self.batch_size = 1
self.effective_batch_size = 2
self.iter_between_update = int(self.effective_batch_size / self.batch_size)
self.epochs = 1
self.total_iters = 20000
def set_loss_from_options(self):
self.kernalize = not self.opt_unet.non_neg
if self.keep_scale_consistent:
self.width = 640
self.height = 480
if self.run_eval:
self.height_split = 1
self.width_split = 1
else:
self.height_split = 5
self.width_split = 5
self.effective_width = int(self.width / self.width_split)
self.effective_height = int(self.height / self.height_split)
else:
if self.run_eval:
self.width = 640
self.height = 480
else:
self.width = 128
self.height = 96
self.effective_width = self.width
self.effective_height = self.height
if self.effective_width > 128:
self.no_inner_prod = True
else:
self.no_inner_prod = False
self.source = 'TUM'
if self.source == 'CARLA':
self.root_dir = '/mnt/storage/minghanz_data/CARLA(with_pose)/_out'
elif self.source == 'TUM':
self.root_dir = '/home/minghanz/Datasets/TUM/rgbd/untarred'
if self.run_eval:
self.folders = ['rgbd_dataset_freiburg1_desk']
else:
self.folders = None
if self.kernalize:
self.sparsify_mode = 2
self.L_norm = 2
self.feat_scale_after_normalize = 0.1
self.reg_norm_mode = False
else:
self.sparsify_mode = 2
self.L_norm = (1, 2)
if self.self_sparse_mode:
self.feat_scale_after_normalize = 0.1
else:
self.feat_scale_after_normalize = 1.0
self.reg_norm_mode = False
self.feat_norm_per_pxl = 1
self.set_loss_from_mode()
return
def set_loss_from_mode(self):
self.loss_item = []
self.loss_weight = []
if self.min_dist_mode:
self.loss_item.extend(['cos_sim', 'func_dist'])
if self.normalize_inprod_over_pts:
self.loss_weight.extend([1, 100])
elif self.kernalize:
self.loss_weight.extend([1, 1e-05])
elif self.self_trans:
self.loss_weight.extend([0, -1e-06])
else:
self.loss_weight.extend([1, 1e-06])
if self.diff_mode:
self.loss_item.extend(['cos_diff', 'dist_diff'])
if self.normalize_inprod_over_pts:
self.loss_weight.extend([1, 100])
elif self.kernalize:
self.loss_weight.extend([1, 1e-06])
else:
self.loss_weight.extend([1, 0.0001])
if self.min_grad_mode:
self.loss_item.extend(['w_angle', 'v_angle'])
self.loss_weight.extend([1, 1])
if self.reg_norm_mode:
self.loss_item.append('feat_norm')
self.loss_weight.append(0.1)
if self.self_sparse_mode:
self.loss_item.extend(['cos_sim', 'func_dist'])
self.loss_weight.extend([0, 1])
self.samp_pt = self.min_grad_mode
return
def set_from_manual(self, overwrite_opt):
manual_keys = overwrite_opt.__dict__.keys()
for key in manual_keys:
vars(self)[key] = vars(overwrite_opt)[key]
self.dist_coef['feature'] = self.dist_coef_feature
return
def set_eval_full_size(self):
if self.eval_full_size == False:
self.eval_full_size = True
self.no_inner_prod_ori = self.no_inner_prod
self.visualize_pca_chnl_ori = self.visualize_pca_chnl
self.no_inner_prod = True
self.visualize_pca_chnl = False
def unset_eval_full_size(self):
if self.eval_full_size == True:
self.eval_full_size = False
self.no_inner_prod = self.no_inner_prod_ori
self.visualize_pca_chnl = self.visualize_pca_chnl_ori |
# Python - 2.7.6
def find_next_square(sq):
num = int(sq ** 0.5)
return (num + 1) ** 2 if (num ** 2) == sq else -1
| def find_next_square(sq):
num = int(sq ** 0.5)
return (num + 1) ** 2 if num ** 2 == sq else -1 |
# value of A represent its position in C
# value of C represent its position in B
def count_sort(A, k):
B = [0 for i in range(len(A))]
C = [0 for i in range(k)]
# count the frequency of each elements in A and save them in the coresponding position in B
for i in range(0, len(A)):
C[A[i] - 1] += 1
# accumulated sum of C, indicating where we should put in Aay B
for i in range(1, k, 1):
C[i] = C[i - 1] + C[i]
# count the
for i in range(len(A)-1, -1, -1):
B[C[A[i]-1]-1] = A[i]
C[A[i]-1] -= 1
return B
B = count_sort([4, 1, 3, 4, 3], 4)
print(B) | def count_sort(A, k):
b = [0 for i in range(len(A))]
c = [0 for i in range(k)]
for i in range(0, len(A)):
C[A[i] - 1] += 1
for i in range(1, k, 1):
C[i] = C[i - 1] + C[i]
for i in range(len(A) - 1, -1, -1):
B[C[A[i] - 1] - 1] = A[i]
C[A[i] - 1] -= 1
return B
b = count_sort([4, 1, 3, 4, 3], 4)
print(B) |
class Params:
# -------------------------------
# GENERAL
# -------------------------------
gpu_ewc = '4' # GPU number
gpu_rewc = '3' # GPU number
data_size = 224 # Data size
batch_size = 32 # Batch size
nb_cl = 50 # Classes per group
nb_groups = 4 # Number of groups 200 = 50*4
nb_val = 0 # Number of images for val
epochs = 50 # Total number of epochs
num_samples = 5 # Samples per class to compute the Fisher information
lr_init = 0.001 # Initial learning rate
lr_strat = [40,80] # Epochs where learning rate gets decreased
lr_factor = 5. # Learning rate decrease factor
wght_decay = 0.00001 # Weight Decay
ratio = 100.0 # ratio = lwf loss / softmax loss
# -------------------------------
# Parameters for test
# -------------------------------
eval_single = True # Evaluate different task in Single head setting
# -------------------------------
# Parameters for path
# -------------------------------
save_path = './checkpoints/' # Model saving path
train_path = '/data/Datasets/CUB_200_2011/CUB_200_2011/' # Data path
| class Params:
gpu_ewc = '4'
gpu_rewc = '3'
data_size = 224
batch_size = 32
nb_cl = 50
nb_groups = 4
nb_val = 0
epochs = 50
num_samples = 5
lr_init = 0.001
lr_strat = [40, 80]
lr_factor = 5.0
wght_decay = 1e-05
ratio = 100.0
eval_single = True
save_path = './checkpoints/'
train_path = '/data/Datasets/CUB_200_2011/CUB_200_2011/' |
place_needed = int(input().split()[1])
scores = [j for j in reversed(sorted([int(i) for i in input().split() if int(i) > 0]))]
try:
score_needed = scores[place_needed - 1]
except IndexError:
score_needed = 0
amount = 0
for i in scores:
if i >= score_needed:
amount += 1
print(amount)
| place_needed = int(input().split()[1])
scores = [j for j in reversed(sorted([int(i) for i in input().split() if int(i) > 0]))]
try:
score_needed = scores[place_needed - 1]
except IndexError:
score_needed = 0
amount = 0
for i in scores:
if i >= score_needed:
amount += 1
print(amount) |
# List aa images with query stringa available
def list_all_images_subparser(subparser):
list_all_images = subparser.add_parser(
'list-all-images',
description=('***List all'
' images of'
' producers/consumers'
' account'),
help=('List all'
' images of'
' producers/consumers'
' account'))
group_key = list_all_images.add_mutually_exclusive_group(required=True)
group_key.add_argument('-pn',
'--producer-username',
help="Producer\'s(source account) username")
group_key.add_argument('-cn',
'--consumer-username',
dest='producer_username',
metavar='CONSUMER_USERNAME',
help="Consumer\'s(destination account) username")
group_apikey = list_all_images.add_mutually_exclusive_group(required=True)
group_apikey.add_argument('-pa',
'--producer-apikey',
help="Producer\'s(source account) apikey")
group_apikey.add_argument('-ca',
'--consumer-apikey',
dest='producer_apikey',
metavar='CONSUMER_APIKEY',
help="Consumer\'s(destination account) apikey")
list_all_images.add_argument('--visibility',
nargs=1,
help='[shared][private][public]')
list_all_images.add_argument('--member-status',
nargs=1,
help='[pending][accepted][rejected][all]')
list_all_images.add_argument('--owner',
nargs=1,
help='Owner Id')
| def list_all_images_subparser(subparser):
list_all_images = subparser.add_parser('list-all-images', description='***List all images of producers/consumers account', help='List all images of producers/consumers account')
group_key = list_all_images.add_mutually_exclusive_group(required=True)
group_key.add_argument('-pn', '--producer-username', help="Producer's(source account) username")
group_key.add_argument('-cn', '--consumer-username', dest='producer_username', metavar='CONSUMER_USERNAME', help="Consumer's(destination account) username")
group_apikey = list_all_images.add_mutually_exclusive_group(required=True)
group_apikey.add_argument('-pa', '--producer-apikey', help="Producer's(source account) apikey")
group_apikey.add_argument('-ca', '--consumer-apikey', dest='producer_apikey', metavar='CONSUMER_APIKEY', help="Consumer's(destination account) apikey")
list_all_images.add_argument('--visibility', nargs=1, help='[shared][private][public]')
list_all_images.add_argument('--member-status', nargs=1, help='[pending][accepted][rejected][all]')
list_all_images.add_argument('--owner', nargs=1, help='Owner Id') |
# No good name, sorry, lol :)
def combinations(list, k):
return 0
print( combinations([1, 2, 3, 4], 3) ) | def combinations(list, k):
return 0
print(combinations([1, 2, 3, 4], 3)) |
#Find the difference between the sum of the squares of the first one hundred natural numbers
# and the square of the sum.
#Generating a list with natural numbers 1-100.
nums = list(range(101))
#print(nums)
#Find the square of the sum (1+...+100).
# The following is old code: (that does work.)
#LIST = nums
#x = 0
#total = 0
#while x < 101:
# print('index: ', x)
# print('total sum thus far: ', total)
# hold = LIST[x]
# total = total + hold
# x += 1
#print('the sum of 1-100 is:', total)
LIST = list(range(101))
#Funtion for the trianuglar numbers:
def tri_num(n):
n = int(n)
sum = n * (n+1)
sum = sum / 2
sum = int(sum)
return sum
a = tri_num(100)
print(a)
print(a*a)
#Function for the triangular numbers but every term is squared, (e.g. 1^2 + 2^2 + ...)
def tri_num_sqrd(n):
n = int(n)
sum = n * (n+1) * ((2*n)+1)
sum = sum / 6
sum = int(sum)
return sum
b = tri_num_sqrd(100)
print(b)
print()
print("The answer to problem 6 is: ")
print((a*a) - b)
| nums = list(range(101))
list = list(range(101))
def tri_num(n):
n = int(n)
sum = n * (n + 1)
sum = sum / 2
sum = int(sum)
return sum
a = tri_num(100)
print(a)
print(a * a)
def tri_num_sqrd(n):
n = int(n)
sum = n * (n + 1) * (2 * n + 1)
sum = sum / 6
sum = int(sum)
return sum
b = tri_num_sqrd(100)
print(b)
print()
print('The answer to problem 6 is: ')
print(a * a - b) |
class Message:
# type id_message id_device timestamp
type = 'default'
id = 0
source_id = 0
source_timestamp = 0
payload = bytearray(0)
def __init__(self, type, id, source_id, source_timestamp, payload):
self.type = type
self.id = id
self.source_id = source_id
self.source_timestamp
self.payload = payload
def header_to_string(self):
return '%s %s %s %s' % (self.type, self.id, self.source_id, self.source_timestamp)
def payload_to_string(self):
if isinstance(self.payload, bytearray):
return self.payload.decode(errors='replace').rstrip('\x00')
else:
return '%s' % self.payload
| class Message:
type = 'default'
id = 0
source_id = 0
source_timestamp = 0
payload = bytearray(0)
def __init__(self, type, id, source_id, source_timestamp, payload):
self.type = type
self.id = id
self.source_id = source_id
self.source_timestamp
self.payload = payload
def header_to_string(self):
return '%s %s %s %s' % (self.type, self.id, self.source_id, self.source_timestamp)
def payload_to_string(self):
if isinstance(self.payload, bytearray):
return self.payload.decode(errors='replace').rstrip('\x00')
else:
return '%s' % self.payload |
class Solution:
def cloneTree(self, root: 'Node') -> 'Node':
"""Tree.
"""
if not root:
return None
croot = Node(root.val)
m = {root: croot}
nodes = deque([root])
cnodes = deque([croot])
while nodes:
n = nodes.popleft()
cn = cnodes.popleft()
for ch in n.children:
cch = Node(ch.val)
cn.children.append(cch)
nodes.append(ch)
cnodes.append(cch)
return croot
| class Solution:
def clone_tree(self, root: 'Node') -> 'Node':
"""Tree.
"""
if not root:
return None
croot = node(root.val)
m = {root: croot}
nodes = deque([root])
cnodes = deque([croot])
while nodes:
n = nodes.popleft()
cn = cnodes.popleft()
for ch in n.children:
cch = node(ch.val)
cn.children.append(cch)
nodes.append(ch)
cnodes.append(cch)
return croot |
# Copyright (C) 2020 Square, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
def metadata(
group_id,
artifact_id,
version,
target,
license,
github_slug,
developers = [],
description = None,
name = None):
""" Generates a known struct which can be consumed to generate release packaging. """
if not developers:
fail("Must specify at least one developer.")
return struct(
name = name if name != None else artifact_id,
description = description,
group_id = group_id,
artifact_id = artifact_id,
version = version,
target = target,
github_slug = github_slug,
license = license,
developers = developers,
)
def developer(id, name, email, url = None):
""" Generates an id/string pair which can be consumed by maven_pom"""
if not url:
url = "http://github.com/{id}".format(id = id)
return "{id}::{name}::{email}::{url}".format(id = id, name = name, email = email, url = url)
| def metadata(group_id, artifact_id, version, target, license, github_slug, developers=[], description=None, name=None):
""" Generates a known struct which can be consumed to generate release packaging. """
if not developers:
fail('Must specify at least one developer.')
return struct(name=name if name != None else artifact_id, description=description, group_id=group_id, artifact_id=artifact_id, version=version, target=target, github_slug=github_slug, license=license, developers=developers)
def developer(id, name, email, url=None):
""" Generates an id/string pair which can be consumed by maven_pom"""
if not url:
url = 'http://github.com/{id}'.format(id=id)
return '{id}::{name}::{email}::{url}'.format(id=id, name=name, email=email, url=url) |
{
'targets': [
{
'target_name': 'xwalk_extensions_unittest',
'type': 'executable',
'dependencies': [
'../../base/base.gyp:base',
'../../base/base.gyp:run_all_unittests',
'../../testing/gtest.gyp:gtest',
'extensions.gyp:xwalk_extensions',
],
'sources': [
'browser/xwalk_extension_function_handler_unittest.cc',
'common/xwalk_extension_server_unittest.cc',
],
},
{
'target_name': 'xwalk_extensions_browsertest',
'type': 'executable',
'dependencies': [
'../../base/base.gyp:base',
'../../content/content.gyp:content_browser',
'../../content/content_shell_and_tests.gyp:test_support_content',
'../../net/net.gyp:net',
'../../skia/skia.gyp:skia',
'../../testing/gtest.gyp:gtest',
'../test/base/base.gyp:xwalk_test_base',
'../xwalk.gyp:xwalk_runtime',
'extensions.gyp:xwalk_extensions',
'extensions_resources.gyp:xwalk_extensions_resources',
'external_extension_sample.gyp:*',
],
'defines': [
'HAS_OUT_OF_PROC_TEST_RUNNER',
],
'variables': {
'jsapi_component': 'extensions',
},
'includes': [
'../xwalk_jsapi.gypi',
],
'sources': [
'test/bad_extension_test.cc',
'test/conflicting_entry_points.cc',
'test/context_destruction.cc',
'test/crash_extension_process.cc',
'test/export_object.cc',
'test/extension_in_iframe.cc',
'test/external_extension.cc',
'test/external_extension_multi_process.cc',
'test/in_process_threads_browsertest.cc',
'test/internal_extension_browsertest.cc',
'test/internal_extension_browsertest.h',
'test/nested_namespace.cc',
'test/namespace_read_only.cc',
'test/test.idl',
'test/v8tools_module.cc',
'test/xwalk_extensions_browsertest.cc',
'test/xwalk_extensions_test_base.cc',
'test/xwalk_extensions_test_base.h',
],
},
],
}
| {'targets': [{'target_name': 'xwalk_extensions_unittest', 'type': 'executable', 'dependencies': ['../../base/base.gyp:base', '../../base/base.gyp:run_all_unittests', '../../testing/gtest.gyp:gtest', 'extensions.gyp:xwalk_extensions'], 'sources': ['browser/xwalk_extension_function_handler_unittest.cc', 'common/xwalk_extension_server_unittest.cc']}, {'target_name': 'xwalk_extensions_browsertest', 'type': 'executable', 'dependencies': ['../../base/base.gyp:base', '../../content/content.gyp:content_browser', '../../content/content_shell_and_tests.gyp:test_support_content', '../../net/net.gyp:net', '../../skia/skia.gyp:skia', '../../testing/gtest.gyp:gtest', '../test/base/base.gyp:xwalk_test_base', '../xwalk.gyp:xwalk_runtime', 'extensions.gyp:xwalk_extensions', 'extensions_resources.gyp:xwalk_extensions_resources', 'external_extension_sample.gyp:*'], 'defines': ['HAS_OUT_OF_PROC_TEST_RUNNER'], 'variables': {'jsapi_component': 'extensions'}, 'includes': ['../xwalk_jsapi.gypi'], 'sources': ['test/bad_extension_test.cc', 'test/conflicting_entry_points.cc', 'test/context_destruction.cc', 'test/crash_extension_process.cc', 'test/export_object.cc', 'test/extension_in_iframe.cc', 'test/external_extension.cc', 'test/external_extension_multi_process.cc', 'test/in_process_threads_browsertest.cc', 'test/internal_extension_browsertest.cc', 'test/internal_extension_browsertest.h', 'test/nested_namespace.cc', 'test/namespace_read_only.cc', 'test/test.idl', 'test/v8tools_module.cc', 'test/xwalk_extensions_browsertest.cc', 'test/xwalk_extensions_test_base.cc', 'test/xwalk_extensions_test_base.h']}]} |
def preprocess(df, standardize = False):
"""Splits the data into training and validation sets.
arguments:
df: the dataframe of training and test data you want to split.
standardize: if True returns standardized data.
"""
#split the data
train, test = train_test_split(df, train_size=0.8, random_state = 42)
#sort the data
train = train.sort_values(by = ["x1"])
test = test.sort_values(by = ["x1"])
train.describe()
X_train, y_train = train[["x1"]], train["y"]
X_test, y_test = test[["x1"]], test["y"]
X_train_N = add_higher_order_polynomial_terms(X_train, N=15)
X_test_N = add_higher_order_polynomial_terms(X_test, N=15)
if standardize:
scaler = StandardScaler().fit(X_train_N)
X_train_N = scaler.transform(X_train_N)
X_test_N = scaler.transform(X_test_N)
#"X_val" : X_val_N, "y_val" : y_val,
datasets = {"X_train": X_train_N, "y_train": y_train, "X_test" : X_test_N, "y_test": y_test}
return(datasets)
def fit_ridge_and_lasso_cv(X_train, y_train, X_test, y_test,
k = None, alphas = [10**9], best_OLS_r2 = best_least_squares_r2 ): #X_val, y_val,
""" takes in train and validation test sets and reports the best selected model using ridge and lasso regression.
Arguments:
X_train: the train design matrix
y_train: the reponse variable for the training set
X_val: the validation design matrix
y_train: the reponse variable for the validation set
k: the number of k-fold cross validation sections to be fed to Ridge and Lasso Regularization.
"""
# Let us do k-fold cross validation
fitted_ridge = RidgeCV(alphas=alphas, cv = k).fit(X_train, y_train)
fitted_lasso = LassoCV(alphas=alphas, cv = k).fit(X_train, y_train)
print('R^2 score for our original OLS model: {}\n'.format(best_OLS_r2))
ridge_a = fitted_ridge.alpha_
ridge_score = fitted_ridge.score(X_test, y_test)
print('Best alpha for ridge: {}'.format(ridge_a))
print('R^2 score for Ridge with alpha={}: {}\n'.format(ridge_a, ridge_score))
lasso_a = fitted_lasso.alpha_
lasso_score = fitted_lasso.score(X_test, y_test)
print('Best alpha for lasso: {}'.format(lasso_a))
print('R^2 score for Lasso with alpha={}: {}'.format(lasso_a, lasso_score))
r2_df = pd.DataFrame({"OLS": best_OLS_r2, "Lasso" : lasso_score, "Ridge" : ridge_score}, index = [0])
r2_df = r2_df.melt()
r2_df.columns = ["model", "r2_Score"]
plt.title("Validation set")
sns.barplot(x = "model", y = "r2_Score", data = r2_df)
plt.show() | def preprocess(df, standardize=False):
"""Splits the data into training and validation sets.
arguments:
df: the dataframe of training and test data you want to split.
standardize: if True returns standardized data.
"""
(train, test) = train_test_split(df, train_size=0.8, random_state=42)
train = train.sort_values(by=['x1'])
test = test.sort_values(by=['x1'])
train.describe()
(x_train, y_train) = (train[['x1']], train['y'])
(x_test, y_test) = (test[['x1']], test['y'])
x_train_n = add_higher_order_polynomial_terms(X_train, N=15)
x_test_n = add_higher_order_polynomial_terms(X_test, N=15)
if standardize:
scaler = standard_scaler().fit(X_train_N)
x_train_n = scaler.transform(X_train_N)
x_test_n = scaler.transform(X_test_N)
datasets = {'X_train': X_train_N, 'y_train': y_train, 'X_test': X_test_N, 'y_test': y_test}
return datasets
def fit_ridge_and_lasso_cv(X_train, y_train, X_test, y_test, k=None, alphas=[10 ** 9], best_OLS_r2=best_least_squares_r2):
""" takes in train and validation test sets and reports the best selected model using ridge and lasso regression.
Arguments:
X_train: the train design matrix
y_train: the reponse variable for the training set
X_val: the validation design matrix
y_train: the reponse variable for the validation set
k: the number of k-fold cross validation sections to be fed to Ridge and Lasso Regularization.
"""
fitted_ridge = ridge_cv(alphas=alphas, cv=k).fit(X_train, y_train)
fitted_lasso = lasso_cv(alphas=alphas, cv=k).fit(X_train, y_train)
print('R^2 score for our original OLS model: {}\n'.format(best_OLS_r2))
ridge_a = fitted_ridge.alpha_
ridge_score = fitted_ridge.score(X_test, y_test)
print('Best alpha for ridge: {}'.format(ridge_a))
print('R^2 score for Ridge with alpha={}: {}\n'.format(ridge_a, ridge_score))
lasso_a = fitted_lasso.alpha_
lasso_score = fitted_lasso.score(X_test, y_test)
print('Best alpha for lasso: {}'.format(lasso_a))
print('R^2 score for Lasso with alpha={}: {}'.format(lasso_a, lasso_score))
r2_df = pd.DataFrame({'OLS': best_OLS_r2, 'Lasso': lasso_score, 'Ridge': ridge_score}, index=[0])
r2_df = r2_df.melt()
r2_df.columns = ['model', 'r2_Score']
plt.title('Validation set')
sns.barplot(x='model', y='r2_Score', data=r2_df)
plt.show() |
class Solution:
@staticmethod
def naive(n,edges):
adj = {i:[] for i in range(n)}
for u,v in edges:
adj[u].append(v)
adj[v].append(u)
# no cycle, only one fully connected tree
visited = set()
def dfs(i,fro):
if i in visited:
return False
visited.add(i)
for child in adj[i]:
if child != fro:
if not dfs(child,i): return False
return True
if not dfs(0,-1): return False
if len(visited)!=n: return False
return True | class Solution:
@staticmethod
def naive(n, edges):
adj = {i: [] for i in range(n)}
for (u, v) in edges:
adj[u].append(v)
adj[v].append(u)
visited = set()
def dfs(i, fro):
if i in visited:
return False
visited.add(i)
for child in adj[i]:
if child != fro:
if not dfs(child, i):
return False
return True
if not dfs(0, -1):
return False
if len(visited) != n:
return False
return True |
def factorial(n):
"""
Computes the factorial of n.
"""
if n < 0:
raise ValueError('received negative input')
result = 1
for i in range(1, n + 1):
result *= i
return result
| def factorial(n):
"""
Computes the factorial of n.
"""
if n < 0:
raise value_error('received negative input')
result = 1
for i in range(1, n + 1):
result *= i
return result |
class CardSelectionConfigController(object):
cs = None
controller = None
pos = None
def __init__(self, cs, controller, pos=-1):
self.cs = cs
self.controller = controller
self.pos = pos
def save(self):
if self.pos < 0:
self.controller.add_cs(self.cs)
else:
self.controller.update_cs(self.cs, self.pos)
def get_nth_card_text(self, n):
return self.cs.cards[n].text
def set_nth_card_text(self, n, text):
self.cs.cards[n].text = text
def get_task_text(self):
return self.cs.text_p1
def set_task_text(self, txt):
self.cs.text_p1 = txt
def get_rule(self):
return self.cs.rule
def set_rule(self, txt):
self.cs.rule = txt
def get_extra_text(self):
return self.cs.text_p2
def set_extra_text(self, txt):
self.cs.text_p2 = txt
def get_instructions(self):
return self.cs.instructions
def set_instructions(self, txt):
self.cs.instructions = txt
def is_fixed_position(self):
return self.cs.is_fixed_position
def set_is_fixed_position(self, val):
self.cs.is_fixed_position = bool(val)
| class Cardselectionconfigcontroller(object):
cs = None
controller = None
pos = None
def __init__(self, cs, controller, pos=-1):
self.cs = cs
self.controller = controller
self.pos = pos
def save(self):
if self.pos < 0:
self.controller.add_cs(self.cs)
else:
self.controller.update_cs(self.cs, self.pos)
def get_nth_card_text(self, n):
return self.cs.cards[n].text
def set_nth_card_text(self, n, text):
self.cs.cards[n].text = text
def get_task_text(self):
return self.cs.text_p1
def set_task_text(self, txt):
self.cs.text_p1 = txt
def get_rule(self):
return self.cs.rule
def set_rule(self, txt):
self.cs.rule = txt
def get_extra_text(self):
return self.cs.text_p2
def set_extra_text(self, txt):
self.cs.text_p2 = txt
def get_instructions(self):
return self.cs.instructions
def set_instructions(self, txt):
self.cs.instructions = txt
def is_fixed_position(self):
return self.cs.is_fixed_position
def set_is_fixed_position(self, val):
self.cs.is_fixed_position = bool(val) |
"""
With / As Keywords
"""
# print("Normal Write Start")
# my_write = open("textfile.txt", "w")
# my_write.write("Trying to write to the file")
# my_write.close()
#
#
# print("Normal Read Start")
# my_read = open("textfile.txt", "r")
# print(str(my_read.read()))
print("With As Write Start")
with open("withas.txt", "w") as with_as_write:
with_as_write.write("This is an example of with as write/read")
print()
print("With As Read Start")
with open("withas.txt", "r") as with_as_read:
print(str(with_as_read.read())) | """
With / As Keywords
"""
print('With As Write Start')
with open('withas.txt', 'w') as with_as_write:
with_as_write.write('This is an example of with as write/read')
print()
print('With As Read Start')
with open('withas.txt', 'r') as with_as_read:
print(str(with_as_read.read())) |
""" A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone.
The frog can jump on a stone, but it must not jump into the water.
If the frog's last jump was k units, then its next jump must be either k - 1, k, or k + 1 units.
Note that the frog can only jump in the forward direction.
1
0 1 3 5
0 1 1
"""
class Solution403:
pass
| """ A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone.
The frog can jump on a stone, but it must not jump into the water.
If the frog's last jump was k units, then its next jump must be either k - 1, k, or k + 1 units.
Note that the frog can only jump in the forward direction.
1
0 1 3 5
0 1 1
"""
class Solution403:
pass |
"""The longest common subsequence problem is the problem of finding the longest subsequence common to all sequences
in a set of sequences. It differs from the longest common substring problem: unlike substrings, subsequences are not
required to occupy consecutive positions within the original sequences. """
"""For better understanding watch the video https://youtu.be/sSno9rV8Rhg"""
def lcs(string1, string2):
m = len(string1)
n = len(string2)
l = [[None for _ in range(n + 1)] for _ in range(m + 1)]
for i in range(m + 1):
for j in range(n + 1):
if i == 0 or j == 0:
l[i][j] = 0
elif string1[i - 1] == string2[
j - 1]: # check the alphabet of the 2 string match or not, in matrix indices are one extra therefore we reduce indices by 1
l[i][j] = 1 + l[i - 1][j - 1] # if match the condition add diagonal value by 1 and store into the current index
else:
l[i][j] = max(l[i - 1][j],
l[i][j - 1]) # if not matches store the max value of the previous row and previous column
return l
string1 = "BDCB"
string2 = "BACDB"
a = lcs(string1, string2)
print(a)
print("Longest Sequences ", a[-1][-1])
l1 = len(string1)
l2 = len(string2)
sequence = []
val = None
while val != 0: # continue the loop until you reaches to the zero value
if a[l1][l2] == a[l1][l2 - 1]: # if the consecutive value of the same row is equal then reduce the column by 1
l2 -= 1
else:
# if the consecutive value of the same row is not equal then reduce the column and row by 1 to go to 1
# level up
val = a[l1 - 1][l2 - 1]
sequence.insert(0, string2[l2 - 1]) # insert that value from where index goes up
l1 -= 1
l2 -= 1
print("Sequence is", "".join(sequence))
| """The longest common subsequence problem is the problem of finding the longest subsequence common to all sequences
in a set of sequences. It differs from the longest common substring problem: unlike substrings, subsequences are not
required to occupy consecutive positions within the original sequences. """
'For better understanding watch the video https://youtu.be/sSno9rV8Rhg'
def lcs(string1, string2):
m = len(string1)
n = len(string2)
l = [[None for _ in range(n + 1)] for _ in range(m + 1)]
for i in range(m + 1):
for j in range(n + 1):
if i == 0 or j == 0:
l[i][j] = 0
elif string1[i - 1] == string2[j - 1]:
l[i][j] = 1 + l[i - 1][j - 1]
else:
l[i][j] = max(l[i - 1][j], l[i][j - 1])
return l
string1 = 'BDCB'
string2 = 'BACDB'
a = lcs(string1, string2)
print(a)
print('Longest Sequences ', a[-1][-1])
l1 = len(string1)
l2 = len(string2)
sequence = []
val = None
while val != 0:
if a[l1][l2] == a[l1][l2 - 1]:
l2 -= 1
else:
val = a[l1 - 1][l2 - 1]
sequence.insert(0, string2[l2 - 1])
l1 -= 1
l2 -= 1
print('Sequence is', ''.join(sequence)) |
"""Re-exports shell rule."""
load("@bazel_skylib//lib:shell.bzl", _shell = "shell")
shell = _shell
| """Re-exports shell rule."""
load('@bazel_skylib//lib:shell.bzl', _shell='shell')
shell = _shell |
T = int(input())
for _ in range(T):
n = int(input())
s = [int(s_arr) for s_arr in input().split(' ')]
misere, count = 0, 0
for i in range(n):
misere ^= s[i]
if s[i] <= 1:
count += 1
print ("Second" if (count == n and misere == 1) or (count < n and misere == 0) else "First") | t = int(input())
for _ in range(T):
n = int(input())
s = [int(s_arr) for s_arr in input().split(' ')]
(misere, count) = (0, 0)
for i in range(n):
misere ^= s[i]
if s[i] <= 1:
count += 1
print('Second' if count == n and misere == 1 or (count < n and misere == 0) else 'First') |
# tests transition from small to large int representation by multiplication
for rhs in range(2, 11):
lhs = 1
for k in range(100):
res = lhs * rhs
print(lhs, '*', rhs, '=', res)
lhs = res
# below tests pos/neg combinations that overflow small int
# 31-bit overflow
i = 1 << 20
print(i * i)
print(i * -i)
print(-i * i)
print(-i * -i)
# 63-bit overflow
i = 1 << 40
print(i * i)
print(i * -i)
print(-i * i)
print(-i * -i)
| for rhs in range(2, 11):
lhs = 1
for k in range(100):
res = lhs * rhs
print(lhs, '*', rhs, '=', res)
lhs = res
i = 1 << 20
print(i * i)
print(i * -i)
print(-i * i)
print(-i * -i)
i = 1 << 40
print(i * i)
print(i * -i)
print(-i * i)
print(-i * -i) |
class Reference():
metadata = {}
def __init__(self, metadata: dict, figures: list):
self.metadata.update(metadata)
for fig in figures:
setattr(self, fig.name, fig)
class Figure():
"""
This is the base class for figure data.
"""
def __init__(self, name: str, lines: list):
self.name = name
self.lines = lines
class Line():
def __init__(self, x, y, label):
self.x = x
self.y = y
self.label = label | class Reference:
metadata = {}
def __init__(self, metadata: dict, figures: list):
self.metadata.update(metadata)
for fig in figures:
setattr(self, fig.name, fig)
class Figure:
"""
This is the base class for figure data.
"""
def __init__(self, name: str, lines: list):
self.name = name
self.lines = lines
class Line:
def __init__(self, x, y, label):
self.x = x
self.y = y
self.label = label |
class Solution:
def findComplement(self, num: int) -> int:
r = '{:08b}'.format(num).lstrip('0')
r2 = ''
for i in r:
if i == '0':
r2 += '1'
else:
r2 += '0'
r3 = int(r2, 2)
return r3
if __name__ == '__main__':
s = Solution()
r = s.findComplement(5)
print(r)
| class Solution:
def find_complement(self, num: int) -> int:
r = '{:08b}'.format(num).lstrip('0')
r2 = ''
for i in r:
if i == '0':
r2 += '1'
else:
r2 += '0'
r3 = int(r2, 2)
return r3
if __name__ == '__main__':
s = solution()
r = s.findComplement(5)
print(r) |
__copyright__ = """
Copyright 2021 Amazon.com, Inc. or its affiliates.
Copyright 2021 Netflix Inc.
Copyright 2021 Google LLC
"""
__license__ = """
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.
"""
APPLICATIONS_LIST_TOPIC = "dab/applications/list"
APPLICATIONS_LAUNCH_TOPIC = "dab/applications/launch"
APPLICATIONS_LAUNCH_WITH_CONTENT_TOPIC = "dab/applications/launch-with-content"
APPLICATIONS_EXIT_TOPIC = "dab/applications/exit"
APPLICATIONS_GET_STATE_TOPIC = "dab/applications/get-state"
SYSTEM_RESTART_TOPIC = "dab/system/restart"
SYSTEM_LANGUAGE_LIST_TOPIC = "dab/system/language/list"
SYSTEM_LANGUAGE_GET_TOPIC = "dab/system/language/get"
SYSTEM_LANGUAGE_SET_TOPIC = "dab/system/language/set"
DEVICE_TELEMETRY_START_TOPIC = "dab/device-telemetry/start"
DEVICE_TELEMETRY_STOP_TOPIC = "dab/device-telemetry/stop"
APPLICATION_TELEMETRY_START_TOPIC = "dab/app-telemetry/start"
APPLICATION_TELEMETRY_STOP_TOPIC = "dab/app-telemetry/stop"
INPUT_KEY_PRESS_TOPIC = "dab/input/key-press"
INPUT_LONG_KEY_PRESS_TOPIC = "dab/input/long-key-press"
HEALTH_CHECK_TOPIC = "dab/health-check/get"
DEVICE_INFO_TOPIC = "dab/device/info"
DAB_VERSION_TOPIC = "dab/version"
| __copyright__ = '\n Copyright 2021 Amazon.com, Inc. or its affiliates.\n Copyright 2021 Netflix Inc.\n Copyright 2021 Google LLC\n'
__license__ = '\n Licensed under the Apache License, Version 2.0 (the "License");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n'
applications_list_topic = 'dab/applications/list'
applications_launch_topic = 'dab/applications/launch'
applications_launch_with_content_topic = 'dab/applications/launch-with-content'
applications_exit_topic = 'dab/applications/exit'
applications_get_state_topic = 'dab/applications/get-state'
system_restart_topic = 'dab/system/restart'
system_language_list_topic = 'dab/system/language/list'
system_language_get_topic = 'dab/system/language/get'
system_language_set_topic = 'dab/system/language/set'
device_telemetry_start_topic = 'dab/device-telemetry/start'
device_telemetry_stop_topic = 'dab/device-telemetry/stop'
application_telemetry_start_topic = 'dab/app-telemetry/start'
application_telemetry_stop_topic = 'dab/app-telemetry/stop'
input_key_press_topic = 'dab/input/key-press'
input_long_key_press_topic = 'dab/input/long-key-press'
health_check_topic = 'dab/health-check/get'
device_info_topic = 'dab/device/info'
dab_version_topic = 'dab/version' |
def filter_museums(request):
sub = {'nature': 1,
'memorial': 2,
'art': 3,
'gallery': 4,
'history': 5}
categories = [sub[i] for i in sub if request.GET.get(i) != 'false']
return categories
| def filter_museums(request):
sub = {'nature': 1, 'memorial': 2, 'art': 3, 'gallery': 4, 'history': 5}
categories = [sub[i] for i in sub if request.GET.get(i) != 'false']
return categories |
for i in range(1, 70, 2):
s= str(i+1)
print("printf \"26\\n30\\n" + s + "\\n\" > tile.sizes")
print("./polycc --tile --parallel NusValidation.cpp")
print("gcc -o nus" + s + " -O2 NusValidation.cpp.pluto.c -fopenmp -lm")
print("cp nus" + s + " exp")
print("./exp/nus" + s)
| for i in range(1, 70, 2):
s = str(i + 1)
print('printf "26\\n30\\n' + s + '\\n" > tile.sizes')
print('./polycc --tile --parallel NusValidation.cpp')
print('gcc -o nus' + s + ' -O2 NusValidation.cpp.pluto.c -fopenmp -lm')
print('cp nus' + s + ' exp')
print('./exp/nus' + s) |
# Puzzle Input
with open('Day05_Input.txt') as puzzle_input:
seats = puzzle_input.read().split('\n')
# Converts a list containing a binary number to a decimal number
def bin_to_decimal(bin_num):
dec_num = 0
bin_len = len(bin_num)
for pos, bit in enumerate(bin_num):
if bit == 1:
dec_num += 2 ** (bin_len - pos - 1)
return dec_num
# Calculates all the seats IDs
seat_id = []
for s in seats:
seat_position = [[], []]
# Convert from letters to binary
for letter in s[:-3]:
seat_position[0] += [0] if letter == 'F' else [1]
for letter in s[-3:]:
seat_position[1] += [0] if letter == 'L' else [1]
# Convert from binary to seat ID
seat_id += [bin_to_decimal(seat_position[0]) * 8 + bin_to_decimal(seat_position[1])]
print(max(seat_id))
| with open('Day05_Input.txt') as puzzle_input:
seats = puzzle_input.read().split('\n')
def bin_to_decimal(bin_num):
dec_num = 0
bin_len = len(bin_num)
for (pos, bit) in enumerate(bin_num):
if bit == 1:
dec_num += 2 ** (bin_len - pos - 1)
return dec_num
seat_id = []
for s in seats:
seat_position = [[], []]
for letter in s[:-3]:
seat_position[0] += [0] if letter == 'F' else [1]
for letter in s[-3:]:
seat_position[1] += [0] if letter == 'L' else [1]
seat_id += [bin_to_decimal(seat_position[0]) * 8 + bin_to_decimal(seat_position[1])]
print(max(seat_id)) |
# All traversals in one: Pre, post and inorder
# Time complexity: O(3n)
# Space complexity: O(4n), 4 stacks are being used
class Node():
def __init__(self, key):
self.left = None
self.value = key
self.right = None
def traversal(node):
if node is None:
return []
stack = [[node, 1]]
preorder = []
inorder = []
postorder = []
while(len(stack)!=0):
curr = stack[-1][0]
if(stack[-1][1] == 1):
preorder.append(curr.value)
stack[-1][1] += 1
if(curr.left):
stack.append([curr.left, 1])
if(stack[-1][1] == 2):
inorder.append(curr.value)
stack[-1][1] += 1
if(curr.right):
stack.append([curr.right, 1])
if(stack[-1][1] == 3):
postorder.append(curr.value)
stack.pop()
return(preorder, inorder, postorder)
root = Node(1)
root.left = Node(2)
root.right = Node(7)
root.left.left = Node(3)
root.left.left.right = Node(4)
root.left.left.right.right = Node(5)
root.left.left.right.right.right = Node(6)
root.right.left = Node(8)
root.right.right = Node(9)
root.right.right.right = Node(10)
preorder, inorder, postorder = traversal(root)
print('Inorder traversal:', inorder)
print('Preorder traversal:', preorder)
print('Postorder traversal:', postorder)
| class Node:
def __init__(self, key):
self.left = None
self.value = key
self.right = None
def traversal(node):
if node is None:
return []
stack = [[node, 1]]
preorder = []
inorder = []
postorder = []
while len(stack) != 0:
curr = stack[-1][0]
if stack[-1][1] == 1:
preorder.append(curr.value)
stack[-1][1] += 1
if curr.left:
stack.append([curr.left, 1])
if stack[-1][1] == 2:
inorder.append(curr.value)
stack[-1][1] += 1
if curr.right:
stack.append([curr.right, 1])
if stack[-1][1] == 3:
postorder.append(curr.value)
stack.pop()
return (preorder, inorder, postorder)
root = node(1)
root.left = node(2)
root.right = node(7)
root.left.left = node(3)
root.left.left.right = node(4)
root.left.left.right.right = node(5)
root.left.left.right.right.right = node(6)
root.right.left = node(8)
root.right.right = node(9)
root.right.right.right = node(10)
(preorder, inorder, postorder) = traversal(root)
print('Inorder traversal:', inorder)
print('Preorder traversal:', preorder)
print('Postorder traversal:', postorder) |
file = open("/disk/lulu/database/TSGene/pro/TSG.genepos.qukong.txt")
#f = open("out.txt", "w")
for line in file:
# print line,
list = line.strip().split("\t")
# print list
if list[4] == "-":
line1 = line.strip().replace("-", "")
print (line1)
# print >> f, "%s" % line1
else:
print (list[0], "\t", list[1], "\t", list[2], "\t", list[3], "\t", list[5], "\t", list[6], "\t", list[7], "\t", list[8])
list1 = list[4].strip().split('|')
for i in list1:
print (list[0], "\t", list[1], "\t", list[2], "\t", i, "\t", list[5], "\t", list[6], "\t", list[7], "\t", list[8]) | file = open('/disk/lulu/database/TSGene/pro/TSG.genepos.qukong.txt')
for line in file:
list = line.strip().split('\t')
if list[4] == '-':
line1 = line.strip().replace('-', '')
print(line1)
else:
print(list[0], '\t', list[1], '\t', list[2], '\t', list[3], '\t', list[5], '\t', list[6], '\t', list[7], '\t', list[8])
list1 = list[4].strip().split('|')
for i in list1:
print(list[0], '\t', list[1], '\t', list[2], '\t', i, '\t', list[5], '\t', list[6], '\t', list[7], '\t', list[8]) |
# -*- coding: utf-8 -*-
class EndOfStream(Exception):
pass
class InvalidSyntaxError(Exception):
pass
class InvalidCommandFormat(InvalidSyntaxError):
pass
class TokenNotFound(InvalidSyntaxError):
pass
class DeprecatedSyntax(InvalidSyntaxError):
pass
class RenderingError(Exception):
pass
class ApertureSelectionError(Exception):
pass
class FeatureNotSupportedError(Exception):
pass
def suppress_context(exc: Exception) -> Exception:
exc.__suppress_context__ = True
return exc
| class Endofstream(Exception):
pass
class Invalidsyntaxerror(Exception):
pass
class Invalidcommandformat(InvalidSyntaxError):
pass
class Tokennotfound(InvalidSyntaxError):
pass
class Deprecatedsyntax(InvalidSyntaxError):
pass
class Renderingerror(Exception):
pass
class Apertureselectionerror(Exception):
pass
class Featurenotsupportederror(Exception):
pass
def suppress_context(exc: Exception) -> Exception:
exc.__suppress_context__ = True
return exc |
src = []
include_tmp = []
if aos_global_config.compiler == 'armcc':
src = Split('''
compilers/armlibc/armcc_libc.c
''')
include_tmp = Split('''
compilers/armlibc
''')
elif aos_global_config.compiler == 'rvct':
src = Split('''
compilers/armlibc/armcc_libc.c
''')
include_tmp = Split('''
compilers/armlibc
''')
elif aos_global_config.compiler == 'iar':
src = Split('''
compilers/iar/iar_libc.c
''')
include_tmp = Split('''
compilers/iar
''')
elif aos_global_config.board != 'linuxhost':
src = Split('''
newlib_stub.c
''')
component = aos_component('newlib_stub', src)
for i in include_tmp:
component.add_global_includes(i) | src = []
include_tmp = []
if aos_global_config.compiler == 'armcc':
src = split('\n compilers/armlibc/armcc_libc.c\n ')
include_tmp = split('\n compilers/armlibc\n ')
elif aos_global_config.compiler == 'rvct':
src = split('\n compilers/armlibc/armcc_libc.c\n ')
include_tmp = split('\n compilers/armlibc\n ')
elif aos_global_config.compiler == 'iar':
src = split('\n compilers/iar/iar_libc.c\n ')
include_tmp = split('\n compilers/iar\n ')
elif aos_global_config.board != 'linuxhost':
src = split('\n newlib_stub.c\n ')
component = aos_component('newlib_stub', src)
for i in include_tmp:
component.add_global_includes(i) |
#
# PySNMP MIB module CISCO-PRIVATE-VLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-PRIVATE-VLAN-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:33:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint")
ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
vtpVlanEntry, vtpVlanEditEntry = mibBuilder.importSymbols("CISCO-VTP-MIB", "vtpVlanEntry", "vtpVlanEditEntry")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup")
Counter32, IpAddress, Unsigned32, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, TimeTicks, MibIdentifier, ObjectIdentity, Counter64, Integer32, Bits, iso, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "IpAddress", "Unsigned32", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "TimeTicks", "MibIdentifier", "ObjectIdentity", "Counter64", "Integer32", "Bits", "iso", "NotificationType")
TextualConvention, TruthValue, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "DisplayString")
ciscoPrivateVlanMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 173))
ciscoPrivateVlanMIB.setRevisions(('2005-09-08 00:00', '2002-07-24 00:00', '2001-05-23 00:00', '2001-04-17 00:00',))
if mibBuilder.loadTexts: ciscoPrivateVlanMIB.setLastUpdated('200509080000Z')
if mibBuilder.loadTexts: ciscoPrivateVlanMIB.setOrganization('Cisco Systems, Inc.')
class PrivateVlanType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))
namedValues = NamedValues(("normal", 1), ("primary", 2), ("isolated", 3), ("community", 4), ("twoWayCommunity", 5))
class VlanIndexOrZero(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 4095)
class VlanIndexBitmap(TextualConvention, OctetString):
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 128)
cpvlanMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1))
cpvlanVlanObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1))
cpvlanPortObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2))
cpvlanSVIObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3))
cpvlanVlanTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1), )
if mibBuilder.loadTexts: cpvlanVlanTable.setStatus('current')
cpvlanVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1), )
vtpVlanEntry.registerAugmentions(("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanEntry"))
cpvlanVlanEntry.setIndexNames(*vtpVlanEntry.getIndexNames())
if mibBuilder.loadTexts: cpvlanVlanEntry.setStatus('current')
cpvlanVlanPrivateVlanType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1, 1), PrivateVlanType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpvlanVlanPrivateVlanType.setStatus('current')
cpvlanVlanAssociatedPrimaryVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1, 2), VlanIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpvlanVlanAssociatedPrimaryVlan.setStatus('current')
cpvlanVlanEditTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2), )
if mibBuilder.loadTexts: cpvlanVlanEditTable.setStatus('current')
cpvlanVlanEditEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1), )
vtpVlanEditEntry.registerAugmentions(("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanEditEntry"))
cpvlanVlanEditEntry.setIndexNames(*vtpVlanEditEntry.getIndexNames())
if mibBuilder.loadTexts: cpvlanVlanEditEntry.setStatus('current')
cpvlanVlanEditPrivateVlanType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1, 1), PrivateVlanType().clone('normal')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanVlanEditPrivateVlanType.setStatus('current')
cpvlanVlanEditAssocPrimaryVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1, 2), VlanIndexOrZero()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanVlanEditAssocPrimaryVlan.setStatus('current')
cpvlanPrivatePortTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1), )
if mibBuilder.loadTexts: cpvlanPrivatePortTable.setStatus('current')
cpvlanPrivatePortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: cpvlanPrivatePortEntry.setStatus('current')
cpvlanPrivatePortSecondaryVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1, 1, 1), VlanIndexOrZero()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanPrivatePortSecondaryVlan.setStatus('current')
cpvlanPromPortTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2), )
if mibBuilder.loadTexts: cpvlanPromPortTable.setStatus('current')
cpvlanPromPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: cpvlanPromPortEntry.setStatus('current')
cpvlanPromPortMultiPrimaryVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 1), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpvlanPromPortMultiPrimaryVlan.setStatus('current')
cpvlanPromPortSecondaryRemap = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap.setStatus('current')
cpvlanPromPortSecondaryRemap2k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap2k.setStatus('current')
cpvlanPromPortSecondaryRemap3k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap3k.setStatus('current')
cpvlanPromPortSecondaryRemap4k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap4k.setStatus('current')
cpvlanPromPortTwoWayRemapCapable = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 6), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpvlanPromPortTwoWayRemapCapable.setStatus('current')
cpvlanPortModeTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3), )
if mibBuilder.loadTexts: cpvlanPortModeTable.setStatus('current')
cpvlanPortModeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: cpvlanPortModeEntry.setStatus('current')
cpvlanPortMode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("nonPrivateVlan", 1), ("host", 2), ("promiscuous", 3), ("secondaryTrunk", 4), ("promiscuousTrunk", 5))).clone('nonPrivateVlan')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanPortMode.setStatus('current')
cpvlanTrunkPortTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4), )
if mibBuilder.loadTexts: cpvlanTrunkPortTable.setStatus('current')
cpvlanTrunkPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: cpvlanTrunkPortEntry.setStatus('current')
cpvlanTrunkPortDynamicState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("onNoNegotiate", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanTrunkPortDynamicState.setStatus('current')
cpvlanTrunkPortEncapType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("dot1Q", 1), ("isl", 2), ("negotiate", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanTrunkPortEncapType.setStatus('current')
cpvlanTrunkPortNativeVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 3), VlanIndexOrZero()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanTrunkPortNativeVlan.setStatus('current')
cpvlanTrunkPortSecondaryVlans = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 4), VlanIndexBitmap()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans.setStatus('current')
cpvlanTrunkPortSecondaryVlans2k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 5), VlanIndexBitmap()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans2k.setStatus('current')
cpvlanTrunkPortSecondaryVlans3k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 6), VlanIndexBitmap()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans3k.setStatus('current')
cpvlanTrunkPortSecondaryVlans4k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 7), VlanIndexBitmap()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans4k.setStatus('current')
cpvlanTrunkPortNormalVlans = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 8), VlanIndexBitmap()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans.setStatus('current')
cpvlanTrunkPortNormalVlans2k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 9), VlanIndexBitmap()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans2k.setStatus('current')
cpvlanTrunkPortNormalVlans3k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 10), VlanIndexBitmap()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans3k.setStatus('current')
cpvlanTrunkPortNormalVlans4k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 11), VlanIndexBitmap()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans4k.setStatus('current')
cpvlanTrunkPortDynamicStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("trunking", 1), ("notTrunking", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpvlanTrunkPortDynamicStatus.setStatus('current')
cpvlanTrunkPortEncapOperType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("dot1Q", 1), ("isl", 2), ("notApplicable", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cpvlanTrunkPortEncapOperType.setStatus('current')
cpvlanSVIMappingTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1), )
if mibBuilder.loadTexts: cpvlanSVIMappingTable.setStatus('current')
cpvlanSVIMappingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1), ).setIndexNames((0, "CISCO-PRIVATE-VLAN-MIB", "cpvlanSVIMappingVlanIndex"))
if mibBuilder.loadTexts: cpvlanSVIMappingEntry.setStatus('current')
cpvlanSVIMappingVlanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1, 1), VlanIndexOrZero())
if mibBuilder.loadTexts: cpvlanSVIMappingVlanIndex.setStatus('current')
cpvlanSVIMappingPrimarySVI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1, 2), VlanIndexOrZero()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cpvlanSVIMappingPrimarySVI.setStatus('current')
cpvlanMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2))
cpvlanMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 1))
cpvlanMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2))
cpvlanMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 1, 1)).setObjects()
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlanMIBCompliance = cpvlanMIBCompliance.setStatus('current')
cpvlanVlanGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 1)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanPrivateVlanType"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanAssociatedPrimaryVlan"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanEditPrivateVlanType"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanEditAssocPrimaryVlan"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlanVlanGroup = cpvlanVlanGroup.setStatus('current')
cpvlanPrivatePortGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 2)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanPrivatePortSecondaryVlan"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlanPrivatePortGroup = cpvlanPrivatePortGroup.setStatus('current')
cpvlanPromPortGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 3)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortMultiPrimaryVlan"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortSecondaryRemap"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortTwoWayRemapCapable"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlanPromPortGroup = cpvlanPromPortGroup.setStatus('current')
cpvlanPromPort4kGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 4)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortSecondaryRemap2k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortSecondaryRemap3k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortSecondaryRemap4k"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlanPromPort4kGroup = cpvlanPromPort4kGroup.setStatus('current')
cpvlanPortModeGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 5)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanPortMode"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlanPortModeGroup = cpvlanPortModeGroup.setStatus('current')
cpvlanSVIMappingGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 6)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanSVIMappingPrimarySVI"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlanSVIMappingGroup = cpvlanSVIMappingGroup.setStatus('current')
cpvlanTrunkPortGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 7)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortDynamicState"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortEncapType"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortNativeVlan"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortSecondaryVlans"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortSecondaryVlans2k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortSecondaryVlans3k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortSecondaryVlans4k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortNormalVlans"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortNormalVlans2k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortNormalVlans3k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortNormalVlans4k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortDynamicStatus"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortEncapOperType"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlanTrunkPortGroup = cpvlanTrunkPortGroup.setStatus('current')
mibBuilder.exportSymbols("CISCO-PRIVATE-VLAN-MIB", cpvlanPromPortTwoWayRemapCapable=cpvlanPromPortTwoWayRemapCapable, cpvlanPortModeTable=cpvlanPortModeTable, cpvlanPromPort4kGroup=cpvlanPromPort4kGroup, VlanIndexBitmap=VlanIndexBitmap, cpvlanVlanTable=cpvlanVlanTable, cpvlanVlanEditAssocPrimaryVlan=cpvlanVlanEditAssocPrimaryVlan, cpvlanTrunkPortTable=cpvlanTrunkPortTable, cpvlanPortModeGroup=cpvlanPortModeGroup, cpvlanPromPortGroup=cpvlanPromPortGroup, cpvlanTrunkPortEncapOperType=cpvlanTrunkPortEncapOperType, cpvlanMIBConformance=cpvlanMIBConformance, cpvlanPrivatePortSecondaryVlan=cpvlanPrivatePortSecondaryVlan, cpvlanTrunkPortNormalVlans2k=cpvlanTrunkPortNormalVlans2k, cpvlanVlanPrivateVlanType=cpvlanVlanPrivateVlanType, cpvlanSVIObjects=cpvlanSVIObjects, PrivateVlanType=PrivateVlanType, cpvlanPortModeEntry=cpvlanPortModeEntry, cpvlanTrunkPortDynamicState=cpvlanTrunkPortDynamicState, cpvlanTrunkPortNativeVlan=cpvlanTrunkPortNativeVlan, VlanIndexOrZero=VlanIndexOrZero, cpvlanPromPortSecondaryRemap4k=cpvlanPromPortSecondaryRemap4k, cpvlanVlanObjects=cpvlanVlanObjects, cpvlanPromPortEntry=cpvlanPromPortEntry, cpvlanPromPortSecondaryRemap3k=cpvlanPromPortSecondaryRemap3k, cpvlanTrunkPortEncapType=cpvlanTrunkPortEncapType, cpvlanSVIMappingGroup=cpvlanSVIMappingGroup, cpvlanTrunkPortSecondaryVlans2k=cpvlanTrunkPortSecondaryVlans2k, cpvlanTrunkPortEntry=cpvlanTrunkPortEntry, cpvlanSVIMappingTable=cpvlanSVIMappingTable, cpvlanVlanGroup=cpvlanVlanGroup, cpvlanVlanEditPrivateVlanType=cpvlanVlanEditPrivateVlanType, cpvlanPortObjects=cpvlanPortObjects, cpvlanSVIMappingVlanIndex=cpvlanSVIMappingVlanIndex, PYSNMP_MODULE_ID=ciscoPrivateVlanMIB, cpvlanSVIMappingEntry=cpvlanSVIMappingEntry, cpvlanMIBCompliance=cpvlanMIBCompliance, cpvlanTrunkPortSecondaryVlans3k=cpvlanTrunkPortSecondaryVlans3k, cpvlanVlanEditTable=cpvlanVlanEditTable, cpvlanPrivatePortGroup=cpvlanPrivatePortGroup, cpvlanSVIMappingPrimarySVI=cpvlanSVIMappingPrimarySVI, cpvlanVlanEntry=cpvlanVlanEntry, cpvlanPrivatePortTable=cpvlanPrivatePortTable, cpvlanTrunkPortDynamicStatus=cpvlanTrunkPortDynamicStatus, cpvlanPromPortSecondaryRemap2k=cpvlanPromPortSecondaryRemap2k, cpvlanPromPortMultiPrimaryVlan=cpvlanPromPortMultiPrimaryVlan, cpvlanPortMode=cpvlanPortMode, cpvlanMIBCompliances=cpvlanMIBCompliances, cpvlanPromPortTable=cpvlanPromPortTable, cpvlanTrunkPortNormalVlans=cpvlanTrunkPortNormalVlans, ciscoPrivateVlanMIB=ciscoPrivateVlanMIB, cpvlanVlanAssociatedPrimaryVlan=cpvlanVlanAssociatedPrimaryVlan, cpvlanVlanEditEntry=cpvlanVlanEditEntry, cpvlanTrunkPortGroup=cpvlanTrunkPortGroup, cpvlanPromPortSecondaryRemap=cpvlanPromPortSecondaryRemap, cpvlanTrunkPortNormalVlans3k=cpvlanTrunkPortNormalVlans3k, cpvlanMIBObjects=cpvlanMIBObjects, cpvlanTrunkPortSecondaryVlans4k=cpvlanTrunkPortSecondaryVlans4k, cpvlanTrunkPortNormalVlans4k=cpvlanTrunkPortNormalVlans4k, cpvlanMIBGroups=cpvlanMIBGroups, cpvlanPrivatePortEntry=cpvlanPrivatePortEntry, cpvlanTrunkPortSecondaryVlans=cpvlanTrunkPortSecondaryVlans)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint')
(cisco_mgmt,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoMgmt')
(vtp_vlan_entry, vtp_vlan_edit_entry) = mibBuilder.importSymbols('CISCO-VTP-MIB', 'vtpVlanEntry', 'vtpVlanEditEntry')
(if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex')
(notification_group, module_compliance, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance', 'ObjectGroup')
(counter32, ip_address, unsigned32, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, gauge32, time_ticks, mib_identifier, object_identity, counter64, integer32, bits, iso, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'IpAddress', 'Unsigned32', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Gauge32', 'TimeTicks', 'MibIdentifier', 'ObjectIdentity', 'Counter64', 'Integer32', 'Bits', 'iso', 'NotificationType')
(textual_convention, truth_value, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'TruthValue', 'DisplayString')
cisco_private_vlan_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 9, 173))
ciscoPrivateVlanMIB.setRevisions(('2005-09-08 00:00', '2002-07-24 00:00', '2001-05-23 00:00', '2001-04-17 00:00'))
if mibBuilder.loadTexts:
ciscoPrivateVlanMIB.setLastUpdated('200509080000Z')
if mibBuilder.loadTexts:
ciscoPrivateVlanMIB.setOrganization('Cisco Systems, Inc.')
class Privatevlantype(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5))
named_values = named_values(('normal', 1), ('primary', 2), ('isolated', 3), ('community', 4), ('twoWayCommunity', 5))
class Vlanindexorzero(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 4095)
class Vlanindexbitmap(TextualConvention, OctetString):
status = 'current'
subtype_spec = OctetString.subtypeSpec + value_size_constraint(0, 128)
cpvlan_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1))
cpvlan_vlan_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1))
cpvlan_port_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2))
cpvlan_svi_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3))
cpvlan_vlan_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1))
if mibBuilder.loadTexts:
cpvlanVlanTable.setStatus('current')
cpvlan_vlan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1))
vtpVlanEntry.registerAugmentions(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanEntry'))
cpvlanVlanEntry.setIndexNames(*vtpVlanEntry.getIndexNames())
if mibBuilder.loadTexts:
cpvlanVlanEntry.setStatus('current')
cpvlan_vlan_private_vlan_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1, 1), private_vlan_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cpvlanVlanPrivateVlanType.setStatus('current')
cpvlan_vlan_associated_primary_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1, 2), vlan_index_or_zero()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cpvlanVlanAssociatedPrimaryVlan.setStatus('current')
cpvlan_vlan_edit_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2))
if mibBuilder.loadTexts:
cpvlanVlanEditTable.setStatus('current')
cpvlan_vlan_edit_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1))
vtpVlanEditEntry.registerAugmentions(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanEditEntry'))
cpvlanVlanEditEntry.setIndexNames(*vtpVlanEditEntry.getIndexNames())
if mibBuilder.loadTexts:
cpvlanVlanEditEntry.setStatus('current')
cpvlan_vlan_edit_private_vlan_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1, 1), private_vlan_type().clone('normal')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanVlanEditPrivateVlanType.setStatus('current')
cpvlan_vlan_edit_assoc_primary_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1, 2), vlan_index_or_zero()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanVlanEditAssocPrimaryVlan.setStatus('current')
cpvlan_private_port_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1))
if mibBuilder.loadTexts:
cpvlanPrivatePortTable.setStatus('current')
cpvlan_private_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
cpvlanPrivatePortEntry.setStatus('current')
cpvlan_private_port_secondary_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1, 1, 1), vlan_index_or_zero()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanPrivatePortSecondaryVlan.setStatus('current')
cpvlan_prom_port_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2))
if mibBuilder.loadTexts:
cpvlanPromPortTable.setStatus('current')
cpvlan_prom_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
cpvlanPromPortEntry.setStatus('current')
cpvlan_prom_port_multi_primary_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 1), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cpvlanPromPortMultiPrimaryVlan.setStatus('current')
cpvlan_prom_port_secondary_remap = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanPromPortSecondaryRemap.setStatus('current')
cpvlan_prom_port_secondary_remap2k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanPromPortSecondaryRemap2k.setStatus('current')
cpvlan_prom_port_secondary_remap3k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanPromPortSecondaryRemap3k.setStatus('current')
cpvlan_prom_port_secondary_remap4k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 5), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanPromPortSecondaryRemap4k.setStatus('current')
cpvlan_prom_port_two_way_remap_capable = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 6), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cpvlanPromPortTwoWayRemapCapable.setStatus('current')
cpvlan_port_mode_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3))
if mibBuilder.loadTexts:
cpvlanPortModeTable.setStatus('current')
cpvlan_port_mode_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
cpvlanPortModeEntry.setStatus('current')
cpvlan_port_mode = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('nonPrivateVlan', 1), ('host', 2), ('promiscuous', 3), ('secondaryTrunk', 4), ('promiscuousTrunk', 5))).clone('nonPrivateVlan')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanPortMode.setStatus('current')
cpvlan_trunk_port_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4))
if mibBuilder.loadTexts:
cpvlanTrunkPortTable.setStatus('current')
cpvlan_trunk_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
cpvlanTrunkPortEntry.setStatus('current')
cpvlan_trunk_port_dynamic_state = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('on', 1), ('onNoNegotiate', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanTrunkPortDynamicState.setStatus('current')
cpvlan_trunk_port_encap_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('dot1Q', 1), ('isl', 2), ('negotiate', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanTrunkPortEncapType.setStatus('current')
cpvlan_trunk_port_native_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 3), vlan_index_or_zero()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanTrunkPortNativeVlan.setStatus('current')
cpvlan_trunk_port_secondary_vlans = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 4), vlan_index_bitmap()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanTrunkPortSecondaryVlans.setStatus('current')
cpvlan_trunk_port_secondary_vlans2k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 5), vlan_index_bitmap()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanTrunkPortSecondaryVlans2k.setStatus('current')
cpvlan_trunk_port_secondary_vlans3k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 6), vlan_index_bitmap()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanTrunkPortSecondaryVlans3k.setStatus('current')
cpvlan_trunk_port_secondary_vlans4k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 7), vlan_index_bitmap()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanTrunkPortSecondaryVlans4k.setStatus('current')
cpvlan_trunk_port_normal_vlans = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 8), vlan_index_bitmap()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanTrunkPortNormalVlans.setStatus('current')
cpvlan_trunk_port_normal_vlans2k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 9), vlan_index_bitmap()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanTrunkPortNormalVlans2k.setStatus('current')
cpvlan_trunk_port_normal_vlans3k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 10), vlan_index_bitmap()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanTrunkPortNormalVlans3k.setStatus('current')
cpvlan_trunk_port_normal_vlans4k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 11), vlan_index_bitmap()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanTrunkPortNormalVlans4k.setStatus('current')
cpvlan_trunk_port_dynamic_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('trunking', 1), ('notTrunking', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cpvlanTrunkPortDynamicStatus.setStatus('current')
cpvlan_trunk_port_encap_oper_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('dot1Q', 1), ('isl', 2), ('notApplicable', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cpvlanTrunkPortEncapOperType.setStatus('current')
cpvlan_svi_mapping_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1))
if mibBuilder.loadTexts:
cpvlanSVIMappingTable.setStatus('current')
cpvlan_svi_mapping_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1)).setIndexNames((0, 'CISCO-PRIVATE-VLAN-MIB', 'cpvlanSVIMappingVlanIndex'))
if mibBuilder.loadTexts:
cpvlanSVIMappingEntry.setStatus('current')
cpvlan_svi_mapping_vlan_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1, 1), vlan_index_or_zero())
if mibBuilder.loadTexts:
cpvlanSVIMappingVlanIndex.setStatus('current')
cpvlan_svi_mapping_primary_svi = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1, 2), vlan_index_or_zero()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cpvlanSVIMappingPrimarySVI.setStatus('current')
cpvlan_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2))
cpvlan_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 1))
cpvlan_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2))
cpvlan_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 1, 1)).setObjects()
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlan_mib_compliance = cpvlanMIBCompliance.setStatus('current')
cpvlan_vlan_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 1)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanPrivateVlanType'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanAssociatedPrimaryVlan'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanEditPrivateVlanType'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanEditAssocPrimaryVlan'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlan_vlan_group = cpvlanVlanGroup.setStatus('current')
cpvlan_private_port_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 2)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPrivatePortSecondaryVlan'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlan_private_port_group = cpvlanPrivatePortGroup.setStatus('current')
cpvlan_prom_port_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 3)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortMultiPrimaryVlan'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortSecondaryRemap'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortTwoWayRemapCapable'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlan_prom_port_group = cpvlanPromPortGroup.setStatus('current')
cpvlan_prom_port4k_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 4)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortSecondaryRemap2k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortSecondaryRemap3k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortSecondaryRemap4k'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlan_prom_port4k_group = cpvlanPromPort4kGroup.setStatus('current')
cpvlan_port_mode_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 5)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPortMode'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlan_port_mode_group = cpvlanPortModeGroup.setStatus('current')
cpvlan_svi_mapping_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 6)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanSVIMappingPrimarySVI'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlan_svi_mapping_group = cpvlanSVIMappingGroup.setStatus('current')
cpvlan_trunk_port_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 7)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortDynamicState'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortEncapType'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortNativeVlan'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortSecondaryVlans'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortSecondaryVlans2k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortSecondaryVlans3k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortSecondaryVlans4k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortNormalVlans'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortNormalVlans2k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortNormalVlans3k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortNormalVlans4k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortDynamicStatus'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortEncapOperType'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cpvlan_trunk_port_group = cpvlanTrunkPortGroup.setStatus('current')
mibBuilder.exportSymbols('CISCO-PRIVATE-VLAN-MIB', cpvlanPromPortTwoWayRemapCapable=cpvlanPromPortTwoWayRemapCapable, cpvlanPortModeTable=cpvlanPortModeTable, cpvlanPromPort4kGroup=cpvlanPromPort4kGroup, VlanIndexBitmap=VlanIndexBitmap, cpvlanVlanTable=cpvlanVlanTable, cpvlanVlanEditAssocPrimaryVlan=cpvlanVlanEditAssocPrimaryVlan, cpvlanTrunkPortTable=cpvlanTrunkPortTable, cpvlanPortModeGroup=cpvlanPortModeGroup, cpvlanPromPortGroup=cpvlanPromPortGroup, cpvlanTrunkPortEncapOperType=cpvlanTrunkPortEncapOperType, cpvlanMIBConformance=cpvlanMIBConformance, cpvlanPrivatePortSecondaryVlan=cpvlanPrivatePortSecondaryVlan, cpvlanTrunkPortNormalVlans2k=cpvlanTrunkPortNormalVlans2k, cpvlanVlanPrivateVlanType=cpvlanVlanPrivateVlanType, cpvlanSVIObjects=cpvlanSVIObjects, PrivateVlanType=PrivateVlanType, cpvlanPortModeEntry=cpvlanPortModeEntry, cpvlanTrunkPortDynamicState=cpvlanTrunkPortDynamicState, cpvlanTrunkPortNativeVlan=cpvlanTrunkPortNativeVlan, VlanIndexOrZero=VlanIndexOrZero, cpvlanPromPortSecondaryRemap4k=cpvlanPromPortSecondaryRemap4k, cpvlanVlanObjects=cpvlanVlanObjects, cpvlanPromPortEntry=cpvlanPromPortEntry, cpvlanPromPortSecondaryRemap3k=cpvlanPromPortSecondaryRemap3k, cpvlanTrunkPortEncapType=cpvlanTrunkPortEncapType, cpvlanSVIMappingGroup=cpvlanSVIMappingGroup, cpvlanTrunkPortSecondaryVlans2k=cpvlanTrunkPortSecondaryVlans2k, cpvlanTrunkPortEntry=cpvlanTrunkPortEntry, cpvlanSVIMappingTable=cpvlanSVIMappingTable, cpvlanVlanGroup=cpvlanVlanGroup, cpvlanVlanEditPrivateVlanType=cpvlanVlanEditPrivateVlanType, cpvlanPortObjects=cpvlanPortObjects, cpvlanSVIMappingVlanIndex=cpvlanSVIMappingVlanIndex, PYSNMP_MODULE_ID=ciscoPrivateVlanMIB, cpvlanSVIMappingEntry=cpvlanSVIMappingEntry, cpvlanMIBCompliance=cpvlanMIBCompliance, cpvlanTrunkPortSecondaryVlans3k=cpvlanTrunkPortSecondaryVlans3k, cpvlanVlanEditTable=cpvlanVlanEditTable, cpvlanPrivatePortGroup=cpvlanPrivatePortGroup, cpvlanSVIMappingPrimarySVI=cpvlanSVIMappingPrimarySVI, cpvlanVlanEntry=cpvlanVlanEntry, cpvlanPrivatePortTable=cpvlanPrivatePortTable, cpvlanTrunkPortDynamicStatus=cpvlanTrunkPortDynamicStatus, cpvlanPromPortSecondaryRemap2k=cpvlanPromPortSecondaryRemap2k, cpvlanPromPortMultiPrimaryVlan=cpvlanPromPortMultiPrimaryVlan, cpvlanPortMode=cpvlanPortMode, cpvlanMIBCompliances=cpvlanMIBCompliances, cpvlanPromPortTable=cpvlanPromPortTable, cpvlanTrunkPortNormalVlans=cpvlanTrunkPortNormalVlans, ciscoPrivateVlanMIB=ciscoPrivateVlanMIB, cpvlanVlanAssociatedPrimaryVlan=cpvlanVlanAssociatedPrimaryVlan, cpvlanVlanEditEntry=cpvlanVlanEditEntry, cpvlanTrunkPortGroup=cpvlanTrunkPortGroup, cpvlanPromPortSecondaryRemap=cpvlanPromPortSecondaryRemap, cpvlanTrunkPortNormalVlans3k=cpvlanTrunkPortNormalVlans3k, cpvlanMIBObjects=cpvlanMIBObjects, cpvlanTrunkPortSecondaryVlans4k=cpvlanTrunkPortSecondaryVlans4k, cpvlanTrunkPortNormalVlans4k=cpvlanTrunkPortNormalVlans4k, cpvlanMIBGroups=cpvlanMIBGroups, cpvlanPrivatePortEntry=cpvlanPrivatePortEntry, cpvlanTrunkPortSecondaryVlans=cpvlanTrunkPortSecondaryVlans) |
"""
File contains the groovy scripts used by Nexus 3 script api as objects
that may be used in the nexus3 state module.
I put these here as it made it easy to sync the groovy with the module itself
"""
create_blobstore = """
import groovy.json.JsonSlurper
parsed_args = new JsonSlurper().parseText(args)
existingBlobStore = blobStore.getBlobStoreManager().get(parsed_args.name)
if (existingBlobStore == null) {
if (parsed_args.type == "S3") {
blobStore.createS3BlobStore(parsed_args.name, parsed_args.config)
msg = "S3 blobstore {} created"
} else {
blobStore.createFileBlobStore(parsed_args.name, parsed_args.path)
msg = "Created blobstore {} created"
}
log.info(msg, parsed_args.name)
} else {
msg = "Blobstore {} already exists. Left untouched"
}
log.info(msg, parsed_args.name)
"""
create_content_selector = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.selector.SelectorManager
import org.sonatype.nexus.selector.SelectorConfiguration
parsed_args = new JsonSlurper().parseText(args)
selectorManager = container.lookup(SelectorManager.class.name)
def selectorConfig
boolean update = true
selectorConfig = selectorManager.browse().find { it -> it.name == parsed_args.name }
if (selectorConfig == null) {
update = false
selectorConfig = new SelectorConfiguration(
'name': parsed_args.name
)
}
selectorConfig.setDescription(parsed_args.description)
selectorConfig.setType('csel')
selectorConfig.setAttributes([
'expression': parsed_args.search_expression
] as Map<String, Object>)
if (update) {
selectorManager.update(selectorConfig)
} else {
selectorManager.create(selectorConfig)
}
"""
create_repo_group = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.repository.config.Configuration
parsed_args = new JsonSlurper().parseText(args)
repositoryManager = repository.repositoryManager
existingRepository = repositoryManager.get(parsed_args.name)
if (existingRepository != null) {
newConfig = existingRepository.configuration.copy()
// We only update values we are allowed to change (cf. greyed out options in gui)
if (parsed_args.recipe_name == 'docker-group') {
newConfig.attributes['docker']['forceBasicAuth'] = parsed_args.docker_force_basic_auth
newConfig.attributes['docker']['v1Enabled'] = parsed_args.docker_v1_enabled
newConfig.attributes['docker']['httpPort'] = parsed_args.http_port
}
newConfig.attributes['group']['memberNames'] = parsed_args.member_repos
newConfig.attributes['storage']['strictContentTypeValidation'] = Boolean.valueOf(parsed_args.strict_content_validation)
repositoryManager.update(newConfig)
} else {
if (parsed_args.recipe_name == 'docker-group') {
configuration = new Configuration(
repositoryName: parsed_args.name,
recipeName: parsed_args.recipe_name,
online: true,
attributes: [
docker: [
forceBasicAuth: parsed_args.docker_force_basic_auth,
v1Enabled : parsed_args.docker_v1_enabled,
httpPort: parsed_args.docker_http_port
],
group: [
memberNames: parsed_args.member_repos
],
storage: [
blobStoreName: parsed_args.blob_store,
strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)
]
]
)
} else {
configuration = new Configuration(
repositoryName: parsed_args.name,
recipeName: parsed_args.recipe_name,
online: true,
attributes: [
group : [
memberNames: parsed_args.member_repos
],
storage: [
blobStoreName: parsed_args.blob_store,
strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)
]
]
)
}
repositoryManager.create(configuration)
}
"""
create_repo_hosted = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.repository.config.Configuration
parsed_args = new JsonSlurper().parseText(args)
repositoryManager = repository.repositoryManager
existingRepository = repositoryManager.get(parsed_args.name)
msg = "Args: {}"
log.debug(msg, args)
if (existingRepository != null) {
msg = "Repo {} already exists. Updating..."
log.debug(msg, parsed_args.name)
newConfig = existingRepository.configuration.copy()
// We only update values we are allowed to change (cf. greyed out options in gui)
if (parsed_args.recipe_name == 'docker-hosted') {
newConfig.attributes['docker']['forceBasicAuth'] = parsed_args.docker_force_basic_auth
newConfig.attributes['docker']['v1Enabled'] = parsed_args.docker_v1_enabled
newConfig.attributes['docker']['httpPort'] = parsed_args.docker_http_port
} else if (parsed_args.recipe_name == 'maven2-hosted') {
newConfig.attributes['maven']['versionPolicy'] = parsed_args.maven_version_policy.toUpperCase()
newConfig.attributes['maven']['layoutPolicy'] = parsed_args.maven_layout_policy.toUpperCase()
} else if (parsed_args.recipe_name == 'yum-hosted') {
newConfig.attributes['yum']['repodataDepth'] = parsed_args.yum_repodata_depth as Integer
newConfig.attributes['yum']['deployPolicy'] = parsed_args.yum_deploy_policy.toUpperCase()
}
newConfig.attributes['storage']['writePolicy'] = parsed_args.write_policy.toUpperCase()
newConfig.attributes['storage']['strictContentTypeValidation'] = Boolean.valueOf(parsed_args.strict_content_validation)
repositoryManager.update(newConfig)
} else {
if (parsed_args.recipe_name == 'maven2-hosted') {
configuration = new Configuration(
repositoryName: parsed_args.name,
recipeName: parsed_args.recipe_name,
online: true,
attributes: [
maven: [
versionPolicy: parsed_args.maven_version_policy.toUpperCase(),
layoutPolicy : parsed_args.maven_layout_policy.toUpperCase()
],
storage: [
writePolicy: parsed_args.write_policy.toUpperCase(),
blobStoreName: parsed_args.blob_store,
strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)
]
]
)
} else if (parsed_args.recipe_name == 'docker-hosted') {
configuration = new Configuration(
repositoryName: parsed_args.name,
recipeName: parsed_args.recipe_name,
online: true,
attributes: [
docker: [
forceBasicAuth: parsed_args.docker_force_basic_auth,
v1Enabled : parsed_args.docker_v1_enabled,
httpPort: parsed_args.docker_http_port
],
storage: [
writePolicy: parsed_args.write_policy.toUpperCase(),
blobStoreName: parsed_args.blob_store,
strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)
]
]
)
} else if (parsed_args.recipe_name == 'yum-hosted') {
configuration = new Configuration(
repositoryName: parsed_args.name,
recipeName: parsed_args.recipe_name,
online: true,
attributes: [
yum : [
repodataDepth : parsed_args.yum_repodata_depth.toInteger(),
deployPolicy : parsed_args.yum_deploy_policy.toUpperCase()
],
storage: [
writePolicy: parsed_args.write_policy.toUpperCase(),
blobStoreName: parsed_args.blob_store,
strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)
]
]
)
} else {
configuration = new Configuration(
repositoryName: parsed_args.name,
recipeName: parsed_args.recipe_name,
online: true,
attributes: [
storage: [
writePolicy: parsed_args.write_policy.toUpperCase(),
blobStoreName: parsed_args.blob_store,
strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)
]
]
)
}
msg = "Configuration: {}"
log.debug(msg, configuration)
repositoryManager.create(configuration)
}
"""
create_repo_proxy = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.repository.config.Configuration
parsed_args = new JsonSlurper().parseText(args)
repositoryManager = repository.repositoryManager
authentication = parsed_args.remote_username == null ? null : [
type: 'username',
username: parsed_args.remote_username,
password: parsed_args.remote_password
]
existingRepository = repositoryManager.get(parsed_args.name)
msg = "Args: {}"
log.debug(msg, args)
if (existingRepository != null) {
msg = "Repo {} already exists. Updating..."
log.debug(msg, parsed_args.name)
newConfig = existingRepository.configuration.copy()
// We only update values we are allowed to change (cf. greyed out options in gui)
if (parsed_args.recipe_name == 'docker-proxy') {
newConfig.attributes['docker']['forceBasicAuth'] = parsed_args.docker_force_basic_auth
newConfig.attributes['docker']['v1Enabled'] = parsed_args.docker_v1_enabled
newConfig.attributes['dockerProxy']['indexType'] = parsed_args.docker_index_type
newConfig.attributes['dockerProxy']['useTrustStoreForIndexAccess'] = parsed_args.docker_use_nexus_certificates_to_access_index
newConfig.attributes['docker']['httpPort'] = parsed_args.docker_http_port
} else if (parsed_args.recipe_name == 'maven2-proxy') {
newConfig.attributes['maven']['versionPolicy'] = parsed_args.maven_version_policy.toUpperCase()
newConfig.attributes['maven']['layoutPolicy'] = parsed_args.maven_layout_policy.toUpperCase()
}
newConfig.attributes['proxy']['remoteUrl'] = parsed_args.remote_url
newConfig.attributes['proxy']['contentMaxAge'] = parsed_args.get('content_max_age', 1440.0)
newConfig.attributes['proxy']['metadataMaxAge'] = parsed_args.get('metadata_max_age', 1440.0)
newConfig.attributes['storage']['strictContentTypeValidation'] = Boolean.valueOf(parsed_args.strict_content_validation)
newConfig.attributes['httpclient']['authentication'] = authentication
repositoryManager.update(newConfig)
} else {
if (parsed_args.recipe_name == 'bower-proxy') {
configuration = new Configuration(
repositoryName: parsed_args.name,
recipeName: parsed_args.recipe_name,
online: true,
attributes: [
bower: [
rewritePackageUrls: true
],
proxy: [
remoteUrl: parsed_args.remote_url,
contentMaxAge: parsed_args.get('content_max_age', 1440.0),
metadataMaxAge: parsed_args.get('metadata_max_age', 1440.0)
],
httpclient: [
blocked: false,
autoBlock: true,
authentication: authentication
],
storage: [
blobStoreName: parsed_args.blob_store,
strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)
],
negativeCache: [
enabled: parsed_args.get("negative_cache_enabled", true),
timeToLive: parsed_args.get("negative_cache_ttl", 1440.0)
]
]
)
} else if (parsed_args.recipe_name == 'maven2-proxy') {
configuration = new Configuration(
repositoryName: parsed_args.name,
recipeName: parsed_args.recipe_name,
online: true,
attributes: [
maven : [
versionPolicy: parsed_args.maven_version_policy.toUpperCase(),
layoutPolicy : parsed_args.maven_layout_policy.toUpperCase()
],
proxy: [
remoteUrl: parsed_args.remote_url,
contentMaxAge: parsed_args.get('content_max_age', 1440.0),
metadataMaxAge: parsed_args.get('metadata_max_age', 1440.0)
],
httpclient: [
blocked: false,
autoBlock: true,
authentication: authentication
],
storage: [
blobStoreName: parsed_args.blob_store,
strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)
],
negativeCache: [
enabled: parsed_args.get("negative_cache_enabled", true),
timeToLive: parsed_args.get("negative_cache_ttl", 1440.0)
]
]
)
} else if (parsed_args.recipe_name == 'docker-proxy') {
configuration = new Configuration(
repositoryName: parsed_args.name,
recipeName: parsed_args.recipe_name,
online: true,
attributes: [
docker: [
forceBasicAuth: parsed_args.docker_force_basic_auth,
v1Enabled : parsed_args.docker_v1_enabled,
httpPort: parsed_args.docker_http_port
],
proxy: [
remoteUrl: parsed_args.remote_url,
contentMaxAge: parsed_args.get('content_max_age', 1440.0),
metadataMaxAge: parsed_args.get('metadata_max_age', 1440.0)
],
dockerProxy: [
indexType: parsed_args.docker_index_type.toUpperCase(),
useTrustStoreForIndexAccess: parsed_args.docker_use_nexus_certificates_to_access_index
],
httpclient: [
blocked: false,
autoBlock: true,
authentication: authentication
],
storage: [
blobStoreName: parsed_args.blob_store,
strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)
],
negativeCache: [
enabled: parsed_args.get("negative_cache_enabled", true),
timeToLive: parsed_args.get("negative_cache_ttl", 1440.0)
]
]
)
} else {
configuration = new Configuration(
repositoryName: parsed_args.name,
recipeName: parsed_args.recipe_name,
online: true,
attributes: [
proxy: [
remoteUrl: parsed_args.remote_url,
contentMaxAge: parsed_args.get('content_max_age', 1440.0),
metadataMaxAge: parsed_args.get('metadata_max_age', 1440.0)
],
httpclient: [
blocked: false,
autoBlock: true,
authentication: authentication
],
storage: [
blobStoreName: parsed_args.blob_store,
strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)
],
negativeCache: [
enabled: parsed_args.get("negative_cache_enabled", true),
timeToLive: parsed_args.get("negative_cache_ttl", 1440.0)
]
]
)
}
msg = "Configuration: {}"
log.debug(msg, configuration)
repositoryManager.create(configuration)
}
"""
create_task = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.scheduling.TaskConfiguration
import org.sonatype.nexus.scheduling.TaskInfo
import org.sonatype.nexus.scheduling.TaskScheduler
import org.sonatype.nexus.scheduling.schedule.Schedule
parsed_args = new JsonSlurper().parseText(args)
TaskScheduler taskScheduler = container.lookup(TaskScheduler.class.getName())
TaskInfo existingTask = taskScheduler.listsTasks().find { TaskInfo taskInfo ->
taskInfo.name == parsed_args.name
}
if (existingTask && existingTask.getCurrentState().getRunState() != null) {
log.info("Could not update currently running task : " + parsed_args.name)
return
}
TaskConfiguration taskConfiguration = taskScheduler.createTaskConfigurationInstance(parsed_args.typeId)
if (existingTask) { taskConfiguration.setId(existingTask.getId()) }
taskConfiguration.setName(parsed_args.name)
parsed_args.taskProperties.each { key, value -> taskConfiguration.setString(key, value) }
if (parsed_args.task_alert_email) {
taskConfiguration.setAlertEmail(parsed_args.task_alert_email)
}
parsed_args.booleanTaskProperties.each { key, value -> taskConfiguration.setBoolean(key, Boolean.valueOf(value)) }
Schedule schedule = taskScheduler.scheduleFactory.cron(new Date(), parsed_args.cron)
taskScheduler.scheduleTask(taskConfiguration, schedule)
"""
delete_blobstore = """
import groovy.json.JsonSlurper
parsed_args = new JsonSlurper().parseText(args)
existingBlobStore = blobStore.getBlobStoreManager().get(parsed_args.name)
if (existingBlobStore != null) {
blobStore.getBlobStoreManager().delete(parsed_args.name)
}
"""
delete_repo = """
import groovy.json.JsonSlurper
parsed_args = new JsonSlurper().parseText(args)
repository.getRepositoryManager().delete(parsed_args.name)
"""
setup_anonymous_access = """
import groovy.json.JsonSlurper
parsed_args = new JsonSlurper().parseText(args)
security.setAnonymousAccess(Boolean.valueOf(parsed_args.anonymous_access))
"""
setup_base_url = """
import groovy.json.JsonSlurper
parsed_args = new JsonSlurper().parseText(args)
core.baseUrl(parsed_args.base_url)
"""
setup_capability = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.capability.CapabilityReference
import org.sonatype.nexus.capability.CapabilityType
import org.sonatype.nexus.internal.capability.DefaultCapabilityReference
import org.sonatype.nexus.internal.capability.DefaultCapabilityRegistry
parsed_args = new JsonSlurper().parseText(args)
parsed_args.capability_properties['headerEnabled'] = parsed_args.capability_properties['headerEnabled'].toString()
parsed_args.capability_properties['footerEnabled'] = parsed_args.capability_properties['footerEnabled'].toString()
def capabilityRegistry = container.lookup(DefaultCapabilityRegistry.class.getName())
def capabilityType = CapabilityType.capabilityType(parsed_args.capability_typeId)
DefaultCapabilityReference existing = capabilityRegistry.all.find { CapabilityReference capabilityReference ->
capabilityReference.context().descriptor().type() == capabilityType
}
if (existing) {
log.info(parsed_args.typeId + ' capability updated to: {}',
capabilityRegistry.update(existing.id(), Boolean.valueOf(parsed_args.get('capability_enabled', true)), existing.notes(), parsed_args.capability_properties).toString()
)
}
else {
log.info(parsed_args.typeId + ' capability created as: {}', capabilityRegistry.
add(capabilityType, Boolean.valueOf(parsed_args.get('capability_enabled', true)), 'configured through api', parsed_args.capability_properties).toString()
)
}
"""
setup_email = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.email.EmailConfiguration
import org.sonatype.nexus.email.EmailManager
parsed_args = new JsonSlurper().parseText(args)
def emailMgr = container.lookup(EmailManager.class.getName());
emailConfig = new EmailConfiguration(
enabled: parsed_args.email_server_enabled,
host: parsed_args.email_server_host,
port: Integer.valueOf(parsed_args.email_server_port),
username: parsed_args.email_server_username,
password: parsed_args.email_server_password,
fromAddress: parsed_args.email_from_address,
subjectPrefix: parsed_args.email_subject_prefix,
startTlsEnabled: parsed_args.email_tls_enabled,
startTlsRequired: parsed_args.email_tls_required,
sslOnConnectEnabled: parsed_args.email_ssl_on_connect_enabled,
sslCheckServerIdentityEnabled: parsed_args.email_ssl_check_server_identity_enabled,
nexusTrustStoreEnabled: parsed_args.email_trust_store_enabled
)
emailMgr.configuration = emailConfig
"""
setup_http_proxy = """
import groovy.json.JsonSlurper
parsed_args = new JsonSlurper().parseText(args)
core.removeHTTPProxy()
if (parsed_args.with_http_proxy) {
if (parsed_args.http_proxy_username) {
core.httpProxyWithBasicAuth(parsed_args.http_proxy_host, parsed_args.http_proxy_port as int, parsed_args.http_proxy_username, parsed_args.http_proxy_password)
} else {
core.httpProxy(parsed_args.http_proxy_host, parsed_args.http_proxy_port as int)
}
}
core.removeHTTPSProxy()
if (parsed_args.with_https_proxy) {
if (parsed_args.https_proxy_username) {
core.httpsProxyWithBasicAuth(parsed_args.https_proxy_host, parsed_args.https_proxy_port as int, parsed_args.https_proxy_username, parsed_args.https_proxy_password)
} else {
core.httpsProxy(parsed_args.https_proxy_host, parsed_args.https_proxy_port as int)
}
}
if (parsed_args.with_http_proxy || parsed_args.with_https_proxy) {
core.nonProxyHosts()
core.nonProxyHosts(parsed_args.proxy_exclude_hosts as String[])
}
"""
setup_ldap = """
import org.sonatype.nexus.ldap.persist.LdapConfigurationManager
import org.sonatype.nexus.ldap.persist.entity.LdapConfiguration
import org.sonatype.nexus.ldap.persist.entity.Connection
import org.sonatype.nexus.ldap.persist.entity.Mapping
import groovy.json.JsonSlurper
parsed_args = new JsonSlurper().parseText(args)
def ldapConfigMgr = container.lookup(LdapConfigurationManager.class.getName());
def ldapConfig = new LdapConfiguration()
boolean update = false;
// Look for existing config to update
ldapConfigMgr.listLdapServerConfigurations().each {
if (it.name == parsed_args.name) {
ldapConfig = it
update = true
}
}
ldapConfig.setName(parsed_args.name)
// Connection
connection = new Connection()
connection.setHost(new Connection.Host(Connection.Protocol.valueOf(parsed_args.protocol), parsed_args.hostname, Integer.valueOf(parsed_args.port)))
if (parsed_args.auth == "simple") {
connection.setAuthScheme("simple")
connection.setSystemUsername(parsed_args.username)
connection.setSystemPassword(parsed_args.password)
} else {
connection.setAuthScheme("none")
}
connection.setSearchBase(parsed_args.search_base)
connection.setConnectionTimeout(30)
connection.setConnectionRetryDelay(300)
connection.setMaxIncidentsCount(3)
ldapConfig.setConnection(connection)
// Mapping
mapping = new Mapping()
mapping.setUserBaseDn(parsed_args.user_base_dn)
mapping.setLdapFilter(parsed_args.user_ldap_filter)
mapping.setUserObjectClass(parsed_args.user_object_class)
mapping.setUserIdAttribute(parsed_args.user_id_attribute)
mapping.setUserRealNameAttribute(parsed_args.user_real_name_attribute)
mapping.setEmailAddressAttribute(parsed_args.user_email_attribute)
if (parsed_args.map_groups_as_roles) {
if(parsed_args.map_groups_as_roles_type == "static"){
mapping.setLdapGroupsAsRoles(true)
mapping.setGroupBaseDn(parsed_args.group_base_dn)
mapping.setGroupObjectClass(parsed_args.group_object_class)
mapping.setGroupIdAttribute(parsed_args.group_id_attribute)
mapping.setGroupMemberAttribute(parsed_args.group_member_attribute)
mapping.setGroupMemberFormat(parsed_args.group_member_format)
} else if (parsed_args.map_groups_as_roles_type == "dynamic") {
mapping.setLdapGroupsAsRoles(true)
mapping.setUserMemberOfAttribute(parsed_args.user_memberof_attribute)
}
}
mapping.setUserSubtree(parsed_args.user_subtree)
mapping.setGroupSubtree(parsed_args.group_subtree)
ldapConfig.setMapping(mapping)
if (update) {
ldapConfigMgr.updateLdapServerConfiguration(ldapConfig)
} else {
ldapConfigMgr.addLdapServerConfiguration(ldapConfig)
}
"""
setup_privilege = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.security.privilege.NoSuchPrivilegeException
import org.sonatype.nexus.security.user.UserManager
import org.sonatype.nexus.security.privilege.Privilege
parsed_args = new JsonSlurper().parseText(args)
authManager = security.getSecuritySystem().getAuthorizationManager(UserManager.DEFAULT_SOURCE)
def privilege
boolean update = true
try {
privilege = authManager.getPrivilege(parsed_args.name)
} catch (NoSuchPrivilegeException ignored) {
// could not find any existing privilege
update = false
privilege = new Privilege(
'id': parsed_args.name,
'name': parsed_args.name
)
}
privilege.setDescription(parsed_args.description)
privilege.setType(parsed_args.type)
privilege.setProperties([
'format': parsed_args.format,
'contentSelector': parsed_args.contentSelector,
'repository': parsed_args.repository,
'actions': parsed_args.actions.join(',')
] as Map<String, String>)
if (update) {
authManager.updatePrivilege(privilege)
log.info("Privilege {} updated", parsed_args.name)
} else {
authManager.addPrivilege(privilege)
log.info("Privilege {} created", parsed_args.name)
}
"""
setup_realms = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.security.realm.RealmManager
parsed_args = new JsonSlurper().parseText(args)
realmManager = container.lookup(RealmManager.class.getName())
if (parsed_args.realm_name == 'NuGetApiKey') {
// enable/disable the NuGet API-Key Realm
realmManager.enableRealm("NuGetApiKey", parsed_args.status)
}
if (parsed_args.realm_name == 'NpmToken') {
// enable/disable the npm Bearer Token Realm
realmManager.enableRealm("NpmToken", parsed_args.status)
}
if (parsed_args.realm_name == 'rutauth-realm') {
// enable/disable the Rut Auth Realm
realmManager.enableRealm("rutauth-realm", parsed_args.status)
}
if (parsed_args.realm_name == 'LdapRealm') {
// enable/disable the LDAP Realm
realmManager.enableRealm("LdapRealm", parsed_args.status)
}
if (parsed_args.realm_name == 'DockerToken') {
// enable/disable the Docker Bearer Token Realm
realmManager.enableRealm("DockerToken", parsed_args.status)
}
"""
setup_role = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.security.user.UserManager
import org.sonatype.nexus.security.role.NoSuchRoleException
parsed_args = new JsonSlurper().parseText(args)
authManager = security.getSecuritySystem().getAuthorizationManager(UserManager.DEFAULT_SOURCE)
privileges = (parsed_args.privileges == null ? new HashSet() : parsed_args.privileges.toSet())
roles = (parsed_args.roles == null ? new HashSet() : parsed_args.roles.toSet())
try {
existingRole = authManager.getRole(parsed_args.id)
existingRole.setName(parsed_args.name)
existingRole.setDescription(parsed_args.description)
existingRole.setPrivileges(privileges)
existingRole.setRoles(roles)
authManager.updateRole(existingRole)
log.info("Role {} updated", parsed_args.name)
} catch (NoSuchRoleException ignored) {
security.addRole(parsed_args.id, parsed_args.name, parsed_args.description, privileges.toList(), roles.toList())
log.info("Role {} created", parsed_args.name)
}
"""
setup_user = """
import groovy.json.JsonSlurper
import org.sonatype.nexus.security.user.UserManager
import org.sonatype.nexus.security.user.UserNotFoundException
import org.sonatype.nexus.security.user.User
parsed_args = new JsonSlurper().parseText(args)
state = parsed_args.state == null ? 'present' : parsed_args.state
if ( state == 'absent' ) {
deleteUser(parsed_args)
} else {
try {
updateUser(parsed_args)
} catch (UserNotFoundException ignored) {
addUser(parsed_args)
}
}
def updateUser(parsed_args) {
User user = security.securitySystem.getUser(parsed_args.username)
user.setFirstName(parsed_args.first_name)
user.setLastName(parsed_args.last_name)
user.setEmailAddress(parsed_args.email)
security.securitySystem.updateUser(user)
security.setUserRoles(parsed_args.username, parsed_args.roles)
security.securitySystem.changePassword(parsed_args.username, parsed_args.password)
log.info("Updated user {}", parsed_args.username)
}
def addUser(parsed_args) {
security.addUser(parsed_args.username, parsed_args.first_name, parsed_args.last_name, parsed_args.email, true, parsed_args.password, parsed_args.roles)
log.info("Created user {}", parsed_args.username)
}
def deleteUser(parsed_args) {
try {
security.securitySystem.deleteUser(parsed_args.username, UserManager.DEFAULT_SOURCE)
log.info("Deleted user {}", parsed_args.username)
} catch (UserNotFoundException ignored) {
log.info("Delete user: user {} does not exist", parsed_args.username)
}
}
"""
update_admin_password = """
import groovy.json.JsonSlurper
parsed_args = new JsonSlurper().parseText(args)
security.securitySystem.changePassword('admin', parsed_args.new_password)
"""
| """
File contains the groovy scripts used by Nexus 3 script api as objects
that may be used in the nexus3 state module.
I put these here as it made it easy to sync the groovy with the module itself
"""
create_blobstore = '\nimport groovy.json.JsonSlurper\n\nparsed_args = new JsonSlurper().parseText(args)\n\nexistingBlobStore = blobStore.getBlobStoreManager().get(parsed_args.name)\nif (existingBlobStore == null) {\n if (parsed_args.type == "S3") {\n blobStore.createS3BlobStore(parsed_args.name, parsed_args.config)\n msg = "S3 blobstore {} created"\n } else {\n blobStore.createFileBlobStore(parsed_args.name, parsed_args.path)\n msg = "Created blobstore {} created"\n }\n log.info(msg, parsed_args.name)\n} else {\n msg = "Blobstore {} already exists. Left untouched"\n}\n\nlog.info(msg, parsed_args.name)\n'
create_content_selector = "\nimport groovy.json.JsonSlurper\nimport org.sonatype.nexus.selector.SelectorManager\nimport org.sonatype.nexus.selector.SelectorConfiguration\n\nparsed_args = new JsonSlurper().parseText(args)\n\nselectorManager = container.lookup(SelectorManager.class.name)\n\ndef selectorConfig\nboolean update = true\n\nselectorConfig = selectorManager.browse().find { it -> it.name == parsed_args.name } \n\nif (selectorConfig == null) {\n update = false\n selectorConfig = new SelectorConfiguration(\n 'name': parsed_args.name\n )\n}\n\nselectorConfig.setDescription(parsed_args.description)\nselectorConfig.setType('csel')\nselectorConfig.setAttributes([\n 'expression': parsed_args.search_expression\n] as Map<String, Object>)\n\nif (update) {\n selectorManager.update(selectorConfig)\n} else {\n selectorManager.create(selectorConfig)\n}\n"
create_repo_group = "\nimport groovy.json.JsonSlurper\nimport org.sonatype.nexus.repository.config.Configuration\n\nparsed_args = new JsonSlurper().parseText(args)\n\nrepositoryManager = repository.repositoryManager\n\nexistingRepository = repositoryManager.get(parsed_args.name)\n\nif (existingRepository != null) {\n\n newConfig = existingRepository.configuration.copy()\n // We only update values we are allowed to change (cf. greyed out options in gui)\n if (parsed_args.recipe_name == 'docker-group') {\n newConfig.attributes['docker']['forceBasicAuth'] = parsed_args.docker_force_basic_auth\n newConfig.attributes['docker']['v1Enabled'] = parsed_args.docker_v1_enabled\n newConfig.attributes['docker']['httpPort'] = parsed_args.http_port\n }\n newConfig.attributes['group']['memberNames'] = parsed_args.member_repos\n newConfig.attributes['storage']['strictContentTypeValidation'] = Boolean.valueOf(parsed_args.strict_content_validation)\n\n repositoryManager.update(newConfig)\n\n} else {\n\n if (parsed_args.recipe_name == 'docker-group') {\n configuration = new Configuration(\n repositoryName: parsed_args.name,\n recipeName: parsed_args.recipe_name,\n online: true,\n attributes: [\n docker: [\n forceBasicAuth: parsed_args.docker_force_basic_auth,\n v1Enabled : parsed_args.docker_v1_enabled,\n httpPort: parsed_args.docker_http_port\n ],\n group: [\n memberNames: parsed_args.member_repos\n ],\n storage: [\n blobStoreName: parsed_args.blob_store,\n strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)\n ]\n ]\n )\n } else {\n configuration = new Configuration(\n repositoryName: parsed_args.name,\n recipeName: parsed_args.recipe_name,\n online: true,\n attributes: [\n group : [\n memberNames: parsed_args.member_repos\n ],\n storage: [\n blobStoreName: parsed_args.blob_store,\n strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)\n ]\n ]\n )\n }\n\n repositoryManager.create(configuration)\n\n}\n"
create_repo_hosted = '\nimport groovy.json.JsonSlurper\nimport org.sonatype.nexus.repository.config.Configuration\n\nparsed_args = new JsonSlurper().parseText(args)\n\nrepositoryManager = repository.repositoryManager\n\nexistingRepository = repositoryManager.get(parsed_args.name)\n\nmsg = "Args: {}"\nlog.debug(msg, args)\n\nif (existingRepository != null) {\n\n msg = "Repo {} already exists. Updating..."\n log.debug(msg, parsed_args.name)\n\n newConfig = existingRepository.configuration.copy()\n // We only update values we are allowed to change (cf. greyed out options in gui)\n if (parsed_args.recipe_name == \'docker-hosted\') {\n newConfig.attributes[\'docker\'][\'forceBasicAuth\'] = parsed_args.docker_force_basic_auth\n newConfig.attributes[\'docker\'][\'v1Enabled\'] = parsed_args.docker_v1_enabled\n newConfig.attributes[\'docker\'][\'httpPort\'] = parsed_args.docker_http_port\n } else if (parsed_args.recipe_name == \'maven2-hosted\') {\n newConfig.attributes[\'maven\'][\'versionPolicy\'] = parsed_args.maven_version_policy.toUpperCase()\n newConfig.attributes[\'maven\'][\'layoutPolicy\'] = parsed_args.maven_layout_policy.toUpperCase()\n } else if (parsed_args.recipe_name == \'yum-hosted\') {\n newConfig.attributes[\'yum\'][\'repodataDepth\'] = parsed_args.yum_repodata_depth as Integer\n newConfig.attributes[\'yum\'][\'deployPolicy\'] = parsed_args.yum_deploy_policy.toUpperCase()\n }\n\n newConfig.attributes[\'storage\'][\'writePolicy\'] = parsed_args.write_policy.toUpperCase()\n newConfig.attributes[\'storage\'][\'strictContentTypeValidation\'] = Boolean.valueOf(parsed_args.strict_content_validation)\n\n repositoryManager.update(newConfig)\n\n} else {\n\n if (parsed_args.recipe_name == \'maven2-hosted\') {\n configuration = new Configuration(\n repositoryName: parsed_args.name,\n recipeName: parsed_args.recipe_name,\n online: true,\n attributes: [\n maven: [\n versionPolicy: parsed_args.maven_version_policy.toUpperCase(),\n layoutPolicy : parsed_args.maven_layout_policy.toUpperCase()\n ],\n storage: [\n writePolicy: parsed_args.write_policy.toUpperCase(),\n blobStoreName: parsed_args.blob_store,\n strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)\n ]\n ]\n )\n } else if (parsed_args.recipe_name == \'docker-hosted\') {\n configuration = new Configuration(\n repositoryName: parsed_args.name,\n recipeName: parsed_args.recipe_name,\n online: true,\n attributes: [\n docker: [\n forceBasicAuth: parsed_args.docker_force_basic_auth,\n v1Enabled : parsed_args.docker_v1_enabled,\n httpPort: parsed_args.docker_http_port\n ],\n storage: [\n writePolicy: parsed_args.write_policy.toUpperCase(),\n blobStoreName: parsed_args.blob_store,\n strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)\n ]\n ]\n )\n } else if (parsed_args.recipe_name == \'yum-hosted\') {\n configuration = new Configuration(\n repositoryName: parsed_args.name,\n recipeName: parsed_args.recipe_name,\n online: true,\n attributes: [\n yum : [\n repodataDepth : parsed_args.yum_repodata_depth.toInteger(),\n deployPolicy : parsed_args.yum_deploy_policy.toUpperCase()\n ],\n storage: [\n writePolicy: parsed_args.write_policy.toUpperCase(),\n blobStoreName: parsed_args.blob_store,\n strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)\n ]\n ]\n )\n } else { \n configuration = new Configuration(\n repositoryName: parsed_args.name,\n recipeName: parsed_args.recipe_name,\n online: true,\n attributes: [\n storage: [\n writePolicy: parsed_args.write_policy.toUpperCase(),\n blobStoreName: parsed_args.blob_store,\n strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)\n ]\n ]\n )\n }\n\n msg = "Configuration: {}"\n log.debug(msg, configuration)\n\n repositoryManager.create(configuration)\n\n}\n'
create_repo_proxy = '\nimport groovy.json.JsonSlurper\nimport org.sonatype.nexus.repository.config.Configuration\n\nparsed_args = new JsonSlurper().parseText(args)\n\nrepositoryManager = repository.repositoryManager\n\nauthentication = parsed_args.remote_username == null ? null : [\n type: \'username\',\n username: parsed_args.remote_username,\n password: parsed_args.remote_password\n]\n\nexistingRepository = repositoryManager.get(parsed_args.name)\n\nmsg = "Args: {}"\nlog.debug(msg, args)\n\nif (existingRepository != null) {\n\n msg = "Repo {} already exists. Updating..."\n log.debug(msg, parsed_args.name)\n\n newConfig = existingRepository.configuration.copy()\n // We only update values we are allowed to change (cf. greyed out options in gui)\n if (parsed_args.recipe_name == \'docker-proxy\') {\n newConfig.attributes[\'docker\'][\'forceBasicAuth\'] = parsed_args.docker_force_basic_auth\n newConfig.attributes[\'docker\'][\'v1Enabled\'] = parsed_args.docker_v1_enabled\n newConfig.attributes[\'dockerProxy\'][\'indexType\'] = parsed_args.docker_index_type\n newConfig.attributes[\'dockerProxy\'][\'useTrustStoreForIndexAccess\'] = parsed_args.docker_use_nexus_certificates_to_access_index\n newConfig.attributes[\'docker\'][\'httpPort\'] = parsed_args.docker_http_port\n } else if (parsed_args.recipe_name == \'maven2-proxy\') {\n newConfig.attributes[\'maven\'][\'versionPolicy\'] = parsed_args.maven_version_policy.toUpperCase()\n newConfig.attributes[\'maven\'][\'layoutPolicy\'] = parsed_args.maven_layout_policy.toUpperCase()\n }\n\n newConfig.attributes[\'proxy\'][\'remoteUrl\'] = parsed_args.remote_url\n newConfig.attributes[\'proxy\'][\'contentMaxAge\'] = parsed_args.get(\'content_max_age\', 1440.0)\n newConfig.attributes[\'proxy\'][\'metadataMaxAge\'] = parsed_args.get(\'metadata_max_age\', 1440.0)\n newConfig.attributes[\'storage\'][\'strictContentTypeValidation\'] = Boolean.valueOf(parsed_args.strict_content_validation)\n newConfig.attributes[\'httpclient\'][\'authentication\'] = authentication\n\n repositoryManager.update(newConfig)\n\n} else {\n\n if (parsed_args.recipe_name == \'bower-proxy\') {\n configuration = new Configuration(\n repositoryName: parsed_args.name,\n recipeName: parsed_args.recipe_name,\n online: true,\n attributes: [\n bower: [\n rewritePackageUrls: true\n ],\n proxy: [\n remoteUrl: parsed_args.remote_url,\n contentMaxAge: parsed_args.get(\'content_max_age\', 1440.0),\n metadataMaxAge: parsed_args.get(\'metadata_max_age\', 1440.0)\n ],\n httpclient: [\n blocked: false,\n autoBlock: true,\n authentication: authentication\n ],\n storage: [\n blobStoreName: parsed_args.blob_store,\n strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)\n ],\n negativeCache: [\n enabled: parsed_args.get("negative_cache_enabled", true),\n timeToLive: parsed_args.get("negative_cache_ttl", 1440.0)\n ]\n ]\n )\n } else if (parsed_args.recipe_name == \'maven2-proxy\') {\n configuration = new Configuration(\n repositoryName: parsed_args.name,\n recipeName: parsed_args.recipe_name,\n online: true,\n attributes: [\n maven : [\n versionPolicy: parsed_args.maven_version_policy.toUpperCase(),\n layoutPolicy : parsed_args.maven_layout_policy.toUpperCase()\n ],\n proxy: [\n remoteUrl: parsed_args.remote_url,\n contentMaxAge: parsed_args.get(\'content_max_age\', 1440.0),\n metadataMaxAge: parsed_args.get(\'metadata_max_age\', 1440.0)\n ],\n httpclient: [\n blocked: false,\n autoBlock: true,\n authentication: authentication\n ],\n storage: [\n blobStoreName: parsed_args.blob_store,\n strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)\n ],\n negativeCache: [\n enabled: parsed_args.get("negative_cache_enabled", true),\n timeToLive: parsed_args.get("negative_cache_ttl", 1440.0)\n ]\n ]\n )\n } else if (parsed_args.recipe_name == \'docker-proxy\') {\n configuration = new Configuration(\n repositoryName: parsed_args.name,\n recipeName: parsed_args.recipe_name,\n online: true,\n attributes: [\n docker: [\n forceBasicAuth: parsed_args.docker_force_basic_auth,\n v1Enabled : parsed_args.docker_v1_enabled,\n httpPort: parsed_args.docker_http_port\n ],\n proxy: [\n remoteUrl: parsed_args.remote_url,\n contentMaxAge: parsed_args.get(\'content_max_age\', 1440.0),\n metadataMaxAge: parsed_args.get(\'metadata_max_age\', 1440.0)\n ],\n dockerProxy: [\n indexType: parsed_args.docker_index_type.toUpperCase(),\n useTrustStoreForIndexAccess: parsed_args.docker_use_nexus_certificates_to_access_index\n ],\n httpclient: [\n blocked: false,\n autoBlock: true,\n authentication: authentication\n ],\n storage: [\n blobStoreName: parsed_args.blob_store,\n strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)\n ],\n negativeCache: [\n enabled: parsed_args.get("negative_cache_enabled", true),\n timeToLive: parsed_args.get("negative_cache_ttl", 1440.0)\n ]\n ]\n )\n } else {\n configuration = new Configuration(\n repositoryName: parsed_args.name,\n recipeName: parsed_args.recipe_name,\n online: true,\n attributes: [\n proxy: [\n remoteUrl: parsed_args.remote_url,\n contentMaxAge: parsed_args.get(\'content_max_age\', 1440.0),\n metadataMaxAge: parsed_args.get(\'metadata_max_age\', 1440.0)\n ],\n httpclient: [\n blocked: false,\n autoBlock: true,\n authentication: authentication\n ],\n storage: [\n blobStoreName: parsed_args.blob_store,\n strictContentTypeValidation: Boolean.valueOf(parsed_args.strict_content_validation)\n ],\n negativeCache: [\n enabled: parsed_args.get("negative_cache_enabled", true),\n timeToLive: parsed_args.get("negative_cache_ttl", 1440.0)\n ]\n ]\n )\n }\n\n msg = "Configuration: {}"\n log.debug(msg, configuration)\n\n repositoryManager.create(configuration)\n\n}\n'
create_task = '\nimport groovy.json.JsonSlurper\nimport org.sonatype.nexus.scheduling.TaskConfiguration\nimport org.sonatype.nexus.scheduling.TaskInfo\nimport org.sonatype.nexus.scheduling.TaskScheduler\nimport org.sonatype.nexus.scheduling.schedule.Schedule\n\nparsed_args = new JsonSlurper().parseText(args)\n\nTaskScheduler taskScheduler = container.lookup(TaskScheduler.class.getName())\n\nTaskInfo existingTask = taskScheduler.listsTasks().find { TaskInfo taskInfo ->\n taskInfo.name == parsed_args.name\n}\n\nif (existingTask && existingTask.getCurrentState().getRunState() != null) {\n log.info("Could not update currently running task : " + parsed_args.name)\n return\n}\n\nTaskConfiguration taskConfiguration = taskScheduler.createTaskConfigurationInstance(parsed_args.typeId)\nif (existingTask) { taskConfiguration.setId(existingTask.getId()) }\ntaskConfiguration.setName(parsed_args.name)\n\nparsed_args.taskProperties.each { key, value -> taskConfiguration.setString(key, value) }\n\nif (parsed_args.task_alert_email) {\n taskConfiguration.setAlertEmail(parsed_args.task_alert_email)\n}\n\nparsed_args.booleanTaskProperties.each { key, value -> taskConfiguration.setBoolean(key, Boolean.valueOf(value)) }\n\nSchedule schedule = taskScheduler.scheduleFactory.cron(new Date(), parsed_args.cron)\n\ntaskScheduler.scheduleTask(taskConfiguration, schedule)\n'
delete_blobstore = '\nimport groovy.json.JsonSlurper\n\nparsed_args = new JsonSlurper().parseText(args)\n\nexistingBlobStore = blobStore.getBlobStoreManager().get(parsed_args.name)\nif (existingBlobStore != null) {\n blobStore.getBlobStoreManager().delete(parsed_args.name)\n}\n'
delete_repo = '\nimport groovy.json.JsonSlurper\n\nparsed_args = new JsonSlurper().parseText(args)\n\nrepository.getRepositoryManager().delete(parsed_args.name)\n'
setup_anonymous_access = '\nimport groovy.json.JsonSlurper\n\nparsed_args = new JsonSlurper().parseText(args)\n\nsecurity.setAnonymousAccess(Boolean.valueOf(parsed_args.anonymous_access))\n'
setup_base_url = '\nimport groovy.json.JsonSlurper\n\nparsed_args = new JsonSlurper().parseText(args)\n\ncore.baseUrl(parsed_args.base_url)\n'
setup_capability = "\nimport groovy.json.JsonSlurper\nimport org.sonatype.nexus.capability.CapabilityReference\nimport org.sonatype.nexus.capability.CapabilityType\nimport org.sonatype.nexus.internal.capability.DefaultCapabilityReference\nimport org.sonatype.nexus.internal.capability.DefaultCapabilityRegistry\n\nparsed_args = new JsonSlurper().parseText(args)\n\nparsed_args.capability_properties['headerEnabled'] = parsed_args.capability_properties['headerEnabled'].toString()\nparsed_args.capability_properties['footerEnabled'] = parsed_args.capability_properties['footerEnabled'].toString()\n\ndef capabilityRegistry = container.lookup(DefaultCapabilityRegistry.class.getName())\ndef capabilityType = CapabilityType.capabilityType(parsed_args.capability_typeId)\n\nDefaultCapabilityReference existing = capabilityRegistry.all.find { CapabilityReference capabilityReference ->\n capabilityReference.context().descriptor().type() == capabilityType\n}\n\nif (existing) {\n log.info(parsed_args.typeId + ' capability updated to: {}',\n capabilityRegistry.update(existing.id(), Boolean.valueOf(parsed_args.get('capability_enabled', true)), existing.notes(), parsed_args.capability_properties).toString()\n )\n}\nelse {\n log.info(parsed_args.typeId + ' capability created as: {}', capabilityRegistry.\n add(capabilityType, Boolean.valueOf(parsed_args.get('capability_enabled', true)), 'configured through api', parsed_args.capability_properties).toString()\n )\n}\n"
setup_email = '\nimport groovy.json.JsonSlurper\nimport org.sonatype.nexus.email.EmailConfiguration\nimport org.sonatype.nexus.email.EmailManager\n\nparsed_args = new JsonSlurper().parseText(args)\n\ndef emailMgr = container.lookup(EmailManager.class.getName());\n\nemailConfig = new EmailConfiguration(\n enabled: parsed_args.email_server_enabled,\n host: parsed_args.email_server_host,\n port: Integer.valueOf(parsed_args.email_server_port),\n username: parsed_args.email_server_username,\n password: parsed_args.email_server_password,\n fromAddress: parsed_args.email_from_address,\n subjectPrefix: parsed_args.email_subject_prefix,\n startTlsEnabled: parsed_args.email_tls_enabled,\n startTlsRequired: parsed_args.email_tls_required,\n sslOnConnectEnabled: parsed_args.email_ssl_on_connect_enabled,\n sslCheckServerIdentityEnabled: parsed_args.email_ssl_check_server_identity_enabled,\n nexusTrustStoreEnabled: parsed_args.email_trust_store_enabled\n)\n\nemailMgr.configuration = emailConfig\n'
setup_http_proxy = '\nimport groovy.json.JsonSlurper\n\nparsed_args = new JsonSlurper().parseText(args)\n\n\ncore.removeHTTPProxy()\nif (parsed_args.with_http_proxy) {\n if (parsed_args.http_proxy_username) {\n core.httpProxyWithBasicAuth(parsed_args.http_proxy_host, parsed_args.http_proxy_port as int, parsed_args.http_proxy_username, parsed_args.http_proxy_password)\n } else {\n core.httpProxy(parsed_args.http_proxy_host, parsed_args.http_proxy_port as int)\n }\n}\n\ncore.removeHTTPSProxy()\nif (parsed_args.with_https_proxy) {\n if (parsed_args.https_proxy_username) {\n core.httpsProxyWithBasicAuth(parsed_args.https_proxy_host, parsed_args.https_proxy_port as int, parsed_args.https_proxy_username, parsed_args.https_proxy_password)\n } else {\n core.httpsProxy(parsed_args.https_proxy_host, parsed_args.https_proxy_port as int)\n }\n}\n\nif (parsed_args.with_http_proxy || parsed_args.with_https_proxy) {\n core.nonProxyHosts()\n core.nonProxyHosts(parsed_args.proxy_exclude_hosts as String[])\n}\n'
setup_ldap = '\nimport org.sonatype.nexus.ldap.persist.LdapConfigurationManager\nimport org.sonatype.nexus.ldap.persist.entity.LdapConfiguration\nimport org.sonatype.nexus.ldap.persist.entity.Connection\nimport org.sonatype.nexus.ldap.persist.entity.Mapping\nimport groovy.json.JsonSlurper\n\nparsed_args = new JsonSlurper().parseText(args)\n\n\ndef ldapConfigMgr = container.lookup(LdapConfigurationManager.class.getName());\n\ndef ldapConfig = new LdapConfiguration()\nboolean update = false;\n\n// Look for existing config to update\nldapConfigMgr.listLdapServerConfigurations().each {\n if (it.name == parsed_args.name) {\n ldapConfig = it\n update = true\n }\n}\n\nldapConfig.setName(parsed_args.name)\n\n// Connection\nconnection = new Connection()\nconnection.setHost(new Connection.Host(Connection.Protocol.valueOf(parsed_args.protocol), parsed_args.hostname, Integer.valueOf(parsed_args.port)))\nif (parsed_args.auth == "simple") {\n connection.setAuthScheme("simple")\n connection.setSystemUsername(parsed_args.username)\n connection.setSystemPassword(parsed_args.password)\n} else {\n connection.setAuthScheme("none")\n}\nconnection.setSearchBase(parsed_args.search_base)\nconnection.setConnectionTimeout(30)\nconnection.setConnectionRetryDelay(300)\nconnection.setMaxIncidentsCount(3)\nldapConfig.setConnection(connection)\n\n\n// Mapping\nmapping = new Mapping()\nmapping.setUserBaseDn(parsed_args.user_base_dn)\nmapping.setLdapFilter(parsed_args.user_ldap_filter)\nmapping.setUserObjectClass(parsed_args.user_object_class)\nmapping.setUserIdAttribute(parsed_args.user_id_attribute)\nmapping.setUserRealNameAttribute(parsed_args.user_real_name_attribute)\nmapping.setEmailAddressAttribute(parsed_args.user_email_attribute)\n\nif (parsed_args.map_groups_as_roles) {\n if(parsed_args.map_groups_as_roles_type == "static"){\n mapping.setLdapGroupsAsRoles(true)\n mapping.setGroupBaseDn(parsed_args.group_base_dn)\n mapping.setGroupObjectClass(parsed_args.group_object_class)\n mapping.setGroupIdAttribute(parsed_args.group_id_attribute)\n mapping.setGroupMemberAttribute(parsed_args.group_member_attribute)\n mapping.setGroupMemberFormat(parsed_args.group_member_format)\n } else if (parsed_args.map_groups_as_roles_type == "dynamic") {\n mapping.setLdapGroupsAsRoles(true)\n mapping.setUserMemberOfAttribute(parsed_args.user_memberof_attribute)\n }\n}\n\nmapping.setUserSubtree(parsed_args.user_subtree)\nmapping.setGroupSubtree(parsed_args.group_subtree)\n\nldapConfig.setMapping(mapping)\n\n\nif (update) {\n ldapConfigMgr.updateLdapServerConfiguration(ldapConfig)\n} else {\n ldapConfigMgr.addLdapServerConfiguration(ldapConfig)\n}\n'
setup_privilege = '\nimport groovy.json.JsonSlurper\nimport org.sonatype.nexus.security.privilege.NoSuchPrivilegeException\nimport org.sonatype.nexus.security.user.UserManager\nimport org.sonatype.nexus.security.privilege.Privilege\n\nparsed_args = new JsonSlurper().parseText(args)\n\nauthManager = security.getSecuritySystem().getAuthorizationManager(UserManager.DEFAULT_SOURCE)\n\ndef privilege\nboolean update = true\n\ntry {\n privilege = authManager.getPrivilege(parsed_args.name)\n} catch (NoSuchPrivilegeException ignored) {\n // could not find any existing privilege\n update = false\n privilege = new Privilege(\n \'id\': parsed_args.name,\n \'name\': parsed_args.name\n )\n}\n\nprivilege.setDescription(parsed_args.description)\nprivilege.setType(parsed_args.type)\nprivilege.setProperties([\n \'format\': parsed_args.format,\n \'contentSelector\': parsed_args.contentSelector,\n \'repository\': parsed_args.repository,\n \'actions\': parsed_args.actions.join(\',\')\n] as Map<String, String>)\n\nif (update) {\n authManager.updatePrivilege(privilege)\n log.info("Privilege {} updated", parsed_args.name)\n} else {\n authManager.addPrivilege(privilege)\n log.info("Privilege {} created", parsed_args.name)\n}\n'
setup_realms = '\nimport groovy.json.JsonSlurper\nimport org.sonatype.nexus.security.realm.RealmManager\n\nparsed_args = new JsonSlurper().parseText(args)\n\nrealmManager = container.lookup(RealmManager.class.getName())\n\nif (parsed_args.realm_name == \'NuGetApiKey\') {\n // enable/disable the NuGet API-Key Realm\n realmManager.enableRealm("NuGetApiKey", parsed_args.status)\n}\n\nif (parsed_args.realm_name == \'NpmToken\') {\n // enable/disable the npm Bearer Token Realm\n realmManager.enableRealm("NpmToken", parsed_args.status)\n}\n\nif (parsed_args.realm_name == \'rutauth-realm\') {\n // enable/disable the Rut Auth Realm\n realmManager.enableRealm("rutauth-realm", parsed_args.status)\n}\n\nif (parsed_args.realm_name == \'LdapRealm\') {\n // enable/disable the LDAP Realm\n realmManager.enableRealm("LdapRealm", parsed_args.status)\n}\n\nif (parsed_args.realm_name == \'DockerToken\') {\n // enable/disable the Docker Bearer Token Realm\n realmManager.enableRealm("DockerToken", parsed_args.status)\n}\n'
setup_role = '\nimport groovy.json.JsonSlurper\nimport org.sonatype.nexus.security.user.UserManager\nimport org.sonatype.nexus.security.role.NoSuchRoleException\n\nparsed_args = new JsonSlurper().parseText(args)\n\nauthManager = security.getSecuritySystem().getAuthorizationManager(UserManager.DEFAULT_SOURCE)\n\nprivileges = (parsed_args.privileges == null ? new HashSet() : parsed_args.privileges.toSet())\nroles = (parsed_args.roles == null ? new HashSet() : parsed_args.roles.toSet())\n\ntry {\n existingRole = authManager.getRole(parsed_args.id)\n existingRole.setName(parsed_args.name)\n existingRole.setDescription(parsed_args.description)\n existingRole.setPrivileges(privileges)\n existingRole.setRoles(roles)\n authManager.updateRole(existingRole)\n log.info("Role {} updated", parsed_args.name)\n} catch (NoSuchRoleException ignored) {\n security.addRole(parsed_args.id, parsed_args.name, parsed_args.description, privileges.toList(), roles.toList())\n log.info("Role {} created", parsed_args.name)\n}\n'
setup_user = '\nimport groovy.json.JsonSlurper\nimport org.sonatype.nexus.security.user.UserManager\nimport org.sonatype.nexus.security.user.UserNotFoundException\nimport org.sonatype.nexus.security.user.User\n\nparsed_args = new JsonSlurper().parseText(args)\nstate = parsed_args.state == null ? \'present\' : parsed_args.state\n\nif ( state == \'absent\' ) {\n deleteUser(parsed_args)\n} else {\n try {\n updateUser(parsed_args)\n } catch (UserNotFoundException ignored) {\n addUser(parsed_args)\n }\n}\n\ndef updateUser(parsed_args) {\n User user = security.securitySystem.getUser(parsed_args.username)\n user.setFirstName(parsed_args.first_name)\n user.setLastName(parsed_args.last_name)\n user.setEmailAddress(parsed_args.email)\n security.securitySystem.updateUser(user)\n security.setUserRoles(parsed_args.username, parsed_args.roles)\n security.securitySystem.changePassword(parsed_args.username, parsed_args.password)\n log.info("Updated user {}", parsed_args.username)\n}\n\ndef addUser(parsed_args) {\n security.addUser(parsed_args.username, parsed_args.first_name, parsed_args.last_name, parsed_args.email, true, parsed_args.password, parsed_args.roles)\n log.info("Created user {}", parsed_args.username)\n}\n\ndef deleteUser(parsed_args) {\n try {\n security.securitySystem.deleteUser(parsed_args.username, UserManager.DEFAULT_SOURCE)\n log.info("Deleted user {}", parsed_args.username)\n } catch (UserNotFoundException ignored) {\n log.info("Delete user: user {} does not exist", parsed_args.username)\n }\n}\n'
update_admin_password = "\nimport groovy.json.JsonSlurper\n\nparsed_args = new JsonSlurper().parseText(args)\n\nsecurity.securitySystem.changePassword('admin', parsed_args.new_password)\n" |
def compose_maxmin(R, S):
"""
X = {1: 0, 2: 0.2, 3: 0.4}
Y = {1: 0, 2: 0.2}
Relation (X*Y) = {(1, 1): 0, (1, 2): 0, (2, 1): 0, (2, 2): 0.04, (3, 1): 0, (3, 2): 0.08}
:param R: a dictionary like above example that
:param S: a dictionary like above example
:return: RoS a composition of R to S
For example:
R = {(1,1):0.7, (1,2):0.3, (2,1):0.8, (2,2):0.4}
S = {(1,1):0.9, (1,2):0.6, (1,3):0.2, (2,1):0.1, (2,2):0.7, (2,3):0.5}
RoS = {(1, 2): 0.6, (1, 3): 0.3, (2, 3): 0.4, (2, 2): 0.6, (1, 1): 0.7, (2, 1): 0.8}
"""
if not isinstance(R, dict):
raise TypeError("input argument should be a dictionary.")
if not isinstance(S, dict):
raise TypeError("input argument should be a dictionary.")
if len(list(R.keys())) < 1:
raise ValueError("dictionary 'R' should have at least one member.")
if len(list(S.keys())) < 1:
raise ValueError("dictionary 'S' should have at least one member.")
X = []
Yx = []
Yz = []
Z = []
for key, value in R.items():
X.append(key[0])
Yx.append(key[1])
if not isinstance(value, float):
raise TypeError("value of dictionary R in "+str(key)+" should be a float.")
elif not 0.0 <= value <= 1.0:
raise TypeError("value of membership of R in "+str(key)+" is not between 0 and 1 ")
for key, value in S.items():
Yz.append(key[0])
Z.append(key[1])
if not isinstance(value, float):
raise TypeError("value of dictionary S in "+str(key)+" should be a float.")
elif not 0.0 <= value <= 1.0:
raise TypeError("value of membership of S in " + str(key) + " is not between 0 and 1 ")
# check Yx equal Yz
if set(Yx) != set(Yz):
raise ValueError("(X --> Y --> Z) Y's in relation R not equal with relation S")
RoS = {}
for x in set(X):
for z in set(Z):
max_membership = 0.0
for y in set(Yx):
min_membership = min(R[(x, y)], S[(y, z)])
if min_membership > max_membership:
max_membership = min_membership
RoS[(x, z)] = max_membership
return RoS
| def compose_maxmin(R, S):
"""
X = {1: 0, 2: 0.2, 3: 0.4}
Y = {1: 0, 2: 0.2}
Relation (X*Y) = {(1, 1): 0, (1, 2): 0, (2, 1): 0, (2, 2): 0.04, (3, 1): 0, (3, 2): 0.08}
:param R: a dictionary like above example that
:param S: a dictionary like above example
:return: RoS a composition of R to S
For example:
R = {(1,1):0.7, (1,2):0.3, (2,1):0.8, (2,2):0.4}
S = {(1,1):0.9, (1,2):0.6, (1,3):0.2, (2,1):0.1, (2,2):0.7, (2,3):0.5}
RoS = {(1, 2): 0.6, (1, 3): 0.3, (2, 3): 0.4, (2, 2): 0.6, (1, 1): 0.7, (2, 1): 0.8}
"""
if not isinstance(R, dict):
raise type_error('input argument should be a dictionary.')
if not isinstance(S, dict):
raise type_error('input argument should be a dictionary.')
if len(list(R.keys())) < 1:
raise value_error("dictionary 'R' should have at least one member.")
if len(list(S.keys())) < 1:
raise value_error("dictionary 'S' should have at least one member.")
x = []
yx = []
yz = []
z = []
for (key, value) in R.items():
X.append(key[0])
Yx.append(key[1])
if not isinstance(value, float):
raise type_error('value of dictionary R in ' + str(key) + ' should be a float.')
elif not 0.0 <= value <= 1.0:
raise type_error('value of membership of R in ' + str(key) + ' is not between 0 and 1 ')
for (key, value) in S.items():
Yz.append(key[0])
Z.append(key[1])
if not isinstance(value, float):
raise type_error('value of dictionary S in ' + str(key) + ' should be a float.')
elif not 0.0 <= value <= 1.0:
raise type_error('value of membership of S in ' + str(key) + ' is not between 0 and 1 ')
if set(Yx) != set(Yz):
raise value_error("(X --> Y --> Z) Y's in relation R not equal with relation S")
ro_s = {}
for x in set(X):
for z in set(Z):
max_membership = 0.0
for y in set(Yx):
min_membership = min(R[x, y], S[y, z])
if min_membership > max_membership:
max_membership = min_membership
RoS[x, z] = max_membership
return RoS |
class Solution:
def rangeSumBST(self, root, L, R):
def dfs(node):
if node:
if L <= node.val <= R:
self.ans = self.ans + node.val
if L < node.val:
dfs(node.left)
if R > node.val:
dfs(node.right)
self.ans = 0
dfs(root)
return self.ans
| class Solution:
def range_sum_bst(self, root, L, R):
def dfs(node):
if node:
if L <= node.val <= R:
self.ans = self.ans + node.val
if L < node.val:
dfs(node.left)
if R > node.val:
dfs(node.right)
self.ans = 0
dfs(root)
return self.ans |
"""
This problem was asked by Google.
Given two rectangles on a 2D graph, return the area of their intersection. If the rectangles don't intersect, return 0.
For example, given the following rectangles:
{
"top_left": (1, 4),
"dimensions": (3, 3) # width, height
}
and
{
"top_left": (0, 5),
"dimensions": (4, 3) # width, height
}
return 6.
"""
# naive solution: generate set of points that compose the two rectangles, the intesenction of points is the
# overlapping part, find the height and width of the overlapping part and calculate the area.
def generate_all_points(top_left, dims):
width, height = dims
points = set()
curr_point = top_left
for y in range(height+1):
for x in range(width+1):
points.add((curr_point[0]+x, curr_point[1]-y)) # width increases to the left, height increases down
return points
def intersection_area(rec_1, rec_2):
rec_1_points = generate_all_points(rec_1["top_left"], rec_1["dimensions"])
rec_2_points = generate_all_points(rec_2["top_left"], rec_2["dimensions"])
# print(rec_1_points.intersection(rec_2_points))
intersection_points = rec_1_points.intersection(rec_2_points)
if len(intersection_points) == 0:
return 0
intersection_points = list(intersection_points)
intersection_points.sort(key=lambda point: point[1], reverse=True)
# print(intersection_points)
intersection_points.sort(key=lambda point: point[0], reverse=False)
# print(intersection_points)
top_left = intersection_points[0]
bottom_right = intersection_points[-1]
width = abs(top_left[0] - bottom_right[0])
height = abs(top_left[1] - bottom_right[1])
return width * height
# better solution: find the right-most left border and the bottom-most top border this will be the top left corner
# of the intersecting rectangle. Then find the top-most bottom border and the left-most right
# border this will be the bottom-right corner.
# If the top-left x is greater than the bottom-right x then does not intersect, similarly
# If the bottom-right y is greater than the top-right y then also does not intersect.
def intersection_area_redux(rec_1, rec_2):
top_left_x = max(rec_1["top_left"][0], rec_2["top_left"][0])
top_left_y = min(rec_1["top_left"][1], rec_2["top_left"][1])
bottom_right_x = min(rec_1["top_left"][0] + rec_1["dimensions"][0], rec_2["top_left"][0] + rec_2["dimensions"][0])
bottom_right_y = max(rec_1["top_left"][1] - rec_1["dimensions"][1], rec_2["top_left"][1] - rec_2["dimensions"][1])
if top_left_x > bottom_right_x or bottom_right_y > top_left_y:
return 0
return (bottom_right_x - top_left_x) * (top_left_y- bottom_right_y)
if __name__ == '__main__':
r1 = {
"top_left": (1, 4),
"dimensions": (3, 3) # width, height
}
r2 = {
"top_left": (0, 5),
"dimensions": (4, 3) # width, height
}
assert intersection_area(r1, r2) == 6
assert intersection_area_redux(r1, r2) ==6
r1 = {
"top_left": (1, 4),
"dimensions": (3, 3) # width, height
}
r2 = {
"top_left": (0, 8),
"dimensions": (4, 3) # width, height
}
assert intersection_area(r1, r2) == 0
assert intersection_area_redux(r1, r2) == 0 | """
This problem was asked by Google.
Given two rectangles on a 2D graph, return the area of their intersection. If the rectangles don't intersect, return 0.
For example, given the following rectangles:
{
"top_left": (1, 4),
"dimensions": (3, 3) # width, height
}
and
{
"top_left": (0, 5),
"dimensions": (4, 3) # width, height
}
return 6.
"""
def generate_all_points(top_left, dims):
(width, height) = dims
points = set()
curr_point = top_left
for y in range(height + 1):
for x in range(width + 1):
points.add((curr_point[0] + x, curr_point[1] - y))
return points
def intersection_area(rec_1, rec_2):
rec_1_points = generate_all_points(rec_1['top_left'], rec_1['dimensions'])
rec_2_points = generate_all_points(rec_2['top_left'], rec_2['dimensions'])
intersection_points = rec_1_points.intersection(rec_2_points)
if len(intersection_points) == 0:
return 0
intersection_points = list(intersection_points)
intersection_points.sort(key=lambda point: point[1], reverse=True)
intersection_points.sort(key=lambda point: point[0], reverse=False)
top_left = intersection_points[0]
bottom_right = intersection_points[-1]
width = abs(top_left[0] - bottom_right[0])
height = abs(top_left[1] - bottom_right[1])
return width * height
def intersection_area_redux(rec_1, rec_2):
top_left_x = max(rec_1['top_left'][0], rec_2['top_left'][0])
top_left_y = min(rec_1['top_left'][1], rec_2['top_left'][1])
bottom_right_x = min(rec_1['top_left'][0] + rec_1['dimensions'][0], rec_2['top_left'][0] + rec_2['dimensions'][0])
bottom_right_y = max(rec_1['top_left'][1] - rec_1['dimensions'][1], rec_2['top_left'][1] - rec_2['dimensions'][1])
if top_left_x > bottom_right_x or bottom_right_y > top_left_y:
return 0
return (bottom_right_x - top_left_x) * (top_left_y - bottom_right_y)
if __name__ == '__main__':
r1 = {'top_left': (1, 4), 'dimensions': (3, 3)}
r2 = {'top_left': (0, 5), 'dimensions': (4, 3)}
assert intersection_area(r1, r2) == 6
assert intersection_area_redux(r1, r2) == 6
r1 = {'top_left': (1, 4), 'dimensions': (3, 3)}
r2 = {'top_left': (0, 8), 'dimensions': (4, 3)}
assert intersection_area(r1, r2) == 0
assert intersection_area_redux(r1, r2) == 0 |
class DataGridViewRowErrorTextNeededEventArgs(EventArgs):
""" Provides data for the System.Windows.Forms.DataGridView.RowErrorTextNeeded event of a System.Windows.Forms.DataGridView control. """
ErrorText=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the error text for the row.
Get: ErrorText(self: DataGridViewRowErrorTextNeededEventArgs) -> str
Set: ErrorText(self: DataGridViewRowErrorTextNeededEventArgs)=value
"""
RowIndex=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the row that raised the System.Windows.Forms.DataGridView.RowErrorTextNeeded event.
Get: RowIndex(self: DataGridViewRowErrorTextNeededEventArgs) -> int
"""
| class Datagridviewrowerrortextneededeventargs(EventArgs):
""" Provides data for the System.Windows.Forms.DataGridView.RowErrorTextNeeded event of a System.Windows.Forms.DataGridView control. """
error_text = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets or sets the error text for the row.\n\n\n\nGet: ErrorText(self: DataGridViewRowErrorTextNeededEventArgs) -> str\n\n\n\nSet: ErrorText(self: DataGridViewRowErrorTextNeededEventArgs)=value\n\n'
row_index = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the row that raised the System.Windows.Forms.DataGridView.RowErrorTextNeeded event.\n\n\n\nGet: RowIndex(self: DataGridViewRowErrorTextNeededEventArgs) -> int\n\n\n\n' |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @author jsbxyyx
# @since 1.0
class Types:
BIT = -7
TINYINT = -6
SMALLINT = 5
INTEGER = 4
BIGINT = -5
FLOAT = 6
REAL = 7
DOUBLE = 8
NUMERIC = 2
DECIMAL = 3
CHAR = 1
VARCHAR = 12
LONGVARCHAR = -1
DATE = 91
TIME = 92
TIMESTAMP = 93
BINARY = -2
VARBINARY = -3
LONGVARBINARY = -4
NULL = 0
OTHER = 1111
JAVA_OBJECT = 2000
DISTINCT = 2001
STRUCT = 2002
ARRAY = 2003
BLOB = 2004
CLOB = 2005
REF = 2006
DATALINK = 70
BOOLEAN = 16
ROWID = -8
NCHAR = -15
NVARCHAR = -9
LONGNVARCHAR = -16
NCLOB = 2011
SQLXML = 2009
REF_CURSOR = 2012
TIME_WITH_TIMEZONE = 2013
TIMESTAMP_WITH_TIMEZONE = 2014
# mysql
INT = 4
DATETIME = 93
TINYTEXT = 2005
TEXT = 2005
MEDIUMTEXT = 2005
LONGTEXT = 2005
JSON = 2005
@classmethod
def get(cls, name: str):
return getattr(cls, name.upper(), None)
| class Types:
bit = -7
tinyint = -6
smallint = 5
integer = 4
bigint = -5
float = 6
real = 7
double = 8
numeric = 2
decimal = 3
char = 1
varchar = 12
longvarchar = -1
date = 91
time = 92
timestamp = 93
binary = -2
varbinary = -3
longvarbinary = -4
null = 0
other = 1111
java_object = 2000
distinct = 2001
struct = 2002
array = 2003
blob = 2004
clob = 2005
ref = 2006
datalink = 70
boolean = 16
rowid = -8
nchar = -15
nvarchar = -9
longnvarchar = -16
nclob = 2011
sqlxml = 2009
ref_cursor = 2012
time_with_timezone = 2013
timestamp_with_timezone = 2014
int = 4
datetime = 93
tinytext = 2005
text = 2005
mediumtext = 2005
longtext = 2005
json = 2005
@classmethod
def get(cls, name: str):
return getattr(cls, name.upper(), None) |
class Count(object):
version=1.5
def add(self,x,y):
return x+y
def sub(self,x,y):
return x-y
if __name__ == '__main__':
c=Count()
print(c.add(1,2))
print(c.sub(10,5)) | class Count(object):
version = 1.5
def add(self, x, y):
return x + y
def sub(self, x, y):
return x - y
if __name__ == '__main__':
c = count()
print(c.add(1, 2))
print(c.sub(10, 5)) |
expected_output = {
"sensor_list": {
"Environmental Monitoring": {
"sensor": {
"PEM Iout": {"location": "P1", "reading": "0 A", "state": "Normal"},
"PEM Vin": {"location": "P1", "reading": "104 V AC", "state": "Normal"},
"PEM Vout": {"location": "P1", "reading": "0 V DC", "state": "Normal"},
"Temp: Asic1": {
"location": "0",
"reading": "41 Celsius",
"state": "Normal",
},
"Temp: C2D C0": {
"location": "R0",
"reading": "38 Celsius",
"state": "Normal",
},
"Temp: C2D C1": {
"location": "R0",
"reading": "34 Celsius",
"state": "Normal",
},
"Temp: CPP Rear": {
"location": "F0",
"reading": "54 Celsius",
"state": "Normal",
},
"Temp: CPU AIR": {
"location": "R0",
"reading": "31 Celsius",
"state": "Normal",
},
"Temp: Center": {
"location": "0",
"reading": "34 Celsius",
"state": "Normal",
},
"Temp: FC": {
"location": "P1",
"reading": "27 Celsius",
"state": "Fan Speed 65%",
},
"Temp: HKP Die": {
"location": "F0",
"reading": "51 Celsius",
"state": "Normal",
},
"Temp: Inlet": {
"location": "R0",
"reading": "27 Celsius",
"state": "Normal",
},
"Temp: Left": {
"location": "0",
"reading": "29 Celsius",
"state": "Normal",
},
"Temp: Left Ext": {
"location": "F0",
"reading": "39 Celsius",
"state": "Normal",
},
"Temp: MCH AIR": {
"location": "R0",
"reading": "39 Celsius",
"state": "Normal",
},
"Temp: MCH DIE": {
"location": "R0",
"reading": "52 Celsius",
"state": "Normal",
},
"Temp: MCH Die": {
"location": "F0",
"reading": "60 Celsius",
"state": "Normal",
},
"Temp: Olv Die": {
"location": "F0",
"reading": "49 Celsius",
"state": "Normal",
},
"Temp: Outlet": {
"location": "R0",
"reading": "29 Celsius",
"state": "Normal",
},
"Temp: PEM": {
"location": "P1",
"reading": "26 Celsius",
"state": "Normal",
},
"Temp: Pop Die": {
"location": "F0",
"reading": "56 Celsius",
"state": "Normal",
},
"Temp: Rght Ext": {
"location": "F0",
"reading": "39 Celsius",
"state": "Normal",
},
"Temp: Right": {
"location": "0",
"reading": "33 Celsius",
"state": "Normal",
},
"Temp: SCBY AIR": {
"location": "R0",
"reading": "39 Celsius",
"state": "Normal",
},
"V1: 12v": {"location": "R0", "reading": "11821 mV", "state": "Normal"},
"V1: GP1": {"location": "R0", "reading": "913 mV", "state": "Normal"},
"V1: GP2": {"location": "R0", "reading": "1191 mV", "state": "Normal"},
"V1: VDD": {"location": "R0", "reading": "3281 mV", "state": "Normal"},
"V1: VMA": {"location": "R0", "reading": "1201 mV", "state": "Normal"},
"V1: VMB": {"location": "R0", "reading": "2504 mV", "state": "Normal"},
"V1: VMC": {"location": "R0", "reading": "3295 mV", "state": "Normal"},
"V1: VMD": {"location": "R0", "reading": "2500 mV", "state": "Normal"},
"V1: VME": {"location": "R0", "reading": "1801 mV", "state": "Normal"},
"V1: VMF": {"location": "R0", "reading": "1533 mV", "state": "Normal"},
"V2: 12v": {"location": "R0", "reading": "11821 mV", "state": "Normal"},
"V2: GP1": {"location": "R0", "reading": "2497 mV", "state": "Normal"},
"V2: GP2": {"location": "R0", "reading": "1186 mV", "state": "Normal"},
"V2: VDD": {"location": "R0", "reading": "3276 mV", "state": "Normal"},
"V2: VMA": {"location": "R0", "reading": "1054 mV", "state": "Normal"},
"V2: VMB": {"location": "R0", "reading": "1098 mV", "state": "Normal"},
"V2: VMC": {"location": "R0", "reading": "1059 mV", "state": "Normal"},
"V2: VMD": {"location": "R0", "reading": "991 mV", "state": "Normal"},
"V2: VME": {"location": "R0", "reading": "1103 mV", "state": "Normal"},
"V2: VMF": {"location": "R0", "reading": "1005 mV", "state": "Normal"},
"V3: 12v": {"location": "F0", "reading": "11806 mV", "state": "Normal"},
"V3: VDD": {"location": "F0", "reading": "3286 mV", "state": "Normal"},
"V3: VMA": {"location": "F0", "reading": "3291 mV", "state": "Normal"},
"V3: VMB": {"location": "F0", "reading": "2495 mV", "state": "Normal"},
"V3: VMC": {"location": "F0", "reading": "1499 mV", "state": "Normal"},
"V3: VMD": {"location": "F0", "reading": "1000 mV", "state": "Normal"},
}
}
}
}
| expected_output = {'sensor_list': {'Environmental Monitoring': {'sensor': {'PEM Iout': {'location': 'P1', 'reading': '0 A', 'state': 'Normal'}, 'PEM Vin': {'location': 'P1', 'reading': '104 V AC', 'state': 'Normal'}, 'PEM Vout': {'location': 'P1', 'reading': '0 V DC', 'state': 'Normal'}, 'Temp: Asic1': {'location': '0', 'reading': '41 Celsius', 'state': 'Normal'}, 'Temp: C2D C0': {'location': 'R0', 'reading': '38 Celsius', 'state': 'Normal'}, 'Temp: C2D C1': {'location': 'R0', 'reading': '34 Celsius', 'state': 'Normal'}, 'Temp: CPP Rear': {'location': 'F0', 'reading': '54 Celsius', 'state': 'Normal'}, 'Temp: CPU AIR': {'location': 'R0', 'reading': '31 Celsius', 'state': 'Normal'}, 'Temp: Center': {'location': '0', 'reading': '34 Celsius', 'state': 'Normal'}, 'Temp: FC': {'location': 'P1', 'reading': '27 Celsius', 'state': 'Fan Speed 65%'}, 'Temp: HKP Die': {'location': 'F0', 'reading': '51 Celsius', 'state': 'Normal'}, 'Temp: Inlet': {'location': 'R0', 'reading': '27 Celsius', 'state': 'Normal'}, 'Temp: Left': {'location': '0', 'reading': '29 Celsius', 'state': 'Normal'}, 'Temp: Left Ext': {'location': 'F0', 'reading': '39 Celsius', 'state': 'Normal'}, 'Temp: MCH AIR': {'location': 'R0', 'reading': '39 Celsius', 'state': 'Normal'}, 'Temp: MCH DIE': {'location': 'R0', 'reading': '52 Celsius', 'state': 'Normal'}, 'Temp: MCH Die': {'location': 'F0', 'reading': '60 Celsius', 'state': 'Normal'}, 'Temp: Olv Die': {'location': 'F0', 'reading': '49 Celsius', 'state': 'Normal'}, 'Temp: Outlet': {'location': 'R0', 'reading': '29 Celsius', 'state': 'Normal'}, 'Temp: PEM': {'location': 'P1', 'reading': '26 Celsius', 'state': 'Normal'}, 'Temp: Pop Die': {'location': 'F0', 'reading': '56 Celsius', 'state': 'Normal'}, 'Temp: Rght Ext': {'location': 'F0', 'reading': '39 Celsius', 'state': 'Normal'}, 'Temp: Right': {'location': '0', 'reading': '33 Celsius', 'state': 'Normal'}, 'Temp: SCBY AIR': {'location': 'R0', 'reading': '39 Celsius', 'state': 'Normal'}, 'V1: 12v': {'location': 'R0', 'reading': '11821 mV', 'state': 'Normal'}, 'V1: GP1': {'location': 'R0', 'reading': '913 mV', 'state': 'Normal'}, 'V1: GP2': {'location': 'R0', 'reading': '1191 mV', 'state': 'Normal'}, 'V1: VDD': {'location': 'R0', 'reading': '3281 mV', 'state': 'Normal'}, 'V1: VMA': {'location': 'R0', 'reading': '1201 mV', 'state': 'Normal'}, 'V1: VMB': {'location': 'R0', 'reading': '2504 mV', 'state': 'Normal'}, 'V1: VMC': {'location': 'R0', 'reading': '3295 mV', 'state': 'Normal'}, 'V1: VMD': {'location': 'R0', 'reading': '2500 mV', 'state': 'Normal'}, 'V1: VME': {'location': 'R0', 'reading': '1801 mV', 'state': 'Normal'}, 'V1: VMF': {'location': 'R0', 'reading': '1533 mV', 'state': 'Normal'}, 'V2: 12v': {'location': 'R0', 'reading': '11821 mV', 'state': 'Normal'}, 'V2: GP1': {'location': 'R0', 'reading': '2497 mV', 'state': 'Normal'}, 'V2: GP2': {'location': 'R0', 'reading': '1186 mV', 'state': 'Normal'}, 'V2: VDD': {'location': 'R0', 'reading': '3276 mV', 'state': 'Normal'}, 'V2: VMA': {'location': 'R0', 'reading': '1054 mV', 'state': 'Normal'}, 'V2: VMB': {'location': 'R0', 'reading': '1098 mV', 'state': 'Normal'}, 'V2: VMC': {'location': 'R0', 'reading': '1059 mV', 'state': 'Normal'}, 'V2: VMD': {'location': 'R0', 'reading': '991 mV', 'state': 'Normal'}, 'V2: VME': {'location': 'R0', 'reading': '1103 mV', 'state': 'Normal'}, 'V2: VMF': {'location': 'R0', 'reading': '1005 mV', 'state': 'Normal'}, 'V3: 12v': {'location': 'F0', 'reading': '11806 mV', 'state': 'Normal'}, 'V3: VDD': {'location': 'F0', 'reading': '3286 mV', 'state': 'Normal'}, 'V3: VMA': {'location': 'F0', 'reading': '3291 mV', 'state': 'Normal'}, 'V3: VMB': {'location': 'F0', 'reading': '2495 mV', 'state': 'Normal'}, 'V3: VMC': {'location': 'F0', 'reading': '1499 mV', 'state': 'Normal'}, 'V3: VMD': {'location': 'F0', 'reading': '1000 mV', 'state': 'Normal'}}}}} |
"""
Here we put all the device configuration that we emulate.
"""
# possible kik versions to emulate
kik_version_11_info = {"kik_version": "11.1.1.12218", "classes_dex_sha1_digest": "aCDhFLsmALSyhwi007tvowZkUd0="}
kik_version_13_info = {"kik_version": "13.4.0.9614", "classes_dex_sha1_digest": "ETo70PFW30/jeFMKKY+CNanX2Fg="}
kik_version_14_info = {"kik_version": "14.0.0.11130", "classes_dex_sha1_digest": "9nPRnohIOTbby7wU1+IVDqDmQiQ="}
kik_version_14_5_info = {"kik_version": "14.5.0.13136", "classes_dex_sha1_digest": "LuYEjtvBu4mG2kBBG0wA3Ki1PSE="}
device_id = "62030843678b7376a707ca3d11e87837" # random 16 bytes. you can set it to anything, but stick with it
kik_version_info = kik_version_14_5_info # a kik version that's not updated might cause a captcha on login
android_id = "849d4ffb0c020de7" # random 8 bytes. you can set it to anything, but stick with it
| """
Here we put all the device configuration that we emulate.
"""
kik_version_11_info = {'kik_version': '11.1.1.12218', 'classes_dex_sha1_digest': 'aCDhFLsmALSyhwi007tvowZkUd0='}
kik_version_13_info = {'kik_version': '13.4.0.9614', 'classes_dex_sha1_digest': 'ETo70PFW30/jeFMKKY+CNanX2Fg='}
kik_version_14_info = {'kik_version': '14.0.0.11130', 'classes_dex_sha1_digest': '9nPRnohIOTbby7wU1+IVDqDmQiQ='}
kik_version_14_5_info = {'kik_version': '14.5.0.13136', 'classes_dex_sha1_digest': 'LuYEjtvBu4mG2kBBG0wA3Ki1PSE='}
device_id = '62030843678b7376a707ca3d11e87837'
kik_version_info = kik_version_14_5_info
android_id = '849d4ffb0c020de7' |
"""Created by sgoswami on 8/8/17."""
"""Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the
nodes of the first two lists."""
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def mergeTwoLists(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
curr = head = ListNode(0)
while l1 and l2:
if l1.val < l2.val:
curr.next = ListNode(l1.val)
l1 = l1.next
else:
curr.next = ListNode(l2.val)
l2 = l2.next
curr = curr.next
curr.next = l1 or l2
return head.next
| """Created by sgoswami on 8/8/17."""
'Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the \nnodes of the first two lists.'
class Listnode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def merge_two_lists(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
curr = head = list_node(0)
while l1 and l2:
if l1.val < l2.val:
curr.next = list_node(l1.val)
l1 = l1.next
else:
curr.next = list_node(l2.val)
l2 = l2.next
curr = curr.next
curr.next = l1 or l2
return head.next |
class AST:
def __init__(self, **fields):
for k, v in fields.items():
setattr(self, k, v)
class mod(AST): pass
class Module(mod):
_fields = ('body',)
class Interactive(mod):
_fields = ('body',)
class Expression(mod):
_fields = ('body',)
class Suite(mod):
_fields = ('body',)
class stmt(AST): pass
class FunctionDef(stmt):
_fields = ('name', 'args', 'body', 'decorator_list', 'returns')
class AsyncFunctionDef(stmt):
_fields = ('name', 'args', 'body', 'decorator_list', 'returns')
class ClassDef(stmt):
_fields = ('name', 'bases', 'keywords', 'body', 'decorator_list')
class Return(stmt):
_fields = ('value',)
class Delete(stmt):
_fields = ('targets',)
class Assign(stmt):
_fields = ('targets', 'value')
class AugAssign(stmt):
_fields = ('target', 'op', 'value')
class AnnAssign(stmt):
_fields = ('target', 'annotation', 'value', 'simple')
class For(stmt):
_fields = ('target', 'iter', 'body', 'orelse')
class AsyncFor(stmt):
_fields = ('target', 'iter', 'body', 'orelse')
class While(stmt):
_fields = ('test', 'body', 'orelse')
class If(stmt):
_fields = ('test', 'body', 'orelse')
class With(stmt):
_fields = ('items', 'body')
class AsyncWith(stmt):
_fields = ('items', 'body')
class Raise(stmt):
_fields = ('exc', 'cause')
class Try(stmt):
_fields = ('body', 'handlers', 'orelse', 'finalbody')
class Assert(stmt):
_fields = ('test', 'msg')
class Import(stmt):
_fields = ('names',)
class ImportFrom(stmt):
_fields = ('module', 'names', 'level')
class Global(stmt):
_fields = ('names',)
class Nonlocal(stmt):
_fields = ('names',)
class Expr(stmt):
_fields = ('value',)
class Pass(stmt):
_fields = ()
class Break(stmt):
_fields = ()
class Continue(stmt):
_fields = ()
class expr(AST): pass
class BoolOp(expr):
_fields = ('op', 'values')
class BinOp(expr):
_fields = ('left', 'op', 'right')
class UnaryOp(expr):
_fields = ('op', 'operand')
class Lambda(expr):
_fields = ('args', 'body')
class IfExp(expr):
_fields = ('test', 'body', 'orelse')
class Dict(expr):
_fields = ('keys', 'values')
class Set(expr):
_fields = ('elts',)
class ListComp(expr):
_fields = ('elt', 'generators')
class SetComp(expr):
_fields = ('elt', 'generators')
class DictComp(expr):
_fields = ('key', 'value', 'generators')
class GeneratorExp(expr):
_fields = ('elt', 'generators')
class Await(expr):
_fields = ('value',)
class Yield(expr):
_fields = ('value',)
class YieldFrom(expr):
_fields = ('value',)
class Compare(expr):
_fields = ('left', 'ops', 'comparators')
class Call(expr):
_fields = ('func', 'args', 'keywords')
class Num(expr):
_fields = ('n',)
class Str(expr):
_fields = ('s',)
class FormattedValue(expr):
_fields = ('value', 'conversion', 'format_spec')
class JoinedStr(expr):
_fields = ('values',)
class Bytes(expr):
_fields = ('s',)
class NameConstant(expr):
_fields = ('value',)
class Ellipsis(expr):
_fields = ()
class Constant(expr):
_fields = ('value',)
class Attribute(expr):
_fields = ('value', 'attr', 'ctx')
class Subscript(expr):
_fields = ('value', 'slice', 'ctx')
class Starred(expr):
_fields = ('value', 'ctx')
class Name(expr):
_fields = ('id', 'ctx')
class List(expr):
_fields = ('elts', 'ctx')
class Tuple(expr):
_fields = ('elts', 'ctx')
class expr_context(AST): pass
class Load(expr_context):
_fields = ()
class Store(expr_context):
_fields = ()
class StoreConst(expr_context):
_fields = ()
class Del(expr_context):
_fields = ()
class AugLoad(expr_context):
_fields = ()
class AugStore(expr_context):
_fields = ()
class Param(expr_context):
_fields = ()
class slice(AST): pass
class Slice(slice):
_fields = ('lower', 'upper', 'step')
class ExtSlice(slice):
_fields = ('dims',)
class Index(slice):
_fields = ('value',)
class boolop(AST): pass
class And(boolop):
_fields = ()
class Or(boolop):
_fields = ()
class operator(AST): pass
class Add(operator):
_fields = ()
class Sub(operator):
_fields = ()
class Mult(operator):
_fields = ()
class MatMult(operator):
_fields = ()
class Div(operator):
_fields = ()
class Mod(operator):
_fields = ()
class Pow(operator):
_fields = ()
class LShift(operator):
_fields = ()
class RShift(operator):
_fields = ()
class BitOr(operator):
_fields = ()
class BitXor(operator):
_fields = ()
class BitAnd(operator):
_fields = ()
class FloorDiv(operator):
_fields = ()
class unaryop(AST): pass
class Invert(unaryop):
_fields = ()
class Not(unaryop):
_fields = ()
class UAdd(unaryop):
_fields = ()
class USub(unaryop):
_fields = ()
class cmpop(AST): pass
class Eq(cmpop):
_fields = ()
class NotEq(cmpop):
_fields = ()
class Lt(cmpop):
_fields = ()
class LtE(cmpop):
_fields = ()
class Gt(cmpop):
_fields = ()
class GtE(cmpop):
_fields = ()
class Is(cmpop):
_fields = ()
class IsNot(cmpop):
_fields = ()
class In(cmpop):
_fields = ()
class NotIn(cmpop):
_fields = ()
class comprehension(AST):
_fields = ('target', 'iter', 'ifs', 'is_async')
class excepthandler(AST): pass
class ExceptHandler(excepthandler):
_fields = ('type', 'name', 'body')
class arguments(AST):
_fields = ('args', 'vararg', 'kwonlyargs', 'kw_defaults', 'kwarg', 'defaults')
class arg(AST):
_fields = ('arg', 'annotation')
class keyword(AST):
_fields = ('arg', 'value')
class alias(AST):
_fields = ('name', 'asname')
class withitem(AST):
_fields = ('context_expr', 'optional_vars')
| class Ast:
def __init__(self, **fields):
for (k, v) in fields.items():
setattr(self, k, v)
class Mod(AST):
pass
class Module(mod):
_fields = ('body',)
class Interactive(mod):
_fields = ('body',)
class Expression(mod):
_fields = ('body',)
class Suite(mod):
_fields = ('body',)
class Stmt(AST):
pass
class Functiondef(stmt):
_fields = ('name', 'args', 'body', 'decorator_list', 'returns')
class Asyncfunctiondef(stmt):
_fields = ('name', 'args', 'body', 'decorator_list', 'returns')
class Classdef(stmt):
_fields = ('name', 'bases', 'keywords', 'body', 'decorator_list')
class Return(stmt):
_fields = ('value',)
class Delete(stmt):
_fields = ('targets',)
class Assign(stmt):
_fields = ('targets', 'value')
class Augassign(stmt):
_fields = ('target', 'op', 'value')
class Annassign(stmt):
_fields = ('target', 'annotation', 'value', 'simple')
class For(stmt):
_fields = ('target', 'iter', 'body', 'orelse')
class Asyncfor(stmt):
_fields = ('target', 'iter', 'body', 'orelse')
class While(stmt):
_fields = ('test', 'body', 'orelse')
class If(stmt):
_fields = ('test', 'body', 'orelse')
class With(stmt):
_fields = ('items', 'body')
class Asyncwith(stmt):
_fields = ('items', 'body')
class Raise(stmt):
_fields = ('exc', 'cause')
class Try(stmt):
_fields = ('body', 'handlers', 'orelse', 'finalbody')
class Assert(stmt):
_fields = ('test', 'msg')
class Import(stmt):
_fields = ('names',)
class Importfrom(stmt):
_fields = ('module', 'names', 'level')
class Global(stmt):
_fields = ('names',)
class Nonlocal(stmt):
_fields = ('names',)
class Expr(stmt):
_fields = ('value',)
class Pass(stmt):
_fields = ()
class Break(stmt):
_fields = ()
class Continue(stmt):
_fields = ()
class Expr(AST):
pass
class Boolop(expr):
_fields = ('op', 'values')
class Binop(expr):
_fields = ('left', 'op', 'right')
class Unaryop(expr):
_fields = ('op', 'operand')
class Lambda(expr):
_fields = ('args', 'body')
class Ifexp(expr):
_fields = ('test', 'body', 'orelse')
class Dict(expr):
_fields = ('keys', 'values')
class Set(expr):
_fields = ('elts',)
class Listcomp(expr):
_fields = ('elt', 'generators')
class Setcomp(expr):
_fields = ('elt', 'generators')
class Dictcomp(expr):
_fields = ('key', 'value', 'generators')
class Generatorexp(expr):
_fields = ('elt', 'generators')
class Await(expr):
_fields = ('value',)
class Yield(expr):
_fields = ('value',)
class Yieldfrom(expr):
_fields = ('value',)
class Compare(expr):
_fields = ('left', 'ops', 'comparators')
class Call(expr):
_fields = ('func', 'args', 'keywords')
class Num(expr):
_fields = ('n',)
class Str(expr):
_fields = ('s',)
class Formattedvalue(expr):
_fields = ('value', 'conversion', 'format_spec')
class Joinedstr(expr):
_fields = ('values',)
class Bytes(expr):
_fields = ('s',)
class Nameconstant(expr):
_fields = ('value',)
class Ellipsis(expr):
_fields = ()
class Constant(expr):
_fields = ('value',)
class Attribute(expr):
_fields = ('value', 'attr', 'ctx')
class Subscript(expr):
_fields = ('value', 'slice', 'ctx')
class Starred(expr):
_fields = ('value', 'ctx')
class Name(expr):
_fields = ('id', 'ctx')
class List(expr):
_fields = ('elts', 'ctx')
class Tuple(expr):
_fields = ('elts', 'ctx')
class Expr_Context(AST):
pass
class Load(expr_context):
_fields = ()
class Store(expr_context):
_fields = ()
class Storeconst(expr_context):
_fields = ()
class Del(expr_context):
_fields = ()
class Augload(expr_context):
_fields = ()
class Augstore(expr_context):
_fields = ()
class Param(expr_context):
_fields = ()
class Slice(AST):
pass
class Slice(slice):
_fields = ('lower', 'upper', 'step')
class Extslice(slice):
_fields = ('dims',)
class Index(slice):
_fields = ('value',)
class Boolop(AST):
pass
class And(boolop):
_fields = ()
class Or(boolop):
_fields = ()
class Operator(AST):
pass
class Add(operator):
_fields = ()
class Sub(operator):
_fields = ()
class Mult(operator):
_fields = ()
class Matmult(operator):
_fields = ()
class Div(operator):
_fields = ()
class Mod(operator):
_fields = ()
class Pow(operator):
_fields = ()
class Lshift(operator):
_fields = ()
class Rshift(operator):
_fields = ()
class Bitor(operator):
_fields = ()
class Bitxor(operator):
_fields = ()
class Bitand(operator):
_fields = ()
class Floordiv(operator):
_fields = ()
class Unaryop(AST):
pass
class Invert(unaryop):
_fields = ()
class Not(unaryop):
_fields = ()
class Uadd(unaryop):
_fields = ()
class Usub(unaryop):
_fields = ()
class Cmpop(AST):
pass
class Eq(cmpop):
_fields = ()
class Noteq(cmpop):
_fields = ()
class Lt(cmpop):
_fields = ()
class Lte(cmpop):
_fields = ()
class Gt(cmpop):
_fields = ()
class Gte(cmpop):
_fields = ()
class Is(cmpop):
_fields = ()
class Isnot(cmpop):
_fields = ()
class In(cmpop):
_fields = ()
class Notin(cmpop):
_fields = ()
class Comprehension(AST):
_fields = ('target', 'iter', 'ifs', 'is_async')
class Excepthandler(AST):
pass
class Excepthandler(excepthandler):
_fields = ('type', 'name', 'body')
class Arguments(AST):
_fields = ('args', 'vararg', 'kwonlyargs', 'kw_defaults', 'kwarg', 'defaults')
class Arg(AST):
_fields = ('arg', 'annotation')
class Keyword(AST):
_fields = ('arg', 'value')
class Alias(AST):
_fields = ('name', 'asname')
class Withitem(AST):
_fields = ('context_expr', 'optional_vars') |
# Approach 1 - Backtracking
class Solution:
def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]:
def backtrack(remain, comb, next_start):
if remain == 0:
results.append(comb.copy())
return
elif remain < 0:
return
for i in range(next_start, len(candidates)):
comb.append(candidates[i])
backtrack(remain - candidates[i], comb, i)
comb.pop()
results = []
backtrack(target, [], 0)
return results
| class Solution:
def combination_sum(self, candidates: List[int], target: int) -> List[List[int]]:
def backtrack(remain, comb, next_start):
if remain == 0:
results.append(comb.copy())
return
elif remain < 0:
return
for i in range(next_start, len(candidates)):
comb.append(candidates[i])
backtrack(remain - candidates[i], comb, i)
comb.pop()
results = []
backtrack(target, [], 0)
return results |
#Find the Prime Numbers in a given range with total count.
#(so basically prime number is a number which is only divisible by '1' & itself)
#examples : 2, 3, 5, 7, 11, 13,...
def error():
try:
#Finds the Prime Numbers in a given range:
ip = int(input("Enter the range to find Prime Numbers: "))
if ip <= 0:
print("Wrong Input")
print("Input must be a positive value")
print("Start again..")
error()
print("Prime Numbers: ")
for num in range(1, ip + 1):
if num > 1:
for i in range(2, num):
if (num % i) == 0:
i+=1
break
else:
lst = list()
lst.append(num)
print(lst, end=" ")
#Counts the Prime Numbers in a given range:
def count_Prime_nums(n):
count = 0
for num in range(n):
if num <= 1:
continue
for i in range(2, num):
if (num % i) == 0:
break
else:
count += 1
return count
print("\nTotal no. of Prime Numbers: ", count_Prime_nums(ip))
except:
#If there's an error, without giving a Traceback it prints a message
#and also restarts the programme by itself using Recursion.
print("Wrong Input")
print("Start again..")
error()
error()
| def error():
try:
ip = int(input('Enter the range to find Prime Numbers: '))
if ip <= 0:
print('Wrong Input')
print('Input must be a positive value')
print('Start again..')
error()
print('Prime Numbers: ')
for num in range(1, ip + 1):
if num > 1:
for i in range(2, num):
if num % i == 0:
i += 1
break
else:
lst = list()
lst.append(num)
print(lst, end=' ')
def count__prime_nums(n):
count = 0
for num in range(n):
if num <= 1:
continue
for i in range(2, num):
if num % i == 0:
break
else:
count += 1
return count
print('\nTotal no. of Prime Numbers: ', count__prime_nums(ip))
except:
print('Wrong Input')
print('Start again..')
error()
error() |
# encoding: utf-8
# module Revit.Filter calls itself Filter
# from RevitNodes,Version=1.2.1.3083,Culture=neutral,PublicKeyToken=null
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class FilterRule(object):
""" Revit Filter Rule """
@staticmethod
def ByRuleType(type, value, parameter):
"""
ByRuleType(type: str,value: object,parameter: Parameter) -> FilterRule
Create a new Filter Rule
type: Filter Rule Type
value: Value to check
parameter: Parameter to filter
"""
pass
RuleType = None
class OverrideGraphicSettings(object):
""" Override Graphic Settings """
@staticmethod
def ByProperties(
cutFillColor,
projectionFillColor,
cutLineColor,
projectionLineColor,
cutFillPattern,
projectionFillPattern,
cutLinePattern,
projectionLinePattern,
cutLineWeight,
projectionLineWeight,
):
"""
ByProperties(cutFillColor: Color,projectionFillColor: Color,cutLineColor: Color,projectionLineColor: Color,cutFillPattern: FillPatternElement,projectionFillPattern: FillPatternElement,cutLinePattern: LinePatternElement,projectionLinePattern: LinePatternElement,cutLineWeight: int,projectionLineWeight: int) -> OverrideGraphicSettings
Create a OverrideGraphicSettings element
cutFillColor: Fill color
projectionFillColor: Projection color
cutLineColor: Cut line color
projectionLineColor: Projection line color
cutFillPattern: Cut fill pattern
projectionFillPattern: Projection fill pattern
cutLinePattern: Cut line pattern
projectionLinePattern: Projection line pattern
cutLineWeight: Cut line weight
projectionLineWeight: Projection line weight
Returns: OverrideGraphicSettings
"""
pass
class ParameterFilterElement(Element, IDisposable, IGraphicItem, IFormattable):
""" Parameter Filter Element """
@staticmethod
def ByRules(name, categories, rules):
""" ByRules(name: str,categories: IEnumerable[Category],rules: IEnumerable[FilterRule]) -> ParameterFilterElement """
pass
def SafeInit(self, *args):
"""
SafeInit(self: Element,init: Action)
Handling exceptions when calling the initializing function
"""
pass
def __enter__(self, *args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self, *args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __str__(self, *args):
pass
InternalElement = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Reference to the Element
Get: InternalElement(self: ParameterFilterElement) -> Element
"""
InternalElementId = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""The element id for this element
"""
IsAlive = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Is this element still alive in Revit,and good to be drawn,queried etc.
"""
InternalUniqueId = None
| class Filterrule(object):
""" Revit Filter Rule """
@staticmethod
def by_rule_type(type, value, parameter):
"""
ByRuleType(type: str,value: object,parameter: Parameter) -> FilterRule
Create a new Filter Rule
type: Filter Rule Type
value: Value to check
parameter: Parameter to filter
"""
pass
rule_type = None
class Overridegraphicsettings(object):
""" Override Graphic Settings """
@staticmethod
def by_properties(cutFillColor, projectionFillColor, cutLineColor, projectionLineColor, cutFillPattern, projectionFillPattern, cutLinePattern, projectionLinePattern, cutLineWeight, projectionLineWeight):
"""
ByProperties(cutFillColor: Color,projectionFillColor: Color,cutLineColor: Color,projectionLineColor: Color,cutFillPattern: FillPatternElement,projectionFillPattern: FillPatternElement,cutLinePattern: LinePatternElement,projectionLinePattern: LinePatternElement,cutLineWeight: int,projectionLineWeight: int) -> OverrideGraphicSettings
Create a OverrideGraphicSettings element
cutFillColor: Fill color
projectionFillColor: Projection color
cutLineColor: Cut line color
projectionLineColor: Projection line color
cutFillPattern: Cut fill pattern
projectionFillPattern: Projection fill pattern
cutLinePattern: Cut line pattern
projectionLinePattern: Projection line pattern
cutLineWeight: Cut line weight
projectionLineWeight: Projection line weight
Returns: OverrideGraphicSettings
"""
pass
class Parameterfilterelement(Element, IDisposable, IGraphicItem, IFormattable):
""" Parameter Filter Element """
@staticmethod
def by_rules(name, categories, rules):
""" ByRules(name: str,categories: IEnumerable[Category],rules: IEnumerable[FilterRule]) -> ParameterFilterElement """
pass
def safe_init(self, *args):
"""
SafeInit(self: Element,init: Action)
Handling exceptions when calling the initializing function
"""
pass
def __enter__(self, *args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self, *args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __str__(self, *args):
pass
internal_element = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Reference to the Element\n\n\n\nGet: InternalElement(self: ParameterFilterElement) -> Element\n\n\n\n'
internal_element_id = property(lambda self: object(), lambda self, v: None, lambda self: None)
'The element id for this element\n\n\n\n'
is_alive = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Is this element still alive in Revit,and good to be drawn,queried etc.\n\n\n\n'
internal_unique_id = None |
class Solution:
def spiralMatrixIII(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]:
res = [(r0, c0)]
step = 1
while len(res) < R * C:
# right
for j in range(step):
c0 += 1
if self._in_grid(c0, r0, C, R):
res.append((r0, c0))
# down
for i in range(step):
r0 += 1
if self._in_grid(c0, r0, C, R):
res.append((r0, c0))
step += 1
# left
for j in range(step):
c0 -= 1
if self._in_grid(c0, r0, C, R):
res.append((r0, c0))
# up
for i in range(step):
r0 -= 1
if self._in_grid(c0, r0, C, R):
res.append((r0, c0))
step += 1
return res
def _in_grid(self, c0, r0, C, R):
return 0 <= c0 < C and 0 <= r0 < R
| class Solution:
def spiral_matrix_iii(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]:
res = [(r0, c0)]
step = 1
while len(res) < R * C:
for j in range(step):
c0 += 1
if self._in_grid(c0, r0, C, R):
res.append((r0, c0))
for i in range(step):
r0 += 1
if self._in_grid(c0, r0, C, R):
res.append((r0, c0))
step += 1
for j in range(step):
c0 -= 1
if self._in_grid(c0, r0, C, R):
res.append((r0, c0))
for i in range(step):
r0 -= 1
if self._in_grid(c0, r0, C, R):
res.append((r0, c0))
step += 1
return res
def _in_grid(self, c0, r0, C, R):
return 0 <= c0 < C and 0 <= r0 < R |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class PixelTestPage(object):
"""A wrapper class mimicking the functionality of the PixelTestsStorySet
from the old-style GPU tests.
"""
def __init__(self, url, name, test_rect, revision,
expected_colors=None, tolerance=2, browser_args=None):
super(PixelTestPage, self).__init__()
self.url = url
self.name = name
self.test_rect = test_rect
self.revision = revision
# The expected colors can be specified as a list of dictionaries,
# in which case these specific pixels will be sampled instead of
# comparing the entire image snapshot. The format is only defined
# by contract with _CompareScreenshotSamples in
# cloud_storage_integration_test_base.py.
self.expected_colors = expected_colors
# The tolerance when comparing against the reference image.
self.tolerance = tolerance
self.browser_args = browser_args
def CopyWithNewBrowserArgsAndSuffix(self, browser_args, suffix):
return PixelTestPage(
self.url, self.name + suffix, self.test_rect, self.revision,
self.expected_colors, self.tolerance, browser_args)
def CopyWithNewBrowserArgsAndPrefix(self, browser_args, prefix):
# Assuming the test name is 'Pixel'.
split = self.name.split('_', 1)
return PixelTestPage(
self.url, split[0] + '_' + prefix + split[1], self.test_rect,
self.revision, self.expected_colors, self.tolerance, browser_args)
def CopyPagesWithNewBrowserArgsAndSuffix(pages, browser_args, suffix):
return [
p.CopyWithNewBrowserArgsAndSuffix(browser_args, suffix) for p in pages]
def CopyPagesWithNewBrowserArgsAndPrefix(pages, browser_args, prefix):
return [
p.CopyWithNewBrowserArgsAndPrefix(browser_args, prefix) for p in pages]
def DefaultPages(base_name):
return [
PixelTestPage(
'pixel_canvas2d.html',
base_name + '_Canvas2DRedBox',
test_rect=[0, 0, 300, 300],
revision=7),
PixelTestPage(
'pixel_css3d.html',
base_name + '_CSS3DBlueBox',
test_rect=[0, 0, 300, 300],
revision=15),
PixelTestPage(
'pixel_webgl_aa_alpha.html',
base_name + '_WebGLGreenTriangle_AA_Alpha',
test_rect=[0, 0, 300, 300],
revision=1),
PixelTestPage(
'pixel_webgl_noaa_alpha.html',
base_name + '_WebGLGreenTriangle_NoAA_Alpha',
test_rect=[0, 0, 300, 300],
revision=1),
PixelTestPage(
'pixel_webgl_aa_noalpha.html',
base_name + '_WebGLGreenTriangle_AA_NoAlpha',
test_rect=[0, 0, 300, 300],
revision=1),
PixelTestPage(
'pixel_webgl_noaa_noalpha.html',
base_name + '_WebGLGreenTriangle_NoAA_NoAlpha',
test_rect=[0, 0, 300, 300],
revision=1),
PixelTestPage(
'pixel_scissor.html',
base_name + '_ScissorTestWithPreserveDrawingBuffer',
test_rect=[0, 0, 300, 300],
revision=0, # This is not used.
expected_colors=[
{
'comment': 'red top',
'location': [1, 1],
'size': [198, 188],
'color': [255, 0, 0],
'tolerance': 3
},
{
'comment': 'green bottom left',
'location': [1, 191],
'size': [8, 8],
'color': [0, 255, 0],
'tolerance': 3
},
{
'comment': 'red bottom right',
'location': [11, 191],
'size': [188, 8],
'color': [255, 0, 0],
'tolerance': 3
}
]),
PixelTestPage(
'pixel_canvas2d_webgl.html',
base_name + '_2DCanvasWebGL',
test_rect=[0, 0, 300, 300],
revision=3),
PixelTestPage(
'pixel_background.html',
base_name + '_SolidColorBackground',
test_rect=[500, 500, 100, 100],
revision=1),
]
# Pages that should be run with experimental canvas features.
def ExperimentalCanvasFeaturesPages(base_name):
browser_args = ['--enable-experimental-canvas-features']
unaccelerated_args = [
'--disable-accelerated-2d-canvas',
'--disable-gpu-compositing']
return [
PixelTestPage(
'pixel_offscreenCanvas_transferToImageBitmap_main.html',
base_name + '_OffscreenCanvasTransferToImageBitmap',
test_rect=[0, 0, 300, 300],
revision=1,
browser_args=browser_args),
PixelTestPage(
'pixel_offscreenCanvas_transferToImageBitmap_worker.html',
base_name + '_OffscreenCanvasTransferToImageBitmapWorker',
test_rect=[0, 0, 300, 300],
revision=1,
browser_args=browser_args),
PixelTestPage(
'pixel_offscreenCanvas_webgl_commit_main.html',
base_name + '_OffscreenCanvasWebGLDefault',
test_rect=[0, 0, 350, 350],
revision=1,
browser_args=browser_args),
PixelTestPage(
'pixel_offscreenCanvas_webgl_commit_worker.html',
base_name + '_OffscreenCanvasWebGLDefaultWorker',
test_rect=[0, 0, 350, 350],
revision=1,
browser_args=browser_args),
PixelTestPage(
'pixel_offscreenCanvas_webgl_commit_main.html',
base_name + '_OffscreenCanvasWebGLSoftwareCompositing',
test_rect=[0, 0, 350, 350],
revision=2,
browser_args=browser_args + ['--disable-gpu-compositing']),
PixelTestPage(
'pixel_offscreenCanvas_webgl_commit_worker.html',
base_name + '_OffscreenCanvasWebGLSoftwareCompositingWorker',
test_rect=[0, 0, 350, 350],
revision=2,
browser_args=browser_args + ['--disable-gpu-compositing']),
PixelTestPage(
'pixel_offscreenCanvas_2d_commit_main.html',
base_name + '_OffscreenCanvasAccelerated2D',
test_rect=[0, 0, 300, 300],
revision=2,
browser_args=browser_args),
PixelTestPage(
'pixel_offscreenCanvas_2d_commit_worker.html',
base_name + '_OffscreenCanvasAccelerated2DWorker',
test_rect=[0, 0, 300, 300],
revision=2,
browser_args=browser_args),
PixelTestPage(
'pixel_offscreenCanvas_2d_commit_main.html',
base_name + '_OffscreenCanvasUnaccelerated2D',
test_rect=[0, 0, 300, 300],
revision=2,
browser_args=browser_args + unaccelerated_args),
PixelTestPage(
'pixel_offscreenCanvas_2d_commit_worker.html',
base_name + '_OffscreenCanvasUnaccelerated2DWorker',
test_rect=[0, 0, 300, 300],
revision=2,
browser_args=browser_args + unaccelerated_args),
PixelTestPage(
'pixel_offscreenCanvas_2d_commit_main.html',
base_name + '_OffscreenCanvasUnaccelerated2DGPUCompositing',
test_rect=[0, 0, 300, 300],
revision=4,
browser_args=browser_args + ['--disable-accelerated-2d-canvas']),
PixelTestPage(
'pixel_offscreenCanvas_2d_commit_worker.html',
base_name + '_OffscreenCanvasUnaccelerated2DGPUCompositingWorker',
test_rect=[0, 0, 300, 300],
revision=4,
browser_args=browser_args + ['--disable-accelerated-2d-canvas']),
PixelTestPage(
'pixel_canvas_display_linear-rgb.html',
base_name + '_CanvasDisplayLinearRGBAccelerated2D',
test_rect=[0, 0, 140, 140],
revision=1,
browser_args=browser_args),
PixelTestPage(
'pixel_canvas_display_linear-rgb.html',
base_name + '_CanvasDisplayLinearRGBUnaccelerated2D',
test_rect=[0, 0, 140, 140],
revision=1,
browser_args=browser_args + unaccelerated_args),
PixelTestPage(
'pixel_canvas_display_linear-rgb.html',
base_name + '_CanvasDisplayLinearRGBUnaccelerated2DGPUCompositing',
test_rect=[0, 0, 140, 140],
revision=1,
browser_args=browser_args + ['--disable-accelerated-2d-canvas']),
]
# Pages that should be run with various macOS specific command line
# arguments.
def MacSpecificPages(base_name):
iosurface_2d_canvas_args = [
'--enable-accelerated-2d-canvas',
'--disable-display-list-2d-canvas']
non_chromium_image_args = ['--disable-webgl-image-chromium']
return [
# On macOS, test the IOSurface 2D Canvas compositing path.
PixelTestPage(
'pixel_canvas2d_accelerated.html',
base_name + '_IOSurface2DCanvas',
test_rect=[0, 0, 400, 400],
revision=1,
browser_args=iosurface_2d_canvas_args),
PixelTestPage(
'pixel_canvas2d_webgl.html',
base_name + '_IOSurface2DCanvasWebGL',
test_rect=[0, 0, 300, 300],
revision=2,
browser_args=iosurface_2d_canvas_args),
# On macOS, test WebGL non-Chromium Image compositing path.
PixelTestPage(
'pixel_webgl_aa_alpha.html',
base_name + '_WebGLGreenTriangle_NonChromiumImage_AA_Alpha',
test_rect=[0, 0, 300, 300],
revision=1,
browser_args=non_chromium_image_args),
PixelTestPage(
'pixel_webgl_noaa_alpha.html',
base_name + '_WebGLGreenTriangle_NonChromiumImage_NoAA_Alpha',
test_rect=[0, 0, 300, 300],
revision=1,
browser_args=non_chromium_image_args),
PixelTestPage(
'pixel_webgl_aa_noalpha.html',
base_name + '_WebGLGreenTriangle_NonChromiumImage_AA_NoAlpha',
test_rect=[0, 0, 300, 300],
revision=1,
browser_args=non_chromium_image_args),
PixelTestPage(
'pixel_webgl_noaa_noalpha.html',
base_name + '_WebGLGreenTriangle_NonChromiumImage_NoAA_NoAlpha',
test_rect=[0, 0, 300, 300],
revision=1,
browser_args=non_chromium_image_args),
# On macOS, test CSS filter effects with and without the CA compositor.
PixelTestPage(
'filter_effects.html',
base_name + '_CSSFilterEffects',
test_rect=[0, 0, 300, 300],
revision=3),
PixelTestPage(
'filter_effects.html',
base_name + '_CSSFilterEffects_NoOverlays',
test_rect=[0, 0, 300, 300],
revision=3,
tolerance=10,
browser_args=['--disable-mac-overlays']),
]
| class Pixeltestpage(object):
"""A wrapper class mimicking the functionality of the PixelTestsStorySet
from the old-style GPU tests.
"""
def __init__(self, url, name, test_rect, revision, expected_colors=None, tolerance=2, browser_args=None):
super(PixelTestPage, self).__init__()
self.url = url
self.name = name
self.test_rect = test_rect
self.revision = revision
self.expected_colors = expected_colors
self.tolerance = tolerance
self.browser_args = browser_args
def copy_with_new_browser_args_and_suffix(self, browser_args, suffix):
return pixel_test_page(self.url, self.name + suffix, self.test_rect, self.revision, self.expected_colors, self.tolerance, browser_args)
def copy_with_new_browser_args_and_prefix(self, browser_args, prefix):
split = self.name.split('_', 1)
return pixel_test_page(self.url, split[0] + '_' + prefix + split[1], self.test_rect, self.revision, self.expected_colors, self.tolerance, browser_args)
def copy_pages_with_new_browser_args_and_suffix(pages, browser_args, suffix):
return [p.CopyWithNewBrowserArgsAndSuffix(browser_args, suffix) for p in pages]
def copy_pages_with_new_browser_args_and_prefix(pages, browser_args, prefix):
return [p.CopyWithNewBrowserArgsAndPrefix(browser_args, prefix) for p in pages]
def default_pages(base_name):
return [pixel_test_page('pixel_canvas2d.html', base_name + '_Canvas2DRedBox', test_rect=[0, 0, 300, 300], revision=7), pixel_test_page('pixel_css3d.html', base_name + '_CSS3DBlueBox', test_rect=[0, 0, 300, 300], revision=15), pixel_test_page('pixel_webgl_aa_alpha.html', base_name + '_WebGLGreenTriangle_AA_Alpha', test_rect=[0, 0, 300, 300], revision=1), pixel_test_page('pixel_webgl_noaa_alpha.html', base_name + '_WebGLGreenTriangle_NoAA_Alpha', test_rect=[0, 0, 300, 300], revision=1), pixel_test_page('pixel_webgl_aa_noalpha.html', base_name + '_WebGLGreenTriangle_AA_NoAlpha', test_rect=[0, 0, 300, 300], revision=1), pixel_test_page('pixel_webgl_noaa_noalpha.html', base_name + '_WebGLGreenTriangle_NoAA_NoAlpha', test_rect=[0, 0, 300, 300], revision=1), pixel_test_page('pixel_scissor.html', base_name + '_ScissorTestWithPreserveDrawingBuffer', test_rect=[0, 0, 300, 300], revision=0, expected_colors=[{'comment': 'red top', 'location': [1, 1], 'size': [198, 188], 'color': [255, 0, 0], 'tolerance': 3}, {'comment': 'green bottom left', 'location': [1, 191], 'size': [8, 8], 'color': [0, 255, 0], 'tolerance': 3}, {'comment': 'red bottom right', 'location': [11, 191], 'size': [188, 8], 'color': [255, 0, 0], 'tolerance': 3}]), pixel_test_page('pixel_canvas2d_webgl.html', base_name + '_2DCanvasWebGL', test_rect=[0, 0, 300, 300], revision=3), pixel_test_page('pixel_background.html', base_name + '_SolidColorBackground', test_rect=[500, 500, 100, 100], revision=1)]
def experimental_canvas_features_pages(base_name):
browser_args = ['--enable-experimental-canvas-features']
unaccelerated_args = ['--disable-accelerated-2d-canvas', '--disable-gpu-compositing']
return [pixel_test_page('pixel_offscreenCanvas_transferToImageBitmap_main.html', base_name + '_OffscreenCanvasTransferToImageBitmap', test_rect=[0, 0, 300, 300], revision=1, browser_args=browser_args), pixel_test_page('pixel_offscreenCanvas_transferToImageBitmap_worker.html', base_name + '_OffscreenCanvasTransferToImageBitmapWorker', test_rect=[0, 0, 300, 300], revision=1, browser_args=browser_args), pixel_test_page('pixel_offscreenCanvas_webgl_commit_main.html', base_name + '_OffscreenCanvasWebGLDefault', test_rect=[0, 0, 350, 350], revision=1, browser_args=browser_args), pixel_test_page('pixel_offscreenCanvas_webgl_commit_worker.html', base_name + '_OffscreenCanvasWebGLDefaultWorker', test_rect=[0, 0, 350, 350], revision=1, browser_args=browser_args), pixel_test_page('pixel_offscreenCanvas_webgl_commit_main.html', base_name + '_OffscreenCanvasWebGLSoftwareCompositing', test_rect=[0, 0, 350, 350], revision=2, browser_args=browser_args + ['--disable-gpu-compositing']), pixel_test_page('pixel_offscreenCanvas_webgl_commit_worker.html', base_name + '_OffscreenCanvasWebGLSoftwareCompositingWorker', test_rect=[0, 0, 350, 350], revision=2, browser_args=browser_args + ['--disable-gpu-compositing']), pixel_test_page('pixel_offscreenCanvas_2d_commit_main.html', base_name + '_OffscreenCanvasAccelerated2D', test_rect=[0, 0, 300, 300], revision=2, browser_args=browser_args), pixel_test_page('pixel_offscreenCanvas_2d_commit_worker.html', base_name + '_OffscreenCanvasAccelerated2DWorker', test_rect=[0, 0, 300, 300], revision=2, browser_args=browser_args), pixel_test_page('pixel_offscreenCanvas_2d_commit_main.html', base_name + '_OffscreenCanvasUnaccelerated2D', test_rect=[0, 0, 300, 300], revision=2, browser_args=browser_args + unaccelerated_args), pixel_test_page('pixel_offscreenCanvas_2d_commit_worker.html', base_name + '_OffscreenCanvasUnaccelerated2DWorker', test_rect=[0, 0, 300, 300], revision=2, browser_args=browser_args + unaccelerated_args), pixel_test_page('pixel_offscreenCanvas_2d_commit_main.html', base_name + '_OffscreenCanvasUnaccelerated2DGPUCompositing', test_rect=[0, 0, 300, 300], revision=4, browser_args=browser_args + ['--disable-accelerated-2d-canvas']), pixel_test_page('pixel_offscreenCanvas_2d_commit_worker.html', base_name + '_OffscreenCanvasUnaccelerated2DGPUCompositingWorker', test_rect=[0, 0, 300, 300], revision=4, browser_args=browser_args + ['--disable-accelerated-2d-canvas']), pixel_test_page('pixel_canvas_display_linear-rgb.html', base_name + '_CanvasDisplayLinearRGBAccelerated2D', test_rect=[0, 0, 140, 140], revision=1, browser_args=browser_args), pixel_test_page('pixel_canvas_display_linear-rgb.html', base_name + '_CanvasDisplayLinearRGBUnaccelerated2D', test_rect=[0, 0, 140, 140], revision=1, browser_args=browser_args + unaccelerated_args), pixel_test_page('pixel_canvas_display_linear-rgb.html', base_name + '_CanvasDisplayLinearRGBUnaccelerated2DGPUCompositing', test_rect=[0, 0, 140, 140], revision=1, browser_args=browser_args + ['--disable-accelerated-2d-canvas'])]
def mac_specific_pages(base_name):
iosurface_2d_canvas_args = ['--enable-accelerated-2d-canvas', '--disable-display-list-2d-canvas']
non_chromium_image_args = ['--disable-webgl-image-chromium']
return [pixel_test_page('pixel_canvas2d_accelerated.html', base_name + '_IOSurface2DCanvas', test_rect=[0, 0, 400, 400], revision=1, browser_args=iosurface_2d_canvas_args), pixel_test_page('pixel_canvas2d_webgl.html', base_name + '_IOSurface2DCanvasWebGL', test_rect=[0, 0, 300, 300], revision=2, browser_args=iosurface_2d_canvas_args), pixel_test_page('pixel_webgl_aa_alpha.html', base_name + '_WebGLGreenTriangle_NonChromiumImage_AA_Alpha', test_rect=[0, 0, 300, 300], revision=1, browser_args=non_chromium_image_args), pixel_test_page('pixel_webgl_noaa_alpha.html', base_name + '_WebGLGreenTriangle_NonChromiumImage_NoAA_Alpha', test_rect=[0, 0, 300, 300], revision=1, browser_args=non_chromium_image_args), pixel_test_page('pixel_webgl_aa_noalpha.html', base_name + '_WebGLGreenTriangle_NonChromiumImage_AA_NoAlpha', test_rect=[0, 0, 300, 300], revision=1, browser_args=non_chromium_image_args), pixel_test_page('pixel_webgl_noaa_noalpha.html', base_name + '_WebGLGreenTriangle_NonChromiumImage_NoAA_NoAlpha', test_rect=[0, 0, 300, 300], revision=1, browser_args=non_chromium_image_args), pixel_test_page('filter_effects.html', base_name + '_CSSFilterEffects', test_rect=[0, 0, 300, 300], revision=3), pixel_test_page('filter_effects.html', base_name + '_CSSFilterEffects_NoOverlays', test_rect=[0, 0, 300, 300], revision=3, tolerance=10, browser_args=['--disable-mac-overlays'])] |
def get_sql():
limit = 6
sql = f"SELEct speed from world where animal='dolphin' limit {limit}"
return sql
def get_query_template():
limit = 6
query_template = (
f"SELEct speed from world where animal='dolphin' group by family limit {limit}"
)
return query_template
def get_query():
limit = 99
query = f"SELEct speed from world where animal='dolphin' and name is not null group by family limit {limit}"
return query
| def get_sql():
limit = 6
sql = f"SELEct speed from world where animal='dolphin' limit {limit}"
return sql
def get_query_template():
limit = 6
query_template = f"SELEct speed from world where animal='dolphin' group by family limit {limit}"
return query_template
def get_query():
limit = 99
query = f"SELEct speed from world where animal='dolphin' and name is not null group by family limit {limit}"
return query |
postponed = 'POSTPONED'
scheduled = 'SCHEDULED'
awarded = 'AWARDED'
suspended = 'SUSPENDED'
inPlay = 'IN_PLAY'
canceled = 'CANCELED'
paused = 'PAUSED'
finished = 'FINISHED'
matchToBePlayedList = [scheduled, suspended, paused, inPlay] | postponed = 'POSTPONED'
scheduled = 'SCHEDULED'
awarded = 'AWARDED'
suspended = 'SUSPENDED'
in_play = 'IN_PLAY'
canceled = 'CANCELED'
paused = 'PAUSED'
finished = 'FINISHED'
match_to_be_played_list = [scheduled, suspended, paused, inPlay] |
class ActionException(Exception):
pass
class PingTimeout(Exception):
pass
class MeruException(Exception):
pass
| class Actionexception(Exception):
pass
class Pingtimeout(Exception):
pass
class Meruexception(Exception):
pass |
class Table(object):
def __init__(self, name, columns):
self.name = name
self.columns = columns
| class Table(object):
def __init__(self, name, columns):
self.name = name
self.columns = columns |
def test_add_group(app, xlsx_groups):
old_list = app.group.get_group_list()
app.group.add_new_group(xlsx_groups)
new_list = app.group.get_group_list()
old_list.append(xlsx_groups)
assert sorted(old_list) == sorted(new_list)
| def test_add_group(app, xlsx_groups):
old_list = app.group.get_group_list()
app.group.add_new_group(xlsx_groups)
new_list = app.group.get_group_list()
old_list.append(xlsx_groups)
assert sorted(old_list) == sorted(new_list) |
'''
Created on 18 Sep 2017
@author: ywz
'''
| """
Created on 18 Sep 2017
@author: ywz
""" |
a = 3
b = 4.0
c = a + b
d = a - b
e = a / b
tup = (a, b, c, d, e)
tup
| a = 3
b = 4.0
c = a + b
d = a - b
e = a / b
tup = (a, b, c, d, e)
tup |
#!/usr/bin/env python
NAME = 'Newdefend (NewDefend)'
def is_waf(self):
# Newdefend reveals itself within the server headers without any mal requests
if self.matchheader(('Server', 'Newdefend')):
return True
for attack in self.attacks:
r = attack(self)
if r is None:
return
_, page = r
if any(i in page for i in (b'http://www.newdefend.com/feedback', b'/nd-block/')):
return True
return False
| name = 'Newdefend (NewDefend)'
def is_waf(self):
if self.matchheader(('Server', 'Newdefend')):
return True
for attack in self.attacks:
r = attack(self)
if r is None:
return
(_, page) = r
if any((i in page for i in (b'http://www.newdefend.com/feedback', b'/nd-block/'))):
return True
return False |
# Example: Send Picture Message
id = api.send_message(
from_ = '+1234567980',
to = '+1234567981',
media = ['http://host/path/to/file']
)
| id = api.send_message(from_='+1234567980', to='+1234567981', media=['http://host/path/to/file']) |
def lps(string, result=[]):
if len(string) > 0:
end = 0
for i in range(1, len(string)):
if string[i] == string[0] and i > end:
end = i
if not result:
result.append(string[0: end + 1])
elif len(string[0: end+1]) > len(result[0]):
result.pop()
result.append(string[0: end + 1])
lps(string[1:], result)
if __name__ == "__main__":
string = "bananas"
result = []
lps(string, result)
print(result[0])
| def lps(string, result=[]):
if len(string) > 0:
end = 0
for i in range(1, len(string)):
if string[i] == string[0] and i > end:
end = i
if not result:
result.append(string[0:end + 1])
elif len(string[0:end + 1]) > len(result[0]):
result.pop()
result.append(string[0:end + 1])
lps(string[1:], result)
if __name__ == '__main__':
string = 'bananas'
result = []
lps(string, result)
print(result[0]) |
class ModesOfPaymentService(object):
"""
:class:`fortnox.ModesOfPaymentService` is used by :class:`fortnox.Client` to make
actions related to ModesOfPayment resource.
Normally you won't instantiate this class directly.
"""
"""
Allowed attributes for ModesOfPayment to send to Fortnox backend servers.
"""
OPTS_KEYS_TO_PERSIST = ['Code', 'Description']
SERVICE = "ModesOfPayment"
def __init__(self, http_client):
"""
:param :class:`fortnox.HttpClient` http_client: Pre configured high-level http client.
"""
self.__http_client = http_client
@property
def http_client(self):
return self.__http_client
def list(self, **params):
"""
Retrieve all ModesOfPayment
Returns all ModesOfPayment available to the Company, according to the parameters provided
:calls: ``get /modesofpayments``
:param dict params: (optional) Search options.
:return: List of dictionaries that support attriubte-style access, which represent collection of ModesOfPayment.
:rtype: list
"""
_, _, modes_of_payments = self.http_client.get("/modesofpayments", params=params)
return modes_of_payments
def retrieve(self, code):
"""
Retrieve a single ModesOfPayment
Returns a single ModesOfPayment according to the unique ModesOfPayment ID provided
If the specified ModesOfPayment does not exist, this query returns an error
:calls: ``get /modesofpayments/{code}``
:param int id: Unique identifier of a ModesOfPayment.
:return: Dictionary that support attriubte-style access and represent ModesOfPayment resource.
:rtype: dict
"""
_, _, modes_of_payment = self.http_client.get("/modesofpayments/{code}".format(code=code))
return modes_of_payment
def create(self, *args, **kwargs):
"""
Create a ModesOfPayment
Creates a new ModesOfPayment
**Notice** the ModesOfPayment's name **must** be unique within the scope of the resource_type
:calls: ``post /modesofpayments``
:param tuple *args: (optional) Single object representing ModesOfPayment resource.
:param dict **kwargs: (optional) modes_of_payment attributes.
:return: Dictionary that support attriubte-style access and represents newely created ModesOfPayment resource.
:rtype: dict
"""
if not args and not kwargs:
raise Exception('attributes for ModesOfPayment are missing')
initial_attributes = args[0] if args else kwargs
attributes = dict((k, v) for k, v in initial_attributes.items())
attributes.update({'service': self.SERVICE})
_, _, modes_of_payment = self.http_client.post("/modesofpayments", body=attributes)
return modes_of_payment
def update(self, code, *args, **kwargs):
"""
Update a ModesOfPayment
Updates a ModesOfPayment's information
If the specified ModesOfPayment does not exist, this query will return an error
**Notice** if you want to update a ModesOfPayment, you **must** make sure the ModesOfPayment's name is unique within the scope of the specified resource
:calls: ``put /modesofpayments/{code}``
:param int id: Unique identifier of a ModesOfPayment.
:param tuple *args: (optional) Single object representing ModesOfPayment resource which attributes should be updated.
:param dict **kwargs: (optional) ModesOfPayment attributes to update.
:return: Dictionary that support attriubte-style access and represents updated ModesOfPayment resource.
:rtype: dict
"""
if not args and not kwargs:
raise Exception('attributes for ModesOfPayment are missing')
attributes = args[0] if args else kwargs
attributes = dict((k, v) for k, v in attributes.items())
attributes.update({'service': self.SERVICE})
_, _, modes_of_payment = self.http_client.put("/modesofpayments/{code}".format(code=code), body=attributes)
return modes_of_payment
| class Modesofpaymentservice(object):
"""
:class:`fortnox.ModesOfPaymentService` is used by :class:`fortnox.Client` to make
actions related to ModesOfPayment resource.
Normally you won't instantiate this class directly.
"""
'\n Allowed attributes for ModesOfPayment to send to Fortnox backend servers.\n '
opts_keys_to_persist = ['Code', 'Description']
service = 'ModesOfPayment'
def __init__(self, http_client):
"""
:param :class:`fortnox.HttpClient` http_client: Pre configured high-level http client.
"""
self.__http_client = http_client
@property
def http_client(self):
return self.__http_client
def list(self, **params):
"""
Retrieve all ModesOfPayment
Returns all ModesOfPayment available to the Company, according to the parameters provided
:calls: ``get /modesofpayments``
:param dict params: (optional) Search options.
:return: List of dictionaries that support attriubte-style access, which represent collection of ModesOfPayment.
:rtype: list
"""
(_, _, modes_of_payments) = self.http_client.get('/modesofpayments', params=params)
return modes_of_payments
def retrieve(self, code):
"""
Retrieve a single ModesOfPayment
Returns a single ModesOfPayment according to the unique ModesOfPayment ID provided
If the specified ModesOfPayment does not exist, this query returns an error
:calls: ``get /modesofpayments/{code}``
:param int id: Unique identifier of a ModesOfPayment.
:return: Dictionary that support attriubte-style access and represent ModesOfPayment resource.
:rtype: dict
"""
(_, _, modes_of_payment) = self.http_client.get('/modesofpayments/{code}'.format(code=code))
return modes_of_payment
def create(self, *args, **kwargs):
"""
Create a ModesOfPayment
Creates a new ModesOfPayment
**Notice** the ModesOfPayment's name **must** be unique within the scope of the resource_type
:calls: ``post /modesofpayments``
:param tuple *args: (optional) Single object representing ModesOfPayment resource.
:param dict **kwargs: (optional) modes_of_payment attributes.
:return: Dictionary that support attriubte-style access and represents newely created ModesOfPayment resource.
:rtype: dict
"""
if not args and (not kwargs):
raise exception('attributes for ModesOfPayment are missing')
initial_attributes = args[0] if args else kwargs
attributes = dict(((k, v) for (k, v) in initial_attributes.items()))
attributes.update({'service': self.SERVICE})
(_, _, modes_of_payment) = self.http_client.post('/modesofpayments', body=attributes)
return modes_of_payment
def update(self, code, *args, **kwargs):
"""
Update a ModesOfPayment
Updates a ModesOfPayment's information
If the specified ModesOfPayment does not exist, this query will return an error
**Notice** if you want to update a ModesOfPayment, you **must** make sure the ModesOfPayment's name is unique within the scope of the specified resource
:calls: ``put /modesofpayments/{code}``
:param int id: Unique identifier of a ModesOfPayment.
:param tuple *args: (optional) Single object representing ModesOfPayment resource which attributes should be updated.
:param dict **kwargs: (optional) ModesOfPayment attributes to update.
:return: Dictionary that support attriubte-style access and represents updated ModesOfPayment resource.
:rtype: dict
"""
if not args and (not kwargs):
raise exception('attributes for ModesOfPayment are missing')
attributes = args[0] if args else kwargs
attributes = dict(((k, v) for (k, v) in attributes.items()))
attributes.update({'service': self.SERVICE})
(_, _, modes_of_payment) = self.http_client.put('/modesofpayments/{code}'.format(code=code), body=attributes)
return modes_of_payment |
# Exercise 66 - Translator
d = dict(weather = "clima", earth = "terra", rain = "chuva")
def vocabulary(word):
return d[word] if word in d else ''
word = input('Enter word: ')
print(vocabulary(word)) | d = dict(weather='clima', earth='terra', rain='chuva')
def vocabulary(word):
return d[word] if word in d else ''
word = input('Enter word: ')
print(vocabulary(word)) |
class BoardAlreadyExistsException(Exception):
"""
Exception used for when the Tensorboard class cannot delete a folder
that already exists. This exception should not be use for anything else.
"""
def __init__(self, name):
super().__init__(f'Tensorboard: {name} already exists') | class Boardalreadyexistsexception(Exception):
"""
Exception used for when the Tensorboard class cannot delete a folder
that already exists. This exception should not be use for anything else.
"""
def __init__(self, name):
super().__init__(f'Tensorboard: {name} already exists') |
def bytes2human(n):
# http://code.activestate.com/recipes/578019
symbols = ("K", "M", "G", "T", "P", "E", "Z", "Y")
prefix = {}
for i, s in enumerate(symbols):
prefix[s] = 1 << (i + 1) * 10
for s in reversed(symbols):
if n >= prefix[s]:
value = float(n) / prefix[s]
return "%.1f%s" % (value, s)
return "%sB" % n
| def bytes2human(n):
symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
prefix = {}
for (i, s) in enumerate(symbols):
prefix[s] = 1 << (i + 1) * 10
for s in reversed(symbols):
if n >= prefix[s]:
value = float(n) / prefix[s]
return '%.1f%s' % (value, s)
return '%sB' % n |
#!/usr/bin/env python
NAME = 'Radware AppWall'
def is_waf(self):
if self.matchheader(('X-SL-CompState', '.')):
return True
for attack in self.attacks:
r = attack(self)
if r is None:
return
_, responsebody = r
# Most reliable fingerprint is this on block page
if all(i in responsebody for i in (b'because we have detected unauthorized activity',
b'<TITLE>Unauthorized Request Blocked</TITLE>', b'If you believe that there has been some mistake',
b'?Subject=Security Page - Case Number')):
return True
# Restored a fingerprint for radware previously discarded
if b'CloudWebSec@radware.com' in responsebody:
return True
return False | name = 'Radware AppWall'
def is_waf(self):
if self.matchheader(('X-SL-CompState', '.')):
return True
for attack in self.attacks:
r = attack(self)
if r is None:
return
(_, responsebody) = r
if all((i in responsebody for i in (b'because we have detected unauthorized activity', b'<TITLE>Unauthorized Request Blocked</TITLE>', b'If you believe that there has been some mistake', b'?Subject=Security Page - Case Number'))):
return True
if b'CloudWebSec@radware.com' in responsebody:
return True
return False |
class RoutingPath:
"""Holds a list of locations and optimizes for `in` comparisons
"""
def __init__(self, path):
self._values = tuple(path)
self._set = frozenset(path)
def __len__(self):
return len(self._values)
def __getitem__(self, key):
return self._values[key]
def __iter__(self):
return iter(self._values)
def __reversed__(self):
return reversed(self._values)
def __contains__(self, key):
return key in self._set
def __eq__(self, other):
other_values = other
if isinstance(other, RoutingPath):
other_values = other._values # pylint: disable=protected-access
elif isinstance(other, list):
other_values = tuple(other)
return self._values == other_values
def index(self, *args):
return self._values.index(*args)
| class Routingpath:
"""Holds a list of locations and optimizes for `in` comparisons
"""
def __init__(self, path):
self._values = tuple(path)
self._set = frozenset(path)
def __len__(self):
return len(self._values)
def __getitem__(self, key):
return self._values[key]
def __iter__(self):
return iter(self._values)
def __reversed__(self):
return reversed(self._values)
def __contains__(self, key):
return key in self._set
def __eq__(self, other):
other_values = other
if isinstance(other, RoutingPath):
other_values = other._values
elif isinstance(other, list):
other_values = tuple(other)
return self._values == other_values
def index(self, *args):
return self._values.index(*args) |
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
if len(nums) == 1:
return 1
i = 1
l = len(nums)
cur = 0
while i < l:
if nums[cur] != nums[i]:
nums[cur+1] = nums[i]
cur += 1
i += 1
return cur + 1 | class Solution(object):
def remove_duplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
if len(nums) == 1:
return 1
i = 1
l = len(nums)
cur = 0
while i < l:
if nums[cur] != nums[i]:
nums[cur + 1] = nums[i]
cur += 1
i += 1
return cur + 1 |
def domainchanger(email,newdom,olddom = "1"):
email = email.split("@")
if newdom != email[1]:
newemail = email[0] + "@"+ newdom
return f"Changed: {newemail}"
else:
newemail = email[0] + "@"+ email[1]
return f"Unchanged: {newemail}"
email = input("Enter your email: ")
newdom = input("Enter your newdomain: ")
olddom = input("Enter your old domain: ")
if olddom == "":
print(domainchanger(email,newdom))
else:
print(domainchanger(email,newdom,olddom))
| def domainchanger(email, newdom, olddom='1'):
email = email.split('@')
if newdom != email[1]:
newemail = email[0] + '@' + newdom
return f'Changed: {newemail}'
else:
newemail = email[0] + '@' + email[1]
return f'Unchanged: {newemail}'
email = input('Enter your email: ')
newdom = input('Enter your newdomain: ')
olddom = input('Enter your old domain: ')
if olddom == '':
print(domainchanger(email, newdom))
else:
print(domainchanger(email, newdom, olddom)) |
# -*- coding: utf-8 -*-
def extract_id(object_or_id):
"""Return an id given either an object with an id or an id."""
try:
id = object_or_id.id
except AttributeError:
id = object_or_id
return id
def extract_ids(objects_or_ids):
"""Return a list of ids given either objects with ids or a list of ids."""
try:
ids = [obj.id for obj in objects_or_ids]
except:
ids = objects_or_ids
return ids
def maybe(fn, val):
"""Return fn(val) if val is not None, else None."""
if val:
return fn(val)
else:
return None
| def extract_id(object_or_id):
"""Return an id given either an object with an id or an id."""
try:
id = object_or_id.id
except AttributeError:
id = object_or_id
return id
def extract_ids(objects_or_ids):
"""Return a list of ids given either objects with ids or a list of ids."""
try:
ids = [obj.id for obj in objects_or_ids]
except:
ids = objects_or_ids
return ids
def maybe(fn, val):
"""Return fn(val) if val is not None, else None."""
if val:
return fn(val)
else:
return None |
"""Params for ADDA."""
# params for dataset and data loader
data_root = "data"
usps_data = data_root + '/USPS'
mnistm_data = data_root + '/MNIST_M'
svhn_data = data_root + '/SVHN'
dataset_mean_value = 0.5
dataset_std_value = 0.5
dataset_mean = (dataset_mean_value, dataset_mean_value, dataset_mean_value)
dataset_std = (dataset_std_value, dataset_std_value, dataset_std_value)
batch_size = 128
# models
model_root = "snapshots"
src_encoder_restore = 'snapshots/{:s}/ADDA-source-encoder-best.pt'
src_classifier_restore = "snapshots/{:s}/ADDA-source-classifier-best.pt"
tgt_encoder_restore = "snapshots/{:s}/ADDA-target-encoder-best.pt"
d_model_restore = "snapshots/{:s}/ADDA-critic-best.pt"
src_model_trained = True
tgt_model_trained = True
d_input_dims = 500
d_hidden_dims = 500
d_output_dims = 2
# params for training network
num_gpu = 1
num_epochs_pre = 200
log_step_pre = 100
save_step_pre = 50
eval_step_pre = 5
num_epochs_adapt = 1500
log_step_adapt = 100
save_step_adapt = 500
eval_step_adapt = 5
"""
num_epochs_pre = 20
log_step_pre = 100
save_step_pre = 10
eval_step_pre = 5
num_epochs_adapt = 40
log_step_adapt = 100
save_step_adapt = 20
eval_step_adapt = 5
"""
manual_seed = None
# params for optimizing models
d_learning_rate = 1e-3
c_learning_rate = 2 * 1e-4
beta1 = 0.5
beta2 = 0.9
| """Params for ADDA."""
data_root = 'data'
usps_data = data_root + '/USPS'
mnistm_data = data_root + '/MNIST_M'
svhn_data = data_root + '/SVHN'
dataset_mean_value = 0.5
dataset_std_value = 0.5
dataset_mean = (dataset_mean_value, dataset_mean_value, dataset_mean_value)
dataset_std = (dataset_std_value, dataset_std_value, dataset_std_value)
batch_size = 128
model_root = 'snapshots'
src_encoder_restore = 'snapshots/{:s}/ADDA-source-encoder-best.pt'
src_classifier_restore = 'snapshots/{:s}/ADDA-source-classifier-best.pt'
tgt_encoder_restore = 'snapshots/{:s}/ADDA-target-encoder-best.pt'
d_model_restore = 'snapshots/{:s}/ADDA-critic-best.pt'
src_model_trained = True
tgt_model_trained = True
d_input_dims = 500
d_hidden_dims = 500
d_output_dims = 2
num_gpu = 1
num_epochs_pre = 200
log_step_pre = 100
save_step_pre = 50
eval_step_pre = 5
num_epochs_adapt = 1500
log_step_adapt = 100
save_step_adapt = 500
eval_step_adapt = 5
'\nnum_epochs_pre = 20\nlog_step_pre = 100\nsave_step_pre = 10\neval_step_pre = 5\n\nnum_epochs_adapt = 40\nlog_step_adapt = 100\nsave_step_adapt = 20\neval_step_adapt = 5\n'
manual_seed = None
d_learning_rate = 0.001
c_learning_rate = 2 * 0.0001
beta1 = 0.5
beta2 = 0.9 |
#!/usr/bin/env python
""" This simple Python script can be run to generate
ztriangle_code_*.h, ztriangle_table.*, and ztriangle_*.cxx, which
are a poor man's form of generated code to cover the explosion of
different rendering options while scanning out triangles.
Each different combination of options is compiled to a different
inner-loop triangle scan function. The code in
tinyGraphicsStateGuardian.cxx will select the appropriate function
pointer at draw time. """
# This is the number of generated ztriangle_code_*.h and
# ztriangle_*.cxx files we will produce. You may change this freely;
# you should also change the Sources.pp file accordingly.
NumSegments = 4
# We generate an #include "ztriangle_two.h" for each combination of
# these options.
Options = [
# depth write
[ 'zon', 'zoff' ],
# color write
[ 'cstore', 'cblend', 'cgeneral', 'coff', 'csstore', 'csblend' ],
# alpha test
[ 'anone', 'aless', 'amore' ],
# depth test
[ 'znone', 'zless' ],
# texture filters
[ 'tnearest', 'tmipmap', 'tgeneral' ],
]
# The total number of different combinations of the various Options, above.
OptionsCount = reduce(lambda a, b: a * b, map(lambda o: len(o), Options))
# The various combinations of these options are explicit within
# ztriangle_two.h.
ExtraOptions = [
# shade model
[ 'white', 'flat', 'smooth' ],
# texturing
[ 'untextured', 'textured', 'perspective', 'multitex2', 'multitex3' ],
]
# The expansion of all ExtraOptions combinations into a linear list.
ExtraOptionsMat = []
for i in range(len(ExtraOptions[0])):
for j in range(len(ExtraOptions[1])):
ExtraOptionsMat.append([i, j])
FullOptions = Options + ExtraOptions
CodeTable = {
# depth write
'zon' : '#define STORE_Z(zpix, z) (zpix) = (z)',
'zoff' : '#define STORE_Z(zpix, z)',
# color write
'cstore' : '#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = (rgb)',
'cblend' : '#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_RGB(pix, r, g, b, a)',
'cgeneral' : '#define STORE_PIX(pix, rgb, r, g, b, a) zb->store_pix_func(zb, pix, r, g, b, a)',
'coff' : '#define STORE_PIX(pix, rgb, r, g, b, a)',
# color write, sRGB
'csstore' : '#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = SRGBA_TO_PIXEL(r, g, b, a)',
'csblend' : '#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_SRGB(pix, r, g, b, a)',
# alpha test
'anone' : '#define ACMP(zb, a) 1',
'aless' : '#define ACMP(zb, a) (((int)(a)) < (zb)->reference_alpha)',
'amore' : '#define ACMP(zb, a) (((int)(a)) > (zb)->reference_alpha)',
# depth test
'znone' : '#define ZCMP(zpix, z) 1',
'zless' : '#define ZCMP(zpix, z) ((ZPOINT)(zpix) < (ZPOINT)(z))',
# texture filters
'tnearest' : '#define CALC_MIPMAP_LEVEL(mipmap_level, mipmap_dx, dsdx, dtdx)\n#define ZB_LOOKUP_TEXTURE(texture_def, s, t, level, level_dx) ZB_LOOKUP_TEXTURE_NEAREST(texture_def, s, t)',
'tmipmap' : '#define CALC_MIPMAP_LEVEL(mipmap_level, mipmap_dx, dsdx, dtdx) DO_CALC_MIPMAP_LEVEL(mipmap_level, mipmap_dx, dsdx, dtdx)\n#define INTERP_MIPMAP\n#define ZB_LOOKUP_TEXTURE(texture_def, s, t, level, level_dx) ZB_LOOKUP_TEXTURE_MIPMAP_NEAREST(texture_def, s, t, level)',
'tgeneral' : '#define CALC_MIPMAP_LEVEL(mipmap_level, mipmap_dx, dsdx, dtdx) DO_CALC_MIPMAP_LEVEL(mipmap_level, mipmap_dx, dsdx, dtdx)\n#define INTERP_MIPMAP\n#define ZB_LOOKUP_TEXTURE(texture_def, s, t, level, level_dx) ((level == 0) ? (texture_def)->tex_magfilter_func(texture_def, s, t, level, level_dx) : (texture_def)->tex_minfilter_func(texture_def, s, t, level, level_dx))',
}
ZTriangleStub = """
/* This file is generated code--do not edit. See ztriangle.py. */
#include <stdlib.h>
#include <stdio.h>
#include "pandabase.h"
#include "zbuffer.h"
/* Pick up all of the generated code references to ztriangle_two.h,
which ultimately calls ztriangle.h, many, many times. */
#include "ztriangle_table.h"
#include "ztriangle_code_%s.h"
"""
ops = [0] * len(Options)
class DoneException:
pass
# We write the code that actually instantiates the various
# triangle-filling functions to ztriangle_code_*.h.
code = None
codeSeg = None
fnameDict = {}
fnameList = None
def incrementOptions(ops, i = -1):
if i < -len(ops):
raise DoneException
# Increment the least-significant place if we can.
if ops[i] + 1 < len(Options[i]):
ops[i] += 1
return
# Recurse for the next-most-significant place.
ops[i] = 0
incrementOptions(ops, i - 1)
def getFname(ops):
# Returns the function name corresponding to the indicated ops
# vector.
keywordList = []
for i in range(len(ops)):
keyword = FullOptions[i][ops[i]]
keywordList.append(keyword)
if keywordList[-1].startswith('multitex'):
# We don't bother with white_multitex or flat_multitex.
keywordList[-2] = 'smooth'
fname = 'FB_triangle_%s' % ('_'.join(keywordList))
return fname
def getFref(ops):
# Returns a string that evaluates to a pointer reference to the
# indicated function.
fname = getFname(ops)
codeSeg, i = fnameDict[fname]
fref = 'ztriangle_code_%s[%s]' % (codeSeg, i)
return fref
def closeCode():
""" Close the previously-opened code file. """
if code:
print >> code, ''
print >> code, 'ZB_fillTriangleFunc ztriangle_code_%s[%s] = {' % (codeSeg, len(fnameList))
for fname in fnameList:
print >> code, ' %s,' % (fname)
print >> code, '};'
code.close()
def openCode(count):
""" Open the code file appropriate to the current segment. We
write out the generated code into a series of smaller files,
instead of one mammoth file, just to make it easier on the
compiler. """
global code, codeSeg, fnameList
seg = int(NumSegments * count / OptionsCount) + 1
if codeSeg != seg:
closeCode()
codeSeg = seg
fnameList = []
# Open a new file.
code = open('ztriangle_code_%s.h' % (codeSeg), 'wb')
print >> code, '/* This file is generated code--do not edit. See ztriangle.py. */'
print >> code, ''
# Also generate ztriangle_*.cxx, to include the above file.
zt = open('ztriangle_%s.cxx' % (codeSeg), 'wb')
print >> zt, ZTriangleStub % (codeSeg)
# First, generate the code.
count = 0
try:
while True:
openCode(count)
for i in range(len(ops)):
keyword = Options[i][ops[i]]
print >> code, CodeTable[keyword]
# This reference gets just the initial fname: omitting the
# ExtraOptions, which are implicit in ztriangle_two.h.
fname = getFname(ops)
print >> code, '#define FNAME(name) %s_ ## name' % (fname)
print >> code, '#include "ztriangle_two.h"'
print >> code, ''
# We store the full fnames generated by the above lines
# (including the ExtraOptions) in the fnameDict and fnameList
# tables.
for eops in ExtraOptionsMat:
fops = ops + eops
fname = getFname(fops)
fnameDict[fname] = (codeSeg, len(fnameList))
fnameList.append(fname)
count += 1
incrementOptions(ops)
assert count < OptionsCount
except DoneException:
pass
assert count == OptionsCount
closeCode()
# Now, generate the table of function pointers.
# The external reference for the table containing the above function
# pointers gets written here.
table_decl = open('ztriangle_table.h', 'wb')
print >> table_decl, '/* This file is generated code--do not edit. See ztriangle.py. */'
print >> table_decl, ''
# The actual table definition gets written here.
table_def = open('ztriangle_table.cxx', 'wb')
print >> table_def, '/* This file is generated code--do not edit. See ztriangle.py. */'
print >> table_def, ''
print >> table_def, '#include "pandabase.h"'
print >> table_def, '#include "zbuffer.h"'
print >> table_def, '#include "ztriangle_table.h"'
print >> table_def, ''
for i in range(NumSegments):
print >> table_def, 'extern ZB_fillTriangleFunc ztriangle_code_%s[];' % (i + 1)
print >> table_def, ''
def writeTableEntry(ops):
indent = ' ' * (len(ops) + 1)
i = len(ops)
numOps = len(FullOptions[i])
if i + 1 == len(FullOptions):
# The last level: write out the actual function names.
for j in range(numOps - 1):
print >> table_def, indent + getFref(ops + [j]) + ','
print >> table_def, indent + getFref(ops + [numOps - 1])
else:
# Intermediate levels: write out a nested reference.
for j in range(numOps - 1):
print >> table_def, indent + '{'
writeTableEntry(ops + [j])
print >> table_def, indent + '},'
print >> table_def, indent + '{'
writeTableEntry(ops + [numOps - 1])
print >> table_def, indent + '}'
arraySizeList = []
for opList in FullOptions:
arraySizeList.append('[%s]' % (len(opList)))
arraySize = ''.join(arraySizeList)
print >> table_def, 'const ZB_fillTriangleFunc fill_tri_funcs%s = {' % (arraySize)
print >> table_decl, 'extern const ZB_fillTriangleFunc fill_tri_funcs%s;' % (arraySize)
writeTableEntry([])
print >> table_def, '};'
| """ This simple Python script can be run to generate
ztriangle_code_*.h, ztriangle_table.*, and ztriangle_*.cxx, which
are a poor man's form of generated code to cover the explosion of
different rendering options while scanning out triangles.
Each different combination of options is compiled to a different
inner-loop triangle scan function. The code in
tinyGraphicsStateGuardian.cxx will select the appropriate function
pointer at draw time. """
num_segments = 4
options = [['zon', 'zoff'], ['cstore', 'cblend', 'cgeneral', 'coff', 'csstore', 'csblend'], ['anone', 'aless', 'amore'], ['znone', 'zless'], ['tnearest', 'tmipmap', 'tgeneral']]
options_count = reduce(lambda a, b: a * b, map(lambda o: len(o), Options))
extra_options = [['white', 'flat', 'smooth'], ['untextured', 'textured', 'perspective', 'multitex2', 'multitex3']]
extra_options_mat = []
for i in range(len(ExtraOptions[0])):
for j in range(len(ExtraOptions[1])):
ExtraOptionsMat.append([i, j])
full_options = Options + ExtraOptions
code_table = {'zon': '#define STORE_Z(zpix, z) (zpix) = (z)', 'zoff': '#define STORE_Z(zpix, z)', 'cstore': '#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = (rgb)', 'cblend': '#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_RGB(pix, r, g, b, a)', 'cgeneral': '#define STORE_PIX(pix, rgb, r, g, b, a) zb->store_pix_func(zb, pix, r, g, b, a)', 'coff': '#define STORE_PIX(pix, rgb, r, g, b, a)', 'csstore': '#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = SRGBA_TO_PIXEL(r, g, b, a)', 'csblend': '#define STORE_PIX(pix, rgb, r, g, b, a) (pix) = PIXEL_BLEND_SRGB(pix, r, g, b, a)', 'anone': '#define ACMP(zb, a) 1', 'aless': '#define ACMP(zb, a) (((int)(a)) < (zb)->reference_alpha)', 'amore': '#define ACMP(zb, a) (((int)(a)) > (zb)->reference_alpha)', 'znone': '#define ZCMP(zpix, z) 1', 'zless': '#define ZCMP(zpix, z) ((ZPOINT)(zpix) < (ZPOINT)(z))', 'tnearest': '#define CALC_MIPMAP_LEVEL(mipmap_level, mipmap_dx, dsdx, dtdx)\n#define ZB_LOOKUP_TEXTURE(texture_def, s, t, level, level_dx) ZB_LOOKUP_TEXTURE_NEAREST(texture_def, s, t)', 'tmipmap': '#define CALC_MIPMAP_LEVEL(mipmap_level, mipmap_dx, dsdx, dtdx) DO_CALC_MIPMAP_LEVEL(mipmap_level, mipmap_dx, dsdx, dtdx)\n#define INTERP_MIPMAP\n#define ZB_LOOKUP_TEXTURE(texture_def, s, t, level, level_dx) ZB_LOOKUP_TEXTURE_MIPMAP_NEAREST(texture_def, s, t, level)', 'tgeneral': '#define CALC_MIPMAP_LEVEL(mipmap_level, mipmap_dx, dsdx, dtdx) DO_CALC_MIPMAP_LEVEL(mipmap_level, mipmap_dx, dsdx, dtdx)\n#define INTERP_MIPMAP\n#define ZB_LOOKUP_TEXTURE(texture_def, s, t, level, level_dx) ((level == 0) ? (texture_def)->tex_magfilter_func(texture_def, s, t, level, level_dx) : (texture_def)->tex_minfilter_func(texture_def, s, t, level, level_dx))'}
z_triangle_stub = '\n/* This file is generated code--do not edit. See ztriangle.py. */\n#include <stdlib.h>\n#include <stdio.h>\n#include "pandabase.h"\n#include "zbuffer.h"\n\n/* Pick up all of the generated code references to ztriangle_two.h,\n which ultimately calls ztriangle.h, many, many times. */\n\n#include "ztriangle_table.h"\n#include "ztriangle_code_%s.h"\n'
ops = [0] * len(Options)
class Doneexception:
pass
code = None
code_seg = None
fname_dict = {}
fname_list = None
def increment_options(ops, i=-1):
if i < -len(ops):
raise DoneException
if ops[i] + 1 < len(Options[i]):
ops[i] += 1
return
ops[i] = 0
increment_options(ops, i - 1)
def get_fname(ops):
keyword_list = []
for i in range(len(ops)):
keyword = FullOptions[i][ops[i]]
keywordList.append(keyword)
if keywordList[-1].startswith('multitex'):
keywordList[-2] = 'smooth'
fname = 'FB_triangle_%s' % '_'.join(keywordList)
return fname
def get_fref(ops):
fname = get_fname(ops)
(code_seg, i) = fnameDict[fname]
fref = 'ztriangle_code_%s[%s]' % (codeSeg, i)
return fref
def close_code():
""" Close the previously-opened code file. """
if code:
(print >> code, '')
(print >> code, 'ZB_fillTriangleFunc ztriangle_code_%s[%s] = {' % (codeSeg, len(fnameList)))
for fname in fnameList:
(print >> code, ' %s,' % fname)
(print >> code, '};')
code.close()
def open_code(count):
""" Open the code file appropriate to the current segment. We
write out the generated code into a series of smaller files,
instead of one mammoth file, just to make it easier on the
compiler. """
global code, codeSeg, fnameList
seg = int(NumSegments * count / OptionsCount) + 1
if codeSeg != seg:
close_code()
code_seg = seg
fname_list = []
code = open('ztriangle_code_%s.h' % codeSeg, 'wb')
(print >> code, '/* This file is generated code--do not edit. See ztriangle.py. */')
(print >> code, '')
zt = open('ztriangle_%s.cxx' % codeSeg, 'wb')
(print >> zt, ZTriangleStub % codeSeg)
count = 0
try:
while True:
open_code(count)
for i in range(len(ops)):
keyword = Options[i][ops[i]]
(print >> code, CodeTable[keyword])
fname = get_fname(ops)
(print >> code, '#define FNAME(name) %s_ ## name' % fname)
(print >> code, '#include "ztriangle_two.h"')
(print >> code, '')
for eops in ExtraOptionsMat:
fops = ops + eops
fname = get_fname(fops)
fnameDict[fname] = (codeSeg, len(fnameList))
fnameList.append(fname)
count += 1
increment_options(ops)
assert count < OptionsCount
except DoneException:
pass
assert count == OptionsCount
close_code()
table_decl = open('ztriangle_table.h', 'wb')
(print >> table_decl, '/* This file is generated code--do not edit. See ztriangle.py. */')
(print >> table_decl, '')
table_def = open('ztriangle_table.cxx', 'wb')
(print >> table_def, '/* This file is generated code--do not edit. See ztriangle.py. */')
(print >> table_def, '')
(print >> table_def, '#include "pandabase.h"')
(print >> table_def, '#include "zbuffer.h"')
(print >> table_def, '#include "ztriangle_table.h"')
(print >> table_def, '')
for i in range(NumSegments):
(print >> table_def, 'extern ZB_fillTriangleFunc ztriangle_code_%s[];' % (i + 1))
(print >> table_def, '')
def write_table_entry(ops):
indent = ' ' * (len(ops) + 1)
i = len(ops)
num_ops = len(FullOptions[i])
if i + 1 == len(FullOptions):
for j in range(numOps - 1):
(print >> table_def, indent + get_fref(ops + [j]) + ',')
(print >> table_def, indent + get_fref(ops + [numOps - 1]))
else:
for j in range(numOps - 1):
(print >> table_def, indent + '{')
write_table_entry(ops + [j])
(print >> table_def, indent + '},')
(print >> table_def, indent + '{')
write_table_entry(ops + [numOps - 1])
(print >> table_def, indent + '}')
array_size_list = []
for op_list in FullOptions:
arraySizeList.append('[%s]' % len(opList))
array_size = ''.join(arraySizeList)
(print >> table_def, 'const ZB_fillTriangleFunc fill_tri_funcs%s = {' % arraySize)
(print >> table_decl, 'extern const ZB_fillTriangleFunc fill_tri_funcs%s;' % arraySize)
write_table_entry([])
(print >> table_def, '};') |
class Vector:
def __init__(self, length=3, vec=None):
self._vec = []
if isinstance(vec, list):
self._vec = vec.copy()
else:
if isinstance(length, (int, float)):
for i in range(int(length)):
self._vec.append(0)
self._length = len(self._vec)
def __repr__(self):
s = str(self.__class__)
s += '('
s += str(self._vec)
s += ')'
return s
def __str__(self):
s = '('
for i in range(self._length):
s += str(self._vec[i])
if i < self._length - 1:
s += ', '
s += ')'
return s
def __iter__(self):
self._In = 0
return self
def __next__(self):
self._In += 1
if self._In - 1 < self._length:
return self._vec[self._In - 1]
else:
raise StopIteration
def correctIndex(self, index):
if isinstance(index, (int, float)):
key = int(index)
if key >= 0 and key < self._length:
return key
return None
def __getitem__(self, key):
index = self.correctIndex(key)
if index != None:
return self._vec[index]
def __setitem__(self, key, value):
index = self.correctIndex(key)
if index != None:
self._vec[index] = value
def __add__(self, other):
if isinstance(other, Vector):
if self._length == other.getLength():
newVector = Vector(length = self._length)
for i in range(self._length):
newVector[i] = self[i] + other[i]
return newVector
def __iadd__(self, other):
return self + other
def __mul__(self, other):
if isinstance(other, (int, float)):
newVector = Vector(length = self._length)
for i in range(self._length):
newVector[i] = self[i] * other
return newVector
if isinstance(other, type(self)):
sp = 0
for i in range(len(other)):
sp += self[i] * other[i]
return Vector(vec = [sp])
def __imul__(self, other):
return self * other
def __sub__(self, other):
return self + (other * -1)
def __isub__(self, other):
return self - other
def __div__(self, other):
if isinstance(other, (int, float)):
if other != 0:
return self * (1 / other)
def __idiv__(self, other):
return self / other
def __len__(self):
return len(self._vec)
def getLength(self):
return self._length
def __eq__(self, other):
if isinstance(other, type(self)):
if len(self) == len(other):
for i in range(len(self)):
if self[i] != other[i]:
return False
return True
return False
def __ne__(self, other):
return not self == other
| class Vector:
def __init__(self, length=3, vec=None):
self._vec = []
if isinstance(vec, list):
self._vec = vec.copy()
elif isinstance(length, (int, float)):
for i in range(int(length)):
self._vec.append(0)
self._length = len(self._vec)
def __repr__(self):
s = str(self.__class__)
s += '('
s += str(self._vec)
s += ')'
return s
def __str__(self):
s = '('
for i in range(self._length):
s += str(self._vec[i])
if i < self._length - 1:
s += ', '
s += ')'
return s
def __iter__(self):
self._In = 0
return self
def __next__(self):
self._In += 1
if self._In - 1 < self._length:
return self._vec[self._In - 1]
else:
raise StopIteration
def correct_index(self, index):
if isinstance(index, (int, float)):
key = int(index)
if key >= 0 and key < self._length:
return key
return None
def __getitem__(self, key):
index = self.correctIndex(key)
if index != None:
return self._vec[index]
def __setitem__(self, key, value):
index = self.correctIndex(key)
if index != None:
self._vec[index] = value
def __add__(self, other):
if isinstance(other, Vector):
if self._length == other.getLength():
new_vector = vector(length=self._length)
for i in range(self._length):
newVector[i] = self[i] + other[i]
return newVector
def __iadd__(self, other):
return self + other
def __mul__(self, other):
if isinstance(other, (int, float)):
new_vector = vector(length=self._length)
for i in range(self._length):
newVector[i] = self[i] * other
return newVector
if isinstance(other, type(self)):
sp = 0
for i in range(len(other)):
sp += self[i] * other[i]
return vector(vec=[sp])
def __imul__(self, other):
return self * other
def __sub__(self, other):
return self + other * -1
def __isub__(self, other):
return self - other
def __div__(self, other):
if isinstance(other, (int, float)):
if other != 0:
return self * (1 / other)
def __idiv__(self, other):
return self / other
def __len__(self):
return len(self._vec)
def get_length(self):
return self._length
def __eq__(self, other):
if isinstance(other, type(self)):
if len(self) == len(other):
for i in range(len(self)):
if self[i] != other[i]:
return False
return True
return False
def __ne__(self, other):
return not self == other |
# -*- coding: utf-8 -*-
"""
pip_services3_mongodb.__init__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mongodb module initialization
:copyright: Conceptual Vision Consulting LLC 2015-2016, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
__all__ = [ ]
| """
pip_services3_mongodb.__init__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mongodb module initialization
:copyright: Conceptual Vision Consulting LLC 2015-2016, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
__all__ = [] |
'''
This file contains config values (like the port numbers) used by our library
'''
#:port to use for socket communications
PORT = 1001
#:ip address of group to use for multicast communications
MULTICAST_GROUP_IP = '224.15.35.42'
#:port to use for multicast communications
MULTICAST_PORT = 10000
#:the default timeout for all sockets
DEFAULT_TIMEOUT = 10
#:the max size of a queue for socket requests
MAX_CONNECT_REQUESTS = 5
#:the max buffer size for socket data
NETWORK_CHUNK_SIZE = 8192 #max buffer size to read | """
This file contains config values (like the port numbers) used by our library
"""
port = 1001
multicast_group_ip = '224.15.35.42'
multicast_port = 10000
default_timeout = 10
max_connect_requests = 5
network_chunk_size = 8192 |
food_items = [
"ham",
#"spam",
"eggs",
"nuts"
]
for food in food_items:
if food == "spam":
print ("No spam please")
break
print ("Great - ", food)
#else:
# print ("I am glad - There was no spam")
print ("Finally I have finished") | food_items = ['ham', 'eggs', 'nuts']
for food in food_items:
if food == 'spam':
print('No spam please')
break
print('Great - ', food)
print('Finally I have finished') |
# https://leetcode.com/problems/sum-of-two-integers/
class Solution:
def getSum(self, a: int, b: int) -> int:
result = sum([a, b])
return result
a = 1
b = 2
s = Solution()
result = s.getSum(a, b) | class Solution:
def get_sum(self, a: int, b: int) -> int:
result = sum([a, b])
return result
a = 1
b = 2
s = solution()
result = s.getSum(a, b) |
class HttpHeaders:
X_CORRELATION_ID = "X-Correlation-ID"
CONTENT_TYPE = "Content-Type"
ACCEPT = 'Accept'
| class Httpheaders:
x_correlation_id = 'X-Correlation-ID'
content_type = 'Content-Type'
accept = 'Accept' |
ES_HOST = 'localhost:9200'
ES_INDEX = 'pending-repodb'
ES_DOC_TYPE = 'chemical'
API_PREFIX = 'repodb'
API_VERSION = ''
| es_host = 'localhost:9200'
es_index = 'pending-repodb'
es_doc_type = 'chemical'
api_prefix = 'repodb'
api_version = '' |
def check_types(value, *types, var_name="value"):
"""
Check value by types compliance.
:param value: object.
Value to check.
:param types: tuple.
Types list to compare.
:param var_name: str, optional (default="value").
Name of the variable for exception message.
"""
if len(types) == 0:
raise ValueError("Types list is empty.")
bad_type = True
for type_ in types:
if type(value) is type_:
bad_type = False
if bad_type:
raise ValueError(f"{var_name} parameter must be {types}: "
f"got {type(value)}.")
def check_value(value, lower=None, upper=None, strict_less=False,
strict_greater=False, var_name="value"):
"""
Check for compliance with the bounds.
:param value: object.
Value to check.
:param lower: object, optional (default=None).
Lower bound for comparison.
:param upper: object, optional (default=None).
Upper bound for comparison.
:param strict_less: bool, optional (default=False).
Type of comparison for lower bound.
:param strict_greater: bool, optional (default=False).
Type of comparison for upper bound.
:param var_name: str, optional (default="value").
Name of the variable for exception message.
"""
lower_value = lower is not None
upper_value = upper is not None
if not lower_value and strict_less:
raise ValueError("strict_less argument must be False when lower is "
"not specified.")
if not upper_value and strict_greater:
raise ValueError("strict_greater argument must be False when upper is "
"not specified.")
# Dict where keys have format like
# (lower_value, upper_value, strict_less, strict_greater)
possible_options = {
(True, False, True, False): {"res": lambda x: lower < x,
"str": f"({lower}, inf)"},
(True, False, False, False): {"res": lambda x: lower <= x,
"str": f"[{lower}, inf)"},
(False, True, False, True): {"res": lambda x: x < upper,
"str": f"(-inf, {upper})"},
(False, True, False, False): {"res": lambda x: x <= upper,
"str": f"(-inf, {upper}]"},
(True, True, True, True): {"res": lambda x: lower < x < upper,
"str": f"({lower}, {upper})"},
(True, True, False, True): {"res": lambda x: lower <= x < upper,
"str": f"[{lower}, {upper})"},
(True, True, True, False): {"res": lambda x: lower < x <= upper,
"str": f"({lower}, {upper}]"},
(True, True, False, False): {"res": lambda x: lower <= x <= upper,
"str": f"[{lower}, {upper}]"}
}
result = possible_options[lower_value, upper_value,
strict_less, strict_greater]
if not result["res"](value):
raise ValueError(f"{var_name} parameter must be in {result['str']}: "
f"got {value}.")
def check_equality(value, expected_value, message=None):
"""
Check two values by equality.
:param value: object.
Value to check.
:param expected_value: object.
Value to compare.
:param message: str, optional(default=None).
Message to output with exception.
"""
if value != expected_value:
if message is None:
raise ValueError(f"Variable has unexpected value: "
f"{value} != {expected_value}")
raise ValueError(f"{message}: {value} != {expected_value}")
def check_inheritance(instance, class_, message=None):
"""
Check class on the according interface.
:param instance: object.
Value to check.
:param class_: class
Type of the class to compare.
:param message: str, optional(default=None).
Message to output with exception.
"""
if not isinstance(instance, class_):
if message is None:
raise ValueError(f"{type(instance)} is not subclass of {class_}.")
raise ValueError(f"{message}: "
f"{type(instance)} is not subclass of {class_}.")
| def check_types(value, *types, var_name='value'):
"""
Check value by types compliance.
:param value: object.
Value to check.
:param types: tuple.
Types list to compare.
:param var_name: str, optional (default="value").
Name of the variable for exception message.
"""
if len(types) == 0:
raise value_error('Types list is empty.')
bad_type = True
for type_ in types:
if type(value) is type_:
bad_type = False
if bad_type:
raise value_error(f'{var_name} parameter must be {types}: got {type(value)}.')
def check_value(value, lower=None, upper=None, strict_less=False, strict_greater=False, var_name='value'):
"""
Check for compliance with the bounds.
:param value: object.
Value to check.
:param lower: object, optional (default=None).
Lower bound for comparison.
:param upper: object, optional (default=None).
Upper bound for comparison.
:param strict_less: bool, optional (default=False).
Type of comparison for lower bound.
:param strict_greater: bool, optional (default=False).
Type of comparison for upper bound.
:param var_name: str, optional (default="value").
Name of the variable for exception message.
"""
lower_value = lower is not None
upper_value = upper is not None
if not lower_value and strict_less:
raise value_error('strict_less argument must be False when lower is not specified.')
if not upper_value and strict_greater:
raise value_error('strict_greater argument must be False when upper is not specified.')
possible_options = {(True, False, True, False): {'res': lambda x: lower < x, 'str': f'({lower}, inf)'}, (True, False, False, False): {'res': lambda x: lower <= x, 'str': f'[{lower}, inf)'}, (False, True, False, True): {'res': lambda x: x < upper, 'str': f'(-inf, {upper})'}, (False, True, False, False): {'res': lambda x: x <= upper, 'str': f'(-inf, {upper}]'}, (True, True, True, True): {'res': lambda x: lower < x < upper, 'str': f'({lower}, {upper})'}, (True, True, False, True): {'res': lambda x: lower <= x < upper, 'str': f'[{lower}, {upper})'}, (True, True, True, False): {'res': lambda x: lower < x <= upper, 'str': f'({lower}, {upper}]'}, (True, True, False, False): {'res': lambda x: lower <= x <= upper, 'str': f'[{lower}, {upper}]'}}
result = possible_options[lower_value, upper_value, strict_less, strict_greater]
if not result['res'](value):
raise value_error(f"{var_name} parameter must be in {result['str']}: got {value}.")
def check_equality(value, expected_value, message=None):
"""
Check two values by equality.
:param value: object.
Value to check.
:param expected_value: object.
Value to compare.
:param message: str, optional(default=None).
Message to output with exception.
"""
if value != expected_value:
if message is None:
raise value_error(f'Variable has unexpected value: {value} != {expected_value}')
raise value_error(f'{message}: {value} != {expected_value}')
def check_inheritance(instance, class_, message=None):
"""
Check class on the according interface.
:param instance: object.
Value to check.
:param class_: class
Type of the class to compare.
:param message: str, optional(default=None).
Message to output with exception.
"""
if not isinstance(instance, class_):
if message is None:
raise value_error(f'{type(instance)} is not subclass of {class_}.')
raise value_error(f'{message}: {type(instance)} is not subclass of {class_}.') |
def match(text, pattern, base=10):
text_len = len(text)
pattern_len = len(pattern)
text_hash = _get_hash(text[:pattern_len], base)
pattern_hash = _get_hash(pattern, base)
matches = []
for i in xrange(text_len - pattern_len + 1):
if pattern_hash == text_hash:
# If the hashes match, we also need to check if the text substring
# and the pattern are the same. Hash matches can be result of
# collisons.
if pattern == text[i:i + pattern_len]:
matches.append(i)
if i >= text_len - pattern_len:
break
# Text hash considering only the most significant digit.
text_hash_msd_only = ord(text[i]) * base ** (pattern_len - 1)
# Note that we do not multiply the exponent of the base for the second
# term in the summation because the exponent for the least significant
# digit is 0.
text_hash = (base * (text_hash - text_hash_msd_only) +
ord(text[i + pattern_len]))
return matches
def _get_hash(text, base):
text_hash = 0
for i in xrange(len(text)):
text_hash = text_hash + (ord(text[-i - 1]) * base ** i)
return text_hash
| def match(text, pattern, base=10):
text_len = len(text)
pattern_len = len(pattern)
text_hash = _get_hash(text[:pattern_len], base)
pattern_hash = _get_hash(pattern, base)
matches = []
for i in xrange(text_len - pattern_len + 1):
if pattern_hash == text_hash:
if pattern == text[i:i + pattern_len]:
matches.append(i)
if i >= text_len - pattern_len:
break
text_hash_msd_only = ord(text[i]) * base ** (pattern_len - 1)
text_hash = base * (text_hash - text_hash_msd_only) + ord(text[i + pattern_len])
return matches
def _get_hash(text, base):
text_hash = 0
for i in xrange(len(text)):
text_hash = text_hash + ord(text[-i - 1]) * base ** i
return text_hash |
"""
A collection of useful classes and functions
"""
__all__ = ['add', 'MixedSpam']
def add(a, b):
"""
Add two numbers
"""
return a + b
class MixedSpam(object):
"""
Special spam
"""
def eat(self, time):
"""
Eat special spam in the required time.
"""
pass
| """
A collection of useful classes and functions
"""
__all__ = ['add', 'MixedSpam']
def add(a, b):
"""
Add two numbers
"""
return a + b
class Mixedspam(object):
"""
Special spam
"""
def eat(self, time):
"""
Eat special spam in the required time.
"""
pass |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.