content stringlengths 7 1.05M |
|---|
expected_output = {
"client_count": 85,
"client_notification_tmr_msec": 240000,
"communications": "Up",
"manual_swact": "enabled",
"mode": "Duplex",
"my_state": "13 -ACTIVE",
"peer_state": "8 -STANDBY HOT",
"redundancy_mode_configured": "Stateful Switchover",
"redundancy_mode_operational": "Stateful S... |
# Handling outliers which can cause issues when working with transformed time series data
def replace_outliers(series):
# Calculate the absolute difference of each timepoint from the series mean
absolute_differences_from_mean = np.abs(series - np.mean(series))
# Calculate a mask for the differences th... |
"""
AOV information is encoded and decoded by 3rdParty renderers. These renderers
register AOV callbacks by deriving from or implementing an interface identical
to the AOVCallbacks interface located in the rendererCallbacks module. This
class is then registered by calling:
rendererCallbacks.registerCallbacks(rendererN... |
class MetaConstants(object):
NUM_BUCKETS = "num_buckets"
NUM_SCOPES_PER_BUCKET = "num_scopes_per_bucket"
NUM_COLLECTIONS_PER_SCOPE = "num_collections_per_scope"
NUM_ITEMS_PER_COLLECTION = "num_items"
REMOVE_DEFAULT_COLLECTION = "remove_default_collection"
CREATE_COLLECTIONS_USING_MANIFEST_IMPORT... |
'''
constraints
'''
class DensityConstraint(object):
def __init__(self, volume_frac, density_min = 0, density_max = 1.0):
self.volfrac = volume_frac
self.xmin = density_min
self.xmax = density_max
def volume_frac(self):
return self.volfrac
def density_min(self):
re... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
'''
# Recursion
class Solution:
def preorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
... |
#!/usr/bin/python
#
# core Nagios classes.
#
class Nagios:
'''This class represents the current state of a Nagios installation, as read
from the status file that Nagios maintains.
'''
def __init__(self, statusfile=None):
'''Create a new Nagios state store. One argument, statusfile, is used to... |
def leia_matriz():
'''Retorna uma matriz inserida pelo usuário'''
n_linha = int(input("Entre com o número de linhas da matriz: "))
n_coluna = int(input("Entre com o número de colunas da matriz: "))
matriz = []
for i in range(n_linha):
linha = []
for j in range(n_coluna):
... |
# Read from a file one line at a time.
# amwhaley@cisco.com
# twitter: @mandywhaley
# http://developer.cisco.com
# http://developer.cisco.com/learning
# Jan 15, 2015
# * THIS SAMPLE APPLICATION AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
# * OF ANY KIND BY CISCO, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT... |
the_count = [1,2,3,4,5]
fruits = ['apples','oranges','pears','appricots']
change = [1,'pennies', 2,'dimes',3,'quarters']
#this first kind of for loops goes through a list
for number in the_count :
print ("This is count %d"%number)
# same as above
for fruit in fruits :
print ("A fruit of type : %s"%fru... |
##############################################################################
# The MIT License (MIT)
#
# Copyright (c) 2016-2019 Hajime Nakagami<nakagami@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), ... |
"""
YIELEGRAM
Функции-помощники, сочетающиеся с python-telegram-bot но и не мешающие ему (такое возможно?)
Или обёртка над ботом (на каком уровне лучше внедрить?)
Состав:
- Главный обработчик, навешивающийся на все типы сообщений,
которые будут получены от пользователя в ходе диалога. Текст, медиа, контакты, ... |
"""Config for autoscale.py
author: cuongnb14@gmail.com
"""
INFLUXDB = {
"host": "localhost",
"port" : "8086",
"username" : "root",
"password" : "root",
"db_name" : "cadvisor",
"ts_mapping" : "mapping"
}
MARATHON = {
"host" : "localhost",
"port" : "8080"
}
TIME = {
"w_config_ha" : 10,
"... |
def ausgabe(liste, ende="\n", erstezeile=""):
print(erstezeile)
for element in liste:
print(element, end=ende)
def ausgabe2(liste, **kwargs):
ende = "\n" if "ende" not in kwargs else kwargs["ende"]
erstezeile = "" if "erstezeile" not in kwargs else kwargs["erstezeile"]
print(ers... |
#!/usr/bin/env python
def hello_world():
return 'Hello World!'
|
# -*- coding: utf-8 -*-
__author__ = 'Justin Bayer, bayer.justin@googlemail.com'
__version__ = '$Id$'
""""This module is a place to hold functionality that _has_ to be outside of a
test module but is required by it."""
|
dias = int(input('Por quantos dias você alugou o carro: '))
preco = float(dias*60)
km = int(input('Quantos quilômetros você percorreu: '))
preco += km*0.15
print('Você deve pagar R$ {:.2f} pelo alugel do carro'.format(preco))
|
def get_modification():
mod_dict = dict() # {mod_name: elements}
mod_dict['2-dimethylsuccinyl[C]'] = 'C NORMAL 144.042259 144.042259 0 H(8)C(6)O(4)'
mod_dict['2-monomethylsuccinyl[C]'] = 'C NORMAL 130.026609 130.026609 0 H(6)C(5)O(4)'
mod_dict['2-nitrobenzyl[Y]'] = 'Y NORMAL 135.032028 135.032028 0 H(... |
#
# @lc app=leetcode id=1108 lang=python3
#
# [1108] Defanging an IP Address
#
# @lc code=start
class Solution:
def defangIPaddr(self, address: str) -> str:
return ''.join('[.]' if c == '.' else c for c in address)
# @lc code=end
|
#
# PySNMP MIB module VERILINK-ENTERPRISE-NCMIDCSU-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VERILINK-ENTERPRISE-NCMIDCSU-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:26:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Pyt... |
# coding: utf-8
# Copyright 2015 Donne Martin. 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. A copy of
# the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" fil... |
class Solution:
def countPrimes(self, n: int) -> int:
if n <= 2:
return 0
isPrime = [False] * 2 + [True] * (n - 2)
for i in range(2, int(n**0.5) + 1):
if isPrime[i]:
for j in range(i * i, n, i):
isPrime[j] = False
return sum(isPrime)
|
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... |
coordinates_006B7F = ((113, 130),
(113, 131), (114, 129), (114, 131), (115, 128), (115, 131), (116, 127), (116, 129), (116, 130), (116, 132), (117, 126), (117, 128), (117, 129), (117, 130), (117, 131), (117, 133), (118, 125), (118, 127), (118, 128), (118, 129), (118, 130), (118, 131), (118, 132), (118, 135), (119, 12... |
class Channel(object):
'''Contains a collection of channel related methods.'''
async def get_channel(self, channel_id) -> dict:
'''https://discord.com/developers/docs/resources/channel#get-channel'''
return await self._request('GET', uri=f'/channels/{channel_id}')
async def modify_channel(... |
#
# PySNMP MIB module AH-INTERFACE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AH-INTERFACE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:00:22 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
#def n_grams(self, twittes, n_grams):
teste = ["cbie informática educação tecnologia teste mais novo"]
n = 2
def ngrams(n,texto):
'''n -> número
texto -> String'''
if(type(texto)==str):
teste = [texto]
textoN_Grams = []
for index in range(len(teste)):
textoTemp = ... |
#!/usr/bin/env python
# coding=utf-8
# Python Script
#
# Copyleft © Manoel Vilela
#
#
# A unit fraction contains 1 in the numerator.
# The decimal representation of the unit fractions
# with denominators 2 to 10 are given:
# 1/2 = 0.5
# 1/3 = 0.(3)
# 1/4 = 0.25
# 1/5 = 0.2
# 1/6 ... |
__author__ = '@britodfbr'
def quack():
m = "Quack!"
print(m)
return m
def squeak():
m = "Squeak!"
print(m)
return m
def mute_quack():
m = "<< silence >>"
print(m)
return m
|
"""
Faça um vetor de tamanho 50 preenchido com o seguinte valor: (i + 5 * i)%(i+1), sendo i a posição
do elemento no vetor. Em seguida imprima o vetor na tela
"""
vetor = []
for i in range(50):
vetor.append((i + 5 * i) % (i + 1))
print(vetor)
|
if __name__ == '__main__':
n = int(input())
student_marks = {}
for i in range(n):
name, *line = input().split()
scores = list(map(float, line))
student_marks[name] = scores
query_name = input()
x = student_marks[query_name]
# y = len(x)
summ = 0
for i in range(3):... |
#!/usr/bin/env python
# encoding: utf-8
class Solution:
def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
# let's assume len(nums1) > len(nums2)
if len(nums1) < len(nums2):
nums1, nums2 = nums2, nums1
# build lookup table for nums1
lookup = set(nu... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/nvidia/linorobot_ws/src/linorobot/include".split(';') if "/home/nvidia/linorobot_ws/src/linorobot/include" != "" else []
PROJECT_CATKIN_DEPENDS = "roscpp;rospy;tf2;tf2_ros;nav_msgs;lino_msgs;geom... |
"""Generated definition of cpp_grpc_compile."""
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load(
"//:defs.bzl",
"ProtoLibraryAspectNodeInfo",
"ProtoPluginInfo",
"proto_compile_aspect_attrs",
"proto_compile_aspect_impl",
"proto_compile_attrs",
"proto_compile_impl",
)
# Create aspect ... |
class A:
def __init__(self):
self._x = 1
def _foo(self):
print(self._x)
a = A()
a._f<caret>oo()
print(a._x) |
n = int(input())
a = map(int, input().split())
c = 0
for i in a:
while(i % 2 == 0 or i % 3 == 2):
i -= 1
c += 1
print(c)
|
class Node:
def __init__(self, dataval):
self.dataval = dataval
self.nextval = None
self.preval = None
class CLinkedList:
def __init__(self):
self.headval = None
def AtBeginning(self, newdata):
if self.headval == None:
NewNode = Node(newdata)
... |
metadata = {
"sample_name": "",
"group_name": "",
"file_names": "",
"sequencing_platform": "",
"sequencing_type": "",
"pre_assembled": "",
"sample_type": "",
"organism": "",
"strain": "",
"subtype": {},
"country": "",
"region": "",
"city": "",
"zip_code": "",
... |
dataset_dir = './resource/dataset'
datasets = [
dataset_dir + '/NFLX_dataset_SAST.py',
dataset_dir + '/BVI_HD_dataset_SAST.py',
dataset_dir + '/CC_HD_dataset_SAST.py',
dataset_dir + '/MCL_V_dataset_SAST.py',
dataset_dir + '/IVP_dataset_SAST.py',
da... |
animals = ['Octopus', 'Squid', 'Cuttlefish', 'Nautilus']
for animal in animals:
print(f"A {animal} would make a great pet!")
print("These animals lack bones and also remorse for their enemies.")
print("Any of these animals would make a great pet!")
|
# the following are from Goldsong on udacity
bad_subgrid = [[9,8,7,6,5,4,3,2,1],
[8,7,6,5,4,3,2,1,9],
[7,6,5,4,3,2,1,9,8],
[6,5,4,3,2,1,9,8,7],
[5,4,3,2,1,9,8,7,6],
[4,3,2,1,9,8,7,6,5],
[3,2,1,9,8,7,6,5,4],
[2,1,9,8,7,6,5,4,3],
[1,9,8,7,6,5,4,3,2]]
# floa... |
class Solution(object):
def shortestToChar(self, S, C):
prev = float('-inf')
ans = []
for i, x in enumerate(S):
if x == C: prev = i
ans.append(i - prev)
prev = float('inf')
for i in xrange(len(S) - 1, -1, -1):
if S[i] == C: prev = i
... |
################################################################################
# Author: Fanyang Cheng
# Date: 2/23/2021
# This program asks user for five grads,gives the letter grade and calculate
# average.
################################################################################
def get_valid_score():... |
#!/usr/bin/python3
"""
Helper class to parse the ini files.
Please note that there is also a python module named configparser. However,
as the example ini module contanined no section header for the first
entry (HOSTKEY), we wrote our own
"""
class IniParser:
"""
Initializes a DHT_TRACE_REPLY message to send... |
class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return 'Point({}:{})'.format(self.x, self.y)
def __add__(self, other):
return Point(self.x + other.x, self.y + other.y)
def __sub__(self, other):
return Point(s... |
'''
Return the lowest index at which a value (second argument) should be inserted into an array (first argument) once it has been sorted.
The returned value should be a number.
For example, getIndexToIns([1,2,3,4], 1.5) should return 1 because it is greater than 1 (index 0), but less than 2 (index 1).
Likewise, ge... |
class Solution:
def intervalIntersection(self, firstList: List[List[int]], secondList: List[List[int]]) -> List[List[int]]:
f_len, f = len(firstList), 0
s_len, s = len(secondList), 0
ans = []
while f < f_len and s < s_len:
low = max( firstList[f][0], sec... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 4 18:58:22 2019
@author: Administrator
"""
class Solution:
def sortArray(self, nums: list) -> list:
# return self.quick_sort(nums, 0, len(nums)-1)
self.quick_sort(nums, 0, len(nums)-1)
return nums
# def quick_sort(self, nums, left, rig... |
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# The Universal Permissive License (UPL), Version 1.0
#
# Subject to the condition set forth below, permission is hereby granted to any
# person obtaining a copy of this software, a... |
class Solution(object):
# def maxSubArray(self, nums):
# return self.maxSubArrayHelper(nums, 0, len(nums) - 1)
#
# def maxSubArrayHelper(self, nums, l, r):
# if l > r:
# return -2147483647
# mid = (l + r) / 2
# leftAns = self.maxSubArrayHelper(nums, l, mid - 1)
... |
if __name__ == "__main__":
count = int(input("[>] Enter count of students: "))
students = dict()
for i in range(count):
name = input("[>] Enter name: ")
estimation = int(input("[>] Enter estimation: "))
students[name] = estimation
print(f"[+] Second minimal: {list(sorted(stude... |
# this script converts a hex byte array to hex string
input = ([0x01, 0x00, 0x00, 0x00, 0x01, 0x6b, 0xff, 0x7f, 0xcd, 0x4f, 0x85, 0x65, 0xef, 0x40, 0x6d, 0xd5, 0xd6, 0x3d, 0x4f, 0xf9, 0x4f, 0x31, 0x8f, 0xe8, 0x20, 0x27, 0xfd, 0x4d, 0xc4, 0x51, 0xb0, 0x44, 0x74, 0x01, 0x9f, 0x74, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x4... |
CMD_HELP = ('help', '帮助', '帮助信息')
CMD_ABOUT = ('about', '关于', '你是谁', '你们是谁')
CMD_PING = ('ping', '活着没', '活着吗')
CMD_ADD = ('add', '添加', '增加', '新增', '反馈')
CMD_LIST = ('list', '歌曲列表', '列表')
CMD_PLAY = ('play', '播放', '播放歌曲', '返回', '获取')
CMD_SEARCH = ('ss', 'search', '搜索', '查找', '寻找', '查询')
CMD_STAT = ('stat', '状态', '数据', '... |
"""
Given an array of integers and an integer k, find out whether there are two
distinct indices i and j in the array such that nums[i] = nums[j] and the
difference between i and j is at most k.
"""
class Solution(object):
def containsNearbyDuplicate(self, nums, k):
"""
:type nums: List[int]
... |
# Task 04. Zoo
class Zoo:
def __init__(self, zoo_name):
self.zoo_name = zoo_name
self.mammals = []
self.fishes = []
self.birds = []
def add_animal(self, species, name):
if species == "mammal":
self.mammals.append(name)
elif species == "fish":
... |
class CleanupInfo:
def __init__(self, num_removed=0, space_freed=0):
self.num_removed = num_removed
self.space_freed = space_freed
def __add__(self, other):
if isinstance(other, CleanupInfo):
return CleanupInfo(self.num_removed + other.num_removed,
... |
# Do not edit the class below except for
# the insert, contains, and remove methods.
# Feel free to add new properties and methods
# to the class.
class BST:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def insert(self, value):
node = self
... |
'''
Ряд - 1
'''
def printRange(a, b):
for i in range(a, b + 1):
print(i, end=' ')
print('')
a = int(input()), int(input())
printRange(a[0], a[1])
|
"""
PRACTICE Test 3.
This problem provides practice at:
*** MUTATING and RETURNING-NEW LISTS. ***
Authors: David Mutchler, Valerie Galluzzi, Mark Hays, Amanda Stouder,
their colleagues and Marc Fernandez.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
###############################################... |
class TrieNode(object):
def __init__(self):
self.children = {}
self.is_word = False
class Trie(object):
def __init__(self):
self.root = TrieNode()
def insert(self,word):
cur = self.root
for i in word:
if i not in cur.children:
... |
self.description = "sysupgrade with a disabled repo"
sp = pmpkg("dummy", "1.0-2")
self.addpkg2db("sync", sp)
lp = pmpkg("dummy", "1.0-1")
self.addpkg2db("local", lp)
self.args = "-Syu"
self.db['sync'].option['Usage'] = ['Search']
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=dummy|1.0-1")
|
desired_income = float(input())
total_price = 0
while True:
price = 0
cocktail_name = input()
if cocktail_name == "Party!":
print(f"We need {(desired_income - total_price):.2f} leva more.")
break
cocktails_count = int(input())
price = len(cocktail_name) * cocktails_count
if pric... |
def pytest_addoption(parser):
parser.addoption('--headless', action='store_true', default=False)
def pytest_generate_tests(metafunc):
option_value = metafunc.config.option.headless
if 'headless' in metafunc.fixturenames and option_value is not None:
metafunc.parametrize('headless', [option_value])... |
# Copyright 2020 The Bazel Authors. 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 la... |
# CLASSE - É A FORMA COMO O OBJETOS SE COMPORTAM
"""
A Classe é uma forma de vocÊ criar seues tipos personalizados
Funciona como forma de gelo, e você precis colocar agua para seer moldada
Metódo é uma função que pertence a uma classe"""
class Pessoa: #Letras em maisculo no inicio das frases
olhos = 2 #ATRIBUTO... |
#Assignment 6
#Sum of numbers
#Ask user to enter positive integers and print out the sum
#To stop counting ask user to input -1
number = 0
total = 0
while number != -1:
total += number
number = float(input("Please enter positive integers(enter -1 to stop):\n"))
print(total)
|
"""
Created on 17:07, Apr. 15th, 2021
Author: fassial
Filename: __init__.py
"""
|
# Time: O(n)
# Space: O(1)
class Solution(object):
def replaceDigits(self, s):
"""
:type s: str
:rtype: str
"""
return "".join(chr(ord(s[i-1])+int(s[i])) if i%2 else s[i] for i in xrange(len(s)))
|
""" Tagger ID3 Constants """
__author__ = "Alastair Tse <alastair@tse.id.au>"
__license__ = "BSD"
__copyright__ = "Copyright (c) 2004, Alastair Tse"
__revision__ = "$Id: constants.py,v 1.3 2004/12/21 12:02:06 acnt2 Exp $"
ID3_FILE_READ = 0
ID3_FILE_MODIFY = 1
ID3_FILE_NEW = 2
ID3V2_FILE_HEADER_LENGTH = 10
ID3V2_FI... |
BROADCAST_WEBSOCKET_SECRET = '🤖starscream🤖'
BROADCAST_WEBSOCKET_PORT = 8013
BROADCAST_WEBSOCKET_VERIFY_CERT = False
BROADCAST_WEBSOCKET_PROTOCOL = 'http'
|
# Python program to find second largest
# number in a list
# list of numbers - length of
# list should be at least 2
l = [10, 20, 4, 45, 99, 89, 78, 109]
mx = max(l[0], l[1])
secondmax = min(l[0], l[1])
n = len(l)
for i in range(2, n):
if l[i] > mx:
secondmax = mx
mx = l[i]
elif l[i] > secondm... |
# *****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# 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... |
"""
Given a list paths of directory info, including the directory path, and all the files with contents in this directory, return all the duplicate files in the file system in terms of their paths. You may return the answer in any order.
A group of duplicate files consists of at least two files that have the same cont... |
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: LGPL-3.0-only
class Plan:
def __init__(self, data):
self.id = data["id"]
self.name = data["name"]
self.slug = data["slug"]
self.line = data["line"]
self.pricing = data["pricing"]
self.specs = data["specs"]
s... |
def analysis(result, deck) -> int:
count = 0
for number in deck:
if number in result:
count += 1
return count |
class Astronaut:
def say_hello(self, text):
print(text)
jose = Astronaut()
jose.say_hello(text='Privyet') # Privyet
jose.say_hello('Hello') # Hello
jose.say_hello() # TypeError: say_text() missing 1 required positional argument: 'text'
|
class Solution(object):
def generateMatrix(self, n):
"""
:type n: int
:rtype: List[List[int]]
"""
ans = [[0] * n for _ in range(n)]
left, right, up, down = 0, n - 1, 0, n - 1
k = 1
while left <= right and up <= down:
for i in range(left, right + 1):
ans[up][i] = k
... |
# 读取分数后输出总分和平均分(其五:使用sum函数计算总分)
print('计算总分和平均分。')
number = int(input('学生人数:'))
tensu = [None] * number
for i in range(number):
tensu[i] = int(input('第{}名的分数:'.format(i + 1)))
total = sum(tensu)
print('总分为{}分。'.format(total))
print('平均分为{}分。'.format(total / number))
|
count = 0
while True:
count += 1
x = int(input())
if x == -1: break
parts = ((1 + (2 ** x)) * (1 + (2 ** x)))
print("Teste %d" % count)
print("%d\n" % parts)
|
# Platform-specific build configurations.
load("@protobuf_archive//:protobuf.bzl", "cc_proto_library")
load("@protobuf_archive//:protobuf.bzl", "py_proto_library")
load("//tensorflow:tensorflow.bzl", "if_not_mobile")
load("//tensorflow:tensorflow.bzl", "if_not_windows")
# Appends a suffix to a list of deps.
def tf_de... |
class Car():
"""
A pojo class for cars.
We exercise this class using the non-ORM aspects of sqlalchemy.
"""
def __init__(self, make: str, model: str, junker=False):
self.make = make
self.model = model
self.junker = junker
def get_make(self) -> str:
return self.m... |
"""Define consts for the pysmartthings package."""
__title__ = "pysmartthings"
__version__ = "0.7.7"
# Constants for Health
HEALTH_API_STATE = "state"
HEALTH_PACKAGE_STATE = "state"
HEALTH_API_LAST_UPDATE = "lastUpdatedDate"
HEALTH_PACKAGE_LAST_UPDATE = "lastUpdatedDate"
HEALTH_ATTRIBUTE_MAP = {
HEALTH... |
class Scene(object):
def __init__(self):
pass
def render(self, screen):
raise NotImplementedError
def update(self):
raise NotImplementedError
def handle_event(self, event):
raise NotImplementedError
def processEvent(self, arg):
raise NotImplementedError |
'''Crie um programa que leia um número inteiro e mostre na tela se ele é PAR ou ÍMPAR.'''
numero = int(input('Diga-me um número qualquer: '))
resto = numero % 2
if resto == 0:
print('O número {} é PAR'.format(numero))
else:
print('O número {} é ÍMPAR'.format(numero))
|
# Copyright 2014 The Bazel Authors. 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 la... |
#
# PySNMP MIB module CISCO-UNIFIED-COMPUTING-CONFORM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-CONFORM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:58:47 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Usi... |
"""
Copyright 2018-present Open Networking Foundation
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 agre... |
# https://www.hackerrank.com/challenges/bomber-man/problem?isFullScreen=true
def bomberMan(n, grid):
# Write your code here
def printList(array):
for i in range(len(array)):
array[i] = ''.join(map(str,array[i]))
return array
def bomb(previous_grid, r,c):
complete_st... |
def get_length(dna):
""" (str) -> int
Return the length of the DNA sequence dna.
>>> get_length('ATCGAT')
6
>>> get_length('ATCG')
4
"""
return len(dna)
#print(get_length('SALIM'))
def is_longer(dna1, dna2):
""" (str, str) -> bool
Return True if and only if DNA sequence dna1 ... |
'''
@author: l4zyc0d3r
People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt
'''
class Solution:
def rangeSumBST(self, root: TreeNode, low: int, high: int) -> int:
if not root: return 0
res = 0
if low<=root.val<=high:
res = root.val
retu... |
class Pessoa:
olhos = 2
def __init__(self, *filhos, nome=None, idade=31):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Olá, meu nome é {self.nome}'
@staticmethod
def metodo_statico():
return 42
@classm... |
class Solution(object):
def maxSubArrayLen(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
memo = {0:-1} # key is the continuous sum from the beginning to nums[i], value is the smallest such 'i'
maxLen = 0
ssum = 0
for i,... |
def jpeg_res(filename):
""""This function prints the resolution of the jpeg image file passed into it"""
# open image for reading in binary mode
with open(filename,'rb') as img_file:
# height of image (in 2 bytes) is at 164th position
img_file.seek(163)
# read the 2 bytes
a = img... |
def quick_sort(a): #a is a list of numbers
if(len(a)<=1):
return(a)
mid=a[len(a)//2]
left=[x for x in a if x<mid ]
middle=[x for x in a if x==mid]
right=[x for x in a if x>mid]
return(quick_sort(left)+middle+quick_sort(right))
if(__name__=='__main__'):
arr=[]
n=input('Enter th... |
# -*- coding: utf-8 -*-
"""
smash.models.image_manipulation_model
This file was automatically generated for SMASH by SMASH v2.0 ( https://smashlabs.io )
"""
class ImageManipulationModel(object):
"""Implementation of the 'Image Manipulation Model' model.
TODO: type model description here.
Attr... |
colors = {"clean": "\033[m",
"red": "\033[31m",
"green": "\033[32m",
"yellow": "\033[33m",
"blue": "\033[34m",
"purple": "\033[35m",
"cian": "\033[36m"}
gender = str(input("Enter your gender. \n{}[M]{} or {}[F]{}: "
.format(colors["blue"], c... |
load("//cc_module/private:cc_module.bzl",
_cc_module = "cc_module",
_cc_header_module = "cc_header_module",
_cc_module_binary = "cc_module_binary",
_cc_module_library = "cc_module_library",
_cc_module_test = "cc_module_test",
)
cc_module = _cc_module
cc_header_module = _cc_header_module
cc_mod... |
# --------- Strategy -------------
# BASE CASE
# if either input is 0, return 0
# RECURSIVE STEP
# return one input added to a recursive call with the OTHER input decremented by 1
def multiplication(num_1, num_2):
if num_1 == 0 or num_2 == 0:
return 0
else:
return num_2 + multiplication(num_1 - 1, num_2)
... |
class Solution:
# @param {integer[]} candidates
# @param {integer} target
# @return {integer[][]}
def combinationSum2(self, candidates, target):
candidates.sort()
result = []
tmp = []
self.help(tmp, candidates, 0, target, result)
return result
def help(se... |
def run():
#with _while(1):
pump(0,1)
with _e._parallel():
llift(1)
rlift(1)
_sync()
with _parallel():
llift(0)
rlift(0)
_sync()
with _parallel():
llift(1)
rlift(1)
_sync()
pump(0,0)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.