content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/env python3 def gcd(a, b): if a == 0 : return b return gcd(b%a, a) a = 12000 b = 8642 print(gcd(a, b))
def gcd(a, b): if a == 0: return b return gcd(b % a, a) a = 12000 b = 8642 print(gcd(a, b))
def solve(): n = int(input()) k = list(map(int,input().split())) hashmap = dict() j = 0 ans = 0 c = 0 for i in range(n): if k[i] in hashmap and hashmap[k[i]] > 0: while i > j and k[i] in hashmap and hashmap[k[i]] > 0: hashmap[k[j]] -= 1 j += 1 c -= 1 hashmap[k[i]] = 1 c += 1 ans = max(ans,c) print(ans) if __name__ == '__main__': solve()
def solve(): n = int(input()) k = list(map(int, input().split())) hashmap = dict() j = 0 ans = 0 c = 0 for i in range(n): if k[i] in hashmap and hashmap[k[i]] > 0: while i > j and k[i] in hashmap and (hashmap[k[i]] > 0): hashmap[k[j]] -= 1 j += 1 c -= 1 hashmap[k[i]] = 1 c += 1 ans = max(ans, c) print(ans) if __name__ == '__main__': solve()
# Here the rate is set for Policy flows, local to a compute, which is # lesser than policy flows across computes expected_flow_setup_rate = {} expected_flow_setup_rate['policy'] = { '1.04': 6000, '1.05': 9000, '1.06': 10000, '1.10': 10000, '2.10': 13000} expected_flow_setup_rate['nat'] = { '1.04': 4200, '1.05': 6300, '1.06': 7500, '1.10': 7500, '2.10': 10000}
expected_flow_setup_rate = {} expected_flow_setup_rate['policy'] = {'1.04': 6000, '1.05': 9000, '1.06': 10000, '1.10': 10000, '2.10': 13000} expected_flow_setup_rate['nat'] = {'1.04': 4200, '1.05': 6300, '1.06': 7500, '1.10': 7500, '2.10': 10000}
# Dynamic Programming Python implementation of Min Cost Path # problem R = 3 C = 3 def minCost(cost, m, n): # Instead of following line, we can use int tc[m+1][n+1] or # dynamically allocate memoery to save space. The following # line is used to keep te program simple and make it working # on all compilers. tc = [[0 for x in range(C)] for x in range(R)] tc[0][0] = cost[0][0] # Initialize first column of total cost(tc) array for i in range(1, m+1): tc[i][0] = tc[i-1][0] + cost[i][0] # Initialize first row of tc array for j in range(1, n+1): tc[0][j] = tc[0][j-1] + cost[0][j] # Construct rest of the tc array for i in range(1, m+1): for j in range(1, n+1): tc[i][j] = min(tc[i-1][j-1], tc[i-1][j], tc[i][j-1]) + cost[i][j] return tc[m][n] # Driver program to test above functions cost = [[1, 2, 3], [4, 8, 2], [1, 5, 3]] print(minCost(cost, 2, 2)) #O(mn)
r = 3 c = 3 def min_cost(cost, m, n): tc = [[0 for x in range(C)] for x in range(R)] tc[0][0] = cost[0][0] for i in range(1, m + 1): tc[i][0] = tc[i - 1][0] + cost[i][0] for j in range(1, n + 1): tc[0][j] = tc[0][j - 1] + cost[0][j] for i in range(1, m + 1): for j in range(1, n + 1): tc[i][j] = min(tc[i - 1][j - 1], tc[i - 1][j], tc[i][j - 1]) + cost[i][j] return tc[m][n] cost = [[1, 2, 3], [4, 8, 2], [1, 5, 3]] print(min_cost(cost, 2, 2))
def create_box(input_corners): x = (float(input_corners[0][0]), float(input_corners[1][0])) y = (float(input_corners[0][1]), float(input_corners[1][1])) windmill_lats, windmill_lons = zip(*[ (max(x), max(y)), (min(x), max(y)), (min(x), min(y)), (max(x), min(y)), (max(x), max(y)) ]) return windmill_lats, windmill_lons
def create_box(input_corners): x = (float(input_corners[0][0]), float(input_corners[1][0])) y = (float(input_corners[0][1]), float(input_corners[1][1])) (windmill_lats, windmill_lons) = zip(*[(max(x), max(y)), (min(x), max(y)), (min(x), min(y)), (max(x), min(y)), (max(x), max(y))]) return (windmill_lats, windmill_lons)
class Label: @staticmethod def from_str(value): for l in Label._get_supported_labels(): if l.to_str() == value: return l raise Exception("Label by value '{}' doesn't supported".format(value)) @staticmethod def from_int(value): assert(isinstance(value, int)) for l in Label._get_supported_labels(): if l.to_int() == value: return l raise Exception("Label by value '{}' doesn't supported".format(value)) @staticmethod def from_uint(value): assert(isinstance(value, int) and value >= 0) for l in Label._get_supported_labels(): if l.to_uint() == value: return l raise Exception("Label by unsigned value '{}' doesn't supported".format(value)) @staticmethod def _get_supported_labels(): supported_labels = [ PositiveLabel(), NegativeLabel() ] return supported_labels def to_str(self): raise NotImplementedError() def to_int(self): raise NotImplementedError() def to_uint(self): raise Exception("Not implemented exception") def __eq__(self, other): assert(isinstance(other, Label)) return self.to_int() == other.to_int() def __ne__(self, other): assert(isinstance(other, Label)) return self.to_int() != other.to_int() class PositiveLabel(Label): def to_str(self): return 'pos' def to_int(self): return int(1) def to_uint(self): return int(1) class NegativeLabel(Label): def to_str(self): return 'neg' def to_int(self): return int(-1) def to_uint(self): return int(2)
class Label: @staticmethod def from_str(value): for l in Label._get_supported_labels(): if l.to_str() == value: return l raise exception("Label by value '{}' doesn't supported".format(value)) @staticmethod def from_int(value): assert isinstance(value, int) for l in Label._get_supported_labels(): if l.to_int() == value: return l raise exception("Label by value '{}' doesn't supported".format(value)) @staticmethod def from_uint(value): assert isinstance(value, int) and value >= 0 for l in Label._get_supported_labels(): if l.to_uint() == value: return l raise exception("Label by unsigned value '{}' doesn't supported".format(value)) @staticmethod def _get_supported_labels(): supported_labels = [positive_label(), negative_label()] return supported_labels def to_str(self): raise not_implemented_error() def to_int(self): raise not_implemented_error() def to_uint(self): raise exception('Not implemented exception') def __eq__(self, other): assert isinstance(other, Label) return self.to_int() == other.to_int() def __ne__(self, other): assert isinstance(other, Label) return self.to_int() != other.to_int() class Positivelabel(Label): def to_str(self): return 'pos' def to_int(self): return int(1) def to_uint(self): return int(1) class Negativelabel(Label): def to_str(self): return 'neg' def to_int(self): return int(-1) def to_uint(self): return int(2)
'''70. Climbing Stairs Easy 3866 127 Add to List Share You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive integer. Example 1: Input: 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 step + 1 step 2. 2 steps Example 2: Input: 3 Output: 3 Explanation: There are three ways to climb to the top. 1. 1 step + 1 step + 1 step 2. 1 step + 2 steps 3. 2 steps + 1 step''' n = int(input()) a,b = 1,2 for i in range(n-1): a,b = b,a+b print(a)
"""70. Climbing Stairs Easy 3866 127 Add to List Share You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive integer. Example 1: Input: 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 step + 1 step 2. 2 steps Example 2: Input: 3 Output: 3 Explanation: There are three ways to climb to the top. 1. 1 step + 1 step + 1 step 2. 1 step + 2 steps 3. 2 steps + 1 step""" n = int(input()) (a, b) = (1, 2) for i in range(n - 1): (a, b) = (b, a + b) print(a)
RESOURCES = { 'posts': { 'schema': { 'title': { 'type': 'string', 'minlength': 3, 'maxlength': 30, 'required': True, 'unique': False }, 'body': { 'type': 'string', 'required': True, 'unique': True }, 'published': { 'type': 'boolean', 'default': False }, 'category': { 'type': 'objectid', 'data_relation': { 'resource': 'categories', 'field': '_id', 'embeddable': True }, 'required': True }, 'tags': { 'type': 'list', 'default': [], 'schema': { 'type': 'objectid', 'data_relation': { 'resource': 'tags', 'field': '_id', 'embeddable': True } } } }, }, 'categories': { 'schema': { 'name': { 'type': 'string', 'minlength': 2, 'maxlength': 10, 'required': True, 'unique': True } }, 'item_title': 'category', }, 'tags': { 'schema': { 'name': { 'type': 'string', 'minlength': 2, 'maxlength': 10, 'required': True, 'unique': True } } } }
resources = {'posts': {'schema': {'title': {'type': 'string', 'minlength': 3, 'maxlength': 30, 'required': True, 'unique': False}, 'body': {'type': 'string', 'required': True, 'unique': True}, 'published': {'type': 'boolean', 'default': False}, 'category': {'type': 'objectid', 'data_relation': {'resource': 'categories', 'field': '_id', 'embeddable': True}, 'required': True}, 'tags': {'type': 'list', 'default': [], 'schema': {'type': 'objectid', 'data_relation': {'resource': 'tags', 'field': '_id', 'embeddable': True}}}}}, 'categories': {'schema': {'name': {'type': 'string', 'minlength': 2, 'maxlength': 10, 'required': True, 'unique': True}}, 'item_title': 'category'}, 'tags': {'schema': {'name': {'type': 'string', 'minlength': 2, 'maxlength': 10, 'required': True, 'unique': True}}}}
# Copyright 2016 Google Inc. All Rights Reserved. # # 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. # Modified by: Zhengying Liu, Isabelle Guyon """An example of code submission for the AutoDL challenge. It implements 3 compulsory methods: __init__, train, and test. model.py follows the template of the abstract class algorithm.py found in folder AutoDL_ingestion_program/. To create a valid submission, zip model.py together with an empty file called metadata (this just indicates your submission is a code submission and has nothing to do with the dataset metadata. """ class Model(object): """Fully connected neural network with no hidden layer.""" def __init__(self, metadata): pass
"""An example of code submission for the AutoDL challenge. It implements 3 compulsory methods: __init__, train, and test. model.py follows the template of the abstract class algorithm.py found in folder AutoDL_ingestion_program/. To create a valid submission, zip model.py together with an empty file called metadata (this just indicates your submission is a code submission and has nothing to do with the dataset metadata. """ class Model(object): """Fully connected neural network with no hidden layer.""" def __init__(self, metadata): pass
pkgname = "python-sphinx-removed-in" pkgver = "0.2.1" pkgrel = 0 build_style = "python_module" hostmakedepends = ["python-setuptools"] checkdepends = ["python-sphinx"] depends = ["python-sphinx"] pkgdesc = "Sphinx extension for versionremoved and removed-in directives" maintainer = "q66 <q66@chimera-linux.org>" license = "BSD-3-Clause" url = "https://github.com/MrSenko/sphinx-removed-in" source = f"$(PYPI_SITE)/s/sphinx-removed-in/sphinx-removed-in-{pkgver}.tar.gz" sha256 = "0588239cb534cd97b1d3900d0444311c119e45296a9f73f1ea81ea81a2cd3db1" # dependency of pytest options = ["!check"]
pkgname = 'python-sphinx-removed-in' pkgver = '0.2.1' pkgrel = 0 build_style = 'python_module' hostmakedepends = ['python-setuptools'] checkdepends = ['python-sphinx'] depends = ['python-sphinx'] pkgdesc = 'Sphinx extension for versionremoved and removed-in directives' maintainer = 'q66 <q66@chimera-linux.org>' license = 'BSD-3-Clause' url = 'https://github.com/MrSenko/sphinx-removed-in' source = f'$(PYPI_SITE)/s/sphinx-removed-in/sphinx-removed-in-{pkgver}.tar.gz' sha256 = '0588239cb534cd97b1d3900d0444311c119e45296a9f73f1ea81ea81a2cd3db1' options = ['!check']
class Solution: def canPartition(self, nums: List[int]) -> bool: dp, s = set([0]), sum(nums) if s&1: return False for num in nums: dp.update([v+num for v in dp if v+num <= s>>1]) return s>>1 in dp
class Solution: def can_partition(self, nums: List[int]) -> bool: (dp, s) = (set([0]), sum(nums)) if s & 1: return False for num in nums: dp.update([v + num for v in dp if v + num <= s >> 1]) return s >> 1 in dp
class Solution: def sortLinkedList(self, head: Optional[ListNode]) -> Optional[ListNode]: prev = head curr = head.next while curr: if curr.val < 0: prev.next = curr.next curr.next = head head = curr curr = prev.next else: prev = curr curr = curr.next return head
class Solution: def sort_linked_list(self, head: Optional[ListNode]) -> Optional[ListNode]: prev = head curr = head.next while curr: if curr.val < 0: prev.next = curr.next curr.next = head head = curr curr = prev.next else: prev = curr curr = curr.next return head
"""Preprocessing Sample.""" __author__ = 'Devon Welcheck' def preprocess(req, resp, resource, params): # pylint: disable=unused-argument """Preprocess skeleton."""
"""Preprocessing Sample.""" __author__ = 'Devon Welcheck' def preprocess(req, resp, resource, params): """Preprocess skeleton."""
""" Profile ../profile-datasets-py/div52/011.py file automaticaly created by prof_gen.py script """ self["ID"] = "../profile-datasets-py/div52/011.py" self["Q"] = numpy.array([ 1.60776800e+00, 5.75602400e+00, 7.00189400e+00, 7.33717600e+00, 6.76175900e+00, 8.41951900e+00, 6.54641500e+00, 8.55272200e+00, 6.77920300e+00, 7.25516400e+00, 7.37081000e+00, 5.92257200e+00, 6.50599600e+00, 6.64283300e+00, 6.28100600e+00, 5.43963200e+00, 5.08957400e+00, 5.38038600e+00, 5.50633800e+00, 5.62897900e+00, 5.19042900e+00, 4.84112700e+00, 4.63224600e+00, 4.76220200e+00, 4.69470800e+00, 4.51451000e+00, 4.58671400e+00, 4.67290700e+00, 4.57081400e+00, 4.47585900e+00, 4.42605100e+00, 4.37786600e+00, 4.38445800e+00, 4.39293100e+00, 4.40466700e+00, 4.41761000e+00, 4.37084000e+00, 4.20133400e+00, 4.03640900e+00, 3.99758200e+00, 3.97225900e+00, 3.89513500e+00, 3.76079000e+00, 3.63594700e+00, 3.81527700e+00, 3.99037900e+00, 4.23041800e+00, 4.51608500e+00, 4.76413100e+00, 4.79784600e+00, 4.83083700e+00, 6.93679600e+00, 9.88992600e+00, 1.41402000e+01, 2.17185200e+01, 2.91457900e+01, 3.96929600e+01, 5.04349000e+01, 6.08671100e+01, 7.10095300e+01, 8.43479200e+01, 1.11923300e+02, 1.38998100e+02, 1.94360100e+02, 2.52783000e+02, 3.20280200e+02, 3.93544100e+02, 4.69894600e+02, 5.53426000e+02, 6.41501600e+02, 7.71092500e+02, 8.98548200e+02, 1.06642900e+03, 1.23389900e+03, 1.45307300e+03, 1.68006300e+03, 2.07637800e+03, 2.51954400e+03, 3.27713300e+03, 4.12034400e+03, 5.07040900e+03, 6.02835400e+03, 6.34354100e+03, 6.44987700e+03, 5.89160400e+03, 5.06925600e+03, 4.04401800e+03, 3.04533400e+03, 2.16305800e+03, 1.42927300e+03, 9.42830700e+02, 8.61332300e+02, 9.09295200e+02, 1.23575300e+03, 1.77325600e+03, 3.36407200e+03, 5.26097100e+03, 5.71855000e+03, 5.98901400e+03, 5.82855400e+03, 5.67443100e+03]) self["P"] = numpy.array([ 5.00000000e-03, 1.61000000e-02, 3.84000000e-02, 7.69000000e-02, 1.37000000e-01, 2.24400000e-01, 3.45400000e-01, 5.06400000e-01, 7.14000000e-01, 9.75300000e-01, 1.29720000e+00, 1.68720000e+00, 2.15260000e+00, 2.70090000e+00, 3.33980000e+00, 4.07700000e+00, 4.92040000e+00, 5.87760000e+00, 6.95670000e+00, 8.16550000e+00, 9.51190000e+00, 1.10038000e+01, 1.26492000e+01, 1.44559000e+01, 1.64318000e+01, 1.85847000e+01, 2.09224000e+01, 2.34526000e+01, 2.61829000e+01, 2.91210000e+01, 3.22744000e+01, 3.56504000e+01, 3.92566000e+01, 4.31001000e+01, 4.71882000e+01, 5.15278000e+01, 5.61259000e+01, 6.09895000e+01, 6.61252000e+01, 7.15398000e+01, 7.72395000e+01, 8.32310000e+01, 8.95203000e+01, 9.61138000e+01, 1.03017000e+02, 1.10237000e+02, 1.17777000e+02, 1.25646000e+02, 1.33846000e+02, 1.42385000e+02, 1.51266000e+02, 1.60496000e+02, 1.70078000e+02, 1.80018000e+02, 1.90320000e+02, 2.00989000e+02, 2.12028000e+02, 2.23441000e+02, 2.35234000e+02, 2.47408000e+02, 2.59969000e+02, 2.72919000e+02, 2.86262000e+02, 3.00000000e+02, 3.14137000e+02, 3.28675000e+02, 3.43618000e+02, 3.58966000e+02, 3.74724000e+02, 3.90892000e+02, 4.07474000e+02, 4.24470000e+02, 4.41882000e+02, 4.59712000e+02, 4.77961000e+02, 4.96630000e+02, 5.15720000e+02, 5.35232000e+02, 5.55167000e+02, 5.75525000e+02, 5.96306000e+02, 6.17511000e+02, 6.39140000e+02, 6.61192000e+02, 6.83667000e+02, 7.06565000e+02, 7.29886000e+02, 7.53627000e+02, 7.77789000e+02, 8.02371000e+02, 8.27371000e+02, 8.52788000e+02, 8.78620000e+02, 9.04866000e+02, 9.31523000e+02, 9.58591000e+02, 9.86066000e+02, 1.01395000e+03, 1.04223000e+03, 1.07092000e+03, 1.10000000e+03]) self["CO2"] = numpy.array([ 311.3895, 311.3882, 311.3878, 311.3877, 311.3879, 311.3874, 311.388 , 311.3873, 311.3879, 311.3877, 311.3877, 311.3882, 311.388 , 311.3879, 311.388 , 311.3883, 311.3884, 311.3883, 311.3883, 311.3882, 311.3884, 311.3885, 311.3886, 311.3885, 311.3885, 311.3886, 311.3886, 311.3885, 311.3886, 311.3886, 311.3886, 311.3886, 311.3886, 311.3886, 311.3886, 311.3886, 311.3886, 311.3887, 311.3887, 311.3888, 311.3888, 311.3888, 311.8368, 312.3079, 312.7998, 313.3147, 313.8527, 314.4136, 314.9985, 315.6075, 316.2405, 316.8978, 317.5809, 318.2885, 319.0201, 319.7787, 320.5633, 321.3738, 321.3704, 321.3672, 321.3629, 321.354 , 321.3453, 321.3275, 321.3088, 321.2871, 321.2635, 321.239 , 321.2121, 321.1838, 321.1422, 321.1012, 321.0473, 320.9934, 320.923 , 320.85 , 320.7227, 320.5802, 320.3368, 320.0658, 319.7604, 319.4525, 319.3512, 319.3171, 319.4965, 319.7608, 320.0903, 320.4113, 320.6948, 320.9306, 321.087 , 321.1132, 321.0978, 320.9928, 320.8201, 320.3088, 319.6992, 319.5521, 319.4652, 319.5168, 319.5663]) self["T"] = numpy.array([ 170.672, 167.1 , 177.713, 195.506, 207.725, 218.427, 235.452, 261.271, 286.139, 302.526, 307.761, 299.105, 277.321, 254.123, 242.604, 242.111, 244.188, 247.235, 249.79 , 251.021, 249.495, 247.35 , 245.156, 243.382, 241.117, 238.603, 237.177, 235.891, 234.271, 232.728, 231.48 , 230.272, 230.403, 230.58 , 230.857, 231.173, 231.319, 231.125, 230.936, 230.468, 229.983, 229.041, 227.593, 226.199, 225.705, 225.223, 225.188, 225.476, 225.743, 225.913, 226.079, 225.665, 225.013, 224.05 , 222.293, 220.571, 219.676, 218.897, 218.878, 219.527, 220.435, 222.487, 224.501, 226.873, 229.258, 231.594, 233.885, 236.173, 238.493, 240.796, 243.218, 245.601, 248.126, 250.621, 253.108, 255.562, 257.808, 259.968, 261.977, 263.921, 265.771, 267.581, 269.295, 270.928, 272.357, 273.557, 274.577, 275.147, 275.554, 275.814, 276.066, 276.464, 277.23 , 278.183, 278.559, 276.474, 273.474, 274.53 , 274.81 , 274.81 , 274.81 ]) self["O3"] = numpy.array([ 0.2033725 , 0.2424187 , 0.3208637 , 0.4562969 , 0.736027 , 1.047125 , 1.27765 , 1.424369 , 1.592244 , 1.945423 , 2.494494 , 3.276502 , 4.362954 , 5.659009 , 6.054292 , 6.016611 , 5.807721 , 5.465095 , 5.068172 , 4.685214 , 4.427215 , 4.293835 , 4.20855 , 4.135007 , 4.034985 , 3.921192 , 3.781656 , 3.644418 , 3.521658 , 3.404957 , 3.31342 , 3.224845 , 3.115542 , 3.008671 , 2.838926 , 2.645074 , 2.436685 , 2.192161 , 1.954276 , 1.756302 , 1.566934 , 1.406719 , 1.277961 , 1.153048 , 1.06527 , 0.9795561 , 0.90675 , 0.8436835 , 0.7768094 , 0.6765951 , 0.5785423 , 0.4980748 , 0.4259511 , 0.3548743 , 0.284146 , 0.2148278 , 0.170396 , 0.1296997 , 0.09665075, 0.07037028, 0.04774848, 0.0390997 , 0.03060822, 0.02923244, 0.02885916, 0.02934259, 0.03040131, 0.03152678, 0.03279865, 0.03412979, 0.03602205, 0.0378829 , 0.03856705, 0.03917781, 0.03968628, 0.04016728, 0.04066729, 0.04116737, 0.04188355, 0.04265563, 0.04372776, 0.04484095, 0.0448461 , 0.04464854, 0.0438066 , 0.04338835, 0.04330029, 0.04399183, 0.04493602, 0.0461 , 0.04719323, 0.04845931, 0.05025693, 0.05333931, 0.05646073, 0.05959075, 0.06483308, 0.05655864, 0.0507791 , 0.05078729, 0.05079517]) self["CTP"] = 500.0 self["CFRACTION"] = 0.0 self["IDG"] = 0 self["ISH"] = 0 self["ELEVATION"] = 0.0 self["S2M"]["T"] = 274.81 self["S2M"]["Q"] = 6138.87608117 self["S2M"]["O"] = 0.0507714396589 self["S2M"]["P"] = 1016.79 self["S2M"]["U"] = 8.31799 self["S2M"]["V"] = -1.2184 self["S2M"]["WFETC"] = 100000.0 self["SKIN"]["SURFTYPE"] = 1 self["SKIN"]["WATERTYPE"] = 1 self["SKIN"]["T"] = 272.988 self["SKIN"]["SALINITY"] = 35.0 self["SKIN"]["FOAM_FRACTION"] = 0.0 self["SKIN"]["FASTEM"] = numpy.array([ 3. , 5. , 15. , 0.1, 0.3]) self["ZENANGLE"] = 0.0 self["AZANGLE"] = 0.0 self["SUNZENANGLE"] = 0.0 self["SUNAZANGLE"] = 0.0 self["LATITUDE"] = 80.1708 self["GAS_UNITS"] = 2 self["BE"] = 0.0 self["COSBK"] = 0.0 self["DATE"] = numpy.array([1992, 7, 15]) self["TIME"] = numpy.array([18, 0, 0])
""" Profile ../profile-datasets-py/div52/011.py file automaticaly created by prof_gen.py script """ self['ID'] = '../profile-datasets-py/div52/011.py' self['Q'] = numpy.array([1.607768, 5.756024, 7.001894, 7.337176, 6.761759, 8.419519, 6.546415, 8.552722, 6.779203, 7.255164, 7.37081, 5.922572, 6.505996, 6.642833, 6.281006, 5.439632, 5.089574, 5.380386, 5.506338, 5.628979, 5.190429, 4.841127, 4.632246, 4.762202, 4.694708, 4.51451, 4.586714, 4.672907, 4.570814, 4.475859, 4.426051, 4.377866, 4.384458, 4.392931, 4.404667, 4.41761, 4.37084, 4.201334, 4.036409, 3.997582, 3.972259, 3.895135, 3.76079, 3.635947, 3.815277, 3.990379, 4.230418, 4.516085, 4.764131, 4.797846, 4.830837, 6.936796, 9.889926, 14.1402, 21.71852, 29.14579, 39.69296, 50.4349, 60.86711, 71.00953, 84.34792, 111.9233, 138.9981, 194.3601, 252.783, 320.2802, 393.5441, 469.8946, 553.426, 641.5016, 771.0925, 898.5482, 1066.429, 1233.899, 1453.073, 1680.063, 2076.378, 2519.544, 3277.133, 4120.344, 5070.409, 6028.354, 6343.541, 6449.877, 5891.604, 5069.256, 4044.018, 3045.334, 2163.058, 1429.273, 942.8307, 861.3323, 909.2952, 1235.753, 1773.256, 3364.072, 5260.971, 5718.55, 5989.014, 5828.554, 5674.431]) self['P'] = numpy.array([0.005, 0.0161, 0.0384, 0.0769, 0.137, 0.2244, 0.3454, 0.5064, 0.714, 0.9753, 1.2972, 1.6872, 2.1526, 2.7009, 3.3398, 4.077, 4.9204, 5.8776, 6.9567, 8.1655, 9.5119, 11.0038, 12.6492, 14.4559, 16.4318, 18.5847, 20.9224, 23.4526, 26.1829, 29.121, 32.2744, 35.6504, 39.2566, 43.1001, 47.1882, 51.5278, 56.1259, 60.9895, 66.1252, 71.5398, 77.2395, 83.231, 89.5203, 96.1138, 103.017, 110.237, 117.777, 125.646, 133.846, 142.385, 151.266, 160.496, 170.078, 180.018, 190.32, 200.989, 212.028, 223.441, 235.234, 247.408, 259.969, 272.919, 286.262, 300.0, 314.137, 328.675, 343.618, 358.966, 374.724, 390.892, 407.474, 424.47, 441.882, 459.712, 477.961, 496.63, 515.72, 535.232, 555.167, 575.525, 596.306, 617.511, 639.14, 661.192, 683.667, 706.565, 729.886, 753.627, 777.789, 802.371, 827.371, 852.788, 878.62, 904.866, 931.523, 958.591, 986.066, 1013.95, 1042.23, 1070.92, 1100.0]) self['CO2'] = numpy.array([311.3895, 311.3882, 311.3878, 311.3877, 311.3879, 311.3874, 311.388, 311.3873, 311.3879, 311.3877, 311.3877, 311.3882, 311.388, 311.3879, 311.388, 311.3883, 311.3884, 311.3883, 311.3883, 311.3882, 311.3884, 311.3885, 311.3886, 311.3885, 311.3885, 311.3886, 311.3886, 311.3885, 311.3886, 311.3886, 311.3886, 311.3886, 311.3886, 311.3886, 311.3886, 311.3886, 311.3886, 311.3887, 311.3887, 311.3888, 311.3888, 311.3888, 311.8368, 312.3079, 312.7998, 313.3147, 313.8527, 314.4136, 314.9985, 315.6075, 316.2405, 316.8978, 317.5809, 318.2885, 319.0201, 319.7787, 320.5633, 321.3738, 321.3704, 321.3672, 321.3629, 321.354, 321.3453, 321.3275, 321.3088, 321.2871, 321.2635, 321.239, 321.2121, 321.1838, 321.1422, 321.1012, 321.0473, 320.9934, 320.923, 320.85, 320.7227, 320.5802, 320.3368, 320.0658, 319.7604, 319.4525, 319.3512, 319.3171, 319.4965, 319.7608, 320.0903, 320.4113, 320.6948, 320.9306, 321.087, 321.1132, 321.0978, 320.9928, 320.8201, 320.3088, 319.6992, 319.5521, 319.4652, 319.5168, 319.5663]) self['T'] = numpy.array([170.672, 167.1, 177.713, 195.506, 207.725, 218.427, 235.452, 261.271, 286.139, 302.526, 307.761, 299.105, 277.321, 254.123, 242.604, 242.111, 244.188, 247.235, 249.79, 251.021, 249.495, 247.35, 245.156, 243.382, 241.117, 238.603, 237.177, 235.891, 234.271, 232.728, 231.48, 230.272, 230.403, 230.58, 230.857, 231.173, 231.319, 231.125, 230.936, 230.468, 229.983, 229.041, 227.593, 226.199, 225.705, 225.223, 225.188, 225.476, 225.743, 225.913, 226.079, 225.665, 225.013, 224.05, 222.293, 220.571, 219.676, 218.897, 218.878, 219.527, 220.435, 222.487, 224.501, 226.873, 229.258, 231.594, 233.885, 236.173, 238.493, 240.796, 243.218, 245.601, 248.126, 250.621, 253.108, 255.562, 257.808, 259.968, 261.977, 263.921, 265.771, 267.581, 269.295, 270.928, 272.357, 273.557, 274.577, 275.147, 275.554, 275.814, 276.066, 276.464, 277.23, 278.183, 278.559, 276.474, 273.474, 274.53, 274.81, 274.81, 274.81]) self['O3'] = numpy.array([0.2033725, 0.2424187, 0.3208637, 0.4562969, 0.736027, 1.047125, 1.27765, 1.424369, 1.592244, 1.945423, 2.494494, 3.276502, 4.362954, 5.659009, 6.054292, 6.016611, 5.807721, 5.465095, 5.068172, 4.685214, 4.427215, 4.293835, 4.20855, 4.135007, 4.034985, 3.921192, 3.781656, 3.644418, 3.521658, 3.404957, 3.31342, 3.224845, 3.115542, 3.008671, 2.838926, 2.645074, 2.436685, 2.192161, 1.954276, 1.756302, 1.566934, 1.406719, 1.277961, 1.153048, 1.06527, 0.9795561, 0.90675, 0.8436835, 0.7768094, 0.6765951, 0.5785423, 0.4980748, 0.4259511, 0.3548743, 0.284146, 0.2148278, 0.170396, 0.1296997, 0.09665075, 0.07037028, 0.04774848, 0.0390997, 0.03060822, 0.02923244, 0.02885916, 0.02934259, 0.03040131, 0.03152678, 0.03279865, 0.03412979, 0.03602205, 0.0378829, 0.03856705, 0.03917781, 0.03968628, 0.04016728, 0.04066729, 0.04116737, 0.04188355, 0.04265563, 0.04372776, 0.04484095, 0.0448461, 0.04464854, 0.0438066, 0.04338835, 0.04330029, 0.04399183, 0.04493602, 0.0461, 0.04719323, 0.04845931, 0.05025693, 0.05333931, 0.05646073, 0.05959075, 0.06483308, 0.05655864, 0.0507791, 0.05078729, 0.05079517]) self['CTP'] = 500.0 self['CFRACTION'] = 0.0 self['IDG'] = 0 self['ISH'] = 0 self['ELEVATION'] = 0.0 self['S2M']['T'] = 274.81 self['S2M']['Q'] = 6138.87608117 self['S2M']['O'] = 0.0507714396589 self['S2M']['P'] = 1016.79 self['S2M']['U'] = 8.31799 self['S2M']['V'] = -1.2184 self['S2M']['WFETC'] = 100000.0 self['SKIN']['SURFTYPE'] = 1 self['SKIN']['WATERTYPE'] = 1 self['SKIN']['T'] = 272.988 self['SKIN']['SALINITY'] = 35.0 self['SKIN']['FOAM_FRACTION'] = 0.0 self['SKIN']['FASTEM'] = numpy.array([3.0, 5.0, 15.0, 0.1, 0.3]) self['ZENANGLE'] = 0.0 self['AZANGLE'] = 0.0 self['SUNZENANGLE'] = 0.0 self['SUNAZANGLE'] = 0.0 self['LATITUDE'] = 80.1708 self['GAS_UNITS'] = 2 self['BE'] = 0.0 self['COSBK'] = 0.0 self['DATE'] = numpy.array([1992, 7, 15]) self['TIME'] = numpy.array([18, 0, 0])
class Pessoa: #substantivo def __init__(self, nome: str, idade: int) -> None: self.nome = nome #substantivo self.idade = idade #substantivo def dirigir(self, veiculo: str) -> None: #verbos print(f'Dirigindo um(a) {veiculo}') def cantar(self) -> None: #verbos print('lalalala') def apresentar_idade(self) -> int: #verbos return self.idade
class Pessoa: def __init__(self, nome: str, idade: int) -> None: self.nome = nome self.idade = idade def dirigir(self, veiculo: str) -> None: print(f'Dirigindo um(a) {veiculo}') def cantar(self) -> None: print('lalalala') def apresentar_idade(self) -> int: return self.idade
API_GROUPS = { 'authentication': ['/api-auth/', '/api/auth-valimo/',], 'user': ['/api/users/', '/api/user-invitations/', '/api/user-counters/',], 'organization': [ '/api/customers/', '/api/customer-permissions-log/', '/api/customer-permissions-reviews/', '/api/customer-permissions/', ], 'marketplace': [ '/api/marketplace-bookings/', '/api/marketplace-cart-items/', '/api/marketplace-categories/', '/api/marketplace-category-component-usages/', '/api/marketplace-checklists-categories/', '/api/marketplace-checklists/', '/api/marketplace-component-usages/', '/api/marketplace-offering-files/', '/api/marketplace-offerings/', '/api/marketplace-order-items/', '/api/marketplace-orders/', '/api/marketplace-plans/', '/api/marketplace-plugins/', '/api/marketplace-public-api/', '/api/marketplace-resource-offerings/', '/api/marketplace-resources/', '/api/marketplace-screenshots/', '/api/marketplace-service-providers/', ], 'reporting': [ '/api/support-feedback-average-report/', '/api/support-feedback-report/', ], }
api_groups = {'authentication': ['/api-auth/', '/api/auth-valimo/'], 'user': ['/api/users/', '/api/user-invitations/', '/api/user-counters/'], 'organization': ['/api/customers/', '/api/customer-permissions-log/', '/api/customer-permissions-reviews/', '/api/customer-permissions/'], 'marketplace': ['/api/marketplace-bookings/', '/api/marketplace-cart-items/', '/api/marketplace-categories/', '/api/marketplace-category-component-usages/', '/api/marketplace-checklists-categories/', '/api/marketplace-checklists/', '/api/marketplace-component-usages/', '/api/marketplace-offering-files/', '/api/marketplace-offerings/', '/api/marketplace-order-items/', '/api/marketplace-orders/', '/api/marketplace-plans/', '/api/marketplace-plugins/', '/api/marketplace-public-api/', '/api/marketplace-resource-offerings/', '/api/marketplace-resources/', '/api/marketplace-screenshots/', '/api/marketplace-service-providers/'], 'reporting': ['/api/support-feedback-average-report/', '/api/support-feedback-report/']}
# -*- coding: utf-8 -*- """Module compliance_suite.functions.update_server_settings.py Functions to update server config/settings based on the response of a previous API request. Each function should accept a Runner object and modify its "retrieved_server_settings" attribute """ def update_supported_filters(runner, resource, response_obj): """Update server settings with the supported filters for a resource Arguments: runner (Runner): reference to Runner object resource (str): identifies project, study, expression, continuous response_obj (Response): response object to parse """ for filter_obj in response_obj: runner.retrieved_server_settings[resource]["supp_filters"]\ .append(filter_obj["filter"]) def update_expected_format(runner, resource, response_obj): """Update server settings with the expected file format for a resource Arguments: runner (Runner): reference to Runner object resource (str): identifies project, study, expression, continuous response_obj (Response): response object to parse """ format_str = response_obj["fileType"] runner.retrieved_server_settings["expressions"]["exp_format"] = format_str runner.retrieved_server_settings["continuous"]["exp_format"] = format_str
"""Module compliance_suite.functions.update_server_settings.py Functions to update server config/settings based on the response of a previous API request. Each function should accept a Runner object and modify its "retrieved_server_settings" attribute """ def update_supported_filters(runner, resource, response_obj): """Update server settings with the supported filters for a resource Arguments: runner (Runner): reference to Runner object resource (str): identifies project, study, expression, continuous response_obj (Response): response object to parse """ for filter_obj in response_obj: runner.retrieved_server_settings[resource]['supp_filters'].append(filter_obj['filter']) def update_expected_format(runner, resource, response_obj): """Update server settings with the expected file format for a resource Arguments: runner (Runner): reference to Runner object resource (str): identifies project, study, expression, continuous response_obj (Response): response object to parse """ format_str = response_obj['fileType'] runner.retrieved_server_settings['expressions']['exp_format'] = format_str runner.retrieved_server_settings['continuous']['exp_format'] = format_str
df = pd.read_csv(DATA) df = df.sample(frac=1.0) df.reset_index(drop=True, inplace=True) result = df.tail(n=10)
df = pd.read_csv(DATA) df = df.sample(frac=1.0) df.reset_index(drop=True, inplace=True) result = df.tail(n=10)
def to_binary(number): binarynumber="" if (number!=0): while (number>=1): if (number %2==0): binarynumber=binarynumber+"0" number=number/2 else: binarynumber=binarynumber+"1" number=(number-1)/2 else: binarynumber="0" return "".join(reversed(binarynumber)) if __name__ == '__main__': print(to_binary(35)) print("\n") print(bin(35))
def to_binary(number): binarynumber = '' if number != 0: while number >= 1: if number % 2 == 0: binarynumber = binarynumber + '0' number = number / 2 else: binarynumber = binarynumber + '1' number = (number - 1) / 2 else: binarynumber = '0' return ''.join(reversed(binarynumber)) if __name__ == '__main__': print(to_binary(35)) print('\n') print(bin(35))
x = 5 y = 3 z = x + y print(x) print(y) print(x + y) print(z) w = z print(w)
x = 5 y = 3 z = x + y print(x) print(y) print(x + y) print(z) w = z print(w)
#Calculadora de tabuada n = int(input('Deseja ver tabuada de que numero?')) for c in range(1, 13): print('{} X {:2}= {} '. format(n, c, n * c))
n = int(input('Deseja ver tabuada de que numero?')) for c in range(1, 13): print('{} X {:2}= {} '.format(n, c, n * c))
COLUMNS = [ 'tipo_registro', 'nro_pv_matriz', 'vl_total_bruto', 'qtde_cvnsu', 'vl_total_rejeitado', 'vl_total_rotativo', 'vl_total_parcelado_sem_juros', 'vl_total_parcelado_iata', 'vl_total_dolar', 'vl_total_desconto', 'vl_total_liquido', 'vl_total_gorjeta', 'vl_total_tx_embarque', 'qtde_cvnsu_acatados' ]
columns = ['tipo_registro', 'nro_pv_matriz', 'vl_total_bruto', 'qtde_cvnsu', 'vl_total_rejeitado', 'vl_total_rotativo', 'vl_total_parcelado_sem_juros', 'vl_total_parcelado_iata', 'vl_total_dolar', 'vl_total_desconto', 'vl_total_liquido', 'vl_total_gorjeta', 'vl_total_tx_embarque', 'qtde_cvnsu_acatados']
# Ask user to enter their country name. # print out their phone code. l_country_phone_code = ["China","86","Germany","49","Turkey","90"] def country_name_to_phone_code_list(country_name): for index in range(len(l_country_phone_code)): if l_country_phone_code[index] == country_name: return l_country_phone_code[index+1] def country_name_to_phone_code_dict(country_name): pass print(country_name_to_phone_code_list("Turkey")) print(country_name_to_phone_code_list("Germany")) print(country_name_to_phone_code_list("China"))
l_country_phone_code = ['China', '86', 'Germany', '49', 'Turkey', '90'] def country_name_to_phone_code_list(country_name): for index in range(len(l_country_phone_code)): if l_country_phone_code[index] == country_name: return l_country_phone_code[index + 1] def country_name_to_phone_code_dict(country_name): pass print(country_name_to_phone_code_list('Turkey')) print(country_name_to_phone_code_list('Germany')) print(country_name_to_phone_code_list('China'))
""" EGF string variables for testing. """ # POINT valid_pt = """PT Park Name, City, Pond, Fountain Post office Square, Boston, FALSE, TRUE 42.356243, -71.055631, 2.0 Boston Common, Boston, TRUE, TRUE 42.355465, -71.066412, 10.0 """ invalid_pt_geom = """PTs Park Name, City, Pond, Fountain Post office Square, Boston, FALSE, TRUE 42.356243, -71.055631, 2.0 Boston Common, Boston, TRUE, TRUE 42.355465, -71.066412, 10.0 """ invalid_pt_last_line_1 = """PT Park Name, City, Pond, Fountain Post office Square, Boston, FALSE, TRUE 42.356243, -71.055631, 2.0 Boston Common, Boston, TRUE, TRUE 42.355465, -71.066412, 10.0 """ invalid_pt_last_line_2 = """PT Park Name, City, Pond, Fountain Post office Square, Boston, FALSE, TRUE 42.356243, -71.055631, 2.0 Boston Common, Boston, TRUE, TRUE 42.355465, -71.066412, 10.0 a """ invalid_pt_coord_sets = """PT Park Name, City, Pond, Fountain Post office Square, Boston, FALSE, TRUE 42.356243, -71.055631, 2.0 42.355465, -71.066412, 10.0 Boston Common, Boston, TRUE, TRUE 42.355465, -71.066412, 10.0 """ invalid_pt_headers = """PT Park Name, City, Pond, Fountain Park Name, City, Pond, Fountain Post office Square, Boston, FALSE, TRUE 42.356243, -71.055631, 2.0 Boston Common, Boston, TRUE, TRUE 42.355465, -71.066412, 10.0 """ invalid_pt_sections = """PT Park Name, City, Pond, Fountain """ invalid_pt_section_separators = """PT Park Name, City, Pond, Fountain Post office Square, Boston, FALSE, TRUE 42.356243, -71.055631, 2.0 Boston Common, Boston, TRUE, TRUE 42.355465, -71.066412, 10.0 """ # LINESTRING valid_ls = """LS Park Name, Feature Description Post Office Square, A walk by the fountain 42.356716, -71.055685, 0.0 42.356587, -71.055769, 0.0 42.356566, -71.055754, 0.0 42.356539, -71.055746, 0.0 42.356511, -71.055757, 0.0 42.356495, -71.05579, 0.0 42.356485, -71.05583, 0.0 42.356389, -71.055842, 0.0 42.356252, -71.055796, 0.0 42.356046, -71.055642, 0.0 42.355876, -71.055697, 0.0 42.355828, -71.055758, 0.0 Boston Common, A walk by the fountain 42.356251, -71.062737, 0.0 42.35621, -71.063012, 0.0 42.356153, -71.06305, 0.0 42.356144, -71.063115, 0.0 42.356136, -71.063261, 0.0 42.355825, -71.064018, 0.0 """ invalid_ls_coord_sets_1 = """LS Park Name, Feature Description Post Office Square, A walk by the fountain 42.356716, -71.055685, 0.0 42.356587, -71.055769, 0.0 42.356566, -71.055754, 0.0 42.356539, -71.055746, 0.0 42.356511, -71.055757, 0.0 42.356495, -71.05579, 0.0 42.356485, -71.05583, 0.0 42.356389, -71.055842, 0.0 42.356252, -71.055796, 0.0 42.356046, -71.055642, 0.0 42.355876, -71.055697, 0.0 42.355828, -71.055758, 0.0 Boston Common, A walk by the fountain 42.356251, -71.062737, 0.0 """ invalid_ls_coord_sets_2 = """LS Park Name, Feature Description Post Office Square, A walk by the fountain 42.356716, -71.055685, 0.0 42.356587, -71.055769, 0.0 42.356566, -71.055754, 0.0 42.356539, -71.055746, 0.0 42.356511, -71.055757, 0.0 42.356495, -71.05579, 0.0 42.356485, -71.05583, 0.0 42.356389, -71.055842, 0.0 42.356252, -71.055796, 0.0 42.356046, -71.055642, 0.0 42.355876, -71.055697, 0.0 42.355828, -71.055758, 0.0 Boston Common, A walk by the fountain 42.356251, -71.062737, 0.0 42.35621, -71.063012, 0.0 42.356153, -71.06305, 0.0 42.356144, -71.063115, 0.0 42.356136, -71.063261, 0.0 42.355825, -71.064018, 0.0 """ invalid_ls_sections = """LS Park Name, Feature Description Post Office Square, A walk by the fountain 42.356716, -71.055685, 0.0 42.356587, -71.055769, 0.0 42.356566, -71.055754, 0.0 42.356539, -71.055746, 0.0 42.356511, -71.055757, 0.0 42.356495, -71.05579, 0.0 42.356485, -71.05583, 0.0 42.356389, -71.055842, 0.0 42.356252, -71.055796, 0.0 42.356046, -71.055642, 0.0 42.355876, -71.055697, 0.0 42.355828, -71.055758, 0.0 Boston Common, A walk by the fountain 42.356251, -71.062737, 0.0 42.35621, -71.063012, 0.0 42.356153, -71.06305, 0.0 42.356144, -71.063115, 0.0 42.356136, -71.063261, 0.0 42.355825, -71.064018, 0.0 """ # POLYGON valid_poly = """POLY Park Name, Feature Description Post Office Square, Boundary of Post Office Square with holes for buildings 42.356856, -71.055757, 0.0 42.35608, -71.054976, 0.0 42.355697, -71.055636, 0.0 42.356003, -71.055941, 0.0 42.356767, -71.05622, 0.0 42.355955, -71.055522, 0.0 42.355894, -71.055458, 0.0 42.355846, -71.055546, 0.0 42.355908, -71.055615, 0.0 42.356089, -71.055312, 0.0 42.356005, -71.055226, 0.0 42.355969, -71.055288, 0.0 42.356058, -71.055373, 0.0 Boston Common, Boundary of Boston Common with a hole for the Frog Pond 42.356514, -71.062157, 0.0 42.355222, -71.063337, 0.0 42.352457, -71.064638, 0.0 42.352639, -71.067238, 0.0 42.356132, -71.06915, 0.0 42.357591, -71.06326, 0.0 42.356047, -71.065045, 0.0 42.355953, -71.065107, 0.0 42.355911, -71.065249, 0.0 42.356018, -71.065909, 0.0 42.35601, -71.066016, 0.0 42.355918, -71.066198, 0.0 42.355854, -71.066417, 0.0 42.355876, -71.066521, 0.0 42.355938, -71.066564, 0.0 42.355985, -71.066547, 0.0 42.356221, -71.066, 0.0 42.356296, -71.065647, 0.0 42.35627, -71.065341, 0.0 42.356186, -71.065127, 0.0 42.356123, -71.065061, 0.0 """ invalid_poly_coord_sets_1 = """POLY Park Name, Feature Description Post Office Square, Boundary of Post Office Square with holes for buildings 42.356856, -71.055757, 0.0 42.35608, -71.054976, 0.0 42.355697, -71.055636, 0.0 42.356003, -71.055941, 0.0 42.356767, -71.05622, 0.0 42.356856, -71.055757, 0.0 42.355955, -71.055522, 0.0 42.355894, -71.055458, 0.0 42.355846, -71.055546, 0.0 42.355908, -71.055615, 0.0 42.355955, -71.055522, 0.0 42.356089, -71.055312, 0.0 42.356005, -71.055226, 0.0 42.355969, -71.055288, 0.0 42.356058, -71.055373, 0.0 42.356089, -71.055312, 0.0 Boston Common, Boundary of Boston Common with a hole for the Frog Pond 42.356514, -71.062157, 0.0 42.355222, -71.063337, 0.0 42.356047, -71.065045, 0.0 42.355953, -71.065107, 0.0 42.355911, -71.065249, 0.0 42.356018, -71.065909, 0.0 42.35601, -71.066016, 0.0 42.355918, -71.066198, 0.0 42.355854, -71.066417, 0.0 42.355876, -71.066521, 0.0 42.355938, -71.066564, 0.0 42.355985, -71.066547, 0.0 42.356221, -71.066, 0.0 42.356296, -71.065647, 0.0 42.35627, -71.065341, 0.0 42.356186, -71.065127, 0.0 42.356123, -71.065061, 0.0 42.356047, -71.065045, 0.0 """ invalid_poly_coord_sets_2 = """POLY Park Name, Feature Description Post Office Square, Boundary of Post Office Square with holes for buildings 42.356856, -71.055757, 0.0 42.35608, -71.054976, 0.0 42.355697, -71.055636, 0.0 42.356003, -71.055941, 0.0 42.356767, -71.05622, 0.0 42.356856, -71.055757, 0.0 42.355955, -71.055522, 0.0 42.355894, -71.055458, 0.0 42.355846, -71.055546, 0.0 42.355908, -71.055615, 0.0 42.355955, -71.055522, 0.0 42.356089, -71.055312, 0.0 42.356005, -71.055226, 0.0 42.355969, -71.055288, 0.0 42.356058, -71.055373, 0.0 42.356089, -71.055312, 0.0 Boston Common, Boundary of Boston Common with a hole for the Frog Pond 42.356514, -71.062157, 0.0 42.355222, -71.063337, 0.0 42.352457, -71.064638, 0.0 42.352639, -71.067238, 0.0 42.356132, -71.06915, 0.0 42.357591, -71.06326, 0.0 42.356514, -71.062157, 0.0 42.356047, -71.065045, 0.0 42.355953, -71.065107, 0.0 42.355911, -71.065249, 0.0 42.356018, -71.065909, 0.0 42.35601, -71.066016, 0.0 42.355918, -71.066198, 0.0 42.355854, -71.066417, 0.0 42.355876, -71.066521, 0.0 42.355938, -71.066564, 0.0 42.355985, -71.066547, 0.0 42.356221, -71.066, 0.0 42.356296, -71.065647, 0.0 42.35627, -71.065341, 0.0 42.356186, -71.065127, 0.0 42.356123, -71.065061, 0.0 42.356047, -71.065045, 0.0 """
""" EGF string variables for testing. """ valid_pt = 'PT\n\n\n\nPark Name, City, Pond, Fountain\n\n\n\nPost office Square, Boston, FALSE, TRUE\n42.356243, -71.055631, 2.0\n\n\n\nBoston Common, Boston, TRUE, TRUE\n42.355465, -71.066412, 10.0\n' invalid_pt_geom = 'PTs\n\n\n\nPark Name, City, Pond, Fountain\n\n\n\nPost office Square, Boston, FALSE, TRUE\n42.356243, -71.055631, 2.0\n\n\n\nBoston Common, Boston, TRUE, TRUE\n42.355465, -71.066412, 10.0\n' invalid_pt_last_line_1 = 'PT\n\n\n\nPark Name, City, Pond, Fountain\n\n\n\nPost office Square, Boston, FALSE, TRUE\n42.356243, -71.055631, 2.0\n\n\n\nBoston Common, Boston, TRUE, TRUE\n42.355465, -71.066412, 10.0\n\n' invalid_pt_last_line_2 = 'PT\n\n\n\nPark Name, City, Pond, Fountain\n\n\n\nPost office Square, Boston, FALSE, TRUE\n42.356243, -71.055631, 2.0\n\n\n\nBoston Common, Boston, TRUE, TRUE\n42.355465, -71.066412, 10.0\na\n' invalid_pt_coord_sets = 'PT\n\n\n\nPark Name, City, Pond, Fountain\n\n\n\nPost office Square, Boston, FALSE, TRUE\n42.356243, -71.055631, 2.0\n42.355465, -71.066412, 10.0\n\n\n\nBoston Common, Boston, TRUE, TRUE\n42.355465, -71.066412, 10.0\n' invalid_pt_headers = 'PT\n\n\n\nPark Name, City, Pond, Fountain\nPark Name, City, Pond, Fountain\n\n\n\nPost office Square, Boston, FALSE, TRUE\n42.356243, -71.055631, 2.0\n\n\n\nBoston Common, Boston, TRUE, TRUE\n42.355465, -71.066412, 10.0\n' invalid_pt_sections = 'PT\n\n\n\nPark Name, City, Pond, Fountain\n\n' invalid_pt_section_separators = 'PT\n\n\n\nPark Name, City, Pond, Fountain\n\n\n\nPost office Square, Boston, FALSE, TRUE\n42.356243, -71.055631, 2.0\n\n\n\n\nBoston Common, Boston, TRUE, TRUE\n42.355465, -71.066412, 10.0\n' valid_ls = 'LS\n\n\n\nPark Name, Feature Description\n\n\n\nPost Office Square, A walk by the fountain\n42.356716, -71.055685, 0.0\n42.356587, -71.055769, 0.0\n42.356566, -71.055754, 0.0\n42.356539, -71.055746, 0.0\n42.356511, -71.055757, 0.0\n42.356495, -71.05579, 0.0\n42.356485, -71.05583, 0.0\n42.356389, -71.055842, 0.0\n42.356252, -71.055796, 0.0\n42.356046, -71.055642, 0.0\n42.355876, -71.055697, 0.0\n42.355828, -71.055758, 0.0\n\n\n\nBoston Common, A walk by the fountain\n42.356251, -71.062737, 0.0\n42.35621, -71.063012, 0.0\n42.356153, -71.06305, 0.0\n42.356144, -71.063115, 0.0\n42.356136, -71.063261, 0.0\n42.355825, -71.064018, 0.0\n' invalid_ls_coord_sets_1 = 'LS\n\n\n\nPark Name, Feature Description\n\n\n\nPost Office Square, A walk by the fountain\n42.356716, -71.055685, 0.0\n42.356587, -71.055769, 0.0\n42.356566, -71.055754, 0.0\n42.356539, -71.055746, 0.0\n42.356511, -71.055757, 0.0\n42.356495, -71.05579, 0.0\n42.356485, -71.05583, 0.0\n42.356389, -71.055842, 0.0\n42.356252, -71.055796, 0.0\n42.356046, -71.055642, 0.0\n42.355876, -71.055697, 0.0\n42.355828, -71.055758, 0.0\n\n\n\nBoston Common, A walk by the fountain\n42.356251, -71.062737, 0.0\n' invalid_ls_coord_sets_2 = 'LS\n\n\n\nPark Name, Feature Description\n\n\n\nPost Office Square, A walk by the fountain\n42.356716, -71.055685, 0.0\n42.356587, -71.055769, 0.0\n42.356566, -71.055754, 0.0\n42.356539, -71.055746, 0.0\n42.356511, -71.055757, 0.0\n42.356495, -71.05579, 0.0\n\n42.356485, -71.05583, 0.0\n42.356389, -71.055842, 0.0\n42.356252, -71.055796, 0.0\n42.356046, -71.055642, 0.0\n42.355876, -71.055697, 0.0\n42.355828, -71.055758, 0.0\n\n\n\nBoston Common, A walk by the fountain\n42.356251, -71.062737, 0.0\n42.35621, -71.063012, 0.0\n42.356153, -71.06305, 0.0\n42.356144, -71.063115, 0.0\n42.356136, -71.063261, 0.0\n42.355825, -71.064018, 0.0\n' invalid_ls_sections = 'LS\n\n\n\nPark Name, Feature Description\n\n\nPost Office Square, A walk by the fountain\n42.356716, -71.055685, 0.0\n42.356587, -71.055769, 0.0\n42.356566, -71.055754, 0.0\n42.356539, -71.055746, 0.0\n42.356511, -71.055757, 0.0\n42.356495, -71.05579, 0.0\n42.356485, -71.05583, 0.0\n42.356389, -71.055842, 0.0\n42.356252, -71.055796, 0.0\n42.356046, -71.055642, 0.0\n42.355876, -71.055697, 0.0\n42.355828, -71.055758, 0.0\n\n\nBoston Common, A walk by the fountain\n42.356251, -71.062737, 0.0\n42.35621, -71.063012, 0.0\n42.356153, -71.06305, 0.0\n42.356144, -71.063115, 0.0\n42.356136, -71.063261, 0.0\n42.355825, -71.064018, 0.0\n' valid_poly = 'POLY\n\n\n\nPark Name, Feature Description\n\n\n\nPost Office Square, Boundary of Post Office Square with holes for buildings\n42.356856, -71.055757, 0.0\n42.35608, -71.054976, 0.0\n42.355697, -71.055636, 0.0\n42.356003, -71.055941, 0.0\n42.356767, -71.05622, 0.0\n\n42.355955, -71.055522, 0.0\n42.355894, -71.055458, 0.0\n42.355846, -71.055546, 0.0\n42.355908, -71.055615, 0.0\n\n42.356089, -71.055312, 0.0\n42.356005, -71.055226, 0.0\n42.355969, -71.055288, 0.0\n42.356058, -71.055373, 0.0\n\n\n\nBoston Common, Boundary of Boston Common with a hole for the Frog Pond\n42.356514, -71.062157, 0.0\n42.355222, -71.063337, 0.0\n42.352457, -71.064638, 0.0\n42.352639, -71.067238, 0.0\n42.356132, -71.06915, 0.0\n42.357591, -71.06326, 0.0\n\n42.356047, -71.065045, 0.0\n42.355953, -71.065107, 0.0\n42.355911, -71.065249, 0.0\n42.356018, -71.065909, 0.0\n42.35601, -71.066016, 0.0\n42.355918, -71.066198, 0.0\n42.355854, -71.066417, 0.0\n42.355876, -71.066521, 0.0\n42.355938, -71.066564, 0.0\n42.355985, -71.066547, 0.0\n42.356221, -71.066, 0.0\n42.356296, -71.065647, 0.0\n42.35627, -71.065341, 0.0\n42.356186, -71.065127, 0.0\n42.356123, -71.065061, 0.0\n' invalid_poly_coord_sets_1 = 'POLY\n\n\n\nPark Name, Feature Description\n\n\n\nPost Office Square, Boundary of Post Office Square with holes for buildings\n42.356856, -71.055757, 0.0\n42.35608, -71.054976, 0.0\n42.355697, -71.055636, 0.0\n42.356003, -71.055941, 0.0\n42.356767, -71.05622, 0.0\n42.356856, -71.055757, 0.0\n\n42.355955, -71.055522, 0.0\n42.355894, -71.055458, 0.0\n42.355846, -71.055546, 0.0\n42.355908, -71.055615, 0.0\n42.355955, -71.055522, 0.0\n\n42.356089, -71.055312, 0.0\n42.356005, -71.055226, 0.0\n42.355969, -71.055288, 0.0\n42.356058, -71.055373, 0.0\n42.356089, -71.055312, 0.0\n\n\n\nBoston Common, Boundary of Boston Common with a hole for the Frog Pond\n42.356514, -71.062157, 0.0\n42.355222, -71.063337, 0.0\n\n42.356047, -71.065045, 0.0\n42.355953, -71.065107, 0.0\n42.355911, -71.065249, 0.0\n42.356018, -71.065909, 0.0\n42.35601, -71.066016, 0.0\n42.355918, -71.066198, 0.0\n42.355854, -71.066417, 0.0\n42.355876, -71.066521, 0.0\n42.355938, -71.066564, 0.0\n42.355985, -71.066547, 0.0\n42.356221, -71.066, 0.0\n42.356296, -71.065647, 0.0\n42.35627, -71.065341, 0.0\n42.356186, -71.065127, 0.0\n42.356123, -71.065061, 0.0\n42.356047, -71.065045, 0.0\n' invalid_poly_coord_sets_2 = 'POLY\n\n\n\nPark Name, Feature Description\n\n\n\nPost Office Square, Boundary of Post Office Square with holes for buildings\n42.356856, -71.055757, 0.0\n42.35608, -71.054976, 0.0\n42.355697, -71.055636, 0.0\n42.356003, -71.055941, 0.0\n42.356767, -71.05622, 0.0\n42.356856, -71.055757, 0.0\n\n42.355955, -71.055522, 0.0\n42.355894, -71.055458, 0.0\n42.355846, -71.055546, 0.0\n\n42.355908, -71.055615, 0.0\n42.355955, -71.055522, 0.0\n\n42.356089, -71.055312, 0.0\n42.356005, -71.055226, 0.0\n42.355969, -71.055288, 0.0\n42.356058, -71.055373, 0.0\n42.356089, -71.055312, 0.0\n\n\n\nBoston Common, Boundary of Boston Common with a hole for the Frog Pond\n42.356514, -71.062157, 0.0\n42.355222, -71.063337, 0.0\n42.352457, -71.064638, 0.0\n42.352639, -71.067238, 0.0\n42.356132, -71.06915, 0.0\n42.357591, -71.06326, 0.0\n42.356514, -71.062157, 0.0\n\n42.356047, -71.065045, 0.0\n42.355953, -71.065107, 0.0\n42.355911, -71.065249, 0.0\n42.356018, -71.065909, 0.0\n42.35601, -71.066016, 0.0\n42.355918, -71.066198, 0.0\n42.355854, -71.066417, 0.0\n42.355876, -71.066521, 0.0\n42.355938, -71.066564, 0.0\n42.355985, -71.066547, 0.0\n42.356221, -71.066, 0.0\n42.356296, -71.065647, 0.0\n42.35627, -71.065341, 0.0\n42.356186, -71.065127, 0.0\n42.356123, -71.065061, 0.0\n42.356047, -71.065045, 0.0\n'
class GuidAttribute(Attribute,_Attribute): """ Supplies an explicit System.Guid when an automatic GUID is undesirable. GuidAttribute(guid: str) """ def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self,guid): """ __new__(cls: type,guid: str) """ pass Value=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the System.Guid of the class. Get: Value(self: GuidAttribute) -> str """
class Guidattribute(Attribute, _Attribute): """ Supplies an explicit System.Guid when an automatic GUID is undesirable. GuidAttribute(guid: str) """ def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self, guid): """ __new__(cls: type,guid: str) """ pass value = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets the System.Guid of the class.\n\n\n\nGet: Value(self: GuidAttribute) -> str\n\n\n\n'
def palavras_repetidas(fileName, word): file = open(fileName, 'r') count = 0 for i in file.readlines(): if word in i: count += 1 print(f'{word} aparece no arquivo {fileName} {count} vez(es).')
def palavras_repetidas(fileName, word): file = open(fileName, 'r') count = 0 for i in file.readlines(): if word in i: count += 1 print(f'{word} aparece no arquivo {fileName} {count} vez(es).')
n = int(input()) x = 0 for i in range(n): l = set([j for j in input()]) if "+" in l: x += 1 else : x -= 1 print(x)
n = int(input()) x = 0 for i in range(n): l = set([j for j in input()]) if '+' in l: x += 1 else: x -= 1 print(x)
client = pymongo.MongoClient("mongodb+srv://usermgs:udUnpg6aJnCp9d2W@cluster0.2ivys.mongodb.net/baseteste?retryWrites=true&w=majority") db = client.test
client = pymongo.MongoClient('mongodb+srv://usermgs:udUnpg6aJnCp9d2W@cluster0.2ivys.mongodb.net/baseteste?retryWrites=true&w=majority') db = client.test
class Mammal: x = 10 def walk(self): print("Walking") # class Dog: # def walk(self): # print("Walking") # class Cat: # def walk(self): # print("Walking") class Dog(Mammal): def bark(self): print("Woof, woof!") class Cat(Mammal): pass # Just used here as Python does not like empty classes. Pass just passes... rover = Dog() print(rover.x) rover.bark() fluffy = Cat() fluffy.walk()
class Mammal: x = 10 def walk(self): print('Walking') class Dog(Mammal): def bark(self): print('Woof, woof!') class Cat(Mammal): pass rover = dog() print(rover.x) rover.bark() fluffy = cat() fluffy.walk()
# # @lc app=leetcode.cn id=1203 lang=python3 # # [1203] print-in-order # None # @lc code=end
None
''' Given a binary tree, return the vertical order traversal of its nodes values. For each node at position (X, Y), its left and right children respectively will be at positions (X-1, Y-1) and (X+1, Y-1). Running a vertical line from X = -infinity to X = +infinity, whenever the vertical line touches some nodes, we report the values of the nodes in order from top to bottom (decreasing Y coordinates). If two nodes have the same position, then the value of the node that is reported first is the value that is smaller. Return an list of non-empty reports in order of X coordinate. Every report will have a list of values of nodes. Example 1: Input: [3,9,20,null,null,15,7] Output: [[9],[3,15],[20],[7]] Explanation: Without loss of generality, we can assume the root node is at position (0, 0): Then, the node with value 9 occurs at position (-1, -1); The nodes with values 3 and 15 occur at positions (0, 0) and (0, -2); The node with value 20 occurs at position (1, -1); The node with value 7 occurs at position (2, -2). Example 2: Input: [1,2,3,4,5,6,7] Output: [[4],[2],[1,5,6],[3],[7]] Explanation: The node with value 5 and the node with value 6 have the same position according to the given scheme. However, in the report "[1,5,6]", the node value of 5 comes first since 5 is smaller than 6. Note: The tree will have between 1 and 1000 nodes. Each node's value will be between 0 and 1000. ''' # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def verticalTraversal(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ if not root: return [] # col: node.val dic = {} vec = [(root, 0)] while vec: next_vec = [] for node, col in vec: if col not in dic: dic[col] = [node.val] else: dic[col].append(node.val) if node.left: next_vec.append((node.left, col-1)) if node.right: next_vec.append((node.right, col+1)) vec = sorted(next_vec, key = lambda x: (x[1], x[0].val)) res = [] for col in sorted(dic.keys()): res.append(dic[col]) return res
""" Given a binary tree, return the vertical order traversal of its nodes values. For each node at position (X, Y), its left and right children respectively will be at positions (X-1, Y-1) and (X+1, Y-1). Running a vertical line from X = -infinity to X = +infinity, whenever the vertical line touches some nodes, we report the values of the nodes in order from top to bottom (decreasing Y coordinates). If two nodes have the same position, then the value of the node that is reported first is the value that is smaller. Return an list of non-empty reports in order of X coordinate. Every report will have a list of values of nodes. Example 1: Input: [3,9,20,null,null,15,7] Output: [[9],[3,15],[20],[7]] Explanation: Without loss of generality, we can assume the root node is at position (0, 0): Then, the node with value 9 occurs at position (-1, -1); The nodes with values 3 and 15 occur at positions (0, 0) and (0, -2); The node with value 20 occurs at position (1, -1); The node with value 7 occurs at position (2, -2). Example 2: Input: [1,2,3,4,5,6,7] Output: [[4],[2],[1,5,6],[3],[7]] Explanation: The node with value 5 and the node with value 6 have the same position according to the given scheme. However, in the report "[1,5,6]", the node value of 5 comes first since 5 is smaller than 6. Note: The tree will have between 1 and 1000 nodes. Each node's value will be between 0 and 1000. """ class Solution(object): def vertical_traversal(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ if not root: return [] dic = {} vec = [(root, 0)] while vec: next_vec = [] for (node, col) in vec: if col not in dic: dic[col] = [node.val] else: dic[col].append(node.val) if node.left: next_vec.append((node.left, col - 1)) if node.right: next_vec.append((node.right, col + 1)) vec = sorted(next_vec, key=lambda x: (x[1], x[0].val)) res = [] for col in sorted(dic.keys()): res.append(dic[col]) return res
def check_hgt(h): if "cm" in h: return 150 <= int(h.replace("cm","")) <= 193 elif "in" in h: return 59 <= int(h.replace("in","")) <= 76 else: return False def check_hcl(h): if h[0] != '#' or len(h) != 7: return False for x in h[1:]: if not x in list("abcdef0123456789"): return False return True def check_range(v, low, high): return low <= int(v) <= high validation = { "hgt": check_hgt, "hcl": check_hcl, "pid": lambda x: len(x) == 9, "byr": lambda x: check_range(x, 1920, 2002), "iyr": lambda x: check_range(x, 2010, 2020), "eyr": lambda x: check_range(x, 2020, 2030), "ecl": lambda x: x in ["amb","blu","brn","gry", "grn", "hzl", "oth"], "cid": lambda x: True } def validate_passport(p): return len(p) == 8 or (len(p) == 7 and not p.get("cid", None)) #with open("test.txt", "rt") as file: with open("day4.txt", "rt") as file: valid = 0 valid2 = 0 passport = {} passport2 = {} for l in file.read().splitlines(): if l.strip() == "": valid += validate_passport(passport) valid2 += validate_passport(passport2) passport = {} passport2 = {} else: for x in l.strip().split(' '): p = x.split(":") passport[p[0]] = p[1] if (validation[p[0]](p[1])): passport2[p[0]] = p[1] valid += validate_passport(passport) valid2 += validate_passport(passport2) print (valid) print (valid2)
def check_hgt(h): if 'cm' in h: return 150 <= int(h.replace('cm', '')) <= 193 elif 'in' in h: return 59 <= int(h.replace('in', '')) <= 76 else: return False def check_hcl(h): if h[0] != '#' or len(h) != 7: return False for x in h[1:]: if not x in list('abcdef0123456789'): return False return True def check_range(v, low, high): return low <= int(v) <= high validation = {'hgt': check_hgt, 'hcl': check_hcl, 'pid': lambda x: len(x) == 9, 'byr': lambda x: check_range(x, 1920, 2002), 'iyr': lambda x: check_range(x, 2010, 2020), 'eyr': lambda x: check_range(x, 2020, 2030), 'ecl': lambda x: x in ['amb', 'blu', 'brn', 'gry', 'grn', 'hzl', 'oth'], 'cid': lambda x: True} def validate_passport(p): return len(p) == 8 or (len(p) == 7 and (not p.get('cid', None))) with open('day4.txt', 'rt') as file: valid = 0 valid2 = 0 passport = {} passport2 = {} for l in file.read().splitlines(): if l.strip() == '': valid += validate_passport(passport) valid2 += validate_passport(passport2) passport = {} passport2 = {} else: for x in l.strip().split(' '): p = x.split(':') passport[p[0]] = p[1] if validation[p[0]](p[1]): passport2[p[0]] = p[1] valid += validate_passport(passport) valid2 += validate_passport(passport2) print(valid) print(valid2)
def test_deploying_contract(client, hex_accounts): pre_balance = client.get_balance(hex_accounts[1]) client.send_transaction( _from=hex_accounts[0], to=hex_accounts[1], value=1234, ) post_balance = client.get_balance(hex_accounts[1]) assert post_balance - pre_balance == 1234
def test_deploying_contract(client, hex_accounts): pre_balance = client.get_balance(hex_accounts[1]) client.send_transaction(_from=hex_accounts[0], to=hex_accounts[1], value=1234) post_balance = client.get_balance(hex_accounts[1]) assert post_balance - pre_balance == 1234
if __name__ == '__main__': _, X = input().split() subjects = list() for _ in range(int(X)): subjects.append(map(float, input().split())) for i in zip(*subjects): print("{0:.1f}".format(sum(i)/len(i)))
if __name__ == '__main__': (_, x) = input().split() subjects = list() for _ in range(int(X)): subjects.append(map(float, input().split())) for i in zip(*subjects): print('{0:.1f}'.format(sum(i) / len(i)))
promt = "Here you can enter" promt += "a series of toppings>>>" message = True while message: message = input(promt) if message == "Quit": print(" I'll add " + message + " to your pizza.") else: break promt = "How old are you?" promt += "\nEnter 'quit' when you are finished >>>" while True: age = input(promt) if age == "quit": break age = int(age) if age < 3: print("Your ticket cost is free") elif age < 13: print("Your ticket price is 10 $ ") else: print("Your ticket price is 15 $") sandwich_orders = ["hamburger","cheeseburger","veggie burger", "royal"] finished_sandwiches = [] while sandwich_orders: sandwich = sandwich_orders.pop() print("we are working on "+ sandwich + " at the moment") finished_sandwiches.append(sandwich) print("\n") for sandwich in finished_sandwiches: print("We have made " + sandwich + ", you can take it now") sandwich_orders = ["pastrami","hamburger","cheeseburger","pastrami","veggie burger", "royal","pastrami"] finished_sandwiches = [] print("We are sorry, pastrami sandwich ran out of") while "pastrami" in sandwich_orders: sandwich_orders.remove("pastrami") print("\n") while sandwich_orders: sandwich = sandwich_orders.pop() print("Your order "+ sandwich + " will be prepared soon ! ") finished_sandwiches.append(sandwich) print("\n") for sandwich in finished_sandwiches: print("Your order " + sandwich + " is ready, take it") # name_promt = "Whats your name?>>>" place_promt = "Where would you like to go?>>>" next_promt = "\nWould you like to go with someone?(yes/no)>>>" responses = {} while True: name = input(name_promt) place = input(place_promt) responses[name] = place other_question = input(next_promt) if other_question == "yes": break print(">>>results<<<") for name,place in responses.items(): print(name.title() + " would like to go in " + place.title() + ".")
promt = 'Here you can enter' promt += 'a series of toppings>>>' message = True while message: message = input(promt) if message == 'Quit': print(" I'll add " + message + ' to your pizza.') else: break promt = 'How old are you?' promt += "\nEnter 'quit' when you are finished >>>" while True: age = input(promt) if age == 'quit': break age = int(age) if age < 3: print('Your ticket cost is free') elif age < 13: print('Your ticket price is 10 $ ') else: print('Your ticket price is 15 $') sandwich_orders = ['hamburger', 'cheeseburger', 'veggie burger', 'royal'] finished_sandwiches = [] while sandwich_orders: sandwich = sandwich_orders.pop() print('we are working on ' + sandwich + ' at the moment') finished_sandwiches.append(sandwich) print('\n') for sandwich in finished_sandwiches: print('We have made ' + sandwich + ', you can take it now') sandwich_orders = ['pastrami', 'hamburger', 'cheeseburger', 'pastrami', 'veggie burger', 'royal', 'pastrami'] finished_sandwiches = [] print('We are sorry, pastrami sandwich ran out of') while 'pastrami' in sandwich_orders: sandwich_orders.remove('pastrami') print('\n') while sandwich_orders: sandwich = sandwich_orders.pop() print('Your order ' + sandwich + ' will be prepared soon ! ') finished_sandwiches.append(sandwich) print('\n') for sandwich in finished_sandwiches: print('Your order ' + sandwich + ' is ready, take it') name_promt = 'Whats your name?>>>' place_promt = 'Where would you like to go?>>>' next_promt = '\nWould you like to go with someone?(yes/no)>>>' responses = {} while True: name = input(name_promt) place = input(place_promt) responses[name] = place other_question = input(next_promt) if other_question == 'yes': break print('>>>results<<<') for (name, place) in responses.items(): print(name.title() + ' would like to go in ' + place.title() + '.')
def foo(a, b): x = a * b y = 3 return y def foo(a, b): x = __report_assign(7, 8, 3) x = __report_assign(pos, v, 3) y = __report_assign(lineno, col, 3) print("hello world") foo(3, 2) report_call(0, 3, foo, (report_eval(3), report_eval(2),))
def foo(a, b): x = a * b y = 3 return y def foo(a, b): x = __report_assign(7, 8, 3) x = __report_assign(pos, v, 3) y = __report_assign(lineno, col, 3) print('hello world') foo(3, 2) report_call(0, 3, foo, (report_eval(3), report_eval(2)))
class Solution: def addBinary(self, a: str, b: str) -> str: return bin(int(a, 2) + int(b, 2))[2:] if __name__ == '__main__': a = "11" b = "1" solution = Solution() result = solution.addBinary(a, b) print(result) result1 = int(a, 2) result2 = int(b, 2) print(result1) print(result2) print(bin(result1 + result2)) print(bin(result1 + result2)[2:])
class Solution: def add_binary(self, a: str, b: str) -> str: return bin(int(a, 2) + int(b, 2))[2:] if __name__ == '__main__': a = '11' b = '1' solution = solution() result = solution.addBinary(a, b) print(result) result1 = int(a, 2) result2 = int(b, 2) print(result1) print(result2) print(bin(result1 + result2)) print(bin(result1 + result2)[2:])
""" [intermediate] challenge #5 Source / Reddit Post - https://www.reddit.com/r/dailyprogrammer/comments/pnhtj/2132012_challenge_5_intermediate/ """ words = [] sorted_words = [] with open('intermediate/5/words.txt', 'r') as fp: words = fp.read().split() sorted_words = [''.join(sorted(word)) for word in words] fp.close() word_dict = {} for ind, word in enumerate(sorted_words): if word in word_dict: word_dict[word].append(words[ind]) else: word_dict[word] = [words[ind]] print('\n'.join([', '.join(word_set) for word_set in word_dict.values() if len(word_set) > 1]))
""" [intermediate] challenge #5 Source / Reddit Post - https://www.reddit.com/r/dailyprogrammer/comments/pnhtj/2132012_challenge_5_intermediate/ """ words = [] sorted_words = [] with open('intermediate/5/words.txt', 'r') as fp: words = fp.read().split() sorted_words = [''.join(sorted(word)) for word in words] fp.close() word_dict = {} for (ind, word) in enumerate(sorted_words): if word in word_dict: word_dict[word].append(words[ind]) else: word_dict[word] = [words[ind]] print('\n'.join([', '.join(word_set) for word_set in word_dict.values() if len(word_set) > 1]))
a=int(input()) b=int(input()) print (a/b) a=float(a) b=float(b) print (a/b)
a = int(input()) b = int(input()) print(a / b) a = float(a) b = float(b) print(a / b)
# -*- coding: utf-8 -*- """ Individual scratchpad and maybe up-to-date CDP instance scrapers. """
""" Individual scratchpad and maybe up-to-date CDP instance scrapers. """
def test_Dict(): x: dict[i32, i32] x = {1: 2, 3: 4} # x = {1: "2", "3": 4} -> sematic error y: dict[str, i32] y = {"a": -1, "b": -2} z: i32 z = y["a"] z = y["b"] z = x[1] def test_dict_insert(): y: dict[str, i32] y = {"a": -1, "b": -2} y["c"] = -3 def test_dict_get(): y: dict[str, i32] y = {"a": -1, "b": -2} x: i32 x = y.get("a") x = y.get("a", 0)
def test__dict(): x: dict[i32, i32] x = {1: 2, 3: 4} y: dict[str, i32] y = {'a': -1, 'b': -2} z: i32 z = y['a'] z = y['b'] z = x[1] def test_dict_insert(): y: dict[str, i32] y = {'a': -1, 'b': -2} y['c'] = -3 def test_dict_get(): y: dict[str, i32] y = {'a': -1, 'b': -2} x: i32 x = y.get('a') x = y.get('a', 0)
states = {'Pending', 'Ready', 'Creating', 'Running', 'Cancelled', 'Error', 'Failed', 'Success'} complete_states = ('Cancelled', 'Error', 'Failed', 'Success') valid_state_transitions = { 'Pending': {'Ready'}, 'Ready': {'Creating', 'Running', 'Cancelled', 'Error'}, 'Creating': {'Ready', 'Running'}, 'Running': {'Ready', 'Cancelled', 'Error', 'Failed', 'Success'}, 'Cancelled': set(), 'Error': set(), 'Failed': set(), 'Success': set(), } tasks = ('input', 'main', 'output') memory_types = ('lowmem', 'standard', 'highmem') HTTP_CLIENT_MAX_SIZE = 8 * 1024 * 1024 BATCH_FORMAT_VERSION = 6 STATUS_FORMAT_VERSION = 5 INSTANCE_VERSION = 22 MAX_PERSISTENT_SSD_SIZE_GIB = 64 * 1024 RESERVED_STORAGE_GB_PER_CORE = 5
states = {'Pending', 'Ready', 'Creating', 'Running', 'Cancelled', 'Error', 'Failed', 'Success'} complete_states = ('Cancelled', 'Error', 'Failed', 'Success') valid_state_transitions = {'Pending': {'Ready'}, 'Ready': {'Creating', 'Running', 'Cancelled', 'Error'}, 'Creating': {'Ready', 'Running'}, 'Running': {'Ready', 'Cancelled', 'Error', 'Failed', 'Success'}, 'Cancelled': set(), 'Error': set(), 'Failed': set(), 'Success': set()} tasks = ('input', 'main', 'output') memory_types = ('lowmem', 'standard', 'highmem') http_client_max_size = 8 * 1024 * 1024 batch_format_version = 6 status_format_version = 5 instance_version = 22 max_persistent_ssd_size_gib = 64 * 1024 reserved_storage_gb_per_core = 5
def assigned_type_mismatch(): x = 666 x = '666' return x def annotation_type_mismatch(x: int = '666'): return x def assigned_type_mismatch_between_calls(case): if case: x = 666 else: x = '666' return x
def assigned_type_mismatch(): x = 666 x = '666' return x def annotation_type_mismatch(x: int='666'): return x def assigned_type_mismatch_between_calls(case): if case: x = 666 else: x = '666' return x
# https://www.codewars.com/kata/576757b1df89ecf5bd00073b/train/python def tower_builder(n_floors): times = 1 space = ((2*n_floors -1) // 2) tower = [] for _ in range(n_floors): tower.append((' '*space) + ('*' * times) + (' '*space)) times += 2 space -= 1 return tower
def tower_builder(n_floors): times = 1 space = (2 * n_floors - 1) // 2 tower = [] for _ in range(n_floors): tower.append(' ' * space + '*' * times + ' ' * space) times += 2 space -= 1 return tower
#! /usr/bin/env python # Programs that are runnable. ns3_runnable_programs = ['build/src/aodv/examples/ns3.27-aodv-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-one-hop-debug', 'build/src/buildings/examples/ns3.27-buildings-pathloss-profiler-debug', 'build/src/config-store/examples/ns3.27-config-store-save-debug', 'build/src/core/examples/ns3.27-main-callback-debug', 'build/src/core/examples/ns3.27-sample-simulator-debug', 'build/src/core/examples/ns3.27-main-ptr-debug', 'build/src/core/examples/ns3.27-main-random-variable-debug', 'build/src/core/examples/ns3.27-main-random-variable-stream-debug', 'build/src/core/examples/ns3.27-sample-random-variable-debug', 'build/src/core/examples/ns3.27-sample-random-variable-stream-debug', 'build/src/core/examples/ns3.27-command-line-example-debug', 'build/src/core/examples/ns3.27-hash-example-debug', 'build/src/core/examples/ns3.27-sample-log-time-format-debug', 'build/src/core/examples/ns3.27-test-string-value-formatting-debug', 'build/src/csma/examples/ns3.27-csma-one-subnet-debug', 'build/src/csma/examples/ns3.27-csma-broadcast-debug', 'build/src/csma/examples/ns3.27-csma-packet-socket-debug', 'build/src/csma/examples/ns3.27-csma-multicast-debug', 'build/src/csma/examples/ns3.27-csma-raw-ip-socket-debug', 'build/src/csma/examples/ns3.27-csma-ping-debug', 'build/src/csma-layout/examples/ns3.27-csma-star-debug', 'build/src/dsdv/examples/ns3.27-dsdv-manet-debug', 'build/src/dsr/examples/ns3.27-dsr-debug', 'build/src/energy/examples/ns3.27-li-ion-energy-source-debug', 'build/src/energy/examples/ns3.27-rv-battery-model-test-debug', 'build/src/energy/examples/ns3.27-basic-energy-model-test-debug', 'build/src/fd-net-device/examples/ns3.27-dummy-network-debug', 'build/src/fd-net-device/examples/ns3.27-fd2fd-onoff-debug', 'build/src/internet/examples/ns3.27-main-simple-debug', 'build/src/internet-apps/examples/ns3.27-dhcp-example-debug', 'build/src/lr-wpan/examples/ns3.27-lr-wpan-packet-print-debug', 'build/src/lr-wpan/examples/ns3.27-lr-wpan-phy-test-debug', 'build/src/lr-wpan/examples/ns3.27-lr-wpan-data-debug', 'build/src/lr-wpan/examples/ns3.27-lr-wpan-error-model-plot-debug', 'build/src/lr-wpan/examples/ns3.27-lr-wpan-error-distance-plot-debug', 'build/src/lte/examples/ns3.27-lena-cqi-threshold-debug', 'build/src/lte/examples/ns3.27-lena-dual-stripe-debug', 'build/src/lte/examples/ns3.27-lena-fading-debug', 'build/src/lte/examples/ns3.27-lena-intercell-interference-debug', 'build/src/lte/examples/ns3.27-lena-pathloss-traces-debug', 'build/src/lte/examples/ns3.27-lena-profiling-debug', 'build/src/lte/examples/ns3.27-lena-rem-debug', 'build/src/lte/examples/ns3.27-lena-rem-sector-antenna-debug', 'build/src/lte/examples/ns3.27-lena-rlc-traces-debug', 'build/src/lte/examples/ns3.27-lena-simple-debug', 'build/src/lte/examples/ns3.27-lena-simple-epc-debug', 'build/src/lte/examples/ns3.27-lena-deactivate-bearer-debug', 'build/src/lte/examples/ns3.27-lena-x2-handover-debug', 'build/src/lte/examples/ns3.27-lena-x2-handover-measures-debug', 'build/src/lte/examples/ns3.27-lena-frequency-reuse-debug', 'build/src/lte/examples/ns3.27-lena-distributed-ffr-debug', 'build/src/lte/examples/ns3.27-lena-uplink-power-control-debug', 'build/src/mesh/examples/ns3.27-mesh-debug', 'build/src/mobility/examples/ns3.27-main-grid-topology-debug', 'build/src/mobility/examples/ns3.27-main-random-topology-debug', 'build/src/mobility/examples/ns3.27-main-random-walk-debug', 'build/src/mobility/examples/ns3.27-mobility-trace-example-debug', 'build/src/mobility/examples/ns3.27-ns2-mobility-trace-debug', 'build/src/mobility/examples/ns3.27-bonnmotion-ns2-example-debug', 'build/src/mpi/examples/ns3.27-simple-distributed-debug', 'build/src/mpi/examples/ns3.27-third-distributed-debug', 'build/src/mpi/examples/ns3.27-nms-p2p-nix-distributed-debug', 'build/src/mpi/examples/ns3.27-simple-distributed-empty-node-debug', 'build/src/netanim/examples/ns3.27-dumbbell-animation-debug', 'build/src/netanim/examples/ns3.27-grid-animation-debug', 'build/src/netanim/examples/ns3.27-star-animation-debug', 'build/src/netanim/examples/ns3.27-wireless-animation-debug', 'build/src/netanim/examples/ns3.27-uan-animation-debug', 'build/src/netanim/examples/ns3.27-colors-link-description-debug', 'build/src/netanim/examples/ns3.27-resources-counters-debug', 'build/src/network/examples/ns3.27-main-packet-header-debug', 'build/src/network/examples/ns3.27-main-packet-tag-debug', 'build/src/network/examples/ns3.27-packet-socket-apps-debug', 'build/src/nix-vector-routing/examples/ns3.27-nix-simple-debug', 'build/src/nix-vector-routing/examples/ns3.27-nms-p2p-nix-debug', 'build/src/olsr/examples/ns3.27-simple-point-to-point-olsr-debug', 'build/src/olsr/examples/ns3.27-olsr-hna-debug', 'build/src/point-to-point/examples/ns3.27-main-attribute-value-debug', 'build/src/propagation/examples/ns3.27-main-propagation-loss-debug', 'build/src/propagation/examples/ns3.27-jakes-propagation-model-example-debug', 'build/src/sixlowpan/examples/ns3.27-example-sixlowpan-debug', 'build/src/sixlowpan/examples/ns3.27-example-ping-lr-wpan-debug', 'build/src/spectrum/examples/ns3.27-adhoc-aloha-ideal-phy-debug', 'build/src/spectrum/examples/ns3.27-adhoc-aloha-ideal-phy-matrix-propagation-loss-model-debug', 'build/src/spectrum/examples/ns3.27-adhoc-aloha-ideal-phy-with-microwave-oven-debug', 'build/src/spectrum/examples/ns3.27-tv-trans-example-debug', 'build/src/spectrum/examples/ns3.27-tv-trans-regional-example-debug', 'build/src/stats/examples/ns3.27-gnuplot-example-debug', 'build/src/stats/examples/ns3.27-double-probe-example-debug', 'build/src/stats/examples/ns3.27-time-probe-example-debug', 'build/src/stats/examples/ns3.27-gnuplot-aggregator-example-debug', 'build/src/stats/examples/ns3.27-gnuplot-helper-example-debug', 'build/src/stats/examples/ns3.27-file-aggregator-example-debug', 'build/src/stats/examples/ns3.27-file-helper-example-debug', 'build/src/topology-read/examples/ns3.27-topology-example-sim-debug', 'build/src/traffic-control/examples/ns3.27-red-tests-debug', 'build/src/traffic-control/examples/ns3.27-red-vs-ared-debug', 'build/src/traffic-control/examples/ns3.27-adaptive-red-tests-debug', 'build/src/traffic-control/examples/ns3.27-pfifo-vs-red-debug', 'build/src/traffic-control/examples/ns3.27-codel-vs-pfifo-basic-test-debug', 'build/src/traffic-control/examples/ns3.27-codel-vs-pfifo-asymmetric-debug', 'build/src/traffic-control/examples/ns3.27-pie-example-debug', 'build/src/uan/examples/ns3.27-uan-cw-example-debug', 'build/src/uan/examples/ns3.27-uan-rc-example-debug', 'build/src/virtual-net-device/examples/ns3.27-virtual-net-device-debug', 'build/src/wave/examples/ns3.27-wave-simple-80211p-debug', 'build/src/wave/examples/ns3.27-wave-simple-device-debug', 'build/src/wave/examples/ns3.27-vanet-routing-compare-debug', 'build/src/wifi/examples/ns3.27-wifi-phy-test-debug', 'build/src/wifi/examples/ns3.27-test-interference-helper-debug', 'build/src/wifi/examples/ns3.27-wifi-manager-example-debug', 'build/src/wimax/examples/ns3.27-wimax-ipv4-debug', 'build/src/wimax/examples/ns3.27-wimax-multicast-debug', 'build/src/wimax/examples/ns3.27-wimax-simple-debug', 'build/examples/energy/ns3.27-energy-model-example-debug', 'build/examples/energy/ns3.27-energy-model-with-harvesting-example-debug', 'build/examples/error-model/ns3.27-simple-error-model-debug', 'build/examples/ipv6/ns3.27-icmpv6-redirect-debug', 'build/examples/ipv6/ns3.27-ping6-debug', 'build/examples/ipv6/ns3.27-radvd-debug', 'build/examples/ipv6/ns3.27-radvd-two-prefix-debug', 'build/examples/ipv6/ns3.27-test-ipv6-debug', 'build/examples/ipv6/ns3.27-fragmentation-ipv6-debug', 'build/examples/ipv6/ns3.27-fragmentation-ipv6-two-MTU-debug', 'build/examples/ipv6/ns3.27-loose-routing-ipv6-debug', 'build/examples/ipv6/ns3.27-wsn-ping6-debug', 'build/examples/matrix-topology/ns3.27-matrix-topology-debug', 'build/examples/naming/ns3.27-object-names-debug', 'build/examples/routing/ns3.27-dynamic-global-routing-debug', 'build/examples/routing/ns3.27-static-routing-slash32-debug', 'build/examples/routing/ns3.27-global-routing-slash32-debug', 'build/examples/routing/ns3.27-global-injection-slash32-debug', 'build/examples/routing/ns3.27-simple-global-routing-debug', 'build/examples/routing/ns3.27-simple-alternate-routing-debug', 'build/examples/routing/ns3.27-mixed-global-routing-debug', 'build/examples/routing/ns3.27-simple-routing-ping6-debug', 'build/examples/routing/ns3.27-manet-routing-compare-debug', 'build/examples/routing/ns3.27-ripng-simple-network-debug', 'build/examples/routing/ns3.27-rip-simple-network-debug', 'build/examples/routing/ns3.27-global-routing-multi-switch-plus-router-debug', 'build/examples/socket/ns3.27-socket-bound-static-routing-debug', 'build/examples/socket/ns3.27-socket-bound-tcp-static-routing-debug', 'build/examples/socket/ns3.27-socket-options-ipv4-debug', 'build/examples/socket/ns3.27-socket-options-ipv6-debug', 'build/examples/stats/ns3.27-wifi-example-sim-debug', 'build/examples/tcp/ns3.27-tcp-large-transfer-debug', 'build/examples/tcp/ns3.27-tcp-nsc-lfn-debug', 'build/examples/tcp/ns3.27-tcp-nsc-zoo-debug', 'build/examples/tcp/ns3.27-tcp-star-server-debug', 'build/examples/tcp/ns3.27-star-debug', 'build/examples/tcp/ns3.27-tcp-bulk-send-debug', 'build/examples/tcp/ns3.27-tcp-pcap-nanosec-example-debug', 'build/examples/tcp/ns3.27-tcp-nsc-comparison-debug', 'build/examples/tcp/ns3.27-tcp-variants-comparison-debug', 'build/examples/traffic-control/ns3.27-traffic-control-debug', 'build/examples/traffic-control/ns3.27-queue-discs-benchmark-debug', 'build/examples/traffic-control/ns3.27-red-vs-fengadaptive-debug', 'build/examples/traffic-control/ns3.27-red-vs-nlred-debug', 'build/examples/tutorial/ns3.27-hello-simulator-debug', 'build/examples/tutorial/ns3.27-first-debug', 'build/examples/tutorial/ns3.27-second-debug', 'build/examples/tutorial/ns3.27-third-debug', 'build/examples/tutorial/ns3.27-fourth-debug', 'build/examples/tutorial/ns3.27-fifth-debug', 'build/examples/tutorial/ns3.27-sixth-debug', 'build/examples/tutorial/ns3.27-seventh-debug', 'build/examples/udp/ns3.27-udp-echo-debug', 'build/examples/udp-client-server/ns3.27-udp-client-server-debug', 'build/examples/udp-client-server/ns3.27-udp-trace-client-server-debug', 'build/examples/wireless/ns3.27-mixed-wired-wireless-debug', 'build/examples/wireless/ns3.27-wifi-adhoc-debug', 'build/examples/wireless/ns3.27-wifi-clear-channel-cmu-debug', 'build/examples/wireless/ns3.27-wifi-ap-debug', 'build/examples/wireless/ns3.27-wifi-wired-bridging-debug', 'build/examples/wireless/ns3.27-multirate-debug', 'build/examples/wireless/ns3.27-wifi-simple-adhoc-debug', 'build/examples/wireless/ns3.27-wifi-simple-adhoc-grid-debug', 'build/examples/wireless/ns3.27-wifi-simple-infra-debug', 'build/examples/wireless/ns3.27-wifi-simple-interference-debug', 'build/examples/wireless/ns3.27-wifi-blockack-debug', 'build/examples/wireless/ns3.27-ofdm-validation-debug', 'build/examples/wireless/ns3.27-ofdm-ht-validation-debug', 'build/examples/wireless/ns3.27-ofdm-vht-validation-debug', 'build/examples/wireless/ns3.27-wifi-hidden-terminal-debug', 'build/examples/wireless/ns3.27-ht-wifi-network-debug', 'build/examples/wireless/ns3.27-vht-wifi-network-debug', 'build/examples/wireless/ns3.27-wifi-timing-attributes-debug', 'build/examples/wireless/ns3.27-wifi-sleep-debug', 'build/examples/wireless/ns3.27-power-adaptation-distance-debug', 'build/examples/wireless/ns3.27-power-adaptation-interference-debug', 'build/examples/wireless/ns3.27-rate-adaptation-distance-debug', 'build/examples/wireless/ns3.27-wifi-aggregation-debug', 'build/examples/wireless/ns3.27-simple-ht-hidden-stations-debug', 'build/examples/wireless/ns3.27-80211n-mimo-debug', 'build/examples/wireless/ns3.27-mixed-network-debug', 'build/examples/wireless/ns3.27-wifi-tcp-debug', 'build/examples/wireless/ns3.27-80211e-txop-debug', 'build/examples/wireless/ns3.27-wifi-spectrum-per-example-debug', 'build/examples/wireless/ns3.27-wifi-spectrum-per-interference-debug', 'build/examples/wireless/ns3.27-wifi-spectrum-saturation-example-debug', 'build/examples/wireless/ns3.27-ofdm-he-validation-debug', 'build/examples/wireless/ns3.27-he-wifi-network-debug', 'build/examples/wireless/ns3.27-wifi-multi-tos-debug', 'build/examples/wireless/ns3.27-wifi-backward-compatibility-debug', 'build/scratch/ns3.27-scratch-simulator-debug', 'build/scratch/subdir/ns3.27-subdir-debug'] # Scripts that are runnable. ns3_runnable_scripts = ['csma-bridge.py', 'sample-simulator.py', 'wifi-olsr-flowmon.py', 'simple-routing-ping6.py', 'first.py', 'second.py', 'third.py', 'mixed-wired-wireless.py', 'wifi-ap.py']
ns3_runnable_programs = ['build/src/aodv/examples/ns3.27-aodv-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-debug', 'build/src/bridge/examples/ns3.27-csma-bridge-one-hop-debug', 'build/src/buildings/examples/ns3.27-buildings-pathloss-profiler-debug', 'build/src/config-store/examples/ns3.27-config-store-save-debug', 'build/src/core/examples/ns3.27-main-callback-debug', 'build/src/core/examples/ns3.27-sample-simulator-debug', 'build/src/core/examples/ns3.27-main-ptr-debug', 'build/src/core/examples/ns3.27-main-random-variable-debug', 'build/src/core/examples/ns3.27-main-random-variable-stream-debug', 'build/src/core/examples/ns3.27-sample-random-variable-debug', 'build/src/core/examples/ns3.27-sample-random-variable-stream-debug', 'build/src/core/examples/ns3.27-command-line-example-debug', 'build/src/core/examples/ns3.27-hash-example-debug', 'build/src/core/examples/ns3.27-sample-log-time-format-debug', 'build/src/core/examples/ns3.27-test-string-value-formatting-debug', 'build/src/csma/examples/ns3.27-csma-one-subnet-debug', 'build/src/csma/examples/ns3.27-csma-broadcast-debug', 'build/src/csma/examples/ns3.27-csma-packet-socket-debug', 'build/src/csma/examples/ns3.27-csma-multicast-debug', 'build/src/csma/examples/ns3.27-csma-raw-ip-socket-debug', 'build/src/csma/examples/ns3.27-csma-ping-debug', 'build/src/csma-layout/examples/ns3.27-csma-star-debug', 'build/src/dsdv/examples/ns3.27-dsdv-manet-debug', 'build/src/dsr/examples/ns3.27-dsr-debug', 'build/src/energy/examples/ns3.27-li-ion-energy-source-debug', 'build/src/energy/examples/ns3.27-rv-battery-model-test-debug', 'build/src/energy/examples/ns3.27-basic-energy-model-test-debug', 'build/src/fd-net-device/examples/ns3.27-dummy-network-debug', 'build/src/fd-net-device/examples/ns3.27-fd2fd-onoff-debug', 'build/src/internet/examples/ns3.27-main-simple-debug', 'build/src/internet-apps/examples/ns3.27-dhcp-example-debug', 'build/src/lr-wpan/examples/ns3.27-lr-wpan-packet-print-debug', 'build/src/lr-wpan/examples/ns3.27-lr-wpan-phy-test-debug', 'build/src/lr-wpan/examples/ns3.27-lr-wpan-data-debug', 'build/src/lr-wpan/examples/ns3.27-lr-wpan-error-model-plot-debug', 'build/src/lr-wpan/examples/ns3.27-lr-wpan-error-distance-plot-debug', 'build/src/lte/examples/ns3.27-lena-cqi-threshold-debug', 'build/src/lte/examples/ns3.27-lena-dual-stripe-debug', 'build/src/lte/examples/ns3.27-lena-fading-debug', 'build/src/lte/examples/ns3.27-lena-intercell-interference-debug', 'build/src/lte/examples/ns3.27-lena-pathloss-traces-debug', 'build/src/lte/examples/ns3.27-lena-profiling-debug', 'build/src/lte/examples/ns3.27-lena-rem-debug', 'build/src/lte/examples/ns3.27-lena-rem-sector-antenna-debug', 'build/src/lte/examples/ns3.27-lena-rlc-traces-debug', 'build/src/lte/examples/ns3.27-lena-simple-debug', 'build/src/lte/examples/ns3.27-lena-simple-epc-debug', 'build/src/lte/examples/ns3.27-lena-deactivate-bearer-debug', 'build/src/lte/examples/ns3.27-lena-x2-handover-debug', 'build/src/lte/examples/ns3.27-lena-x2-handover-measures-debug', 'build/src/lte/examples/ns3.27-lena-frequency-reuse-debug', 'build/src/lte/examples/ns3.27-lena-distributed-ffr-debug', 'build/src/lte/examples/ns3.27-lena-uplink-power-control-debug', 'build/src/mesh/examples/ns3.27-mesh-debug', 'build/src/mobility/examples/ns3.27-main-grid-topology-debug', 'build/src/mobility/examples/ns3.27-main-random-topology-debug', 'build/src/mobility/examples/ns3.27-main-random-walk-debug', 'build/src/mobility/examples/ns3.27-mobility-trace-example-debug', 'build/src/mobility/examples/ns3.27-ns2-mobility-trace-debug', 'build/src/mobility/examples/ns3.27-bonnmotion-ns2-example-debug', 'build/src/mpi/examples/ns3.27-simple-distributed-debug', 'build/src/mpi/examples/ns3.27-third-distributed-debug', 'build/src/mpi/examples/ns3.27-nms-p2p-nix-distributed-debug', 'build/src/mpi/examples/ns3.27-simple-distributed-empty-node-debug', 'build/src/netanim/examples/ns3.27-dumbbell-animation-debug', 'build/src/netanim/examples/ns3.27-grid-animation-debug', 'build/src/netanim/examples/ns3.27-star-animation-debug', 'build/src/netanim/examples/ns3.27-wireless-animation-debug', 'build/src/netanim/examples/ns3.27-uan-animation-debug', 'build/src/netanim/examples/ns3.27-colors-link-description-debug', 'build/src/netanim/examples/ns3.27-resources-counters-debug', 'build/src/network/examples/ns3.27-main-packet-header-debug', 'build/src/network/examples/ns3.27-main-packet-tag-debug', 'build/src/network/examples/ns3.27-packet-socket-apps-debug', 'build/src/nix-vector-routing/examples/ns3.27-nix-simple-debug', 'build/src/nix-vector-routing/examples/ns3.27-nms-p2p-nix-debug', 'build/src/olsr/examples/ns3.27-simple-point-to-point-olsr-debug', 'build/src/olsr/examples/ns3.27-olsr-hna-debug', 'build/src/point-to-point/examples/ns3.27-main-attribute-value-debug', 'build/src/propagation/examples/ns3.27-main-propagation-loss-debug', 'build/src/propagation/examples/ns3.27-jakes-propagation-model-example-debug', 'build/src/sixlowpan/examples/ns3.27-example-sixlowpan-debug', 'build/src/sixlowpan/examples/ns3.27-example-ping-lr-wpan-debug', 'build/src/spectrum/examples/ns3.27-adhoc-aloha-ideal-phy-debug', 'build/src/spectrum/examples/ns3.27-adhoc-aloha-ideal-phy-matrix-propagation-loss-model-debug', 'build/src/spectrum/examples/ns3.27-adhoc-aloha-ideal-phy-with-microwave-oven-debug', 'build/src/spectrum/examples/ns3.27-tv-trans-example-debug', 'build/src/spectrum/examples/ns3.27-tv-trans-regional-example-debug', 'build/src/stats/examples/ns3.27-gnuplot-example-debug', 'build/src/stats/examples/ns3.27-double-probe-example-debug', 'build/src/stats/examples/ns3.27-time-probe-example-debug', 'build/src/stats/examples/ns3.27-gnuplot-aggregator-example-debug', 'build/src/stats/examples/ns3.27-gnuplot-helper-example-debug', 'build/src/stats/examples/ns3.27-file-aggregator-example-debug', 'build/src/stats/examples/ns3.27-file-helper-example-debug', 'build/src/topology-read/examples/ns3.27-topology-example-sim-debug', 'build/src/traffic-control/examples/ns3.27-red-tests-debug', 'build/src/traffic-control/examples/ns3.27-red-vs-ared-debug', 'build/src/traffic-control/examples/ns3.27-adaptive-red-tests-debug', 'build/src/traffic-control/examples/ns3.27-pfifo-vs-red-debug', 'build/src/traffic-control/examples/ns3.27-codel-vs-pfifo-basic-test-debug', 'build/src/traffic-control/examples/ns3.27-codel-vs-pfifo-asymmetric-debug', 'build/src/traffic-control/examples/ns3.27-pie-example-debug', 'build/src/uan/examples/ns3.27-uan-cw-example-debug', 'build/src/uan/examples/ns3.27-uan-rc-example-debug', 'build/src/virtual-net-device/examples/ns3.27-virtual-net-device-debug', 'build/src/wave/examples/ns3.27-wave-simple-80211p-debug', 'build/src/wave/examples/ns3.27-wave-simple-device-debug', 'build/src/wave/examples/ns3.27-vanet-routing-compare-debug', 'build/src/wifi/examples/ns3.27-wifi-phy-test-debug', 'build/src/wifi/examples/ns3.27-test-interference-helper-debug', 'build/src/wifi/examples/ns3.27-wifi-manager-example-debug', 'build/src/wimax/examples/ns3.27-wimax-ipv4-debug', 'build/src/wimax/examples/ns3.27-wimax-multicast-debug', 'build/src/wimax/examples/ns3.27-wimax-simple-debug', 'build/examples/energy/ns3.27-energy-model-example-debug', 'build/examples/energy/ns3.27-energy-model-with-harvesting-example-debug', 'build/examples/error-model/ns3.27-simple-error-model-debug', 'build/examples/ipv6/ns3.27-icmpv6-redirect-debug', 'build/examples/ipv6/ns3.27-ping6-debug', 'build/examples/ipv6/ns3.27-radvd-debug', 'build/examples/ipv6/ns3.27-radvd-two-prefix-debug', 'build/examples/ipv6/ns3.27-test-ipv6-debug', 'build/examples/ipv6/ns3.27-fragmentation-ipv6-debug', 'build/examples/ipv6/ns3.27-fragmentation-ipv6-two-MTU-debug', 'build/examples/ipv6/ns3.27-loose-routing-ipv6-debug', 'build/examples/ipv6/ns3.27-wsn-ping6-debug', 'build/examples/matrix-topology/ns3.27-matrix-topology-debug', 'build/examples/naming/ns3.27-object-names-debug', 'build/examples/routing/ns3.27-dynamic-global-routing-debug', 'build/examples/routing/ns3.27-static-routing-slash32-debug', 'build/examples/routing/ns3.27-global-routing-slash32-debug', 'build/examples/routing/ns3.27-global-injection-slash32-debug', 'build/examples/routing/ns3.27-simple-global-routing-debug', 'build/examples/routing/ns3.27-simple-alternate-routing-debug', 'build/examples/routing/ns3.27-mixed-global-routing-debug', 'build/examples/routing/ns3.27-simple-routing-ping6-debug', 'build/examples/routing/ns3.27-manet-routing-compare-debug', 'build/examples/routing/ns3.27-ripng-simple-network-debug', 'build/examples/routing/ns3.27-rip-simple-network-debug', 'build/examples/routing/ns3.27-global-routing-multi-switch-plus-router-debug', 'build/examples/socket/ns3.27-socket-bound-static-routing-debug', 'build/examples/socket/ns3.27-socket-bound-tcp-static-routing-debug', 'build/examples/socket/ns3.27-socket-options-ipv4-debug', 'build/examples/socket/ns3.27-socket-options-ipv6-debug', 'build/examples/stats/ns3.27-wifi-example-sim-debug', 'build/examples/tcp/ns3.27-tcp-large-transfer-debug', 'build/examples/tcp/ns3.27-tcp-nsc-lfn-debug', 'build/examples/tcp/ns3.27-tcp-nsc-zoo-debug', 'build/examples/tcp/ns3.27-tcp-star-server-debug', 'build/examples/tcp/ns3.27-star-debug', 'build/examples/tcp/ns3.27-tcp-bulk-send-debug', 'build/examples/tcp/ns3.27-tcp-pcap-nanosec-example-debug', 'build/examples/tcp/ns3.27-tcp-nsc-comparison-debug', 'build/examples/tcp/ns3.27-tcp-variants-comparison-debug', 'build/examples/traffic-control/ns3.27-traffic-control-debug', 'build/examples/traffic-control/ns3.27-queue-discs-benchmark-debug', 'build/examples/traffic-control/ns3.27-red-vs-fengadaptive-debug', 'build/examples/traffic-control/ns3.27-red-vs-nlred-debug', 'build/examples/tutorial/ns3.27-hello-simulator-debug', 'build/examples/tutorial/ns3.27-first-debug', 'build/examples/tutorial/ns3.27-second-debug', 'build/examples/tutorial/ns3.27-third-debug', 'build/examples/tutorial/ns3.27-fourth-debug', 'build/examples/tutorial/ns3.27-fifth-debug', 'build/examples/tutorial/ns3.27-sixth-debug', 'build/examples/tutorial/ns3.27-seventh-debug', 'build/examples/udp/ns3.27-udp-echo-debug', 'build/examples/udp-client-server/ns3.27-udp-client-server-debug', 'build/examples/udp-client-server/ns3.27-udp-trace-client-server-debug', 'build/examples/wireless/ns3.27-mixed-wired-wireless-debug', 'build/examples/wireless/ns3.27-wifi-adhoc-debug', 'build/examples/wireless/ns3.27-wifi-clear-channel-cmu-debug', 'build/examples/wireless/ns3.27-wifi-ap-debug', 'build/examples/wireless/ns3.27-wifi-wired-bridging-debug', 'build/examples/wireless/ns3.27-multirate-debug', 'build/examples/wireless/ns3.27-wifi-simple-adhoc-debug', 'build/examples/wireless/ns3.27-wifi-simple-adhoc-grid-debug', 'build/examples/wireless/ns3.27-wifi-simple-infra-debug', 'build/examples/wireless/ns3.27-wifi-simple-interference-debug', 'build/examples/wireless/ns3.27-wifi-blockack-debug', 'build/examples/wireless/ns3.27-ofdm-validation-debug', 'build/examples/wireless/ns3.27-ofdm-ht-validation-debug', 'build/examples/wireless/ns3.27-ofdm-vht-validation-debug', 'build/examples/wireless/ns3.27-wifi-hidden-terminal-debug', 'build/examples/wireless/ns3.27-ht-wifi-network-debug', 'build/examples/wireless/ns3.27-vht-wifi-network-debug', 'build/examples/wireless/ns3.27-wifi-timing-attributes-debug', 'build/examples/wireless/ns3.27-wifi-sleep-debug', 'build/examples/wireless/ns3.27-power-adaptation-distance-debug', 'build/examples/wireless/ns3.27-power-adaptation-interference-debug', 'build/examples/wireless/ns3.27-rate-adaptation-distance-debug', 'build/examples/wireless/ns3.27-wifi-aggregation-debug', 'build/examples/wireless/ns3.27-simple-ht-hidden-stations-debug', 'build/examples/wireless/ns3.27-80211n-mimo-debug', 'build/examples/wireless/ns3.27-mixed-network-debug', 'build/examples/wireless/ns3.27-wifi-tcp-debug', 'build/examples/wireless/ns3.27-80211e-txop-debug', 'build/examples/wireless/ns3.27-wifi-spectrum-per-example-debug', 'build/examples/wireless/ns3.27-wifi-spectrum-per-interference-debug', 'build/examples/wireless/ns3.27-wifi-spectrum-saturation-example-debug', 'build/examples/wireless/ns3.27-ofdm-he-validation-debug', 'build/examples/wireless/ns3.27-he-wifi-network-debug', 'build/examples/wireless/ns3.27-wifi-multi-tos-debug', 'build/examples/wireless/ns3.27-wifi-backward-compatibility-debug', 'build/scratch/ns3.27-scratch-simulator-debug', 'build/scratch/subdir/ns3.27-subdir-debug'] ns3_runnable_scripts = ['csma-bridge.py', 'sample-simulator.py', 'wifi-olsr-flowmon.py', 'simple-routing-ping6.py', 'first.py', 'second.py', 'third.py', 'mixed-wired-wireless.py', 'wifi-ap.py']
# Arithmetic progression # A + (A+B) + (A+2B) + (A+3B) + ... + (A+(C-1)B)) def main(): N = int(input("data:\n")) l = [] for x in range(0,N): a,b,c = input().split(" ") a,b,c = int(a),int(b),int(c) s = 0 for each in range(0,c): s += a + (b*each) l.append(s) print("\nanswer:") for each in l: print(each, end=" ") main()
def main(): n = int(input('data:\n')) l = [] for x in range(0, N): (a, b, c) = input().split(' ') (a, b, c) = (int(a), int(b), int(c)) s = 0 for each in range(0, c): s += a + b * each l.append(s) print('\nanswer:') for each in l: print(each, end=' ') main()
#!/usr/bin/env python3 # Algorithm: Quick sort # Referrence: https://github.com/TheAlgorithms/Python/blob/master/sorts/quick_sort.py def quick_sort(num_list): """ Quick sort in Python If length of the list is 1 or less, there is no point in sorting it. Hence, the code works on lists with sizes greater than 1 """ if len(num_list) <= 1: return(num_list) else: pivot = num_list.pop() less_than = [] greater_than = [] for num in num_list: if num < pivot: less_than.append(num) elif num > pivot: greater_than.append(num) #print(less_than) #print(pivot) #print(greater_than) return quick_sort(less_than) + [pivot] + quick_sort(greater_than) num_list = [10, -1, 100, 23, 5, 98, 45, 76, -545, -300, 9999] print(quick_sort(num_list))
def quick_sort(num_list): """ Quick sort in Python If length of the list is 1 or less, there is no point in sorting it. Hence, the code works on lists with sizes greater than 1 """ if len(num_list) <= 1: return num_list else: pivot = num_list.pop() less_than = [] greater_than = [] for num in num_list: if num < pivot: less_than.append(num) elif num > pivot: greater_than.append(num) return quick_sort(less_than) + [pivot] + quick_sort(greater_than) num_list = [10, -1, 100, 23, 5, 98, 45, 76, -545, -300, 9999] print(quick_sort(num_list))
col = { "owid": { "Notes": "notes", "Entity": "entity", "Date": "time", "Source URL": "src", "Source label": "src_lb", "Cumulative total": "tot_n_tests", "Daily change in cumulative total": "n_tests", "Cumulative total per thousand": "tot_n_tests_pthab", "Daily change in cumulative total per thousand": "n_tests_pthab", "General source label": "source", "General source URL": "source_url", "Short description": "source_desc", "Detailed description": "source_desc_detailed", } } var = { "owid": {} }
col = {'owid': {'Notes': 'notes', 'Entity': 'entity', 'Date': 'time', 'Source URL': 'src', 'Source label': 'src_lb', 'Cumulative total': 'tot_n_tests', 'Daily change in cumulative total': 'n_tests', 'Cumulative total per thousand': 'tot_n_tests_pthab', 'Daily change in cumulative total per thousand': 'n_tests_pthab', 'General source label': 'source', 'General source URL': 'source_url', 'Short description': 'source_desc', 'Detailed description': 'source_desc_detailed'}} var = {'owid': {}}
# https://codeforces.com/problemset/problem/1030/A n = int(input()) o = list(map(int, input().split())) print('HARD' if o.count(1) != 0 else 'EASY')
n = int(input()) o = list(map(int, input().split())) print('HARD' if o.count(1) != 0 else 'EASY')
class Solution: # @param {integer[]} candidates # @param {integer} target # @return {integer[][]} def combinationSum(self, candidates, target): candidates.sort() return self.combsum(candidates, target) def combsum(self, nums, target): if target == 0: return [[]] if not nums or nums[0] > target or target < 1: return [] res = [] for i in range(len(nums)): num = nums[i] pre = [num] t = target while t >= num: t -= num subs = self.combsum(nums[i + 1:], t) for sub in subs: res.append(pre + sub) pre += [num] return res
class Solution: def combination_sum(self, candidates, target): candidates.sort() return self.combsum(candidates, target) def combsum(self, nums, target): if target == 0: return [[]] if not nums or nums[0] > target or target < 1: return [] res = [] for i in range(len(nums)): num = nums[i] pre = [num] t = target while t >= num: t -= num subs = self.combsum(nums[i + 1:], t) for sub in subs: res.append(pre + sub) pre += [num] return res
def decimal2base(num, base): convert_string = "0123456789ABCDEF" if num < base: return convert_string[num] remainder = num % base num = num // base return decimal2base(num, base) + convert_string[remainder] print(decimal2base(1453, 16))
def decimal2base(num, base): convert_string = '0123456789ABCDEF' if num < base: return convert_string[num] remainder = num % base num = num // base return decimal2base(num, base) + convert_string[remainder] print(decimal2base(1453, 16))
# wykys 2019 def bin_print(byte_array: list, num_in_line: int = 8, space: str = ' | '): def bin_to_str(byte_array: list) -> str: return ''.join([ chr(c) if c > 32 and c < 127 else '.' for c in byte_array ]) tmp = '' for i, byte in enumerate(byte_array): tmp = ''.join([tmp, f'{byte:02X}']) if (i+1) % num_in_line: tmp = ''.join([tmp, ' ']) else: tmp = ''.join([ tmp, space, bin_to_str(byte_array[i-num_in_line+1:i+1]), '\n' ]) if (i+1) % num_in_line: tmp = ''.join([ tmp, ' '*(3*(num_in_line - ((i+1) % num_in_line)) - 1), space, bin_to_str(byte_array[i - ((i+1) % num_in_line) + 1:]), '\n' ]) print(tmp)
def bin_print(byte_array: list, num_in_line: int=8, space: str=' | '): def bin_to_str(byte_array: list) -> str: return ''.join([chr(c) if c > 32 and c < 127 else '.' for c in byte_array]) tmp = '' for (i, byte) in enumerate(byte_array): tmp = ''.join([tmp, f'{byte:02X}']) if (i + 1) % num_in_line: tmp = ''.join([tmp, ' ']) else: tmp = ''.join([tmp, space, bin_to_str(byte_array[i - num_in_line + 1:i + 1]), '\n']) if (i + 1) % num_in_line: tmp = ''.join([tmp, ' ' * (3 * (num_in_line - (i + 1) % num_in_line) - 1), space, bin_to_str(byte_array[i - (i + 1) % num_in_line + 1:]), '\n']) print(tmp)
expected_output = { 'environment-information': { 'environment-item': [{ 'class': 'Temp', 'name': 'PSM 0', 'status': 'OK', 'temperature': { '#text': '25 ' 'degrees ' 'C ' '/ ' '77 ' 'degrees ' 'F', '@junos:celsius': '25' } }, { 'class': 'Temp', 'name': 'PSM 1', 'status': 'OK', 'temperature': { '#text': '24 ' 'degrees ' 'C ' '/ ' '75 ' 'degrees ' 'F', '@junos:celsius': '24' } }, { 'class': 'Temp', 'name': 'PSM 2', 'status': 'OK', 'temperature': { '#text': '24 ' 'degrees ' 'C ' '/ ' '75 ' 'degrees ' 'F', '@junos:celsius': '24' } }, { 'class': 'Temp', 'name': 'PSM 3', 'status': 'OK', 'temperature': { '#text': '23 ' 'degrees ' 'C ' '/ ' '73 ' 'degrees ' 'F', '@junos:celsius': '23' } }, { 'class': 'Temp', 'name': 'PSM 4', 'status': 'Check' }, { 'class': 'Temp', 'name': 'PSM 5', 'status': 'Check' }, { 'class': 'Temp', 'name': 'PSM 6', 'status': 'Check' }, { 'class': 'Temp', 'name': 'PSM 7', 'status': 'Check' }, { 'class': 'Temp', 'name': 'PSM 8', 'status': 'Check' }, { 'class': 'Temp', 'name': 'PSM 9', 'status': 'OK', 'temperature': { '#text': '29 ' 'degrees ' 'C ' '/ ' '84 ' 'degrees ' 'F', '@junos:celsius': '29' } }, { 'class': 'Temp', 'name': 'PSM 10', 'status': 'OK', 'temperature': { '#text': '30 ' 'degrees ' 'C ' '/ ' '86 ' 'degrees ' 'F', '@junos:celsius': '30' } }, { 'class': 'Temp', 'name': 'PSM 11', 'status': 'OK', 'temperature': { '#text': '30 ' 'degrees ' 'C ' '/ ' '86 ' 'degrees ' 'F', '@junos:celsius': '30' } }, { 'class': 'Temp', 'name': 'PSM 12', 'status': 'Check' }, { 'class': 'Temp', 'name': 'PSM 13', 'status': 'Check' }, { 'class': 'Temp', 'name': 'PSM 14', 'status': 'Check' }, { 'class': 'Temp', 'name': 'PSM 15', 'status': 'Check' }, { 'class': 'Temp', 'name': 'PSM 16', 'status': 'Check' }, { 'class': 'Temp', 'name': 'PSM 17', 'status': 'Check' }, { 'class': 'Temp', 'name': 'PDM 0', 'status': 'OK' }, { 'class': 'Temp', 'name': 'PDM 1', 'status': 'OK' }, { 'class': 'Temp', 'name': 'PDM 2', 'status': 'OK' }, { 'class': 'Temp', 'name': 'PDM 3', 'status': 'OK' }, { 'class': 'Temp', 'name': 'CB 0 IntakeA-Zone0', 'status': 'OK', 'temperature': { '#text': '39 ' 'degrees ' 'C ' '/ ' '102 ' 'degrees ' 'F', '@junos:celsius': '39' } }, { 'class': 'Temp', 'name': 'CB 0 IntakeB-Zone1', 'status': 'OK', 'temperature': { '#text': '36 ' 'degrees ' 'C ' '/ ' '96 ' 'degrees ' 'F', '@junos:celsius': '36' } }, { 'class': 'Temp', 'name': 'CB 0 IntakeC-Zone0', 'status': 'OK', 'temperature': { '#text': '51 ' 'degrees ' 'C ' '/ ' '123 ' 'degrees ' 'F', '@junos:celsius': '51' } }, { 'class': 'Temp', 'name': 'CB 0 ' 'ExhaustA-Zone0', 'status': 'OK', 'temperature': { '#text': '40 ' 'degrees ' 'C ' '/ ' '104 ' 'degrees ' 'F', '@junos:celsius': '40' } }, { 'class': 'Temp', 'name': 'CB 0 ' 'ExhaustB-Zone1', 'status': 'OK', 'temperature': { '#text': '35 ' 'degrees ' 'C ' '/ ' '95 ' 'degrees ' 'F', '@junos:celsius': '35' } }, { 'class': 'Temp', 'name': 'CB 0 TCBC-Zone0', 'status': 'OK', 'temperature': { '#text': '45 ' 'degrees ' 'C ' '/ ' '113 ' 'degrees ' 'F', '@junos:celsius': '45' } }, { 'class': 'Temp', 'name': 'CB 1 IntakeA-Zone0', 'status': 'OK', 'temperature': { '#text': '29 ' 'degrees ' 'C ' '/ ' '84 ' 'degrees ' 'F', '@junos:celsius': '29' } }, { 'class': 'Temp', 'name': 'CB 1 IntakeB-Zone1', 'status': 'OK', 'temperature': { '#text': '32 ' 'degrees ' 'C ' '/ ' '89 ' 'degrees ' 'F', '@junos:celsius': '32' } }, { 'class': 'Temp', 'name': 'CB 1 IntakeC-Zone0', 'status': 'OK', 'temperature': { '#text': '33 ' 'degrees ' 'C ' '/ ' '91 ' 'degrees ' 'F', '@junos:celsius': '33' } }, { 'class': 'Temp', 'name': 'CB 1 ' 'ExhaustA-Zone0', 'status': 'OK', 'temperature': { '#text': '32 ' 'degrees ' 'C ' '/ ' '89 ' 'degrees ' 'F', '@junos:celsius': '32' } }, { 'class': 'Temp', 'name': 'CB 1 ' 'ExhaustB-Zone1', 'status': 'OK', 'temperature': { '#text': '32 ' 'degrees ' 'C ' '/ ' '89 ' 'degrees ' 'F', '@junos:celsius': '32' } }, { 'class': 'Temp', 'name': 'CB 1 TCBC-Zone0', 'status': 'OK', 'temperature': { '#text': '39 ' 'degrees ' 'C ' '/ ' '102 ' 'degrees ' 'F', '@junos:celsius': '39' } }, { 'class': 'Temp', 'name': 'SPMB 0 Intake', 'status': 'OK', 'temperature': { '#text': '35 ' 'degrees ' 'C ' '/ ' '95 ' 'degrees ' 'F', '@junos:celsius': '35' } }, { 'class': 'Temp', 'name': 'SPMB 1 Intake', 'status': 'OK', 'temperature': { '#text': '33 ' 'degrees ' 'C ' '/ ' '91 ' 'degrees ' 'F', '@junos:celsius': '33' } }, { 'class': 'Temp', 'name': 'Routing Engine 0', 'status': 'OK', 'temperature': { '#text': '43 ' 'degrees ' 'C ' '/ ' '109 ' 'degrees ' 'F', '@junos:celsius': '43' } }, { 'class': 'Temp', 'name': 'Routing Engine 0 ' 'CPU', 'status': 'OK', 'temperature': { '#text': '39 ' 'degrees ' 'C ' '/ ' '102 ' 'degrees ' 'F', '@junos:celsius': '39' } }, { 'class': 'Temp', 'name': 'Routing Engine 1', 'status': 'OK', 'temperature': { '#text': '40 ' 'degrees ' 'C ' '/ ' '104 ' 'degrees ' 'F', '@junos:celsius': '40' } }, { 'class': 'Temp', 'name': 'Routing Engine 1 ' 'CPU', 'status': 'OK', 'temperature': { '#text': '35 ' 'degrees ' 'C ' '/ ' '95 ' 'degrees ' 'F', '@junos:celsius': '35' } }, { 'class': 'Temp', 'name': 'SFB 0 Intake-Zone0', 'status': 'OK', 'temperature': { '#text': '37 ' 'degrees ' 'C ' '/ ' '98 ' 'degrees ' 'F', '@junos:celsius': '37' } }, { 'class': 'Temp', 'name': 'SFB 0 ' 'Exhaust-Zone1', 'status': 'OK', 'temperature': { '#text': '45 ' 'degrees ' 'C ' '/ ' '113 ' 'degrees ' 'F', '@junos:celsius': '45' } }, { 'class': 'Temp', 'name': 'SFB 0 ' 'IntakeA-Zone0', 'status': 'OK', 'temperature': { '#text': '32 ' 'degrees ' 'C ' '/ ' '89 ' 'degrees ' 'F', '@junos:celsius': '32' } }, { 'class': 'Temp', 'name': 'SFB 0 ' 'IntakeB-Zone1', 'status': 'OK', 'temperature': { '#text': '34 ' 'degrees ' 'C ' '/ ' '93 ' 'degrees ' 'F', '@junos:celsius': '34' } }, { 'class': 'Temp', 'name': 'SFB 0 ' 'Exhaust-Zone0', 'status': 'OK', 'temperature': { '#text': '36 ' 'degrees ' 'C ' '/ ' '96 ' 'degrees ' 'F', '@junos:celsius': '36' } }, { 'class': 'Temp', 'name': 'SFB 0 ' 'SFB-XF2-Zone1', 'status': 'OK', 'temperature': { '#text': '63 ' 'degrees ' 'C ' '/ ' '145 ' 'degrees ' 'F', '@junos:celsius': '63' } }, { 'class': 'Temp', 'name': 'SFB 0 ' 'SFB-XF1-Zone0', 'status': 'OK', 'temperature': { '#text': '55 ' 'degrees ' 'C ' '/ ' '131 ' 'degrees ' 'F', '@junos:celsius': '55' } }, { 'class': 'Temp', 'name': 'SFB 0 ' 'SFB-XF0-Zone0', 'status': 'OK', 'temperature': { '#text': '52 ' 'degrees ' 'C ' '/ ' '125 ' 'degrees ' 'F', '@junos:celsius': '52' } }, { 'class': 'Temp', 'name': 'SFB 1 Intake-Zone0', 'status': 'OK', 'temperature': { '#text': '35 ' 'degrees ' 'C ' '/ ' '95 ' 'degrees ' 'F', '@junos:celsius': '35' } }, { 'class': 'Temp', 'name': 'SFB 1 ' 'Exhaust-Zone1', 'status': 'OK', 'temperature': { '#text': '42 ' 'degrees ' 'C ' '/ ' '107 ' 'degrees ' 'F', '@junos:celsius': '42' } }, { 'class': 'Temp', 'name': 'SFB 1 ' 'IntakeA-Zone0', 'status': 'OK', 'temperature': { '#text': '29 ' 'degrees ' 'C ' '/ ' '84 ' 'degrees ' 'F', '@junos:celsius': '29' } }, { 'class': 'Temp', 'name': 'SFB 1 ' 'IntakeB-Zone1', 'status': 'OK', 'temperature': { '#text': '32 ' 'degrees ' 'C ' '/ ' '89 ' 'degrees ' 'F', '@junos:celsius': '32' } }, { 'class': 'Temp', 'name': 'SFB 1 ' 'Exhaust-Zone0', 'status': 'OK', 'temperature': { '#text': '34 ' 'degrees ' 'C ' '/ ' '93 ' 'degrees ' 'F', '@junos:celsius': '34' } }, { 'class': 'Temp', 'name': 'SFB 1 ' 'SFB-XF2-Zone1', 'status': 'OK', 'temperature': { '#text': '63 ' 'degrees ' 'C ' '/ ' '145 ' 'degrees ' 'F', '@junos:celsius': '63' } }, { 'class': 'Temp', 'name': 'SFB 1 ' 'SFB-XF1-Zone0', 'status': 'OK', 'temperature': { '#text': '53 ' 'degrees ' 'C ' '/ ' '127 ' 'degrees ' 'F', '@junos:celsius': '53' } }, { 'class': 'Temp', 'name': 'SFB 1 ' 'SFB-XF0-Zone0', 'status': 'OK', 'temperature': { '#text': '50 ' 'degrees ' 'C ' '/ ' '122 ' 'degrees ' 'F', '@junos:celsius': '50' } }, { 'class': 'Temp', 'name': 'SFB 2 Intake-Zone0', 'status': 'OK', 'temperature': { '#text': '35 ' 'degrees ' 'C ' '/ ' '95 ' 'degrees ' 'F', '@junos:celsius': '35' } }, { 'class': 'Temp', 'name': 'SFB 2 ' 'Exhaust-Zone1', 'status': 'OK', 'temperature': { '#text': '42 ' 'degrees ' 'C ' '/ ' '107 ' 'degrees ' 'F', '@junos:celsius': '42' } }, { 'class': 'Temp', 'name': 'SFB 2 ' 'IntakeA-Zone0', 'status': 'OK', 'temperature': { '#text': '30 ' 'degrees ' 'C ' '/ ' '86 ' 'degrees ' 'F', '@junos:celsius': '30' } }, { 'class': 'Temp', 'name': 'SFB 2 ' 'IntakeB-Zone1', 'status': 'OK', 'temperature': { '#text': '32 ' 'degrees ' 'C ' '/ ' '89 ' 'degrees ' 'F', '@junos:celsius': '32' } }, { 'class': 'Temp', 'name': 'SFB 2 ' 'Exhaust-Zone0', 'status': 'OK', 'temperature': { '#text': '34 ' 'degrees ' 'C ' '/ ' '93 ' 'degrees ' 'F', '@junos:celsius': '34' } }, { 'class': 'Temp', 'name': 'SFB 2 ' 'SFB-XF2-Zone1', 'status': 'OK', 'temperature': { '#text': '60 ' 'degrees ' 'C ' '/ ' '140 ' 'degrees ' 'F', '@junos:celsius': '60' } }, { 'class': 'Temp', 'name': 'SFB 2 ' 'SFB-XF1-Zone0', 'status': 'OK', 'temperature': { '#text': '53 ' 'degrees ' 'C ' '/ ' '127 ' 'degrees ' 'F', '@junos:celsius': '53' } }, { 'class': 'Temp', 'name': 'SFB 2 ' 'SFB-XF0-Zone0', 'status': 'OK', 'temperature': { '#text': '56 ' 'degrees ' 'C ' '/ ' '132 ' 'degrees ' 'F', '@junos:celsius': '56' } }, { 'class': 'Temp', 'name': 'SFB 3 Intake-Zone0', 'status': 'OK', 'temperature': { '#text': '35 ' 'degrees ' 'C ' '/ ' '95 ' 'degrees ' 'F', '@junos:celsius': '35' } }, { 'class': 'Temp', 'name': 'SFB 3 ' 'Exhaust-Zone1', 'status': 'OK', 'temperature': { '#text': '42 ' 'degrees ' 'C ' '/ ' '107 ' 'degrees ' 'F', '@junos:celsius': '42' } }, { 'class': 'Temp', 'name': 'SFB 3 ' 'IntakeA-Zone0', 'status': 'OK', 'temperature': { '#text': '29 ' 'degrees ' 'C ' '/ ' '84 ' 'degrees ' 'F', '@junos:celsius': '29' } }, { 'class': 'Temp', 'name': 'SFB 3 ' 'IntakeB-Zone1', 'status': 'OK', 'temperature': { '#text': '32 ' 'degrees ' 'C ' '/ ' '89 ' 'degrees ' 'F', '@junos:celsius': '32' } }, { 'class': 'Temp', 'name': 'SFB 3 ' 'Exhaust-Zone0', 'status': 'OK', 'temperature': { '#text': '34 ' 'degrees ' 'C ' '/ ' '93 ' 'degrees ' 'F', '@junos:celsius': '34' } }, { 'class': 'Temp', 'name': 'SFB 3 ' 'SFB-XF2-Zone1', 'status': 'OK', 'temperature': { '#text': '61 ' 'degrees ' 'C ' '/ ' '141 ' 'degrees ' 'F', '@junos:celsius': '61' } }, { 'class': 'Temp', 'name': 'SFB 3 ' 'SFB-XF1-Zone0', 'status': 'OK', 'temperature': { '#text': '53 ' 'degrees ' 'C ' '/ ' '127 ' 'degrees ' 'F', '@junos:celsius': '53' } }, { 'class': 'Temp', 'name': 'SFB 3 ' 'SFB-XF0-Zone0', 'status': 'OK', 'temperature': { '#text': '50 ' 'degrees ' 'C ' '/ ' '122 ' 'degrees ' 'F', '@junos:celsius': '50' } }, { 'class': 'Temp', 'name': 'SFB 4 Intake-Zone0', 'status': 'OK', 'temperature': { '#text': '34 ' 'degrees ' 'C ' '/ ' '93 ' 'degrees ' 'F', '@junos:celsius': '34' } }, { 'class': 'Temp', 'name': 'SFB 4 ' 'Exhaust-Zone1', 'status': 'OK', 'temperature': { '#text': '42 ' 'degrees ' 'C ' '/ ' '107 ' 'degrees ' 'F', '@junos:celsius': '42' } }, { 'class': 'Temp', 'name': 'SFB 4 ' 'IntakeA-Zone0', 'status': 'OK', 'temperature': { '#text': '29 ' 'degrees ' 'C ' '/ ' '84 ' 'degrees ' 'F', '@junos:celsius': '29' } }, { 'class': 'Temp', 'name': 'SFB 4 ' 'IntakeB-Zone1', 'status': 'OK', 'temperature': { '#text': '32 ' 'degrees ' 'C ' '/ ' '89 ' 'degrees ' 'F', '@junos:celsius': '32' } }, { 'class': 'Temp', 'name': 'SFB 4 ' 'Exhaust-Zone0', 'status': 'OK', 'temperature': { '#text': '34 ' 'degrees ' 'C ' '/ ' '93 ' 'degrees ' 'F', '@junos:celsius': '34' } }, { 'class': 'Temp', 'name': 'SFB 4 ' 'SFB-XF2-Zone1', 'status': 'OK', 'temperature': { '#text': '64 ' 'degrees ' 'C ' '/ ' '147 ' 'degrees ' 'F', '@junos:celsius': '64' } }, { 'class': 'Temp', 'name': 'SFB 4 ' 'SFB-XF1-Zone0', 'status': 'OK', 'temperature': { '#text': '53 ' 'degrees ' 'C ' '/ ' '127 ' 'degrees ' 'F', '@junos:celsius': '53' } }, { 'class': 'Temp', 'name': 'SFB 4 ' 'SFB-XF0-Zone0', 'status': 'OK', 'temperature': { '#text': '50 ' 'degrees ' 'C ' '/ ' '122 ' 'degrees ' 'F', '@junos:celsius': '50' } }, { 'class': 'Temp', 'name': 'SFB 5 Intake-Zone0', 'status': 'OK', 'temperature': { '#text': '34 ' 'degrees ' 'C ' '/ ' '93 ' 'degrees ' 'F', '@junos:celsius': '34' } }, { 'class': 'Temp', 'name': 'SFB 5 ' 'Exhaust-Zone1', 'status': 'OK', 'temperature': { '#text': '41 ' 'degrees ' 'C ' '/ ' '105 ' 'degrees ' 'F', '@junos:celsius': '41' } }, { 'class': 'Temp', 'name': 'SFB 5 ' 'IntakeA-Zone0', 'status': 'OK', 'temperature': { '#text': '29 ' 'degrees ' 'C ' '/ ' '84 ' 'degrees ' 'F', '@junos:celsius': '29' } }, { 'class': 'Temp', 'name': 'SFB 5 ' 'IntakeB-Zone1', 'status': 'OK', 'temperature': { '#text': '31 ' 'degrees ' 'C ' '/ ' '87 ' 'degrees ' 'F', '@junos:celsius': '31' } }, { 'class': 'Temp', 'name': 'SFB 5 ' 'Exhaust-Zone0', 'status': 'OK', 'temperature': { '#text': '34 ' 'degrees ' 'C ' '/ ' '93 ' 'degrees ' 'F', '@junos:celsius': '34' } }, { 'class': 'Temp', 'name': 'SFB 5 ' 'SFB-XF2-Zone1', 'status': 'OK', 'temperature': { '#text': '63 ' 'degrees ' 'C ' '/ ' '145 ' 'degrees ' 'F', '@junos:celsius': '63' } }, { 'class': 'Temp', 'name': 'SFB 5 ' 'SFB-XF1-Zone0', 'status': 'OK', 'temperature': { '#text': '53 ' 'degrees ' 'C ' '/ ' '127 ' 'degrees ' 'F', '@junos:celsius': '53' } }, { 'class': 'Temp', 'name': 'SFB 5 ' 'SFB-XF0-Zone0', 'status': 'OK', 'temperature': { '#text': '50 ' 'degrees ' 'C ' '/ ' '122 ' 'degrees ' 'F', '@junos:celsius': '50' } }, { 'class': 'Temp', 'name': 'SFB 6 Intake-Zone0', 'status': 'OK', 'temperature': { '#text': '34 ' 'degrees ' 'C ' '/ ' '93 ' 'degrees ' 'F', '@junos:celsius': '34' } }, { 'class': 'Temp', 'name': 'SFB 6 ' 'Exhaust-Zone1', 'status': 'OK', 'temperature': { '#text': '42 ' 'degrees ' 'C ' '/ ' '107 ' 'degrees ' 'F', '@junos:celsius': '42' } }, { 'class': 'Temp', 'name': 'SFB 6 ' 'IntakeA-Zone0', 'status': 'OK', 'temperature': { '#text': '29 ' 'degrees ' 'C ' '/ ' '84 ' 'degrees ' 'F', '@junos:celsius': '29' } }, { 'class': 'Temp', 'name': 'SFB 6 ' 'IntakeB-Zone1', 'status': 'OK', 'temperature': { '#text': '32 ' 'degrees ' 'C ' '/ ' '89 ' 'degrees ' 'F', '@junos:celsius': '32' } }, { 'class': 'Temp', 'name': 'SFB 6 ' 'Exhaust-Zone0', 'status': 'OK', 'temperature': { '#text': '34 ' 'degrees ' 'C ' '/ ' '93 ' 'degrees ' 'F', '@junos:celsius': '34' } }, { 'class': 'Temp', 'name': 'SFB 6 ' 'SFB-XF2-Zone1', 'status': 'OK', 'temperature': { '#text': '62 ' 'degrees ' 'C ' '/ ' '143 ' 'degrees ' 'F', '@junos:celsius': '62' } }, { 'class': 'Temp', 'name': 'SFB 6 ' 'SFB-XF1-Zone0', 'status': 'OK', 'temperature': { '#text': '53 ' 'degrees ' 'C ' '/ ' '127 ' 'degrees ' 'F', '@junos:celsius': '53' } }, { 'class': 'Temp', 'name': 'SFB 6 ' 'SFB-XF0-Zone0', 'status': 'OK', 'temperature': { '#text': '49 ' 'degrees ' 'C ' '/ ' '120 ' 'degrees ' 'F', '@junos:celsius': '49' } }, { 'class': 'Temp', 'name': 'SFB 7 Intake-Zone0', 'status': 'OK', 'temperature': { '#text': '35 ' 'degrees ' 'C ' '/ ' '95 ' 'degrees ' 'F', '@junos:celsius': '35' } }, { 'class': 'Temp', 'name': 'SFB 7 ' 'Exhaust-Zone1', 'status': 'OK', 'temperature': { '#text': '43 ' 'degrees ' 'C ' '/ ' '109 ' 'degrees ' 'F', '@junos:celsius': '43' } }, { 'class': 'Temp', 'name': 'SFB 7 ' 'IntakeA-Zone0', 'status': 'OK', 'temperature': { '#text': '31 ' 'degrees ' 'C ' '/ ' '87 ' 'degrees ' 'F', '@junos:celsius': '31' } }, { 'class': 'Temp', 'name': 'SFB 7 ' 'IntakeB-Zone1', 'status': 'OK', 'temperature': { '#text': '32 ' 'degrees ' 'C ' '/ ' '89 ' 'degrees ' 'F', '@junos:celsius': '32' } }, { 'class': 'Temp', 'name': 'SFB 7 ' 'Exhaust-Zone0', 'status': 'OK', 'temperature': { '#text': '35 ' 'degrees ' 'C ' '/ ' '95 ' 'degrees ' 'F', '@junos:celsius': '35' } }, { 'class': 'Temp', 'name': 'SFB 7 ' 'SFB-XF2-Zone1', 'status': 'OK', 'temperature': { '#text': '65 ' 'degrees ' 'C ' '/ ' '149 ' 'degrees ' 'F', '@junos:celsius': '65' } }, { 'class': 'Temp', 'name': 'SFB 7 ' 'SFB-XF1-Zone0', 'status': 'OK', 'temperature': { '#text': '56 ' 'degrees ' 'C ' '/ ' '132 ' 'degrees ' 'F', '@junos:celsius': '56' } }, { 'class': 'Temp', 'name': 'SFB 7 ' 'SFB-XF0-Zone0', 'status': 'OK', 'temperature': { '#text': '52 ' 'degrees ' 'C ' '/ ' '125 ' 'degrees ' 'F', '@junos:celsius': '52' } }, { 'class': 'Temp', 'name': 'FPC 0 Intake', 'status': 'OK', 'temperature': { '#text': '29 ' 'degrees ' 'C ' '/ ' '84 ' 'degrees ' 'F', '@junos:celsius': '29' } }, { 'class': 'Temp', 'name': 'FPC 0 Exhaust A', 'status': 'OK', 'temperature': { '#text': '53 ' 'degrees ' 'C ' '/ ' '127 ' 'degrees ' 'F', '@junos:celsius': '53' } }, { 'class': 'Temp', 'name': 'FPC 0 Exhaust B', 'status': 'OK', 'temperature': { '#text': '54 ' 'degrees ' 'C ' '/ ' '129 ' 'degrees ' 'F', '@junos:celsius': '54' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 0 TSen', 'status': 'OK', 'temperature': { '#text': '50 ' 'degrees ' 'C ' '/ ' '122 ' 'degrees ' 'F', '@junos:celsius': '50' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 0 Chip', 'status': 'OK', 'temperature': { '#text': '63 ' 'degrees ' 'C ' '/ ' '145 ' 'degrees ' 'F', '@junos:celsius': '63' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 0 XR2 0 ' 'TSen', 'status': 'OK', 'temperature': { '#text': '50 ' 'degrees ' 'C ' '/ ' '122 ' 'degrees ' 'F', '@junos:celsius': '50' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 0 XR2 0 ' 'Chip', 'status': 'OK', 'temperature': { '#text': '80 ' 'degrees ' 'C ' '/ ' '176 ' 'degrees ' 'F', '@junos:celsius': '80' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 0 XR2 1 ' 'TSen', 'status': 'OK', 'temperature': { '#text': '50 ' 'degrees ' 'C ' '/ ' '122 ' 'degrees ' 'F', '@junos:celsius': '50' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 0 XR2 1 ' 'Chip', 'status': 'OK', 'temperature': { '#text': '80 ' 'degrees ' 'C ' '/ ' '176 ' 'degrees ' 'F', '@junos:celsius': '80' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 1 TSen', 'status': 'OK', 'temperature': { '#text': '36 ' 'degrees ' 'C ' '/ ' '96 ' 'degrees ' 'F', '@junos:celsius': '36' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 1 Chip', 'status': 'OK', 'temperature': { '#text': '44 ' 'degrees ' 'C ' '/ ' '111 ' 'degrees ' 'F', '@junos:celsius': '44' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 1 XR2 0 ' 'TSen', 'status': 'OK', 'temperature': { '#text': '36 ' 'degrees ' 'C ' '/ ' '96 ' 'degrees ' 'F', '@junos:celsius': '36' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 1 XR2 0 ' 'Chip', 'status': 'OK', 'temperature': { '#text': '60 ' 'degrees ' 'C ' '/ ' '140 ' 'degrees ' 'F', '@junos:celsius': '60' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 1 XR2 1 ' 'TSen', 'status': 'OK', 'temperature': { '#text': '36 ' 'degrees ' 'C ' '/ ' '96 ' 'degrees ' 'F', '@junos:celsius': '36' } }, { 'class': 'Temp', 'name': 'FPC 0 XL 1 XR2 1 ' 'Chip', 'status': 'OK', 'temperature': { '#text': '59 ' 'degrees ' 'C ' '/ ' '138 ' 'degrees ' 'F', '@junos:celsius': '59' } }, { 'class': 'Temp', 'name': 'FPC 0 XM 0 TSen', 'status': 'OK', 'temperature': { '#text': '52 ' 'degrees ' 'C ' '/ ' '125 ' 'degrees ' 'F', '@junos:celsius': '52' } }, { 'class': 'Temp', 'name': 'FPC 0 XM 0 Chip', 'status': 'OK', 'temperature': { '#text': '62 ' 'degrees ' 'C ' '/ ' '143 ' 'degrees ' 'F', '@junos:celsius': '62' } }, { 'class': 'Temp', 'name': 'FPC 0 XM 1 TSen', 'status': 'OK', 'temperature': { '#text': '52 ' 'degrees ' 'C ' '/ ' '125 ' 'degrees ' 'F', '@junos:celsius': '52' } }, { 'class': 'Temp', 'name': 'FPC 0 XM 1 Chip', 'status': 'OK', 'temperature': { '#text': '57 ' 'degrees ' 'C ' '/ ' '134 ' 'degrees ' 'F', '@junos:celsius': '57' } }, { 'class': 'Temp', 'name': 'FPC 0 XM 2 TSen', 'status': 'OK', 'temperature': { '#text': '52 ' 'degrees ' 'C ' '/ ' '125 ' 'degrees ' 'F', '@junos:celsius': '52' } }, { 'class': 'Temp', 'name': 'FPC 0 XM 2 Chip', 'status': 'OK', 'temperature': { '#text': '51 ' 'degrees ' 'C ' '/ ' '123 ' 'degrees ' 'F', '@junos:celsius': '51' } }, { 'class': 'Temp', 'name': 'FPC 0 XM 3 TSen', 'status': 'OK', 'temperature': { '#text': '52 ' 'degrees ' 'C ' '/ ' '125 ' 'degrees ' 'F', '@junos:celsius': '52' } }, { 'class': 'Temp', 'name': 'FPC 0 XM 3 Chip', 'status': 'OK', 'temperature': { '#text': '45 ' 'degrees ' 'C ' '/ ' '113 ' 'degrees ' 'F', '@junos:celsius': '45' } }, { 'class': 'Temp', 'name': 'FPC 0 PCIe Switch ' 'TSen', 'status': 'OK', 'temperature': { '#text': '52 ' 'degrees ' 'C ' '/ ' '125 ' 'degrees ' 'F', '@junos:celsius': '52' } }, { 'class': 'Temp', 'name': 'FPC 0 PCIe Switch ' 'Chip', 'status': 'OK', 'temperature': { '#text': '30 ' 'degrees ' 'C ' '/ ' '86 ' 'degrees ' 'F', '@junos:celsius': '30' } }, { 'class': 'Temp', 'name': 'FPC 9 Intake', 'status': 'OK', 'temperature': { '#text': '31 ' 'degrees ' 'C ' '/ ' '87 ' 'degrees ' 'F', '@junos:celsius': '31' } }, { 'class': 'Temp', 'name': 'FPC 9 Exhaust A', 'status': 'OK', 'temperature': { '#text': '48 ' 'degrees ' 'C ' '/ ' '118 ' 'degrees ' 'F', '@junos:celsius': '48' } }, { 'class': 'Temp', 'name': 'FPC 9 Exhaust B', 'status': 'OK', 'temperature': { '#text': '41 ' 'degrees ' 'C ' '/ ' '105 ' 'degrees ' 'F', '@junos:celsius': '41' } }, { 'class': 'Temp', 'name': 'FPC 9 LU 0 TCAM ' 'TSen', 'status': 'OK', 'temperature': { '#text': '46 ' 'degrees ' 'C ' '/ ' '114 ' 'degrees ' 'F', '@junos:celsius': '46' } }, { 'class': 'Temp', 'name': 'FPC 9 LU 0 TCAM ' 'Chip', 'status': 'OK', 'temperature': { '#text': '55 ' 'degrees ' 'C ' '/ ' '131 ' 'degrees ' 'F', '@junos:celsius': '55' } }, { 'class': 'Temp', 'name': 'FPC 9 LU 0 TSen', 'status': 'OK', 'temperature': { '#text': '46 ' 'degrees ' 'C ' '/ ' '114 ' 'degrees ' 'F', '@junos:celsius': '46' } }, { 'class': 'Temp', 'name': 'FPC 9 LU 0 Chip', 'status': 'OK', 'temperature': { '#text': '55 ' 'degrees ' 'C ' '/ ' '131 ' 'degrees ' 'F', '@junos:celsius': '55' } }, { 'class': 'Temp', 'name': 'FPC 9 MQ 0 TSen', 'status': 'OK', 'temperature': { '#text': '46 ' 'degrees ' 'C ' '/ ' '114 ' 'degrees ' 'F', '@junos:celsius': '46' } }, { 'class': 'Temp', 'name': 'FPC 9 MQ 0 Chip', 'status': 'OK', 'temperature': { '#text': '57 ' 'degrees ' 'C ' '/ ' '134 ' 'degrees ' 'F', '@junos:celsius': '57' } }, { 'class': 'Temp', 'name': 'FPC 9 LU 1 TCAM ' 'TSen', 'status': 'OK', 'temperature': { '#text': '41 ' 'degrees ' 'C ' '/ ' '105 ' 'degrees ' 'F', '@junos:celsius': '41' } }, { 'class': 'Temp', 'name': 'FPC 9 LU 1 TCAM ' 'Chip', 'status': 'OK', 'temperature': { '#text': '46 ' 'degrees ' 'C ' '/ ' '114 ' 'degrees ' 'F', '@junos:celsius': '46' } }, { 'class': 'Temp', 'name': 'FPC 9 LU 1 TSen', 'status': 'OK', 'temperature': { '#text': '41 ' 'degrees ' 'C ' '/ ' '105 ' 'degrees ' 'F', '@junos:celsius': '41' } }, { 'class': 'Temp', 'name': 'FPC 9 LU 1 Chip', 'status': 'OK', 'temperature': { '#text': '47 ' 'degrees ' 'C ' '/ ' '116 ' 'degrees ' 'F', '@junos:celsius': '47' } }, { 'class': 'Temp', 'name': 'FPC 9 MQ 1 TSen', 'status': 'OK', 'temperature': { '#text': '41 ' 'degrees ' 'C ' '/ ' '105 ' 'degrees ' 'F', '@junos:celsius': '41' } }, { 'class': 'Temp', 'name': 'FPC 9 MQ 1 Chip', 'status': 'OK', 'temperature': { '#text': '47 ' 'degrees ' 'C ' '/ ' '116 ' 'degrees ' 'F', '@junos:celsius': '47' } }, { 'class': 'Temp', 'name': 'ADC 9 Intake', 'status': 'OK', 'temperature': { '#text': '32 ' 'degrees ' 'C ' '/ ' '89 ' 'degrees ' 'F', '@junos:celsius': '32' } }, { 'class': 'Temp', 'name': 'ADC 9 Exhaust', 'status': 'OK', 'temperature': { '#text': '42 ' 'degrees ' 'C ' '/ ' '107 ' 'degrees ' 'F', '@junos:celsius': '42' } }, { 'class': 'Temp', 'name': 'ADC 9 ADC-XF1', 'status': 'OK', 'temperature': { '#text': '49 ' 'degrees ' 'C ' '/ ' '120 ' 'degrees ' 'F', '@junos:celsius': '49' } }, { 'class': 'Temp', 'name': 'ADC 9 ADC-XF0', 'status': 'OK', 'temperature': { '#text': '59 ' 'degrees ' 'C ' '/ ' '138 ' 'degrees ' 'F', '@junos:celsius': '59' } }, { 'class': 'Fans', 'comment': '2760 RPM', 'name': 'Fan Tray 0 Fan 1', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 0 Fan 2', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 0 Fan 3', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 0 Fan 4', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 0 Fan 5', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 0 Fan 6', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 1 Fan 1', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 1 Fan 2', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 1 Fan 3', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 1 Fan 4', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 1 Fan 5', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 1 Fan 6', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 2 Fan 1', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 2 Fan 2', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 2 Fan 3', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 2 Fan 4', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 2 Fan 5', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 2 Fan 6', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 3 Fan 1', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2400 RPM', 'name': 'Fan Tray 3 Fan 2', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 3 Fan 3', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 3 Fan 4', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 3 Fan 5', 'status': 'OK' }, { 'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 3 Fan 6', 'status': 'OK' }] } }
expected_output = {'environment-information': {'environment-item': [{'class': 'Temp', 'name': 'PSM 0', 'status': 'OK', 'temperature': {'#text': '25 degrees C / 77 degrees F', '@junos:celsius': '25'}}, {'class': 'Temp', 'name': 'PSM 1', 'status': 'OK', 'temperature': {'#text': '24 degrees C / 75 degrees F', '@junos:celsius': '24'}}, {'class': 'Temp', 'name': 'PSM 2', 'status': 'OK', 'temperature': {'#text': '24 degrees C / 75 degrees F', '@junos:celsius': '24'}}, {'class': 'Temp', 'name': 'PSM 3', 'status': 'OK', 'temperature': {'#text': '23 degrees C / 73 degrees F', '@junos:celsius': '23'}}, {'class': 'Temp', 'name': 'PSM 4', 'status': 'Check'}, {'class': 'Temp', 'name': 'PSM 5', 'status': 'Check'}, {'class': 'Temp', 'name': 'PSM 6', 'status': 'Check'}, {'class': 'Temp', 'name': 'PSM 7', 'status': 'Check'}, {'class': 'Temp', 'name': 'PSM 8', 'status': 'Check'}, {'class': 'Temp', 'name': 'PSM 9', 'status': 'OK', 'temperature': {'#text': '29 degrees C / 84 degrees F', '@junos:celsius': '29'}}, {'class': 'Temp', 'name': 'PSM 10', 'status': 'OK', 'temperature': {'#text': '30 degrees C / 86 degrees F', '@junos:celsius': '30'}}, {'class': 'Temp', 'name': 'PSM 11', 'status': 'OK', 'temperature': {'#text': '30 degrees C / 86 degrees F', '@junos:celsius': '30'}}, {'class': 'Temp', 'name': 'PSM 12', 'status': 'Check'}, {'class': 'Temp', 'name': 'PSM 13', 'status': 'Check'}, {'class': 'Temp', 'name': 'PSM 14', 'status': 'Check'}, {'class': 'Temp', 'name': 'PSM 15', 'status': 'Check'}, {'class': 'Temp', 'name': 'PSM 16', 'status': 'Check'}, {'class': 'Temp', 'name': 'PSM 17', 'status': 'Check'}, {'class': 'Temp', 'name': 'PDM 0', 'status': 'OK'}, {'class': 'Temp', 'name': 'PDM 1', 'status': 'OK'}, {'class': 'Temp', 'name': 'PDM 2', 'status': 'OK'}, {'class': 'Temp', 'name': 'PDM 3', 'status': 'OK'}, {'class': 'Temp', 'name': 'CB 0 IntakeA-Zone0', 'status': 'OK', 'temperature': {'#text': '39 degrees C / 102 degrees F', '@junos:celsius': '39'}}, {'class': 'Temp', 'name': 'CB 0 IntakeB-Zone1', 'status': 'OK', 'temperature': {'#text': '36 degrees C / 96 degrees F', '@junos:celsius': '36'}}, {'class': 'Temp', 'name': 'CB 0 IntakeC-Zone0', 'status': 'OK', 'temperature': {'#text': '51 degrees C / 123 degrees F', '@junos:celsius': '51'}}, {'class': 'Temp', 'name': 'CB 0 ExhaustA-Zone0', 'status': 'OK', 'temperature': {'#text': '40 degrees C / 104 degrees F', '@junos:celsius': '40'}}, {'class': 'Temp', 'name': 'CB 0 ExhaustB-Zone1', 'status': 'OK', 'temperature': {'#text': '35 degrees C / 95 degrees F', '@junos:celsius': '35'}}, {'class': 'Temp', 'name': 'CB 0 TCBC-Zone0', 'status': 'OK', 'temperature': {'#text': '45 degrees C / 113 degrees F', '@junos:celsius': '45'}}, {'class': 'Temp', 'name': 'CB 1 IntakeA-Zone0', 'status': 'OK', 'temperature': {'#text': '29 degrees C / 84 degrees F', '@junos:celsius': '29'}}, {'class': 'Temp', 'name': 'CB 1 IntakeB-Zone1', 'status': 'OK', 'temperature': {'#text': '32 degrees C / 89 degrees F', '@junos:celsius': '32'}}, {'class': 'Temp', 'name': 'CB 1 IntakeC-Zone0', 'status': 'OK', 'temperature': {'#text': '33 degrees C / 91 degrees F', '@junos:celsius': '33'}}, {'class': 'Temp', 'name': 'CB 1 ExhaustA-Zone0', 'status': 'OK', 'temperature': {'#text': '32 degrees C / 89 degrees F', '@junos:celsius': '32'}}, {'class': 'Temp', 'name': 'CB 1 ExhaustB-Zone1', 'status': 'OK', 'temperature': {'#text': '32 degrees C / 89 degrees F', '@junos:celsius': '32'}}, {'class': 'Temp', 'name': 'CB 1 TCBC-Zone0', 'status': 'OK', 'temperature': {'#text': '39 degrees C / 102 degrees F', '@junos:celsius': '39'}}, {'class': 'Temp', 'name': 'SPMB 0 Intake', 'status': 'OK', 'temperature': {'#text': '35 degrees C / 95 degrees F', '@junos:celsius': '35'}}, {'class': 'Temp', 'name': 'SPMB 1 Intake', 'status': 'OK', 'temperature': {'#text': '33 degrees C / 91 degrees F', '@junos:celsius': '33'}}, {'class': 'Temp', 'name': 'Routing Engine 0', 'status': 'OK', 'temperature': {'#text': '43 degrees C / 109 degrees F', '@junos:celsius': '43'}}, {'class': 'Temp', 'name': 'Routing Engine 0 CPU', 'status': 'OK', 'temperature': {'#text': '39 degrees C / 102 degrees F', '@junos:celsius': '39'}}, {'class': 'Temp', 'name': 'Routing Engine 1', 'status': 'OK', 'temperature': {'#text': '40 degrees C / 104 degrees F', '@junos:celsius': '40'}}, {'class': 'Temp', 'name': 'Routing Engine 1 CPU', 'status': 'OK', 'temperature': {'#text': '35 degrees C / 95 degrees F', '@junos:celsius': '35'}}, {'class': 'Temp', 'name': 'SFB 0 Intake-Zone0', 'status': 'OK', 'temperature': {'#text': '37 degrees C / 98 degrees F', '@junos:celsius': '37'}}, {'class': 'Temp', 'name': 'SFB 0 Exhaust-Zone1', 'status': 'OK', 'temperature': {'#text': '45 degrees C / 113 degrees F', '@junos:celsius': '45'}}, {'class': 'Temp', 'name': 'SFB 0 IntakeA-Zone0', 'status': 'OK', 'temperature': {'#text': '32 degrees C / 89 degrees F', '@junos:celsius': '32'}}, {'class': 'Temp', 'name': 'SFB 0 IntakeB-Zone1', 'status': 'OK', 'temperature': {'#text': '34 degrees C / 93 degrees F', '@junos:celsius': '34'}}, {'class': 'Temp', 'name': 'SFB 0 Exhaust-Zone0', 'status': 'OK', 'temperature': {'#text': '36 degrees C / 96 degrees F', '@junos:celsius': '36'}}, {'class': 'Temp', 'name': 'SFB 0 SFB-XF2-Zone1', 'status': 'OK', 'temperature': {'#text': '63 degrees C / 145 degrees F', '@junos:celsius': '63'}}, {'class': 'Temp', 'name': 'SFB 0 SFB-XF1-Zone0', 'status': 'OK', 'temperature': {'#text': '55 degrees C / 131 degrees F', '@junos:celsius': '55'}}, {'class': 'Temp', 'name': 'SFB 0 SFB-XF0-Zone0', 'status': 'OK', 'temperature': {'#text': '52 degrees C / 125 degrees F', '@junos:celsius': '52'}}, {'class': 'Temp', 'name': 'SFB 1 Intake-Zone0', 'status': 'OK', 'temperature': {'#text': '35 degrees C / 95 degrees F', '@junos:celsius': '35'}}, {'class': 'Temp', 'name': 'SFB 1 Exhaust-Zone1', 'status': 'OK', 'temperature': {'#text': '42 degrees C / 107 degrees F', '@junos:celsius': '42'}}, {'class': 'Temp', 'name': 'SFB 1 IntakeA-Zone0', 'status': 'OK', 'temperature': {'#text': '29 degrees C / 84 degrees F', '@junos:celsius': '29'}}, {'class': 'Temp', 'name': 'SFB 1 IntakeB-Zone1', 'status': 'OK', 'temperature': {'#text': '32 degrees C / 89 degrees F', '@junos:celsius': '32'}}, {'class': 'Temp', 'name': 'SFB 1 Exhaust-Zone0', 'status': 'OK', 'temperature': {'#text': '34 degrees C / 93 degrees F', '@junos:celsius': '34'}}, {'class': 'Temp', 'name': 'SFB 1 SFB-XF2-Zone1', 'status': 'OK', 'temperature': {'#text': '63 degrees C / 145 degrees F', '@junos:celsius': '63'}}, {'class': 'Temp', 'name': 'SFB 1 SFB-XF1-Zone0', 'status': 'OK', 'temperature': {'#text': '53 degrees C / 127 degrees F', '@junos:celsius': '53'}}, {'class': 'Temp', 'name': 'SFB 1 SFB-XF0-Zone0', 'status': 'OK', 'temperature': {'#text': '50 degrees C / 122 degrees F', '@junos:celsius': '50'}}, {'class': 'Temp', 'name': 'SFB 2 Intake-Zone0', 'status': 'OK', 'temperature': {'#text': '35 degrees C / 95 degrees F', '@junos:celsius': '35'}}, {'class': 'Temp', 'name': 'SFB 2 Exhaust-Zone1', 'status': 'OK', 'temperature': {'#text': '42 degrees C / 107 degrees F', '@junos:celsius': '42'}}, {'class': 'Temp', 'name': 'SFB 2 IntakeA-Zone0', 'status': 'OK', 'temperature': {'#text': '30 degrees C / 86 degrees F', '@junos:celsius': '30'}}, {'class': 'Temp', 'name': 'SFB 2 IntakeB-Zone1', 'status': 'OK', 'temperature': {'#text': '32 degrees C / 89 degrees F', '@junos:celsius': '32'}}, {'class': 'Temp', 'name': 'SFB 2 Exhaust-Zone0', 'status': 'OK', 'temperature': {'#text': '34 degrees C / 93 degrees F', '@junos:celsius': '34'}}, {'class': 'Temp', 'name': 'SFB 2 SFB-XF2-Zone1', 'status': 'OK', 'temperature': {'#text': '60 degrees C / 140 degrees F', '@junos:celsius': '60'}}, {'class': 'Temp', 'name': 'SFB 2 SFB-XF1-Zone0', 'status': 'OK', 'temperature': {'#text': '53 degrees C / 127 degrees F', '@junos:celsius': '53'}}, {'class': 'Temp', 'name': 'SFB 2 SFB-XF0-Zone0', 'status': 'OK', 'temperature': {'#text': '56 degrees C / 132 degrees F', '@junos:celsius': '56'}}, {'class': 'Temp', 'name': 'SFB 3 Intake-Zone0', 'status': 'OK', 'temperature': {'#text': '35 degrees C / 95 degrees F', '@junos:celsius': '35'}}, {'class': 'Temp', 'name': 'SFB 3 Exhaust-Zone1', 'status': 'OK', 'temperature': {'#text': '42 degrees C / 107 degrees F', '@junos:celsius': '42'}}, {'class': 'Temp', 'name': 'SFB 3 IntakeA-Zone0', 'status': 'OK', 'temperature': {'#text': '29 degrees C / 84 degrees F', '@junos:celsius': '29'}}, {'class': 'Temp', 'name': 'SFB 3 IntakeB-Zone1', 'status': 'OK', 'temperature': {'#text': '32 degrees C / 89 degrees F', '@junos:celsius': '32'}}, {'class': 'Temp', 'name': 'SFB 3 Exhaust-Zone0', 'status': 'OK', 'temperature': {'#text': '34 degrees C / 93 degrees F', '@junos:celsius': '34'}}, {'class': 'Temp', 'name': 'SFB 3 SFB-XF2-Zone1', 'status': 'OK', 'temperature': {'#text': '61 degrees C / 141 degrees F', '@junos:celsius': '61'}}, {'class': 'Temp', 'name': 'SFB 3 SFB-XF1-Zone0', 'status': 'OK', 'temperature': {'#text': '53 degrees C / 127 degrees F', '@junos:celsius': '53'}}, {'class': 'Temp', 'name': 'SFB 3 SFB-XF0-Zone0', 'status': 'OK', 'temperature': {'#text': '50 degrees C / 122 degrees F', '@junos:celsius': '50'}}, {'class': 'Temp', 'name': 'SFB 4 Intake-Zone0', 'status': 'OK', 'temperature': {'#text': '34 degrees C / 93 degrees F', '@junos:celsius': '34'}}, {'class': 'Temp', 'name': 'SFB 4 Exhaust-Zone1', 'status': 'OK', 'temperature': {'#text': '42 degrees C / 107 degrees F', '@junos:celsius': '42'}}, {'class': 'Temp', 'name': 'SFB 4 IntakeA-Zone0', 'status': 'OK', 'temperature': {'#text': '29 degrees C / 84 degrees F', '@junos:celsius': '29'}}, {'class': 'Temp', 'name': 'SFB 4 IntakeB-Zone1', 'status': 'OK', 'temperature': {'#text': '32 degrees C / 89 degrees F', '@junos:celsius': '32'}}, {'class': 'Temp', 'name': 'SFB 4 Exhaust-Zone0', 'status': 'OK', 'temperature': {'#text': '34 degrees C / 93 degrees F', '@junos:celsius': '34'}}, {'class': 'Temp', 'name': 'SFB 4 SFB-XF2-Zone1', 'status': 'OK', 'temperature': {'#text': '64 degrees C / 147 degrees F', '@junos:celsius': '64'}}, {'class': 'Temp', 'name': 'SFB 4 SFB-XF1-Zone0', 'status': 'OK', 'temperature': {'#text': '53 degrees C / 127 degrees F', '@junos:celsius': '53'}}, {'class': 'Temp', 'name': 'SFB 4 SFB-XF0-Zone0', 'status': 'OK', 'temperature': {'#text': '50 degrees C / 122 degrees F', '@junos:celsius': '50'}}, {'class': 'Temp', 'name': 'SFB 5 Intake-Zone0', 'status': 'OK', 'temperature': {'#text': '34 degrees C / 93 degrees F', '@junos:celsius': '34'}}, {'class': 'Temp', 'name': 'SFB 5 Exhaust-Zone1', 'status': 'OK', 'temperature': {'#text': '41 degrees C / 105 degrees F', '@junos:celsius': '41'}}, {'class': 'Temp', 'name': 'SFB 5 IntakeA-Zone0', 'status': 'OK', 'temperature': {'#text': '29 degrees C / 84 degrees F', '@junos:celsius': '29'}}, {'class': 'Temp', 'name': 'SFB 5 IntakeB-Zone1', 'status': 'OK', 'temperature': {'#text': '31 degrees C / 87 degrees F', '@junos:celsius': '31'}}, {'class': 'Temp', 'name': 'SFB 5 Exhaust-Zone0', 'status': 'OK', 'temperature': {'#text': '34 degrees C / 93 degrees F', '@junos:celsius': '34'}}, {'class': 'Temp', 'name': 'SFB 5 SFB-XF2-Zone1', 'status': 'OK', 'temperature': {'#text': '63 degrees C / 145 degrees F', '@junos:celsius': '63'}}, {'class': 'Temp', 'name': 'SFB 5 SFB-XF1-Zone0', 'status': 'OK', 'temperature': {'#text': '53 degrees C / 127 degrees F', '@junos:celsius': '53'}}, {'class': 'Temp', 'name': 'SFB 5 SFB-XF0-Zone0', 'status': 'OK', 'temperature': {'#text': '50 degrees C / 122 degrees F', '@junos:celsius': '50'}}, {'class': 'Temp', 'name': 'SFB 6 Intake-Zone0', 'status': 'OK', 'temperature': {'#text': '34 degrees C / 93 degrees F', '@junos:celsius': '34'}}, {'class': 'Temp', 'name': 'SFB 6 Exhaust-Zone1', 'status': 'OK', 'temperature': {'#text': '42 degrees C / 107 degrees F', '@junos:celsius': '42'}}, {'class': 'Temp', 'name': 'SFB 6 IntakeA-Zone0', 'status': 'OK', 'temperature': {'#text': '29 degrees C / 84 degrees F', '@junos:celsius': '29'}}, {'class': 'Temp', 'name': 'SFB 6 IntakeB-Zone1', 'status': 'OK', 'temperature': {'#text': '32 degrees C / 89 degrees F', '@junos:celsius': '32'}}, {'class': 'Temp', 'name': 'SFB 6 Exhaust-Zone0', 'status': 'OK', 'temperature': {'#text': '34 degrees C / 93 degrees F', '@junos:celsius': '34'}}, {'class': 'Temp', 'name': 'SFB 6 SFB-XF2-Zone1', 'status': 'OK', 'temperature': {'#text': '62 degrees C / 143 degrees F', '@junos:celsius': '62'}}, {'class': 'Temp', 'name': 'SFB 6 SFB-XF1-Zone0', 'status': 'OK', 'temperature': {'#text': '53 degrees C / 127 degrees F', '@junos:celsius': '53'}}, {'class': 'Temp', 'name': 'SFB 6 SFB-XF0-Zone0', 'status': 'OK', 'temperature': {'#text': '49 degrees C / 120 degrees F', '@junos:celsius': '49'}}, {'class': 'Temp', 'name': 'SFB 7 Intake-Zone0', 'status': 'OK', 'temperature': {'#text': '35 degrees C / 95 degrees F', '@junos:celsius': '35'}}, {'class': 'Temp', 'name': 'SFB 7 Exhaust-Zone1', 'status': 'OK', 'temperature': {'#text': '43 degrees C / 109 degrees F', '@junos:celsius': '43'}}, {'class': 'Temp', 'name': 'SFB 7 IntakeA-Zone0', 'status': 'OK', 'temperature': {'#text': '31 degrees C / 87 degrees F', '@junos:celsius': '31'}}, {'class': 'Temp', 'name': 'SFB 7 IntakeB-Zone1', 'status': 'OK', 'temperature': {'#text': '32 degrees C / 89 degrees F', '@junos:celsius': '32'}}, {'class': 'Temp', 'name': 'SFB 7 Exhaust-Zone0', 'status': 'OK', 'temperature': {'#text': '35 degrees C / 95 degrees F', '@junos:celsius': '35'}}, {'class': 'Temp', 'name': 'SFB 7 SFB-XF2-Zone1', 'status': 'OK', 'temperature': {'#text': '65 degrees C / 149 degrees F', '@junos:celsius': '65'}}, {'class': 'Temp', 'name': 'SFB 7 SFB-XF1-Zone0', 'status': 'OK', 'temperature': {'#text': '56 degrees C / 132 degrees F', '@junos:celsius': '56'}}, {'class': 'Temp', 'name': 'SFB 7 SFB-XF0-Zone0', 'status': 'OK', 'temperature': {'#text': '52 degrees C / 125 degrees F', '@junos:celsius': '52'}}, {'class': 'Temp', 'name': 'FPC 0 Intake', 'status': 'OK', 'temperature': {'#text': '29 degrees C / 84 degrees F', '@junos:celsius': '29'}}, {'class': 'Temp', 'name': 'FPC 0 Exhaust A', 'status': 'OK', 'temperature': {'#text': '53 degrees C / 127 degrees F', '@junos:celsius': '53'}}, {'class': 'Temp', 'name': 'FPC 0 Exhaust B', 'status': 'OK', 'temperature': {'#text': '54 degrees C / 129 degrees F', '@junos:celsius': '54'}}, {'class': 'Temp', 'name': 'FPC 0 XL 0 TSen', 'status': 'OK', 'temperature': {'#text': '50 degrees C / 122 degrees F', '@junos:celsius': '50'}}, {'class': 'Temp', 'name': 'FPC 0 XL 0 Chip', 'status': 'OK', 'temperature': {'#text': '63 degrees C / 145 degrees F', '@junos:celsius': '63'}}, {'class': 'Temp', 'name': 'FPC 0 XL 0 XR2 0 TSen', 'status': 'OK', 'temperature': {'#text': '50 degrees C / 122 degrees F', '@junos:celsius': '50'}}, {'class': 'Temp', 'name': 'FPC 0 XL 0 XR2 0 Chip', 'status': 'OK', 'temperature': {'#text': '80 degrees C / 176 degrees F', '@junos:celsius': '80'}}, {'class': 'Temp', 'name': 'FPC 0 XL 0 XR2 1 TSen', 'status': 'OK', 'temperature': {'#text': '50 degrees C / 122 degrees F', '@junos:celsius': '50'}}, {'class': 'Temp', 'name': 'FPC 0 XL 0 XR2 1 Chip', 'status': 'OK', 'temperature': {'#text': '80 degrees C / 176 degrees F', '@junos:celsius': '80'}}, {'class': 'Temp', 'name': 'FPC 0 XL 1 TSen', 'status': 'OK', 'temperature': {'#text': '36 degrees C / 96 degrees F', '@junos:celsius': '36'}}, {'class': 'Temp', 'name': 'FPC 0 XL 1 Chip', 'status': 'OK', 'temperature': {'#text': '44 degrees C / 111 degrees F', '@junos:celsius': '44'}}, {'class': 'Temp', 'name': 'FPC 0 XL 1 XR2 0 TSen', 'status': 'OK', 'temperature': {'#text': '36 degrees C / 96 degrees F', '@junos:celsius': '36'}}, {'class': 'Temp', 'name': 'FPC 0 XL 1 XR2 0 Chip', 'status': 'OK', 'temperature': {'#text': '60 degrees C / 140 degrees F', '@junos:celsius': '60'}}, {'class': 'Temp', 'name': 'FPC 0 XL 1 XR2 1 TSen', 'status': 'OK', 'temperature': {'#text': '36 degrees C / 96 degrees F', '@junos:celsius': '36'}}, {'class': 'Temp', 'name': 'FPC 0 XL 1 XR2 1 Chip', 'status': 'OK', 'temperature': {'#text': '59 degrees C / 138 degrees F', '@junos:celsius': '59'}}, {'class': 'Temp', 'name': 'FPC 0 XM 0 TSen', 'status': 'OK', 'temperature': {'#text': '52 degrees C / 125 degrees F', '@junos:celsius': '52'}}, {'class': 'Temp', 'name': 'FPC 0 XM 0 Chip', 'status': 'OK', 'temperature': {'#text': '62 degrees C / 143 degrees F', '@junos:celsius': '62'}}, {'class': 'Temp', 'name': 'FPC 0 XM 1 TSen', 'status': 'OK', 'temperature': {'#text': '52 degrees C / 125 degrees F', '@junos:celsius': '52'}}, {'class': 'Temp', 'name': 'FPC 0 XM 1 Chip', 'status': 'OK', 'temperature': {'#text': '57 degrees C / 134 degrees F', '@junos:celsius': '57'}}, {'class': 'Temp', 'name': 'FPC 0 XM 2 TSen', 'status': 'OK', 'temperature': {'#text': '52 degrees C / 125 degrees F', '@junos:celsius': '52'}}, {'class': 'Temp', 'name': 'FPC 0 XM 2 Chip', 'status': 'OK', 'temperature': {'#text': '51 degrees C / 123 degrees F', '@junos:celsius': '51'}}, {'class': 'Temp', 'name': 'FPC 0 XM 3 TSen', 'status': 'OK', 'temperature': {'#text': '52 degrees C / 125 degrees F', '@junos:celsius': '52'}}, {'class': 'Temp', 'name': 'FPC 0 XM 3 Chip', 'status': 'OK', 'temperature': {'#text': '45 degrees C / 113 degrees F', '@junos:celsius': '45'}}, {'class': 'Temp', 'name': 'FPC 0 PCIe Switch TSen', 'status': 'OK', 'temperature': {'#text': '52 degrees C / 125 degrees F', '@junos:celsius': '52'}}, {'class': 'Temp', 'name': 'FPC 0 PCIe Switch Chip', 'status': 'OK', 'temperature': {'#text': '30 degrees C / 86 degrees F', '@junos:celsius': '30'}}, {'class': 'Temp', 'name': 'FPC 9 Intake', 'status': 'OK', 'temperature': {'#text': '31 degrees C / 87 degrees F', '@junos:celsius': '31'}}, {'class': 'Temp', 'name': 'FPC 9 Exhaust A', 'status': 'OK', 'temperature': {'#text': '48 degrees C / 118 degrees F', '@junos:celsius': '48'}}, {'class': 'Temp', 'name': 'FPC 9 Exhaust B', 'status': 'OK', 'temperature': {'#text': '41 degrees C / 105 degrees F', '@junos:celsius': '41'}}, {'class': 'Temp', 'name': 'FPC 9 LU 0 TCAM TSen', 'status': 'OK', 'temperature': {'#text': '46 degrees C / 114 degrees F', '@junos:celsius': '46'}}, {'class': 'Temp', 'name': 'FPC 9 LU 0 TCAM Chip', 'status': 'OK', 'temperature': {'#text': '55 degrees C / 131 degrees F', '@junos:celsius': '55'}}, {'class': 'Temp', 'name': 'FPC 9 LU 0 TSen', 'status': 'OK', 'temperature': {'#text': '46 degrees C / 114 degrees F', '@junos:celsius': '46'}}, {'class': 'Temp', 'name': 'FPC 9 LU 0 Chip', 'status': 'OK', 'temperature': {'#text': '55 degrees C / 131 degrees F', '@junos:celsius': '55'}}, {'class': 'Temp', 'name': 'FPC 9 MQ 0 TSen', 'status': 'OK', 'temperature': {'#text': '46 degrees C / 114 degrees F', '@junos:celsius': '46'}}, {'class': 'Temp', 'name': 'FPC 9 MQ 0 Chip', 'status': 'OK', 'temperature': {'#text': '57 degrees C / 134 degrees F', '@junos:celsius': '57'}}, {'class': 'Temp', 'name': 'FPC 9 LU 1 TCAM TSen', 'status': 'OK', 'temperature': {'#text': '41 degrees C / 105 degrees F', '@junos:celsius': '41'}}, {'class': 'Temp', 'name': 'FPC 9 LU 1 TCAM Chip', 'status': 'OK', 'temperature': {'#text': '46 degrees C / 114 degrees F', '@junos:celsius': '46'}}, {'class': 'Temp', 'name': 'FPC 9 LU 1 TSen', 'status': 'OK', 'temperature': {'#text': '41 degrees C / 105 degrees F', '@junos:celsius': '41'}}, {'class': 'Temp', 'name': 'FPC 9 LU 1 Chip', 'status': 'OK', 'temperature': {'#text': '47 degrees C / 116 degrees F', '@junos:celsius': '47'}}, {'class': 'Temp', 'name': 'FPC 9 MQ 1 TSen', 'status': 'OK', 'temperature': {'#text': '41 degrees C / 105 degrees F', '@junos:celsius': '41'}}, {'class': 'Temp', 'name': 'FPC 9 MQ 1 Chip', 'status': 'OK', 'temperature': {'#text': '47 degrees C / 116 degrees F', '@junos:celsius': '47'}}, {'class': 'Temp', 'name': 'ADC 9 Intake', 'status': 'OK', 'temperature': {'#text': '32 degrees C / 89 degrees F', '@junos:celsius': '32'}}, {'class': 'Temp', 'name': 'ADC 9 Exhaust', 'status': 'OK', 'temperature': {'#text': '42 degrees C / 107 degrees F', '@junos:celsius': '42'}}, {'class': 'Temp', 'name': 'ADC 9 ADC-XF1', 'status': 'OK', 'temperature': {'#text': '49 degrees C / 120 degrees F', '@junos:celsius': '49'}}, {'class': 'Temp', 'name': 'ADC 9 ADC-XF0', 'status': 'OK', 'temperature': {'#text': '59 degrees C / 138 degrees F', '@junos:celsius': '59'}}, {'class': 'Fans', 'comment': '2760 RPM', 'name': 'Fan Tray 0 Fan 1', 'status': 'OK'}, {'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 0 Fan 2', 'status': 'OK'}, {'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 0 Fan 3', 'status': 'OK'}, {'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 0 Fan 4', 'status': 'OK'}, {'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 0 Fan 5', 'status': 'OK'}, {'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 0 Fan 6', 'status': 'OK'}, {'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 1 Fan 1', 'status': 'OK'}, {'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 1 Fan 2', 'status': 'OK'}, {'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 1 Fan 3', 'status': 'OK'}, {'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 1 Fan 4', 'status': 'OK'}, {'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 1 Fan 5', 'status': 'OK'}, {'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 1 Fan 6', 'status': 'OK'}, {'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 2 Fan 1', 'status': 'OK'}, {'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 2 Fan 2', 'status': 'OK'}, {'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 2 Fan 3', 'status': 'OK'}, {'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 2 Fan 4', 'status': 'OK'}, {'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 2 Fan 5', 'status': 'OK'}, {'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 2 Fan 6', 'status': 'OK'}, {'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 3 Fan 1', 'status': 'OK'}, {'class': 'Fans', 'comment': '2400 RPM', 'name': 'Fan Tray 3 Fan 2', 'status': 'OK'}, {'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 3 Fan 3', 'status': 'OK'}, {'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 3 Fan 4', 'status': 'OK'}, {'class': 'Fans', 'comment': '2640 RPM', 'name': 'Fan Tray 3 Fan 5', 'status': 'OK'}, {'class': 'Fans', 'comment': '2520 RPM', 'name': 'Fan Tray 3 Fan 6', 'status': 'OK'}]}}
# Declan Barr 19 Mar 2018 # Script that contains function sumultiply that takes two integer arguments and # returns their product. Does this without the * or / operators def sumultiply(x, y): sumof = 0 for i in range(1, x+1): sumof = sumof + y return sumof print(sumultiply(11, 13)) print(sumultiply(5, 123))
def sumultiply(x, y): sumof = 0 for i in range(1, x + 1): sumof = sumof + y return sumof print(sumultiply(11, 13)) print(sumultiply(5, 123))
""" link : https://leetcode.com/problems/koko-eating-bananas/ """ class Solution: def minEatingSpeed(self, piles: List[int], h: int) -> int: def condition(val): hr = 0 for i in piles: hr += (val + i - 1)//val return hr <= h left,right = 1,max(piles) while left < right: mid = (left + right)//2 if condition(mid): right = mid else: left = mid + 1 return left
""" link : https://leetcode.com/problems/koko-eating-bananas/ """ class Solution: def min_eating_speed(self, piles: List[int], h: int) -> int: def condition(val): hr = 0 for i in piles: hr += (val + i - 1) // val return hr <= h (left, right) = (1, max(piles)) while left < right: mid = (left + right) // 2 if condition(mid): right = mid else: left = mid + 1 return left
class Node: def __init__(self, value, child, parent): self._value = value self._child = child self._parent = parent def get_value(self): #Return the value of a node return self._value def get_child(self): #Return the value of a node return self._child def get_parent(self): #Return the parent of a node return self._parent def set_value(self, value): #Change the value of a node self._value = value def set_child(self, child): #Change the value of a node self._child = child def set_parent(self, parent): #Change the parent reference self._parent = parent
class Node: def __init__(self, value, child, parent): self._value = value self._child = child self._parent = parent def get_value(self): return self._value def get_child(self): return self._child def get_parent(self): return self._parent def set_value(self, value): self._value = value def set_child(self, child): self._child = child def set_parent(self, parent): self._parent = parent
# -*- coding: utf-8 -*- """ Created on Thu May 28 15:30:04 2020 @author: Christopher Cheng """ class Circle (object): def __init__(self): self.radius = 0 def change_radius(self, radius): self.radius = radius def get_radius (self): return self.radius class Rectangle(object): # A rectangle object with a width and height def __init__(self,length,width): self.length = length self.width = width def set_length(self,length): self.length = length def set_width(self,width): self.width = width
""" Created on Thu May 28 15:30:04 2020 @author: Christopher Cheng """ class Circle(object): def __init__(self): self.radius = 0 def change_radius(self, radius): self.radius = radius def get_radius(self): return self.radius class Rectangle(object): def __init__(self, length, width): self.length = length self.width = width def set_length(self, length): self.length = length def set_width(self, width): self.width = width
class AvatarPlugin: """ Abstract interface for all Avatar plugins Upon start() and stop(), plugins are expected to register/unregister their own event handlers by the means of :func:`System.register_event_listener` and :func:`System.unregister_event_listener` """ def __init__(self, system): self._system = system def init(self, **kwargs): assert(False) #Not implemented def start(self, **kwargs): assert(False) #Not implemented def stop(self, **kwargs): assert(False) #Not implemented
class Avatarplugin: """ Abstract interface for all Avatar plugins Upon start() and stop(), plugins are expected to register/unregister their own event handlers by the means of :func:`System.register_event_listener` and :func:`System.unregister_event_listener` """ def __init__(self, system): self._system = system def init(self, **kwargs): assert False def start(self, **kwargs): assert False def stop(self, **kwargs): assert False
def find_sum(arr, s): curr_sum = arr[0] start = 0 n = len(arr) - 1 i = 1 while i <= n: while curr_sum > s and start < i: curr_sum = curr_sum - arr[start] start += 1 if curr_sum == s: return "Found between {} and {}".format(start, i - 1) curr_sum = curr_sum + arr[i] i += 1 return "Sum not found" arr = [15, 2, 4, 8, 9, 5, 10, 23] print(find_sum(arr, 6))
def find_sum(arr, s): curr_sum = arr[0] start = 0 n = len(arr) - 1 i = 1 while i <= n: while curr_sum > s and start < i: curr_sum = curr_sum - arr[start] start += 1 if curr_sum == s: return 'Found between {} and {}'.format(start, i - 1) curr_sum = curr_sum + arr[i] i += 1 return 'Sum not found' arr = [15, 2, 4, 8, 9, 5, 10, 23] print(find_sum(arr, 6))
class HoloResponse: def __init__(self, success, response=None): self.success = success if response != None: self.response = response
class Holoresponse: def __init__(self, success, response=None): self.success = success if response != None: self.response = response
x = float(1) y = float(2.8) z = float("3") w = float("4.2") print(x) print(y) print(z) print(w) # Author: Bryan G
x = float(1) y = float(2.8) z = float('3') w = float('4.2') print(x) print(y) print(z) print(w)
""" Project name: SortingProblem File name: BubbleSort.py Description: version: Author: Jutraman Email: jutraman@hotmail.com Date: 04/07/2021 21:49 LastEditors: Jutraman LastEditTime: 04/07/2021 Github: https://github.com/Jutraman """ def bubble_sort(array): length = len(array) for i in range(length): for j in range(length - i): if array[j] > array[j + 1]: array[j], array[j + 1] = array[j + 1], array[j] return array
""" Project name: SortingProblem File name: BubbleSort.py Description: version: Author: Jutraman Email: jutraman@hotmail.com Date: 04/07/2021 21:49 LastEditors: Jutraman LastEditTime: 04/07/2021 Github: https://github.com/Jutraman """ def bubble_sort(array): length = len(array) for i in range(length): for j in range(length - i): if array[j] > array[j + 1]: (array[j], array[j + 1]) = (array[j + 1], array[j]) return array
def capture_high_res(filename): return "./camerapi/tmp_large.jpg" def capture_low_res(filename): return "./camerapi/tmp_small.jpg" def init(): return def deinit(): return
def capture_high_res(filename): return './camerapi/tmp_large.jpg' def capture_low_res(filename): return './camerapi/tmp_small.jpg' def init(): return def deinit(): return
''' Constants --- Constants used in other scripts. These are mostly interpretations of fields provided in the Face2Gene jsons. ''' HGVS_ERRORDICT_VERSION = 0 # Bucket name, from where Face2Gene vcf and json files will be downloaded AWS_BUCKET_NAME = "fdna-pedia-dump" # caching directory CACHE_DIR = ".cache" # tests that count as chromosomal tests, if these are positive, cases will be # excluded CHROMOSOMAL_TESTS = [ 'CHROMOSOMAL_MICROARRAY', 'FISH', 'KARYOTYPE' ] # Test result descriptions, that will be counted as positive for our case # selection criteria POSITIVE_RESULTS = [ 'ABNORMAL', 'ABNORMAL_DIAGNOSTIC', 'DELETION_DUPLICATION', 'VARIANTS_DETECTED' ] NEGATIVE_RESULTS = [ 'NORMAL' 'NORMAL_FEMALE' 'NORMAL_MALE' 'NO_SIGNIFICANT_VARIANTS' ] # Translation of Face2Gene Mutation notation to HGVS operators HGVS_OPS = { 'SUBSTITUTION': '>', 'DELETION': 'del', 'DUPLICATION': 'dup', 'INSERTION': 'ins', 'INVERSION': 'inv', 'DELETION_INSERTION': 'delins', 'UNKNOWN': '' } # Translation of Description levels in Face2Gene to HGVS sequence types HGVS_PREFIX = { 'CDNA_LEVEL': 'c', 'PROTEIN_LEVEL': 'p', 'GENOMIC_DNA_LEVEL': 'g', 'UNKNOWN': '', 'RS_NUMBER': '' } # blacklist HPO illegal hpo terms ILLEGAL_HPO = [ 'HP:0000006' # autosomal-dominant inheritance ] CONFIRMED_DIAGNOSIS = [ "MOLECULARLY_DIAGNOSED", "CLINICALLY_DIAGNOSED", "CORRECTED_DIAGNOSIS" ] DIFFERENTIAL_DIAGNOSIS = [ "DIFFERENTIAL_DIAGNOSIS", ]
""" Constants --- Constants used in other scripts. These are mostly interpretations of fields provided in the Face2Gene jsons. """ hgvs_errordict_version = 0 aws_bucket_name = 'fdna-pedia-dump' cache_dir = '.cache' chromosomal_tests = ['CHROMOSOMAL_MICROARRAY', 'FISH', 'KARYOTYPE'] positive_results = ['ABNORMAL', 'ABNORMAL_DIAGNOSTIC', 'DELETION_DUPLICATION', 'VARIANTS_DETECTED'] negative_results = ['NORMALNORMAL_FEMALENORMAL_MALENO_SIGNIFICANT_VARIANTS'] hgvs_ops = {'SUBSTITUTION': '>', 'DELETION': 'del', 'DUPLICATION': 'dup', 'INSERTION': 'ins', 'INVERSION': 'inv', 'DELETION_INSERTION': 'delins', 'UNKNOWN': ''} hgvs_prefix = {'CDNA_LEVEL': 'c', 'PROTEIN_LEVEL': 'p', 'GENOMIC_DNA_LEVEL': 'g', 'UNKNOWN': '', 'RS_NUMBER': ''} illegal_hpo = ['HP:0000006'] confirmed_diagnosis = ['MOLECULARLY_DIAGNOSED', 'CLINICALLY_DIAGNOSED', 'CORRECTED_DIAGNOSIS'] differential_diagnosis = ['DIFFERENTIAL_DIAGNOSIS']
def f(x): return ((2*(x**4))+(3*(x**3))-(6*(x**2))+(5*x)-8) def reachEnd(previousm,currentm): if abs(previousm - currentm) <= 10**(-6): return True return False def printFormat(a,b,c,m,count): print("Step %s" %count) print("a=%.6f b=%.6f c=%.6f" %(a,b,c)) print("f(a)=%.6f f(b)=%.6f f(c)=%.6f" %(f(a),f(b),f(c))) print("m=%.6f f(m)=%.6f" %(m,f(m))) def main(a,b,c): if (not (a < b and c < b)) or (not(f(a) > f(c) and f(b) > f(c))): return False count = 0 previousm = b+1 while True: if (b - c) >= (c - a): m = (b+c)/2 if f(m) >= f(c): b = m else: a = c c = m else: m = (a+c)/2 if f(m) >= f(c): a = m else: b = c c = m printFormat(a,b,c,m,count) if reachEnd(previousm,m): print("Minimum value=%.6f occurring at %.6f" %(f(m),m)) break previousm = m count += 1 main(-3,-1,-2.2)
def f(x): return 2 * x ** 4 + 3 * x ** 3 - 6 * x ** 2 + 5 * x - 8 def reach_end(previousm, currentm): if abs(previousm - currentm) <= 10 ** (-6): return True return False def print_format(a, b, c, m, count): print('Step %s' % count) print('a=%.6f b=%.6f c=%.6f' % (a, b, c)) print('f(a)=%.6f f(b)=%.6f f(c)=%.6f' % (f(a), f(b), f(c))) print('m=%.6f f(m)=%.6f' % (m, f(m))) def main(a, b, c): if not (a < b and c < b) or not (f(a) > f(c) and f(b) > f(c)): return False count = 0 previousm = b + 1 while True: if b - c >= c - a: m = (b + c) / 2 if f(m) >= f(c): b = m else: a = c c = m else: m = (a + c) / 2 if f(m) >= f(c): a = m else: b = c c = m print_format(a, b, c, m, count) if reach_end(previousm, m): print('Minimum value=%.6f occurring at %.6f' % (f(m), m)) break previousm = m count += 1 main(-3, -1, -2.2)
class Solution: def spiralOrder(self, matrix: List[List[int]]) -> List[int]: result = [] rows, columns = len(matrix), len(matrix[0]) up = left = 0 right = columns-1 down = rows-1 while len(result) < rows*columns: for col in range(left, right+1): result.append(matrix[up][col]) for row in range(up+1, down+1): result.append(matrix[row][right]) if up != down: for col in range(right-1, left-1, -1): result.append(matrix[down][col]) if left != right: for row in range(down-1, up, -1): result.append(matrix[row][left]) up += 1 down -= 1 left += 1 right -= 1 return result
class Solution: def spiral_order(self, matrix: List[List[int]]) -> List[int]: result = [] (rows, columns) = (len(matrix), len(matrix[0])) up = left = 0 right = columns - 1 down = rows - 1 while len(result) < rows * columns: for col in range(left, right + 1): result.append(matrix[up][col]) for row in range(up + 1, down + 1): result.append(matrix[row][right]) if up != down: for col in range(right - 1, left - 1, -1): result.append(matrix[down][col]) if left != right: for row in range(down - 1, up, -1): result.append(matrix[row][left]) up += 1 down -= 1 left += 1 right -= 1 return result
class NoProxy: def get(self, _): return None def ban_proxy(self, proxies): return None class RateLimitProxy: def __init__(self, proxies, paths, default=None): self.proxies = proxies self.proxy_count = len(proxies) self.access_counter = { path: {"limit": paths[path], "count": 0} for path in paths.keys() } self.default = {"http": default, "https": default} def get(self, keyword_arguments): counter = self.access_counter.get(keyword_arguments["path"]) if counter is not None: proxy = self.proxies[ (counter["count"] // counter["limit"] - self.proxy_count) % self.proxy_count ] counter["count"] += 1 return {"http": proxy, "https": proxy} return self.default def ban_proxy(self, proxies): self.proxies = list(filter(lambda a: a not in [proxies.get("http", ''), proxies.get("https", '')], self.proxies)) return None
class Noproxy: def get(self, _): return None def ban_proxy(self, proxies): return None class Ratelimitproxy: def __init__(self, proxies, paths, default=None): self.proxies = proxies self.proxy_count = len(proxies) self.access_counter = {path: {'limit': paths[path], 'count': 0} for path in paths.keys()} self.default = {'http': default, 'https': default} def get(self, keyword_arguments): counter = self.access_counter.get(keyword_arguments['path']) if counter is not None: proxy = self.proxies[(counter['count'] // counter['limit'] - self.proxy_count) % self.proxy_count] counter['count'] += 1 return {'http': proxy, 'https': proxy} return self.default def ban_proxy(self, proxies): self.proxies = list(filter(lambda a: a not in [proxies.get('http', ''), proxies.get('https', '')], self.proxies)) return None
months_json = { "1": "January", "2": "February", "3": "March", "4": "April", "5": "May", "6": "June", "7": "July", "8": "August", "9": "September", "01": "January", "02": "February", "03": "March", "04": "April", "05": "May", "06": "June", "07": "July", "08": "August", "09": "September", "10": "October", "11": "November", "12": "December", } month_days = { "1": 31, "2": 28, "3": 31, "4": 30, "5": 31, "6": 30, "7": 31, "8": 31, "9": 30, "01": 31, "02": 28, "03": 31, "04": 30, "05": 31, "06": 30, "07": 31, "08": 31, "09": 30, "10": 31, "11": 30, "12": 31, }
months_json = {'1': 'January', '2': 'February', '3': 'March', '4': 'April', '5': 'May', '6': 'June', '7': 'July', '8': 'August', '9': 'September', '01': 'January', '02': 'February', '03': 'March', '04': 'April', '05': 'May', '06': 'June', '07': 'July', '08': 'August', '09': 'September', '10': 'October', '11': 'November', '12': 'December'} month_days = {'1': 31, '2': 28, '3': 31, '4': 30, '5': 31, '6': 30, '7': 31, '8': 31, '9': 30, '01': 31, '02': 28, '03': 31, '04': 30, '05': 31, '06': 30, '07': 31, '08': 31, '09': 30, '10': 31, '11': 30, '12': 31}
#coding: utf-8 ''' @Time: 2019/4/25 11:15 @Author: fangyoucai '''
""" @Time: 2019/4/25 11:15 @Author: fangyoucai """
__all__ = ['EncryptException', 'DecryptException', 'DefaultKeyNotSet', 'NoValidKeyFound'] class EncryptException(BaseException): pass class DecryptException(BaseException): pass class DefaultKeyNotSet(EncryptException): pass class NoValidKeyFound(DecryptException): pass
__all__ = ['EncryptException', 'DecryptException', 'DefaultKeyNotSet', 'NoValidKeyFound'] class Encryptexception(BaseException): pass class Decryptexception(BaseException): pass class Defaultkeynotset(EncryptException): pass class Novalidkeyfound(DecryptException): pass
SCRABBLE_LETTER_VALUES = { 'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j': 8, 'k': 5, 'l': 1, 'm': 3, 'n': 1, 'o': 1, 'p': 3, 'q': 10, 'r': 1, 's': 1, 't': 1, 'u': 1, 'v': 4, 'w': 4, 'x': 8, 'y': 4, 'z': 10 } # The first step is to implement some code that allows us to calculate the score # for a single word. The function getWordScore should accept as input a string # of lowercase letters (a word) and return the integer score for that word, # using the game's scoring rules. # A Reminder of the Scoring Rules # Hints You may assume that the input word is always either a string of # lowercase letters, or the empty string "". You will want to use the # SCRABBLE_LETTER_VALUES dictionary defined at the top of ps4a.py. You should # not change its value. Do not assume that there are always 7 letters in a hand! # The parameter n is the number of letters required for a bonus score (the # maximum number of letters in the hand). Our goal is to keep the code modular - # if you want to try playing your word game with n=10 or n=4, you will be able # to do it by simply changing the value of HAND_SIZE! Testing: If this function # is implemented properly, and you run test_ps4a.py, you should see that the # test_getWordScore() tests pass. Also test your implementation of getWordScore, # using some reasonable English words. Fill in the code for getWordScore in # ps4a.py and be sure you've passed the appropriate tests in test_ps4a.py before # pasting your function definition here. def getWordScore(word, n): """ Returns the score for a word. Assumes the word is a valid word. The score for a word is the sum of the points for letters in the word, multiplied by the length of the word, PLUS 50 points if all n letters are used on the first turn. Letters are scored as in Scrabble; A is worth 1, B is worth 3, C is worth 3, D is worth 2, E is worth 1, and so on (see SCRABBLE_LETTER_VALUES) word: string (lowercase letters) n: integer (HAND_SIZE; i.e., hand size required for additional points) returns: int >= 0 """ if len(word) == 0: return 0 # wordScore is the cumulative score for this word wordScore = 0 # lettersUsed is cumulative number of letters used in this word lettersUsed = 0 for theLetter in word: # For each letter, determine it's value wordScore += SCRABBLE_LETTER_VALUES[theLetter] lettersUsed += 1 # Multiply score so far by number of letters used wordScore *= lettersUsed # if all letters were used, then add 50 to score if lettersUsed == n: wordScore += 50 return wordScore
scrabble_letter_values = {'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j': 8, 'k': 5, 'l': 1, 'm': 3, 'n': 1, 'o': 1, 'p': 3, 'q': 10, 'r': 1, 's': 1, 't': 1, 'u': 1, 'v': 4, 'w': 4, 'x': 8, 'y': 4, 'z': 10} def get_word_score(word, n): """ Returns the score for a word. Assumes the word is a valid word. The score for a word is the sum of the points for letters in the word, multiplied by the length of the word, PLUS 50 points if all n letters are used on the first turn. Letters are scored as in Scrabble; A is worth 1, B is worth 3, C is worth 3, D is worth 2, E is worth 1, and so on (see SCRABBLE_LETTER_VALUES) word: string (lowercase letters) n: integer (HAND_SIZE; i.e., hand size required for additional points) returns: int >= 0 """ if len(word) == 0: return 0 word_score = 0 letters_used = 0 for the_letter in word: word_score += SCRABBLE_LETTER_VALUES[theLetter] letters_used += 1 word_score *= lettersUsed if lettersUsed == n: word_score += 50 return wordScore
# # @lc app=leetcode id=86 lang=python3 # # [86] Partition List # # https://leetcode.com/problems/partition-list/description/ # # algorithms # Medium (43.12%) # Likes: 1981 # Dislikes: 384 # Total Accepted: 256.4K # Total Submissions: 585.7K # Testcase Example: '[1,4,3,2,5,2]\n3' # # Given the head of a linked list and a value x, partition it such that all # nodes less than x come before nodes greater than or equal to x. # # You should preserve the original relative order of the nodes in each of the # two partitions. # # # Example 1: # # # Input: head = [1,4,3,2,5,2], x = 3 # Output: [1,2,2,4,3,5] # # # Example 2: # # # Input: head = [2,1], x = 2 # Output: [1,2] # # # # Constraints: # # # The number of nodes in the list is in the range [0, 200]. # -100 <= Node.val <= 100 # -200 <= x <= 200 # # # # @lc code=start # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def partition(self, head: ListNode, x: int) -> ListNode: if not head: return head smaller_dummy = ListNode(0) greater_dummy = ListNode(0) smaller = smaller_dummy greater = greater_dummy node = head while node: if node.val < x: smaller.next = node smaller = smaller.next else: greater.next = node greater = greater.next node = node.next greater.next = None smaller.next = greater_dummy.next return smaller_dummy.next # @lc code=end
class Solution: def partition(self, head: ListNode, x: int) -> ListNode: if not head: return head smaller_dummy = list_node(0) greater_dummy = list_node(0) smaller = smaller_dummy greater = greater_dummy node = head while node: if node.val < x: smaller.next = node smaller = smaller.next else: greater.next = node greater = greater.next node = node.next greater.next = None smaller.next = greater_dummy.next return smaller_dummy.next
with open("input.txt", "r") as input_file: input = input_file.read().split("\n") passwords = list(map(lambda line: [list(map(int, line.split(" ")[0].split("-"))), line.split(" ")[1][0], line.split(" ")[2]], input)) valid = 0 for password in passwords: count_letter = password[2].count(password[1]) if password[0][0] <= count_letter <= password[0][1]: valid += 1 print(valid)
with open('input.txt', 'r') as input_file: input = input_file.read().split('\n') passwords = list(map(lambda line: [list(map(int, line.split(' ')[0].split('-'))), line.split(' ')[1][0], line.split(' ')[2]], input)) valid = 0 for password in passwords: count_letter = password[2].count(password[1]) if password[0][0] <= count_letter <= password[0][1]: valid += 1 print(valid)
music = { 'kb': ''' Instrument(Flute) Piece(Undine, Reinecke) Piece(Carmen, Bourne) (Instrument(x) & Piece(w, c) & Era(c, r)) ==> Program(w) Era(Reinecke, Romantic) Era(Bourne, Romantic) ''', 'queries': ''' Program(x) ''', } life = { 'kb': ''' Musician(x) ==> Stressed(x) (Student(x) & Text(y)) ==> Stressed(x) Musician(Heather) ''', 'queries': ''' Stressed(x) ''' } Examples = { 'music': music, 'life': life }
music = {'kb': '\nInstrument(Flute)\nPiece(Undine, Reinecke)\nPiece(Carmen, Bourne)\n\n\n(Instrument(x) & Piece(w, c) & Era(c, r)) ==> Program(w)\nEra(Reinecke, Romantic)\nEra(Bourne, Romantic)\n\n\n ', 'queries': '\n Program(x)\n '} life = {'kb': '\nMusician(x) ==> Stressed(x)\n(Student(x) & Text(y)) ==> Stressed(x)\n\nMusician(Heather)\n ', 'queries': '\nStressed(x)\n '} examples = {'music': music, 'life': life}
"""3.3 Stack of Plates: Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the previous stack exceeds some threshold. Implement a data structure SetOfStacks that mimics this. SetOfStacks should be composed of several stacks and should create a new stack once the previous one exceeds capacity. SetOfStacks. push () and SetOfStacks. pop () should behave identically to a single stack (that is, pop ( ) should return the same values as it would if there were just a single stack). FOLLOW UP Implement a function popAt (int index) which performs a pop operation on a specific sub-stack. """ class SetOfStacks(): def __init__(self, max_stack_size: int, x=[]): self.core = [] self.max = max_stack_size for e in x: self.push(e) def __repr__(self): return repr(self.core) def pop_at(self, index: int): if not self.core: return if not index < len(self.core): return if not self.core[index]: return return self.core[index].pop() def pop(self): if not self.core: return while self.core and not self.core[-1]: self.core.pop() if self.core: return self.core[-1].pop() def push(self, value): if not self.core: self.core = [[value]]; return if len(self.core[-1]) == self.max: self.core.append([value]) else: self.core[-1].append(value) def peek(self): if self.core[n_stack]: return self.core[n_stack][-1] # test multi_stack = SetOfStacks(5, range(24)) # test push print(f'after push: stacks: {multi_stack}') # test pop_at for _ in range(6): print(f'after pop_at(2): {multi_stack.pop_at(2)}, stack: {multi_stack}') # test pop for i in range(20): multi_stack.pop() print(f'after pop: stacks: {multi_stack}')
"""3.3 Stack of Plates: Imagine a (literal) stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the previous stack exceeds some threshold. Implement a data structure SetOfStacks that mimics this. SetOfStacks should be composed of several stacks and should create a new stack once the previous one exceeds capacity. SetOfStacks. push () and SetOfStacks. pop () should behave identically to a single stack (that is, pop ( ) should return the same values as it would if there were just a single stack). FOLLOW UP Implement a function popAt (int index) which performs a pop operation on a specific sub-stack. """ class Setofstacks: def __init__(self, max_stack_size: int, x=[]): self.core = [] self.max = max_stack_size for e in x: self.push(e) def __repr__(self): return repr(self.core) def pop_at(self, index: int): if not self.core: return if not index < len(self.core): return if not self.core[index]: return return self.core[index].pop() def pop(self): if not self.core: return while self.core and (not self.core[-1]): self.core.pop() if self.core: return self.core[-1].pop() def push(self, value): if not self.core: self.core = [[value]] return if len(self.core[-1]) == self.max: self.core.append([value]) else: self.core[-1].append(value) def peek(self): if self.core[n_stack]: return self.core[n_stack][-1] multi_stack = set_of_stacks(5, range(24)) print(f'after push: stacks: {multi_stack}') for _ in range(6): print(f'after pop_at(2): {multi_stack.pop_at(2)}, stack: {multi_stack}') for i in range(20): multi_stack.pop() print(f'after pop: stacks: {multi_stack}')
myl1 = [] num = int(input("Enter the number of elements: ")) for loop in range(num): myl1.append(input(f"Enter element at index {loop} : ")) print(myl1) print(type(myl1)) myt1 = tuple(myl1) print(myt1) print(type(myt1)) print("The elements of tuple object are: ") for loop in myt1: print(loop)
myl1 = [] num = int(input('Enter the number of elements: ')) for loop in range(num): myl1.append(input(f'Enter element at index {loop} : ')) print(myl1) print(type(myl1)) myt1 = tuple(myl1) print(myt1) print(type(myt1)) print('The elements of tuple object are: ') for loop in myt1: print(loop)
# Scrapy settings for scraper project BOT_NAME = 'scraper' SPIDER_MODULES = ['scraper.spiders'] NEWSPIDER_MODULE = 'scraper.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent USER_AGENT = 'Googlebot-News' # Obey robots.txt rules ROBOTSTXT_OBEY = True # MONGO URI for accessing MongoDB MONGO_URI = "" MONGO_DATABASE = "" # sqlite database location SQLITE_DB = "" # pipelines are disabled by default ITEM_PIPELINES = { #'scraper.pipelines.SQLitePipeline': 300, #'scraper.pipelines.MongoPipeline': 600, }
bot_name = 'scraper' spider_modules = ['scraper.spiders'] newspider_module = 'scraper.spiders' user_agent = 'Googlebot-News' robotstxt_obey = True mongo_uri = '' mongo_database = '' sqlite_db = '' item_pipelines = {}
## Data Categorisation ''' 1) Whole Number (Ints) - 100, 1000, -450, 999 2) Real Numbers (Floats) - 33.33, 44.01, -1000.033 3) String - "Bangalore", "India", "Raj", "abc123" 4) Boolean - True, False Variables in python are dynamic in nature ''' a = 10 print(a) print(type(a)) a = 10.33 print(a) print(type(a)) a = 'New Jersey' print(a) print(type(a))
""" 1) Whole Number (Ints) - 100, 1000, -450, 999 2) Real Numbers (Floats) - 33.33, 44.01, -1000.033 3) String - "Bangalore", "India", "Raj", "abc123" 4) Boolean - True, False Variables in python are dynamic in nature """ a = 10 print(a) print(type(a)) a = 10.33 print(a) print(type(a)) a = 'New Jersey' print(a) print(type(a))
class RelationType(object): ONE_TO_MANY = "one_to_many" ONE_TO_ONE = "one_to_one" class Relation(object): def __init__(self, cls): self.cls = cls class HasOne(Relation): def get(self, id): return self.cls.get(id=id) class HasMany(Relation): def get(self, id): value = [] tokens = id.split(",") for token in tokens: value += (self.cls.get(id=token.strip())) return value
class Relationtype(object): one_to_many = 'one_to_many' one_to_one = 'one_to_one' class Relation(object): def __init__(self, cls): self.cls = cls class Hasone(Relation): def get(self, id): return self.cls.get(id=id) class Hasmany(Relation): def get(self, id): value = [] tokens = id.split(',') for token in tokens: value += self.cls.get(id=token.strip()) return value
""" Given an array of integers, find the subset of non-adjacent elements with the maximum sum. Calculate the sum of that subset. It is possible that the maximum sum is , the case when all elements are negative. """ def maxSubsetSum(arr): n = len(arr) # n = length of the array dp = [0]*n # create a dp array of length n & initialize its values to 0 dp[0] = arr[0] # base dp[1] = max(arr[1], dp[0]) for i in range(2,n): # Because of the condition. No two adjacent elements can be picked. # Therefore we can either take one and then skip one, or skip one and run the subroutine. dp[i] = max(arr[i], dp[i-1], arr[i] + dp[i-2]) # in the dp, we store the max sum for the subarray up till the length of the subarray. # Hence simply return the last item in this to get the answer return dp[-1]
""" Given an array of integers, find the subset of non-adjacent elements with the maximum sum. Calculate the sum of that subset. It is possible that the maximum sum is , the case when all elements are negative. """ def max_subset_sum(arr): n = len(arr) dp = [0] * n dp[0] = arr[0] dp[1] = max(arr[1], dp[0]) for i in range(2, n): dp[i] = max(arr[i], dp[i - 1], arr[i] + dp[i - 2]) return dp[-1]
description = 'Alphai alias device' group = 'lowlevel' devices = dict( alphai = device('nicos.devices.generic.DeviceAlias'), )
description = 'Alphai alias device' group = 'lowlevel' devices = dict(alphai=device('nicos.devices.generic.DeviceAlias'))
{ 'targets': [ { 'target_name': 'overlay_window', 'sources': [ 'src/lib/addon.c', 'src/lib/napi_helpers.c' ], 'include_dirs': [ 'src/lib' ], 'conditions': [ ['OS=="win"', { 'defines': [ 'WIN32_LEAN_AND_MEAN' ], 'link_settings': { 'libraries': [ 'oleacc.lib' ] }, 'sources': [ 'src/lib/windows.c', ] }], ['OS=="linux"', { 'defines': [ '_GNU_SOURCE' ], 'link_settings': { 'libraries': [ '-lxcb', '-lpthread' ] }, 'cflags': ['-std=c99', '-pedantic', '-Wall', '-pthread'], 'sources': [ 'src/lib/x11.c', ] }], ['OS=="mac"', { 'link_settings': { 'libraries': [ '-lpthread', '-framework AppKit', '-framework ApplicationServices' ] }, 'xcode_settings': { 'OTHER_CFLAGS': [ '-fobjc-arc' ] }, 'cflags': ['-std=c99', '-pedantic', '-Wall', '-pthread'], 'sources': [ 'src/lib/mac.mm', 'src/lib/mac/OWFullscreenObserver.mm' ] }] ] } ] }
{'targets': [{'target_name': 'overlay_window', 'sources': ['src/lib/addon.c', 'src/lib/napi_helpers.c'], 'include_dirs': ['src/lib'], 'conditions': [['OS=="win"', {'defines': ['WIN32_LEAN_AND_MEAN'], 'link_settings': {'libraries': ['oleacc.lib']}, 'sources': ['src/lib/windows.c']}], ['OS=="linux"', {'defines': ['_GNU_SOURCE'], 'link_settings': {'libraries': ['-lxcb', '-lpthread']}, 'cflags': ['-std=c99', '-pedantic', '-Wall', '-pthread'], 'sources': ['src/lib/x11.c']}], ['OS=="mac"', {'link_settings': {'libraries': ['-lpthread', '-framework AppKit', '-framework ApplicationServices']}, 'xcode_settings': {'OTHER_CFLAGS': ['-fobjc-arc']}, 'cflags': ['-std=c99', '-pedantic', '-Wall', '-pthread'], 'sources': ['src/lib/mac.mm', 'src/lib/mac/OWFullscreenObserver.mm']}]]}]}
# --------------------------------------------------------------------- # Gufo Labs Loader: # a plugin # --------------------------------------------------------------------- # Copyright (C) 2022, Gufo Labs # --------------------------------------------------------------------- class APlugin(object): name = "a" def get_name(self) -> str: return self.name
class Aplugin(object): name = 'a' def get_name(self) -> str: return self.name
# -*- coding: utf-8 -*- # ______________________________________________________________________________ def boolean_func(experiment): """Function that returns True when an experiment matches and False otherwise. Args: experiment (:class:`~skassist.Experiment`): Experiment that is to be tested. """ # ______________________________________________________________________________ def scoring_function(self, model, y_true, y_predicted_probability): """The scoring function takes a model, the true labels and the prediction and calculates one or more scores. These are returned in a dictionary which :func:`~skassist.Model.calc_results` uses to commit them to permanent storage. Args: scoring_function (:func:`function`): A python function for calculating the results given the true labels and the predictions. See :func:`~skassist.Model.scoring_function`. skf (:obj:`numpy.ndarray`): An array containing arrays of splits. E.g. an array with 10 arrays, each containing 3 splits for a 10-fold cross-validation with training, test and validation set. df (:obj:`pandas.DataFrame`): The DataFrame on which to evaluate the model. Must contain all feature, "extra" feature and target columns that the model requires. """
def boolean_func(experiment): """Function that returns True when an experiment matches and False otherwise. Args: experiment (:class:`~skassist.Experiment`): Experiment that is to be tested. """ def scoring_function(self, model, y_true, y_predicted_probability): """The scoring function takes a model, the true labels and the prediction and calculates one or more scores. These are returned in a dictionary which :func:`~skassist.Model.calc_results` uses to commit them to permanent storage. Args: scoring_function (:func:`function`): A python function for calculating the results given the true labels and the predictions. See :func:`~skassist.Model.scoring_function`. skf (:obj:`numpy.ndarray`): An array containing arrays of splits. E.g. an array with 10 arrays, each containing 3 splits for a 10-fold cross-validation with training, test and validation set. df (:obj:`pandas.DataFrame`): The DataFrame on which to evaluate the model. Must contain all feature, "extra" feature and target columns that the model requires. """
class InvalidProxyType(Exception): pass class ApiConnectionError(Exception): pass class ApplicationNotFound(Exception): pass class SqlmapFailedStart(Exception): pass class SpiderTestFailure(Exception): pass class InvalidInputProvided(Exception): pass class InvalidTamperProvided(Exception): pass class PortScanTimeOutException(Exception): pass
class Invalidproxytype(Exception): pass class Apiconnectionerror(Exception): pass class Applicationnotfound(Exception): pass class Sqlmapfailedstart(Exception): pass class Spidertestfailure(Exception): pass class Invalidinputprovided(Exception): pass class Invalidtamperprovided(Exception): pass class Portscantimeoutexception(Exception): pass
class CreatePickupResponse: def __init__(self, res): """ Initialize new instance from CreatePickupResponse class Parameters: res (dict, str): JSON response object or response text message Returns: instance from CreatePickupResponse """ self.fromResponseObj(res) def fromResponseObj(self, res): """ Extract _id, puid, business, businessLocationId, scheduledDate, scheduledTimeSlot, contactPerson, createdAt and updatedAt fields from json response object Parameters: res (dict, str): JSON response object or response text message """ if type(res) is dict and res.get('data') is not None: self.message = res.get("message") newPickup = res["data"] self._id = newPickup["_id"] self.puid = newPickup["puid"] self.business = newPickup["business"] self.businessLocationId = newPickup["businessLocationId"] self.scheduledDate = newPickup["scheduledDate"] self.scheduledTimeSlot = newPickup["scheduledTimeSlot"] self.contactPerson = newPickup["contactPerson"] self.createdAt = newPickup["createdAt"] self.updatedAt = newPickup["updatedAt"] else: self.message = str(res) def __str__(self): return self.message def get_pickupId(self): return self._id def get_message(self): return self.message
class Createpickupresponse: def __init__(self, res): """ Initialize new instance from CreatePickupResponse class Parameters: res (dict, str): JSON response object or response text message Returns: instance from CreatePickupResponse """ self.fromResponseObj(res) def from_response_obj(self, res): """ Extract _id, puid, business, businessLocationId, scheduledDate, scheduledTimeSlot, contactPerson, createdAt and updatedAt fields from json response object Parameters: res (dict, str): JSON response object or response text message """ if type(res) is dict and res.get('data') is not None: self.message = res.get('message') new_pickup = res['data'] self._id = newPickup['_id'] self.puid = newPickup['puid'] self.business = newPickup['business'] self.businessLocationId = newPickup['businessLocationId'] self.scheduledDate = newPickup['scheduledDate'] self.scheduledTimeSlot = newPickup['scheduledTimeSlot'] self.contactPerson = newPickup['contactPerson'] self.createdAt = newPickup['createdAt'] self.updatedAt = newPickup['updatedAt'] else: self.message = str(res) def __str__(self): return self.message def get_pickup_id(self): return self._id def get_message(self): return self.message
test = { 'name': 'q1_3', 'points': 1, 'suites': [ { 'cases': [ {'code': '>>> type(max_estimate) in set([int, np.int32, np.int64])\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> max_estimate in observations.column(0)\nTrue', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
test = {'name': 'q1_3', 'points': 1, 'suites': [{'cases': [{'code': '>>> type(max_estimate) in set([int, np.int32, np.int64])\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> max_estimate in observations.column(0)\nTrue', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
TYPES = {"int","float","str","bool","list"} MATCH_TYPES = {"int": int, "float": float, "str": str, "bool": bool, "list": list} CONSTRAINTS = { "is_same_type": lambda x, y: type(x) == type(y), "int" :{ "min_inc": lambda integer, min: integer >= min, "min_exc": lambda integer, min: integer > min, "max_inc": lambda integer, max: integer >= max, "max_exc": lambda integer, max: integer > max, "value_in": lambda integer, value_in: integer in value_in, "value_out": lambda integer, value_out: not integer in value_out }, "float": { "min_inc": lambda integer, min: integer >= min, "min_exc": lambda integer, min: integer > min, "max_inc": lambda integer, max: integer >= max, "max_exc": lambda integer, max: integer > max, "value_in": lambda float_, value_in: float_ in value_in, "value_out": lambda float_, value_out: not float_ in value_out }, "str": { "value_in": lambda string, value_in: string in value_in, "value_out": lambda string, value_out: not string in value_out }, "list": { "equal_len": lambda list_, len_: len(list_) == len_, "min_len" : lambda list_, min_len: len(list_) >= min_len, "min_inc": lambda list_, min: all(x >= min for x in list_), "min_exc": lambda list_, min: all(x > min for x in list_), "max_inc": lambda list_, max: all(x <= max for x in list_), "max_exc": lambda list_, max: all(x > max for x in list_) } } CONSTRAINT_CHECKS = { "int" :{ "min_inc": lambda min: type(min) in [int, float], "min_exc": lambda min: type(min) in [int, float], "max_inc": lambda max: type(max) in [int, float], "max_exc": lambda max: type(max) in [int, float], "value_in": lambda value_in: all([type(value) == int for value in value_in]), "value_out": lambda value_out: all([type(value) == int for value in value_out]) }, "float": { "min_inc": lambda min: type(min) in [int, float], "min_exc": lambda min: type(min) in [int, float], "max_inc": lambda max: type(max) in [int, float], "max_exc": lambda max: type(max) in [int, float], "value_in": lambda value_in: all([type(value) in [int,float] for value in value_in]), "value_out": lambda value_out: all([type(value) in [int,float] for value in value_out]) }, "str": { "value_in": lambda value_in: all([type(value) == str for value in value_in]), "value_out": lambda value_out: all([type(value) == str for value in value_out]) }, "list": { "equal_len": lambda len_: type(len_) == int and len_ > 0, "min_len" : lambda min: type(min) == int and min >= 0, "min_inc": lambda min: type(min) in [int,float], "min_exc": lambda min: type(min) in [int,float], "max_inc": lambda max: type(max) in [int,float], "max_exc": lambda max: type(max) in [int,float], } }
types = {'int', 'float', 'str', 'bool', 'list'} match_types = {'int': int, 'float': float, 'str': str, 'bool': bool, 'list': list} constraints = {'is_same_type': lambda x, y: type(x) == type(y), 'int': {'min_inc': lambda integer, min: integer >= min, 'min_exc': lambda integer, min: integer > min, 'max_inc': lambda integer, max: integer >= max, 'max_exc': lambda integer, max: integer > max, 'value_in': lambda integer, value_in: integer in value_in, 'value_out': lambda integer, value_out: not integer in value_out}, 'float': {'min_inc': lambda integer, min: integer >= min, 'min_exc': lambda integer, min: integer > min, 'max_inc': lambda integer, max: integer >= max, 'max_exc': lambda integer, max: integer > max, 'value_in': lambda float_, value_in: float_ in value_in, 'value_out': lambda float_, value_out: not float_ in value_out}, 'str': {'value_in': lambda string, value_in: string in value_in, 'value_out': lambda string, value_out: not string in value_out}, 'list': {'equal_len': lambda list_, len_: len(list_) == len_, 'min_len': lambda list_, min_len: len(list_) >= min_len, 'min_inc': lambda list_, min: all((x >= min for x in list_)), 'min_exc': lambda list_, min: all((x > min for x in list_)), 'max_inc': lambda list_, max: all((x <= max for x in list_)), 'max_exc': lambda list_, max: all((x > max for x in list_))}} constraint_checks = {'int': {'min_inc': lambda min: type(min) in [int, float], 'min_exc': lambda min: type(min) in [int, float], 'max_inc': lambda max: type(max) in [int, float], 'max_exc': lambda max: type(max) in [int, float], 'value_in': lambda value_in: all([type(value) == int for value in value_in]), 'value_out': lambda value_out: all([type(value) == int for value in value_out])}, 'float': {'min_inc': lambda min: type(min) in [int, float], 'min_exc': lambda min: type(min) in [int, float], 'max_inc': lambda max: type(max) in [int, float], 'max_exc': lambda max: type(max) in [int, float], 'value_in': lambda value_in: all([type(value) in [int, float] for value in value_in]), 'value_out': lambda value_out: all([type(value) in [int, float] for value in value_out])}, 'str': {'value_in': lambda value_in: all([type(value) == str for value in value_in]), 'value_out': lambda value_out: all([type(value) == str for value in value_out])}, 'list': {'equal_len': lambda len_: type(len_) == int and len_ > 0, 'min_len': lambda min: type(min) == int and min >= 0, 'min_inc': lambda min: type(min) in [int, float], 'min_exc': lambda min: type(min) in [int, float], 'max_inc': lambda max: type(max) in [int, float], 'max_exc': lambda max: type(max) in [int, float]}}
def main(): video = "NET20070330_thlep_1_2" file_path = "optical_flow_features_train/" + video optical_flow_features_train = open(file_path + "/optical_flow_features_train.txt", "r") clear_of_features_train = open(file_path + "/clear_opt_flow_features_train.txt", "w") visual_ids = [] for line in optical_flow_features_train: words = line.rstrip().split(' ') if len(words) == 2: if not int(words[1]) in visual_ids: visual_ids.append(int(words[1])) print("visual_ids", visual_ids) optical_flow_features_train.close() optical_flow_features_train = open(file_path + "/optical_flow_features_train.txt", "r") for line in optical_flow_features_train: words = line.rstrip().split(' ') if len(words) == 2: frame = int(words[0]) speaker_id = int(words[1]) else: # every id that each speaker gets during the video if speaker_id == 0 or speaker_id == 6 or speaker_id == 13 or speaker_id == 15 or speaker_id == 5 or speaker_id == 16 or speaker_id == 4 or speaker_id == 17 or speaker_id == 3 or speaker_id == 18: clear_of_features_train.write(str(frame) + ' ' + str(speaker_id) + '\n') for features in words: clear_of_features_train.write(str(features) + ' ') clear_of_features_train.write('\n') optical_flow_features_train.close() clear_of_features_train.close() if __name__ == "__main__": main()
def main(): video = 'NET20070330_thlep_1_2' file_path = 'optical_flow_features_train/' + video optical_flow_features_train = open(file_path + '/optical_flow_features_train.txt', 'r') clear_of_features_train = open(file_path + '/clear_opt_flow_features_train.txt', 'w') visual_ids = [] for line in optical_flow_features_train: words = line.rstrip().split(' ') if len(words) == 2: if not int(words[1]) in visual_ids: visual_ids.append(int(words[1])) print('visual_ids', visual_ids) optical_flow_features_train.close() optical_flow_features_train = open(file_path + '/optical_flow_features_train.txt', 'r') for line in optical_flow_features_train: words = line.rstrip().split(' ') if len(words) == 2: frame = int(words[0]) speaker_id = int(words[1]) elif speaker_id == 0 or speaker_id == 6 or speaker_id == 13 or (speaker_id == 15) or (speaker_id == 5) or (speaker_id == 16) or (speaker_id == 4) or (speaker_id == 17) or (speaker_id == 3) or (speaker_id == 18): clear_of_features_train.write(str(frame) + ' ' + str(speaker_id) + '\n') for features in words: clear_of_features_train.write(str(features) + ' ') clear_of_features_train.write('\n') optical_flow_features_train.close() clear_of_features_train.close() if __name__ == '__main__': main()
prize_file_1 = open("/Users/MatBook/Downloads/prize3.txt") List = [] prizes = [] for line in prize_file_1: List.append(int(line)) first_line = List.pop(0) for i in List: print(i) for j in List: if i + j == first_line: prizes.append((i,j)) print (List) print( "you can have:", prizes)
prize_file_1 = open('/Users/MatBook/Downloads/prize3.txt') list = [] prizes = [] for line in prize_file_1: List.append(int(line)) first_line = List.pop(0) for i in List: print(i) for j in List: if i + j == first_line: prizes.append((i, j)) print(List) print('you can have:', prizes)
#!/usr/bin/env python # -*- coding: utf-8 -*- template = """/* * * search_dipus * * ~~~~~~~~~~~~~~ * * * * Dipus JavaScript utilties for the full-text search. * * This files is based on searchtools.js of Sphinx. * * * * :copyright: Copyright 2007-2012 by the Sphinx team. * * :license: BSD, see LICENSE for details. * * * */ /** * * helper function to return a node containing the * * search summary for a given text. keywords is a list * * of stemmed words, hlwords is the list of normal, unstemmed * * words. the first one is used to find the occurance, the * * latter for highlighting it. * */ jQuery.makeSearchSummary = function(text, keywords, hlwords) {{ var textLower = text.toLowerCase(); var start = 0; $.each(keywords, function() {{ var i = textLower.indexOf(this.toLowerCase()); if (i > -1) start = i; }}); start = Math.max(start - 120, 0); var excerpt = ((start > 0) ? '...' : '') + $.trim(text.substr(start, 240)) + ((start + 240 - text.length) ? '...' : ''); var rv = $('<div class="context"></div>').text(excerpt); $.each(hlwords, function() {{ rv = rv.highlightText(this, 'highlighted'); }}); return rv; }}; /** * Search Module */ var Search = {{ _dipus_url: "{dipus_url}", _index: null, _pulse_status : -1, init : function (){{ var params = $.getQueryParameters(); if (params.q) {{ var query = params.q[0]; $('input[name="q"]')[0].value = query; this.performSearch(query); }} }}, stopPulse : function() {{ this._pulse_status = 0; }}, startPulse : function() {{ if (this._pulse_status >= 0) return; function pulse() {{ Search._pulse_status = (Search._pulse_status + 1) % 4; var dotString = ''; for (var i = 0; i < Search._pulse_status; i++) dotString += '.'; Search.dots.text(dotString); if (Search._pulse_status > -1) window.setTimeout(pulse, 500); }}; pulse(); }}, /** * perform a search for something */ performSearch : function(query) {{ // create the required interface elements this.out = $('#search-results'); this.title = $('<h2>' + _('Searching') + '</h2>').appendTo(this.out); this.dots = $('<span></span>').appendTo(this.title); this.status = $('<p style="display: none"></p>').appendTo(this.out); this.output = $('<ul class="search"/>').appendTo(this.out); $('#search-progress').text(_('Preparing search...')); this.startPulse(); this.query(query); }}, query : function(query) {{ var hlterms = []; var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" ")); $('#search-progress').empty(); var url = this._dipus_url + "?q=" + $.urlencode(query); $.ajax({{ url: url, dataType: 'jsonp', success: function(json){{ for(var i = 0; i < json.hits.length; i++){{ var hit = json.hits[i]; var listItem = $('<li style="display:none"></li>'); var msgbody = hit._source.message; if (DOCUMENTATION_OPTIONS.FILE_SUFFIX == '') {{ // dirhtml builder var dirname = hit._source.path; if (dirname.match(/\/index\/$/)) {{ dirname = dirname.substring(0, dirname.length-6); }} else if (dirname == 'index/') {{ dirname = ''; }} listItem.append($('<a/>').attr('href', DOCUMENTATION_OPTIONS.URL_ROOT + dirname + highlightstring + query).html(hit._source.title)); }} else {{ // normal html builders listItem.append($('<a/>').attr('href', hit._source.path + DOCUMENTATION_OPTIONS.FILE_SUFFIX + highlightstring + query).html(hit._source.title)); }} if (msgbody) {{ listItem.append($.makeSearchSummary(msgbody, Array(query), Array(query))); Search.output.append(listItem); listItem.slideDown(5); }} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {{ $.get(DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + hit._source.path + '.txt', function(data) {{ if (data != '') {{ listItem.append($.makeSearchSummary(data, Array(query), hlterms)); Search.output.append(listItem); }} listItem.slideDown(5); }}); }} else {{ // no source available, just display title Search.output.append(listItem); listItem.slideDown(5); }} }}; Search.stopPulse(); Search.title.text(_('Search Results')); if (json.hits.length === 0){{ Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\\'ve selected enough categories.')); }}else{{ Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', json.hits.length)); }} Search.status.fadeIn(500); }}, error: function(XMLHttpRequest, textStatus, errorThrown) {{ console.log(textStatus, errorThrown); }} }}); }} }}; $(document).ready(function() {{ Search.init(); }}); """
template = '/*\n * * search_dipus\n * * ~~~~~~~~~~~~~~\n * *\n * * Dipus JavaScript utilties for the full-text search.\n * * This files is based on searchtools.js of Sphinx.\n * *\n * * :copyright: Copyright 2007-2012 by the Sphinx team.\n * * :license: BSD, see LICENSE for details.\n * *\n * */\n\n\n/**\n * * helper function to return a node containing the\n * * search summary for a given text. keywords is a list\n * * of stemmed words, hlwords is the list of normal, unstemmed\n * * words. the first one is used to find the occurance, the\n * * latter for highlighting it.\n * */\n\njQuery.makeSearchSummary = function(text, keywords, hlwords) {{\n var textLower = text.toLowerCase();\n var start = 0;\n $.each(keywords, function() {{\n var i = textLower.indexOf(this.toLowerCase());\n if (i > -1)\n start = i;\n }});\n start = Math.max(start - 120, 0);\n var excerpt = ((start > 0) ? \'...\' : \'\') +\n $.trim(text.substr(start, 240)) +\n ((start + 240 - text.length) ? \'...\' : \'\');\n var rv = $(\'<div class="context"></div>\').text(excerpt);\n $.each(hlwords, function() {{\n rv = rv.highlightText(this, \'highlighted\');\n }});\n return rv;\n}};\n\n/**\n * Search Module\n */\nvar Search = {{\n _dipus_url: "{dipus_url}",\n _index: null,\n _pulse_status : -1,\n\n init : function (){{\n var params = $.getQueryParameters();\n if (params.q) {{\n var query = params.q[0];\n $(\'input[name="q"]\')[0].value = query;\n this.performSearch(query);\n }}\n }},\n stopPulse : function() {{\n this._pulse_status = 0;\n }},\n\n startPulse : function() {{\n if (this._pulse_status >= 0)\n return;\n function pulse() {{\n Search._pulse_status = (Search._pulse_status + 1) % 4;\n var dotString = \'\';\n for (var i = 0; i < Search._pulse_status; i++)\n dotString += \'.\';\n Search.dots.text(dotString);\n if (Search._pulse_status > -1)\n window.setTimeout(pulse, 500);\n }};\n pulse();\n }},\n\n /**\n * perform a search for something\n */\n performSearch : function(query) {{\n // create the required interface elements\n this.out = $(\'#search-results\');\n this.title = $(\'<h2>\' + _(\'Searching\') + \'</h2>\').appendTo(this.out);\n this.dots = $(\'<span></span>\').appendTo(this.title);\n this.status = $(\'<p style="display: none"></p>\').appendTo(this.out);\n this.output = $(\'<ul class="search"/>\').appendTo(this.out);\n\n $(\'#search-progress\').text(_(\'Preparing search...\'));\n this.startPulse();\n\n this.query(query);\n }},\n\n query : function(query) {{\n var hlterms = [];\n var highlightstring = \'?highlight=\' + $.urlencode(hlterms.join(" "));\n\n $(\'#search-progress\').empty();\n\n var url = this._dipus_url + "?q=" + $.urlencode(query);\n $.ajax({{\n url: url,\n dataType: \'jsonp\',\n success: function(json){{\n for(var i = 0; i < json.hits.length; i++){{\n var hit = json.hits[i];\n var listItem = $(\'<li style="display:none"></li>\');\n var msgbody = hit._source.message;\n if (DOCUMENTATION_OPTIONS.FILE_SUFFIX == \'\') {{\n // dirhtml builder\n var dirname = hit._source.path;\n if (dirname.match(/\\/index\\/$/)) {{\n dirname = dirname.substring(0, dirname.length-6);\n }} else if (dirname == \'index/\') {{\n dirname = \'\';\n }}\n listItem.append($(\'<a/>\').attr(\'href\',\n DOCUMENTATION_OPTIONS.URL_ROOT + dirname +\n highlightstring + query).html(hit._source.title));\n }} else {{\n // normal html builders\n listItem.append($(\'<a/>\').attr(\'href\',\n hit._source.path + DOCUMENTATION_OPTIONS.FILE_SUFFIX +\n highlightstring + query).html(hit._source.title));\n }}\n if (msgbody) {{\n listItem.append($.makeSearchSummary(msgbody, Array(query), Array(query)));\n Search.output.append(listItem);\n listItem.slideDown(5);\n }} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {{\n $.get(DOCUMENTATION_OPTIONS.URL_ROOT + \'_sources/\' +\n hit._source.path + \'.txt\', function(data) {{\n if (data != \'\') {{\n listItem.append($.makeSearchSummary(data, Array(query), hlterms));\n Search.output.append(listItem);\n }}\n listItem.slideDown(5);\n }});\n }} else {{\n // no source available, just display title\n Search.output.append(listItem);\n listItem.slideDown(5);\n }}\n }};\n Search.stopPulse();\n Search.title.text(_(\'Search Results\'));\n if (json.hits.length === 0){{\n Search.status.text(_(\'Your search did not match any documents. Please make sure that all words are spelled correctly and that you\\\'ve selected enough categories.\'));\n }}else{{\n Search.status.text(_(\'Search finished, found %s page(s) matching the search query.\').replace(\'%s\', json.hits.length));\n }}\n Search.status.fadeIn(500);\n }},\n error: function(XMLHttpRequest, textStatus, errorThrown) {{\n console.log(textStatus, errorThrown);\n }}\n }});\n }}\n}};\n\n$(document).ready(function() {{\n Search.init();\n}});\n'
def classfinder(k): res=1 while res*(res+1)//2<k: res+=1 return res # cook your dish here for t in range(int(input())): #n=int(input()) n,k=map(int,input().split()) clas=classfinder(k) i=k-clas*(clas-1)//2 str="" for z in range(n): if z==n-clas-1 or z==n-i: str+="b" else: str+="a" print(str)
def classfinder(k): res = 1 while res * (res + 1) // 2 < k: res += 1 return res for t in range(int(input())): (n, k) = map(int, input().split()) clas = classfinder(k) i = k - clas * (clas - 1) // 2 str = '' for z in range(n): if z == n - clas - 1 or z == n - i: str += 'b' else: str += 'a' print(str)
class Config: conf = { "labels": { "pageTitle": "Weatherman V0.0.1" }, "db.database": "weatherman", "db.username": "postgres", "db.password": "postgres", "navigation": [ { "url": "/", "name": "Home" }, { "url": "/cakes", "name": "Cakes" }, { "url": "/mqtt", "name": "MQTT" } ] } def get_config(self): return self.conf def get(self, key): return self.conf[key]
class Config: conf = {'labels': {'pageTitle': 'Weatherman V0.0.1'}, 'db.database': 'weatherman', 'db.username': 'postgres', 'db.password': 'postgres', 'navigation': [{'url': '/', 'name': 'Home'}, {'url': '/cakes', 'name': 'Cakes'}, {'url': '/mqtt', 'name': 'MQTT'}]} def get_config(self): return self.conf def get(self, key): return self.conf[key]
#!/usr/bin/python # -*- coding: UTF-8 -*- """ @author:MT @file:__init__.py.py @time:2021/8/21 23:02 """
""" @author:MT @file:__init__.py.py @time:2021/8/21 23:02 """
def is_leap(year): leap = False if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: leap = True else: leap = False else: leap = True return leap year = int(input()) print(is_leap(year)) ''' In the Gregorian calendar, three conditions are used to identify leap years: The year can be evenly divided by 4, is a leap year, unless: The year can be evenly divided by 100, it is NOT a leap year, unless: The year is also evenly divisible by 400. Then it is a leap year. '''
def is_leap(year): leap = False if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: leap = True else: leap = False else: leap = True return leap year = int(input()) print(is_leap(year)) '\nIn the Gregorian calendar, three conditions are used to identify leap years:\n\n The year can be evenly divided by 4, is a leap year, unless:\n The year can be evenly divided by 100, it is NOT a leap year, unless:\n The year is also evenly divisible by 400. Then it is a leap year.\n\n'
"""HackerEarth docs constants""" DOC_URL_DICT = { # 'doc_name': 'doc_url1', # 'doc_name': 'doc_url2', }
"""HackerEarth docs constants""" doc_url_dict = {}
class Solution(object): def maxSubArray1(self, nums): """ :type nums: List[int] :rtype: int """ this = maxsum = 0 for i in range(len(nums)): this += nums[i] if this > maxsum: maxsum = this elif this < 0: this = 0 return maxsum if maxsum != 0 else max(nums) def maxSubArray(self, nums): """ http://alfred-sun.github.io/blog/2015/03/11/ten-basic-algorithms-for-programmers/ :type nums: List[int] :rtype: int """ start = maxsum = nums[0] for num in nums[1:]: start = max(num, start + num) maxsum = max(maxsum, start) return maxsum
class Solution(object): def max_sub_array1(self, nums): """ :type nums: List[int] :rtype: int """ this = maxsum = 0 for i in range(len(nums)): this += nums[i] if this > maxsum: maxsum = this elif this < 0: this = 0 return maxsum if maxsum != 0 else max(nums) def max_sub_array(self, nums): """ http://alfred-sun.github.io/blog/2015/03/11/ten-basic-algorithms-for-programmers/ :type nums: List[int] :rtype: int """ start = maxsum = nums[0] for num in nums[1:]: start = max(num, start + num) maxsum = max(maxsum, start) return maxsum
""" EVEN IN RANGE: Use range() to print all the even numbers from 0 to 10. """ for number in range(11): if number % 2 == 0: if number == 0: continue print(number)
""" EVEN IN RANGE: Use range() to print all the even numbers from 0 to 10. """ for number in range(11): if number % 2 == 0: if number == 0: continue print(number)
# -*- coding: utf-8 -*- class DummyTile: def __init__(self, pos, label=None): self.pos = pos # Label tells adjacent mine count for this tile. Int between 0...8 or None if unknown self.label = label self.checked = False self.marked = False self.adj_mines = None self.adj_tiles = 0 self.adj_checked = 0 self.adj_unchecked = None def set_label(self, label): self.label = label self.checked = True def set_adj_mines(self, count): self.adj_mines = count self.checked = True def set_adj_tiles(self, count): self.adj_tiles = count def set_adj_checked(self, count): self.adj_checked = count def add_adj_checked(self): self.adj_checked = self.adj_checked + 1 def set_adj_unchecked(self, count): self.adj_unchecked = count def mark(self): self.marked = True
class Dummytile: def __init__(self, pos, label=None): self.pos = pos self.label = label self.checked = False self.marked = False self.adj_mines = None self.adj_tiles = 0 self.adj_checked = 0 self.adj_unchecked = None def set_label(self, label): self.label = label self.checked = True def set_adj_mines(self, count): self.adj_mines = count self.checked = True def set_adj_tiles(self, count): self.adj_tiles = count def set_adj_checked(self, count): self.adj_checked = count def add_adj_checked(self): self.adj_checked = self.adj_checked + 1 def set_adj_unchecked(self, count): self.adj_unchecked = count def mark(self): self.marked = True
##Write code to switch the order of the winners list so that it is now Z to A. Assign this list to the variable z_winners. winners = ['Alice Munro', 'Alvin E. Roth', 'Kazuo Ishiguro', 'Malala Yousafzai', 'Rainer Weiss', 'Youyou Tu'] z_winners = winners z_winners.reverse() print(z_winners)
winners = ['Alice Munro', 'Alvin E. Roth', 'Kazuo Ishiguro', 'Malala Yousafzai', 'Rainer Weiss', 'Youyou Tu'] z_winners = winners z_winners.reverse() print(z_winners)