content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Vehicle:
''' Documentation needed here
'''
def __init__(self, numberOfTires, colorOfVehicle):
''' Documentation needed here
'''
self.numberOfTires = numberOfTires
self.colorOfVehicle = colorOfVehicle
def start(self):
''' This function starts the vehicle
'''
print("I started!")
def dr... | class Vehicle:
""" Documentation needed here
"""
def __init__(self, numberOfTires, colorOfVehicle):
""" Documentation needed here
"""
self.numberOfTires = numberOfTires
self.colorOfVehicle = colorOfVehicle
def start(self):
""" This function starts the vehicle
"""
... |
def tail(filename, n=10):
'Return the last n lines of a file'
with open(filename) as f:
return deque(f, n)
| def tail(filename, n=10):
"""Return the last n lines of a file"""
with open(filename) as f:
return deque(f, n) |
render = ez.Node()
aspect2D = ez.Node()
camera = ez.Camera(parent=render)
camera.y = -20
# Create a a model:
dirt = ez.load.texture('dirt.png')
mesh = ez.load.mesh('hex.bam')
model = ez.Model( mesh, parent=render)
model.shader = ez.load.shader('shaded.glsl')
model.set_shader_input('texture0', dirt)
# Our task functi... | render = ez.Node()
aspect2_d = ez.Node()
camera = ez.Camera(parent=render)
camera.y = -20
dirt = ez.load.texture('dirt.png')
mesh = ez.load.mesh('hex.bam')
model = ez.Model(mesh, parent=render)
model.shader = ez.load.shader('shaded.glsl')
model.set_shader_input('texture0', dirt)
def task_spin_node(node, task):
nod... |
#
# PySNMP MIB module TIMETRA-CLEAR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-CLEAR-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:09:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) ... |
n, m = map(int, input().split())
array = [input() for _ in range(n)]
k = int(input())
for row in sorted(array, key=lambda row: int(row.split()[k])):
print(row)
| (n, m) = map(int, input().split())
array = [input() for _ in range(n)]
k = int(input())
for row in sorted(array, key=lambda row: int(row.split()[k])):
print(row) |
class WordDictionary:
def __init__(self):
"""
Initialize your data structure here.
"""
self.endWord = False
self.children = [None] * 26
def addWord(self, word: str) -> None:
"""
Adds a word into the data structure.
"""
curr = sel... | class Worddictionary:
def __init__(self):
"""
Initialize your data structure here.
"""
self.endWord = False
self.children = [None] * 26
def add_word(self, word: str) -> None:
"""
Adds a word into the data structure.
"""
curr = self
... |
def count(char,word):
total=0
for any in word:
if any in char:
total = total + 1
return total
result = count('a','banana')
print(result)
| def count(char, word):
total = 0
for any in word:
if any in char:
total = total + 1
return total
result = count('a', 'banana')
print(result) |
class VariableEngine:
"""A simple package for handling variables in string."""
def __init__(self, prefix: str = None, suffix: str = None):
self.variables = {}
self.prefix = str(prefix) if prefix else '' #If prefix is none prefix defaults to ''
self.suffix = str(suffix) if suffix else s... | class Variableengine:
"""A simple package for handling variables in string."""
def __init__(self, prefix: str=None, suffix: str=None):
self.variables = {}
self.prefix = str(prefix) if prefix else ''
self.suffix = str(suffix) if suffix else self.prefix
def add_variable(self, variabl... |
class Solution:
def canBeTypedWords(self, text: str, brokenLetters: str) -> int:
result = 0
words = text.split(" ")
set_chars = set(brokenLetters)
for i in words:
set_word = set(i)
sub = set_word - set_chars
if len(set_word) == len(sub):
... | class Solution:
def can_be_typed_words(self, text: str, brokenLetters: str) -> int:
result = 0
words = text.split(' ')
set_chars = set(brokenLetters)
for i in words:
set_word = set(i)
sub = set_word - set_chars
if len(set_word) == len(sub):
... |
#Decorator Pattern
def my_decorator(func):
def wrap_func(*args, **kwargs):
print("**********")
func(*args, **kwargs)
print("**********")
return wrap_func
@my_decorator
def hello(greeting,emoji, withLove="your love"):
print(greeting,emoji, withLove)
hello('yo yo', '<3') | def my_decorator(func):
def wrap_func(*args, **kwargs):
print('**********')
func(*args, **kwargs)
print('**********')
return wrap_func
@my_decorator
def hello(greeting, emoji, withLove='your love'):
print(greeting, emoji, withLove)
hello('yo yo', '<3') |
"""
Write a function to detect if a string is valid or not
"abc_123{}"
"{abc_123}"
"abc_{1}23"
"abc_123{()}()"
"abc_123{()}[()]&"
invalid
"}abc_123{"
"abc_123{"
"ab{[}]"
Raise exception which has the position at which the error occured.
"""
class RaiseException(Exception):
pass
def validate(text):
"""
... | """
Write a function to detect if a string is valid or not
"abc_123{}"
"{abc_123}"
"abc_{1}23"
"abc_123{()}()"
"abc_123{()}[()]&"
invalid
"}abc_123{"
"abc_123{"
"ab{[}]"
Raise exception which has the position at which the error occured.
"""
class Raiseexception(Exception):
pass
def validate(text):
"""
... |
# Copyright (c) 2017-2018 CRS4
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribut... | confirm_actions = ('add', 'delete')
errors_message = {'MISSING_PARAM': 'Missing parameters', 'UNKNOWN_ACTION': 'Unknown action', 'INVALID_CONFIRMATION_CODE': 'Confirmation code not valid', 'INVALID_FR_STATUS': 'Invalid flow request status', 'EXPIRED_CONFIRMATION_ID': 'Confirmation code expired', 'INVALID_CONSENT_STATUS... |
# Copyright 2018 Jetperch LLC
#
# 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,... | """
The USB backend which must be implemented for each platform type.
This module defines the USB backend. Each target platform
(such as Windows, Mac OS/X and Linux), must implement backend that conforms
to this API.
This API is **not** thread-safe. All methods and functions must be invoked
from a single thread.
""... |
class Solution:
def numJewelsInStones(self, J: str, S: str) -> int:
#map = {}
#for i in range(len(J)):
# map[J[i]] = 0
count = 0
for i in range(len(S)):
if str([S[i]][0]) in J: count +=1
return count
J = "aAB"
S = "aAAbbbb"
print(Solution().numJewelsI... | class Solution:
def num_jewels_in_stones(self, J: str, S: str) -> int:
count = 0
for i in range(len(S)):
if str([S[i]][0]) in J:
count += 1
return count
j = 'aAB'
s = 'aAAbbbb'
print(solution().numJewelsInStones(J, S)) |
n = int(input())
sum1 = 0
for i in range(1, n + 1):
if n % i == 0:
sum1 += i
print(sum1)
| n = int(input())
sum1 = 0
for i in range(1, n + 1):
if n % i == 0:
sum1 += i
print(sum1) |
def MoveManyStepsForward(numberOfSteps):
for everySingleNumberInTheRange in range(numberOfSteps):
env.step(0)
async def main():
MoveManyStepsForward(50)
await sleep()
MoveManyStepsForward(150) | def move_many_steps_forward(numberOfSteps):
for every_single_number_in_the_range in range(numberOfSteps):
env.step(0)
async def main():
move_many_steps_forward(50)
await sleep()
move_many_steps_forward(150) |
def distanceK(self, root, target, K):
conn = collections.defaultdict(list)
def connect(parent, child):
if parent and child:
conn[parent.val].append(child.val)
conn[child.val].append(parent.val)
if child.left: connect(child, child.left)
if child.right: connect(chil... | def distance_k(self, root, target, K):
conn = collections.defaultdict(list)
def connect(parent, child):
if parent and child:
conn[parent.val].append(child.val)
conn[child.val].append(parent.val)
if child.left:
connect(child, child.left)
if child.right... |
#!/usr/local/bin/python
# encoding: utf-8
"""
*Code elements for TBS htmlframework*
:Author:
David Young
:Date Created:
April 16, 2013
:dryx syntax:
- ``xxx`` = come back here and do some more work
- ``_someObject`` = a 'private' object that should only be changed for debugging
:Notes:
- If you ... | """
*Code elements for TBS htmlframework*
:Author:
David Young
:Date Created:
April 16, 2013
:dryx syntax:
- ``xxx`` = come back here and do some more work
- ``_someObject`` = a 'private' object that should only be changed for debugging
:Notes:
- If you have any questions requiring this script p... |
entries = [
{
'env-title': 'atari-enduro',
'score': 0.0,
},
{
'env-title': 'atari-space-invaders',
'score': 656.91,
},
{
'env-title': 'atari-qbert',
'score': 6433.38,
},
{
'env-title': 'atari-seaquest',
'score': 1065.98,
},
... | entries = [{'env-title': 'atari-enduro', 'score': 0.0}, {'env-title': 'atari-space-invaders', 'score': 656.91}, {'env-title': 'atari-qbert', 'score': 6433.38}, {'env-title': 'atari-seaquest', 'score': 1065.98}, {'env-title': 'atari-pong', 'score': 3.11}, {'env-title': 'atari-beam-rider', 'score': 1959.22}, {'env-title'... |
name = "fRoDo"
lowercase_name = name.lower()
uppercase_name = name.upper()
titlecase_name = name.title()
print(lowercase_name, uppercase_name, titlecase_name) | name = 'fRoDo'
lowercase_name = name.lower()
uppercase_name = name.upper()
titlecase_name = name.title()
print(lowercase_name, uppercase_name, titlecase_name) |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 8 11:35:38 2019
@author: john
"""
def intcode(input_list, l):
l = [int(x) for x in l] # Convert list values to ints
end = False # set up a condition for the while
pointer = 0 # initialize the pointer to the first position
... | """
Created on Sun Dec 8 11:35:38 2019
@author: john
"""
def intcode(input_list, l):
l = [int(x) for x in l]
end = False
pointer = 0
while not end:
instruct = str(l[pointer]).rjust(5, '0')
operation = instruct[len(instruct) - 2:]
if int(instruct[2]) > 1:
print('A_M... |
'''
priceIsRight = 15
if priceIsRight:
print("Price is too low!")
if priceIsRight:
print("Price is almost there!")
if priceIsRight:
print("Price is exactly that!")
if priceIsRight:
print("Price is too high!")
'''
priceIsRight = int(input("Enter your number: "))... | """
priceIsRight = 15
if priceIsRight:
print("Price is too low!")
if priceIsRight:
print("Price is almost there!")
if priceIsRight:
print("Price is exactly that!")
if priceIsRight:
print("Price is too high!")
"""
price_is_right = int(input('Enter your number: ')... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr1 , arr2 , m , n , x ) :
count , l , r = 0 , 0 , n - 1
while ( l < m and r >= 0 ) :
if ( ( arr1 ... | def f_gold(arr1, arr2, m, n, x):
(count, l, r) = (0, 0, n - 1)
while l < m and r >= 0:
if arr1[l] + arr2[r] == x:
l += 1
r -= 1
count += 1
elif arr1[l] + arr2[r] < x:
l += 1
else:
r -= 1
return count
if __name__ == '__main__... |
# coding: utf-8
# BlackSmith general configuration file
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Jabber server to connect
SERVER = 'example.com'
# Connecting Port
PORT = 5222
# Jabber server`s connecting Host
HOST = 'example.com'
# Using TLS (True - to enable, False - to disable)
SECURE ... | server = 'example.com'
port = 5222
host = 'example.com'
secure = True
username = 'username'
password = 'password'
resource = u'simpleApps'
default_nick = u'BlackSmith-m.1'
chat_msg_limit = 1024
priv_msg_limit = 2024
inc_msg_limit = 8960
mserve = False
boss = 'boss@example.com'
memory_limit = 49152
boss_pass = '' |
# -----------------------------------------------------------------------------
# This piece of work is inspired by Pollere' VerSec:
# https://github.com/pollere/DCT
# But this code is implemented independently without using any line of the
# original one, and released under Apache License.
#
# Copyright (C) 2019-2022 ... | lvs_grammar = '\n ?start: file_input\n\n TAG_IDENT: CNAME\n RULE_IDENT: "#" CNAME\n FN_IDENT: "$" CNAME\n\n name: "/"? component ("/" component)*\n component: STR -> component_from_str\n | TAG_IDENT -> tag_id\n | RULE_IDENT -> rule_id\n\n definition: RULE_IDENT ":" d... |
#!/usr/bin/env python
# -*- coding: utf-8; -*-
# Copyright (c) 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
DEFAULT_OCI_CONFIG_FILE = "~/.oci/config"
DEFAULT_PROFILE = "DEFAULT"
DEFAULT_CONDA_PACK_FOLDER = "~/conda"
CONDA_P... | default_oci_config_file = '~/.oci/config'
default_profile = 'DEFAULT'
default_conda_pack_folder = '~/conda'
conda_pack_os_prefix_format = 'oci://<bucket>@<namespace>/<prefix>'
default_ads_config_folder = '~/.ads_ops'
ops_image_base = 'ads-operators-base'
ml_job_image = 'ml-job'
ml_job_gpu_image = 'ml-job-gpu'
ops_image... |
"""
File: boggle.py
Name:
----------------------------------------
TODO:
"""
# This is the file name of the dictionary txt file
# we will be checking if a word exists by searching through it
FILE = 'dictionary.txt'
dict_list = []
final = []
def main():
"""
TODO:
"""
read_dictionary()
temp = ''
word_lst = []
for... | """
File: boggle.py
Name:
----------------------------------------
TODO:
"""
file = 'dictionary.txt'
dict_list = []
final = []
def main():
"""
TODO:
"""
read_dictionary()
temp = ''
word_lst = []
for i in range(4):
while True:
row = input(str(i + 1) + ' row of letters: ')
... |
INPUT = ">^^v^<>v<<<v<v^>>v^^^<v<>^^><^<<^vv>>>^<<^>><vv<<v^<^^><>>><>v<><>^^<^^^<><>>vv>vv>v<<^>v<>^>v<v^<>v>><>^v<<<<v^vv^><v>v^>>>vv>v^^^<^^<>>v<^^v<>^<vv^^<^><<>^>><^<>>><><vv><>v<<<><><>v><<>^^^^v>>^>^<v<<vv^^<v<^<^>^^v^^^^^v<><^v><<><^v^>v<<>^<>^^v^<>v<v^>v>^^<vv^v><^<>^v<><^><v^><><><<<<>^vv^>^vvvvv><><^<vv^v^v>... | input = '>^^v^<>v<<<v<v^>>v^^^<v<>^^><^<<^vv>>>^<<^>><vv<<v^<^^><>>><>v<><>^^<^^^<><>>vv>vv>v<<^>v<>^>v<v^<>v>><>^v<<<<v^vv^><v>v^>>>vv>v^^^<^^<>>v<^^v<>^<vv^^<^><<>^>><^<>>><><vv><>v<<<><><>v><<>^^^^v>>^>^<v<<vv^^<v<^<^>^^v^^^^^v<><^v><<><^v^>v<<>^<>^^v^<>v<v^>v>^^<vv^v><^<>^v<><^><v^><><><<<<>^vv^>^vvvvv><><^<vv^v^v>... |
def timer(start: float, end: float) -> str:
"""
Timer function. Compute execution time from strart to end (end - start).
:param start: start time
:param end: end time
:return: end - start
"""
hours, rem = divmod(end - start, 3600)
minutes, seconds = divmod(rem, 60)
return "{:0>2}:{:0... | def timer(start: float, end: float) -> str:
"""
Timer function. Compute execution time from strart to end (end - start).
:param start: start time
:param end: end time
:return: end - start
"""
(hours, rem) = divmod(end - start, 3600)
(minutes, seconds) = divmod(rem, 60)
return '{:0>2}... |
#
# PySNMP MIB module CISCO-IMAGE-UPGRADE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-IMAGE-UPGRADE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:01:48 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ... |
#!/opt/local/bin/python
sum_3_5 = 0
for i in range(1,1000):
if i % 3 == 0 or i % 5 == 0:
print(i)
sum_3_5 += i
print(sum_3_5)
| sum_3_5 = 0
for i in range(1, 1000):
if i % 3 == 0 or i % 5 == 0:
print(i)
sum_3_5 += i
print(sum_3_5) |
class Animal(object):
def __init__(self, name):
self.name = name
def eat(self, food):
print("%s is eating %s" % (self.name, food))
class Dog(Animal):
def fetch(self, thing):
print("%s goes after the %s" % (self.name, thing))
class Cat(Animal):
def swatstring(self):
pri... | class Animal(object):
def __init__(self, name):
self.name = name
def eat(self, food):
print('%s is eating %s' % (self.name, food))
class Dog(Animal):
def fetch(self, thing):
print('%s goes after the %s' % (self.name, thing))
class Cat(Animal):
def swatstring(self):
... |
__version__ = '0.0.1'
__url__ = 'http://github.com/blazaid/pycodes/'
__author__ = 'blazaid'
def check_ean13():
pass | __version__ = '0.0.1'
__url__ = 'http://github.com/blazaid/pycodes/'
__author__ = 'blazaid'
def check_ean13():
pass |
class Parser:
"""The Parser is the class that handles the player's input. The player
writes commands, and the parser performs natural language understanding
in order to interpret what the player intended, and how that intent
is reflected in the simulated world.
"""
def __init__(self, game):
... | class Parser:
"""The Parser is the class that handles the player's input. The player
writes commands, and the parser performs natural language understanding
in order to interpret what the player intended, and how that intent
is reflected in the simulated world.
"""
def __init__(self, game):
... |
# List of the training runs for the different target dataset sizes
TRAINING_RUNS = [
'large_dataset/20200616_090434',
'medium_dataset/20200616_214425',
'small_dataset/20200617_143139'
]
| training_runs = ['large_dataset/20200616_090434', 'medium_dataset/20200616_214425', 'small_dataset/20200617_143139'] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... | class Standardtags(object):
voltage = 'Voltage'
current_density = 'CurrentDensity'
current = 'Current'
conductance = 'Conductance'
conductance_density = 'ConductanceDensity'
state_variable = 'StateVariable'
state_time_constant = 'StateTimeConstant'
state_steady_state = 'StateSteadyState'... |
# Copyright 2021 Google LLC. 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 a... | """Module for input resolution exceptions.
Theses exceptions can be raised from ResolverStartegy or ResolverOp
implementation, and each exception is specially handled in input resolution
process. Other errors raised during the input resolution will not be catched
and be propagated to the input resolution caller.
"""
... |
# print("{:~^45}".format(" Simple while loop "))
# i = 1
# while i<=5 :
# print(i)
# i += 1
# print("\n{:~^45}".format(" Example: sum all numbers in [1..100] "))
# i = 1
# sum = 0
# while i <= 100:
# sum += i
# i += 1
# print("sum = ", sum)
# print("\n{:~^45}".format(" Task: sum even numbers in [1..100] "))
# i ... | print('\n{:~^45}'.format('Emulate do-while loop'))
while True:
user_name = input('Enter a name (at least 3 symbols): ')
user_name_length = len(user_name)
if user_name_length > 3:
break
print('Thank you, {}!'.format(user_name)) |
aqiRanges = (0, 50, 100, 150, 200, 300, 500)
aqiDescriptions = ("Good", "Moderate", "Unhealthy for Sensitive Groups",
"Unhealthy", "Very Unhealthy", "Hazardous")
aqiDescription = ""
pm25ranges = (0, 12, 35.4, 55.4, 150.4, 250.4, 500.4)
pm10ranges = (0, 54, 154, 254, 354, 424, 604)
no2ranges = (0, ... | aqi_ranges = (0, 50, 100, 150, 200, 300, 500)
aqi_descriptions = ('Good', 'Moderate', 'Unhealthy for Sensitive Groups', 'Unhealthy', 'Very Unhealthy', 'Hazardous')
aqi_description = ''
pm25ranges = (0, 12, 35.4, 55.4, 150.4, 250.4, 500.4)
pm10ranges = (0, 54, 154, 254, 354, 424, 604)
no2ranges = (0, 53, 100, 360, 649, ... |
def test_evens():
yield check_even_cls
class Test(object):
def test_evens(self):
yield check_even_cls
class Check(object):
def __call__(self):
pass
check_even_cls = Check()
| def test_evens():
yield check_even_cls
class Test(object):
def test_evens(self):
yield check_even_cls
class Check(object):
def __call__(self):
pass
check_even_cls = check() |
def sommig(n):
result = 0
while(n>=1):
result += n
n-=1
return result
print(sommig(3))
print(sommig(8))
print(sommig(17))
print(sommig(33)) | def sommig(n):
result = 0
while n >= 1:
result += n
n -= 1
return result
print(sommig(3))
print(sommig(8))
print(sommig(17))
print(sommig(33)) |
class Job(object):
def __init__(self, server_host, job_id, train_strategy, train_model, train_model_class_name, aggregate_strategy,
distillation_alpha=None):
self.server_host = server_host
self.job_id = job_id
self.train_strategy = train_strategy
self.train_model = ... | class Job(object):
def __init__(self, server_host, job_id, train_strategy, train_model, train_model_class_name, aggregate_strategy, distillation_alpha=None):
self.server_host = server_host
self.job_id = job_id
self.train_strategy = train_strategy
self.train_model = train_model
... |
def foo(bar1, bar2, bar3,
bar4
): # FD102
return
| def foo(bar1, bar2, bar3, bar4):
return |
class Solution:
def canPermutePalindrome(self, s: str) -> bool:
wordset = set()
for c in s:
if c in wordset:
wordset.remove(c)
else:
wordset.add(c)
return len(wordset)<=1
A = Solution()
s = "aab"
print(A.canPermutePalindrome(s)) | class Solution:
def can_permute_palindrome(self, s: str) -> bool:
wordset = set()
for c in s:
if c in wordset:
wordset.remove(c)
else:
wordset.add(c)
return len(wordset) <= 1
a = solution()
s = 'aab'
print(A.canPermutePalindrome(s)) |
"""
Constants used by the Data Structure Generator (DSG)
and the Spec Executor
"""
# MAGIC Numbers:
# Data spec magic number
DSG_MAGIC_NUM = 0x5B7CA17E
# Application data magic number
APPDATA_MAGIC_NUM = 0xAD130AD6
# Version of the file produced by the DSE
DSE_VERSION = 0x00010000
# DSG Arrays and tables sizes:
MAX... | """
Constants used by the Data Structure Generator (DSG)
and the Spec Executor
"""
dsg_magic_num = 1534894462
appdata_magic_num = 2903706326
dse_version = 65536
max_registers = 16
max_mem_regions = 16
max_struct_slots = 16
max_struct_elements = 255
max_packspec_slots = 16
max_constructors = 16
max_param_lists = 16
max_... |
def get_sea_monster():
sea_monster = [
" # ",
"# ## ## ###",
" # # # # # # ",
]
return sea_monster, len(sea_monster), len(sea_monster[0])
def mark_sea_monsters_at_coord(grid, x, y):
sm, sm_y, sm_x = get_sea_monster()
for yval in range(y, y + sm_y):
for xval ... | def get_sea_monster():
sea_monster = [' # ', '# ## ## ###', ' # # # # # # ']
return (sea_monster, len(sea_monster), len(sea_monster[0]))
def mark_sea_monsters_at_coord(grid, x, y):
(sm, sm_y, sm_x) = get_sea_monster()
for yval in range(y, y + sm_y):
for xval in ... |
def check_if_multiple(test_num,list_of_multiples):
for i in list_of_multiples:
if not i:
continue
if not test_num%i:
return test_num
return 0
def sum_of_multiples(number, multiples_list = None):
multiples_list = multiples_list or [3,5]
#implicitly check if None is passed to the function
return sum(l... | def check_if_multiple(test_num, list_of_multiples):
for i in list_of_multiples:
if not i:
continue
if not test_num % i:
return test_num
return 0
def sum_of_multiples(number, multiples_list=None):
multiples_list = multiples_list or [3, 5]
return sum(list(filter(la... |
def algorithm_name(id, config):
algorithm = config['experiment.simple']['algorithm'].rsplit('.', 1)[1]
# env = config['experiment.simple']['environment'].rsplit('.', 1)[1]
tr_radius = get_setting(config, 'algorithm.subdomainbo', 'tr_radius')
beta = get_setting(config, 'model', 'beta')
tr_method = ge... | def algorithm_name(id, config):
algorithm = config['experiment.simple']['algorithm'].rsplit('.', 1)[1]
tr_radius = get_setting(config, 'algorithm.subdomainbo', 'tr_radius')
beta = get_setting(config, 'model', 'beta')
tr_method = get_setting(config, 'algorithm.subdomainbo', 'tr_method')
max_queries_t... |
'''This module contains the output formatters for pyPaSWAS'''
class DefaultFormatter(object):
'''This is the default formatter for pyPasWas.
All available formatters inherit from this formatter.
The results are parsed into a temporary file, which can be used by the main
program for permanen... | """This module contains the output formatters for pyPaSWAS"""
class Defaultformatter(object):
"""This is the default formatter for pyPasWas.
All available formatters inherit from this formatter.
The results are parsed into a temporary file, which can be used by the main
program for permanen... |
x:int = 1
o:object = None
x = o = 42
| x: int = 1
o: object = None
x = o = 42 |
m = int(input())
m = m % 1440
a = m // 60
b = m % 60
print(a, b)
| m = int(input())
m = m % 1440
a = m // 60
b = m % 60
print(a, b) |
# by Kami Bigdely
# Remove control flag
# Reference: https://stackoverflow.com/a/10140333/81306
# This code snippet reads up to the end of the file
n = 16
file = 'foobar.file'
def readfile(file, n):
with open(file, 'rb') as fp:
chunk = fp.read(n)
if chunk == '': # end of file, stop running.
... | n = 16
file = 'foobar.file'
def readfile(file, n):
with open(file, 'rb') as fp:
chunk = fp.read(n)
if chunk == '':
return
print(chunk)
readfile(file, n) |
class Solution:
def minDeletionSize(self, A: List[str]) -> int:
res = 0
for col_str in zip(*A):
if list(col_str) != sorted(col_str):
res += 1
return res
| class Solution:
def min_deletion_size(self, A: List[str]) -> int:
res = 0
for col_str in zip(*A):
if list(col_str) != sorted(col_str):
res += 1
return res |
_base_ = [
'../_base_/models/simmim_swin-base.py',
'../_base_/datasets/imagenet_simmim.py',
'../_base_/schedules/adamw_coslr-200e_in1k.py',
'../_base_/default_runtime.py',
]
# data
data = dict(samples_per_gpu=128)
# optimizer
optimizer = dict(
lr=2e-4 * 2048 / 512,
betas=(0.9, 0.999),
eps=... | _base_ = ['../_base_/models/simmim_swin-base.py', '../_base_/datasets/imagenet_simmim.py', '../_base_/schedules/adamw_coslr-200e_in1k.py', '../_base_/default_runtime.py']
data = dict(samples_per_gpu=128)
optimizer = dict(lr=0.0002 * 2048 / 512, betas=(0.9, 0.999), eps=1e-08, paramwise_options={'norm': dict(weight_decay... |
height = int(input())
for i in range(1,height+1):
for j in range(1, height+1):
if(i == height//2 or i == height or j == 1 or j == height and i >= height//2 or (j%2==1 and i<= height//2)):
print("*",end=" ")
else:
print(end=" ")
print()
# Sample Input :- 7
#... | height = int(input())
for i in range(1, height + 1):
for j in range(1, height + 1):
if i == height // 2 or i == height or j == 1 or (j == height and i >= height // 2) or (j % 2 == 1 and i <= height // 2):
print('*', end=' ')
else:
print(end=' ')
print() |
"""
We *could* implement our own Vulkan backend, so we would not need the wgpu lib.
It would be a lot of work to build and maintain though, so unless the
Rust wgpu project is abandoned or something, this is probably a bad idea.
"""
raise NotImplementedError()
| """
We *could* implement our own Vulkan backend, so we would not need the wgpu lib.
It would be a lot of work to build and maintain though, so unless the
Rust wgpu project is abandoned or something, this is probably a bad idea.
"""
raise not_implemented_error() |
# Copyright (c) 2015-2020 Avere Systems, Inc. All Rights Reserved.
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
__version__ = "0.5.4.3"
__version_info__ = (0, 5, 4, 3)
| __version__ = '0.5.4.3'
__version_info__ = (0, 5, 4, 3) |
house = [ ['hallway', 14.35],
['kitchen', 15.0],
['living room', 19.0],
['bedroom', 12.5],
['bathroom', 8.75] ]
# Code the for loop
for x in house:
print(str(x[0]) + ' area is ' + str(x[1]) + 'm')
| house = [['hallway', 14.35], ['kitchen', 15.0], ['living room', 19.0], ['bedroom', 12.5], ['bathroom', 8.75]]
for x in house:
print(str(x[0]) + ' area is ' + str(x[1]) + 'm') |
lst = []
num = int(input("Input the number of items: "))
for n in range(num):
# Arguments for Ordinal Numbers in a Set
ord = str(n+1)
if n == 0:
ord += "st"
elif n == 1:
ord += "nd"
elif n == 2:
ord += "rd"
else:
ord += "th"
numbers = int(input("Enter the "+ o... | lst = []
num = int(input('Input the number of items: '))
for n in range(num):
ord = str(n + 1)
if n == 0:
ord += 'st'
elif n == 1:
ord += 'nd'
elif n == 2:
ord += 'rd'
else:
ord += 'th'
numbers = int(input('Enter the ' + ord + ' value: '))
lst.append(numbers)
... |
# Author: Konrad Lindenbach <klindenb@ualberta.ca>,
# Emmanuel Odeke <odeke@ualberta.ca>
# Copyright (c) 2014
# Table name strings
MESSAGE_TABLE_KEY = "Message"
RECEIPIENT_TABLE_KEY = "Receipient"
MESSAGE_MARKER_TABLE_KEY = "MessageMarker"
MAX_NAME_LENGTH = 60 # Arbitrary value
MAX_BODY_LENGTH = 200 # Arbitr... | message_table_key = 'Message'
receipient_table_key = 'Receipient'
message_marker_table_key = 'MessageMarker'
max_name_length = 60
max_body_length = 200
max_alias_length = 60
max_token_length = 512
max_subject_length = 80
max_profile_uri_length = 400 |
"""
Each dataset has bug report ids and the ids of duplicate bug reports.
"""
class BugDataset(object):
def __init__(self, file):
f = open(file, 'r')
self.info = f.readline().strip()
self.bugIds = [id for id in f.readline().strip().split()]
self.duplicateIds = [id for id in f.readl... | """
Each dataset has bug report ids and the ids of duplicate bug reports.
"""
class Bugdataset(object):
def __init__(self, file):
f = open(file, 'r')
self.info = f.readline().strip()
self.bugIds = [id for id in f.readline().strip().split()]
self.duplicateIds = [id for id in f.readl... |
CFG = {
"spatial_input": 2,
"spatial_output": 2,
"temporal_input": 8,
"temporal_output": 12,
"bins": [0, 0.01, 0.1, 1.2],
"noise_weight": [0.05, 1, 4, 8],
"noise_weight_eth": [0.175, 1.5, 4, 8],
}
| cfg = {'spatial_input': 2, 'spatial_output': 2, 'temporal_input': 8, 'temporal_output': 12, 'bins': [0, 0.01, 0.1, 1.2], 'noise_weight': [0.05, 1, 4, 8], 'noise_weight_eth': [0.175, 1.5, 4, 8]} |
#!/usr/bin/env python3
def main():
lb_size = int(input())
spectrum = list(map(int, input().split()))
result = sequence_peptide(spectrum, lb_size)
print('-'.join(list(map(str, result))))
AMINO_MASSES = [57, 71, 87, 97, 99, 101, 103, 113, 114, 115, 128, 129, 131, 137, 147, 156, 163, 186]
def _attach... | def main():
lb_size = int(input())
spectrum = list(map(int, input().split()))
result = sequence_peptide(spectrum, lb_size)
print('-'.join(list(map(str, result))))
amino_masses = [57, 71, 87, 97, 99, 101, 103, 113, 114, 115, 128, 129, 131, 137, 147, 156, 163, 186]
def _attach_amino_mass(peptide: tuple) ... |
def fullName(first_name, last_name):
return f'Your first name is {first_name} and last name is {last_name}'
print(fullName(first_name = 'Qaidjohar', last_name = 'Jawadwala'))
# name = fullName('Qaidjohar','Jawadwala')
# print(name) | def full_name(first_name, last_name):
return f'Your first name is {first_name} and last name is {last_name}'
print(full_name(first_name='Qaidjohar', last_name='Jawadwala')) |
iN = int(input())
a_list = list(map(int, input().split()))
multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])
even_num = len(a_list) - odd_num
not4 = even_num - multi4
if not4 >0 :
if odd_num <= multi4:
print("Yes")
else:
print("No")
else:
if... | i_n = int(input())
a_list = list(map(int, input().split()))
multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])
even_num = len(a_list) - odd_num
not4 = even_num - multi4
if not4 > 0:
if odd_num <= multi4:
print('Yes')
else:
print('No')
elif odd_num <=... |
# Time complexity: O(n^3 log n + klogk)
# Space complexity: O(k)
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
nums.sort()
res = []
length = len(nums)
for i in range(0, length - 3):
if i != 0 and nums[i] == nums[i - 1]:
... | class Solution:
def four_sum(self, nums: List[int], target: int) -> List[List[int]]:
nums.sort()
res = []
length = len(nums)
for i in range(0, length - 3):
if i != 0 and nums[i] == nums[i - 1]:
continue
for j in range(i + 1, length - 2):
... |
class GKRect(object):
"""
GKRect is a lightweight rectangle object that is used in many places in Sketch.
It has many of the same methods as MSRect but they cannot always be used
interchangeably
"""
def __init__(self, x, y, width, height):
self._x = x
self._y = y
self._wi... | class Gkrect(object):
"""
GKRect is a lightweight rectangle object that is used in many places in Sketch.
It has many of the same methods as MSRect but they cannot always be used
interchangeably
"""
def __init__(self, x, y, width, height):
self._x = x
self._y = y
self._w... |
class Problem2:
def __init__(self, campoints=None, campoints_true = None, robposes=None):
self._campoints = campoints
self._robposes = robposes
self._campoints_true = campoints_true
@property
def campoints(self):
return self._campoints
@campoints.setter
def campoint... | class Problem2:
def __init__(self, campoints=None, campoints_true=None, robposes=None):
self._campoints = campoints
self._robposes = robposes
self._campoints_true = campoints_true
@property
def campoints(self):
return self._campoints
@campoints.setter
def campoints... |
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'conditions': [
['OS!="win"', {
'variables': {
'config_h_dir':
'.', # crafted for gcc/linux.
},
}, { # else, ... | {'conditions': [['OS!="win"', {'variables': {'config_h_dir': '.'}}, {'variables': {'config_h_dir': 'src/vsprojects'}, 'target_defaults': {'msvs_disabled_warnings': [4018, 4244, 4355], 'defines!': ['WIN32_LEAN_AND_MEAN']}}]], 'targets': [{'target_name': 'protobuf_lite', 'type': '<(library)', 'toolsets': ['host', 'target... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""gitogether
Scripts:
+ :mod:`.__main__` - argparse entry point
Module:
"""
__version__ = (0, 0, 0)
| """gitogether
Scripts:
+ :mod:`.__main__` - argparse entry point
Module:
"""
__version__ = (0, 0, 0) |
# https://leetcode.com/problems/binary-tree-preorder-traversal
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def preorderTraversal(self, root: Optional[T... | class Solution:
def preorder_traversal(self, root: Optional[TreeNode]) -> List[int]:
if root is None:
return []
acc = [root.val]
acc.extend(self.preorderTraversal(root.left))
acc.extend(self.preorderTraversal(root.right))
return acc |
class Solution:
def get_num(self, s, start):
index = start
while index < len(s) and s[index].isdigit():
index += 1
return int(s[start:index]), index
def calculate_helper(self, s, start):
result, sign, index = 0, 1, start
operator = ['+', '-']
while ... | class Solution:
def get_num(self, s, start):
index = start
while index < len(s) and s[index].isdigit():
index += 1
return (int(s[start:index]), index)
def calculate_helper(self, s, start):
(result, sign, index) = (0, 1, start)
operator = ['+', '-']
w... |
text = "zeub"
hexa = ""
for i in text:
hexa += str(hex(ord(i)))[2:].zfill(4)
print(hexa)
hexa = "002B00330033003600380039003000300034003000300030" #YOLOO
hexa = [hexa[i:i+4] for i in range(0, len(hexa), 4)]
text=""
for i in hexa:
text+=chr(int(i, 16))
print(text) | text = 'zeub\x1a'
hexa = ''
for i in text:
hexa += str(hex(ord(i)))[2:].zfill(4)
print(hexa)
hexa = '002B00330033003600380039003000300034003000300030'
hexa = [hexa[i:i + 4] for i in range(0, len(hexa), 4)]
text = ''
for i in hexa:
text += chr(int(i, 16))
print(text) |
class Node:
def __init__(self, value: int) -> None:
self.value = value
self.left = None
self.right = None
class BinarySearchTree:
def __init__(self) -> None:
self.root = None
def insert(self, value: int) -> bool:
new_node = Node(value)
if self.root ... | class Node:
def __init__(self, value: int) -> None:
self.value = value
self.left = None
self.right = None
class Binarysearchtree:
def __init__(self) -> None:
self.root = None
def insert(self, value: int) -> bool:
new_node = node(value)
if self.root is None... |
class ArrayStack:
def __init__(self):
self.data = []
def isEmpty(self):
return len(self.data) == 0
def push(self, val):
return self.data.append(val)
def pop(self):
if self.isEmpty():
raise Empty("Stack underflow!")
return self.data.pop()
def ... | class Arraystack:
def __init__(self):
self.data = []
def is_empty(self):
return len(self.data) == 0
def push(self, val):
return self.data.append(val)
def pop(self):
if self.isEmpty():
raise empty('Stack underflow!')
return self.data.pop()
def ... |
# pylint: skip-file
'''
Contains banner for the application.
'''
class COLORS:
RED = '\033[91m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
LINK = '\033[94m'
PURPLE = '\033[95m'
CYAN = '\033[96m'
PRIMARY = '\033[97m'
SECONDARY = '\033[90m'
END = '\033[0m'
PINK = '\033[95m'
banner ... | """
Contains banner for the application.
"""
class Colors:
red = '\x1b[91m'
green = '\x1b[92m'
yellow = '\x1b[93m'
link = '\x1b[94m'
purple = '\x1b[95m'
cyan = '\x1b[96m'
primary = '\x1b[97m'
secondary = '\x1b[90m'
end = '\x1b[0m'
pink = '\x1b[95m'
banner = f'\n{COLORS.GREEN}\n ... |
#!/usr/bin/env python3
"""
Consider a list (list = []). You can perform the following commands:
insert i e: Insert integer e at position i.
print: Print the list.
remove e: Delete the first occurrence of integer e.
append e: Insert integer e at the end of the list.
sort: Sort the list.
pop: Pop the last element from ... | """
Consider a list (list = []). You can perform the following commands:
insert i e: Insert integer e at position i.
print: Print the list.
remove e: Delete the first occurrence of integer e.
append e: Insert integer e at the end of the list.
sort: Sort the list.
pop: Pop the last element from the list.
reverse: Rever... |
arr = []
b = False
with open("input","r") as f:
for i in f.readlines():
arr = arr + [int(i.rstrip("\n"))]
length = len(arr)
for i in range(0,length):
for j in range(0,length):
for k in range(0,length):
if (arr[i]+arr[j]+arr[k] == 2020):
print("Result = ", arr... | arr = []
b = False
with open('input', 'r') as f:
for i in f.readlines():
arr = arr + [int(i.rstrip('\n'))]
length = len(arr)
for i in range(0, length):
for j in range(0, length):
for k in range(0, length):
if arr[i] + arr[j] + arr[k] == 2020:
print('Result = ', arr[i]... |
def classify(number):
return _classify(number) if number != 1 else 'deficient'
def _classify(number) -> str:
classif: str
aliquot: int = _aliquot(number)
if aliquot > number:
classif = 'abundant'
elif aliquot < number:
classif = 'deficient'
else:
classif = 'perfect'
... | def classify(number):
return _classify(number) if number != 1 else 'deficient'
def _classify(number) -> str:
classif: str
aliquot: int = _aliquot(number)
if aliquot > number:
classif = 'abundant'
elif aliquot < number:
classif = 'deficient'
else:
classif = 'perfect'
... |
def f(a):
a += 2
return a
b = 1
b = f(b)
print(b)
| def f(a):
a += 2
return a
b = 1
b = f(b)
print(b) |
"""
Simple yeetroot example
"""
def yeetRoot():
num = int( input( "which number would you like the square root of? "))
# return print( "the square root of {} is: {:.5f}".format( num, num**.5) )
return num**.5 | """
Simple yeetroot example
"""
def yeet_root():
num = int(input('which number would you like the square root of? '))
return num ** 0.5 |
db = "https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv"
# database file downloaded from
# https://www.weather.gov/source/gis/Shapefiles/County/c_03mr20.zip
# to get the lat and long values for US counties
dbf = "./c_03mr20.dbf"
| db = 'https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv'
dbf = './c_03mr20.dbf' |
class ServiceManager() :
"""
1. definition
2. table
"""
def get_view_obj(self):
"""
get view data for net config
:return:
"""
pass
def set_view_obj(self, obj):
"""
set net config data edited on view
:param obj:
:return:
... | class Servicemanager:
"""
1. definition
2. table
"""
def get_view_obj(self):
"""
get view data for net config
:return:
"""
pass
def set_view_obj(self, obj):
"""
set net config data edited on view
:param obj:
:return:
... |
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"action_config",
"feature",
"flag_group",
"flag_set",
"tool",
"tool_path",
"with_feature_set",
)
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
def _impl(ctx):
if (ctx.attr.cpu == "k8" and ctx.a... | load('@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl', 'action_config', 'feature', 'flag_group', 'flag_set', 'tool', 'tool_path', 'with_feature_set')
load('@bazel_tools//tools/build_defs/cc:action_names.bzl', 'ACTION_NAMES')
def _impl(ctx):
if ctx.attr.cpu == 'k8' and ctx.attr.compiler == 'clang7':
to... |
for i in range(plan_arguments['RUN_NUM']):
############################################# CC #############################################
add_test(name='cc_feature_rtest',
tags=['L10', 'cc'],
args=[' -rtlarg +uvm_set_config_int=uvm_test_top,layers,%d ' % plan_arguments['LAYER_NUM'], ge... | for i in range(plan_arguments['RUN_NUM']):
add_test(name='cc_feature_rtest', tags=['L10', 'cc'], args=[' -rtlarg +uvm_set_config_int=uvm_test_top,layers,%d ' % plan_arguments['LAYER_NUM'], get_seed_args(), DISABLE_COMPARE_ALL_UNITS_SB_ARG], module='nvdla_uvm_test', config=['nvdla_utb'], desc=' None reuse CC random ... |
'''Example test script.
Basic checks of device before processed
Input Variables:
args - arguments dictionary given to demo tester that may be used to
changed nature of test.
dev - Example device under test
name - Name of test being run.
results - Results map of all tests.
Test Specifi... | """Example test script.
Basic checks of device before processed
Input Variables:
args - arguments dictionary given to demo tester that may be used to
changed nature of test.
dev - Example device under test
name - Name of test being run.
results - Results map of all tests.
Test Specifi... |
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 4 20:13:02 2018
@author: User
"""
def checkit(s1, s2):
for i in s1:
for j in s2:
if i == j:
s1 = s1[1:]
s2 = s2[1:]
print(i,j, s1, s2)
if len(s1) >=1 and len(s2) ==0:
... | """
Created on Sun Feb 4 20:13:02 2018
@author: User
"""
def checkit(s1, s2):
for i in s1:
for j in s2:
if i == j:
s1 = s1[1:]
s2 = s2[1:]
print(i, j, s1, s2)
if len(s1) >= 1 and len(s2) == 0:
return True
... |
# 3-9. Dinner Guests: Working with one of the programs from Exercises 3-4 through 3-7 (page 46),
# use len() to print a message indicating the number of people you are inviting to dinner.
guests = ['Antonio', 'Emanuel', 'Francisco']
message = "1.- Hello dear uncle " + guests[0] + ", I hope you can come this 16th for ... | guests = ['Antonio', 'Emanuel', 'Francisco']
message = '1.- Hello dear uncle ' + guests[0] + ', I hope you can come this 16th for a mexican dinner in my house.'
print(message)
message = '2.- Hi ' + guests[1] + "! The next monday we'll have a dinner, you should come here to spend time with friends for a while, also we w... |
#https://adventofcode.com/2021/day/1
input2="""131
140
136
135
155
175
178
186
187
189
194
195
203
193
178
179
180
188
204
214
215
252
253
261
281
294
293
299
300
301
307
333
324
322
323
335
319
312
313
312
320
323
324
336
341
347
357
358
363
357
334
348
364
365
367
370
369
373
344
328
330
327
339
340
341
335
342
347... | input2 = '131\n140\n136\n135\n155\n175\n178\n186\n187\n189\n194\n195\n203\n193\n178\n179\n180\n188\n204\n214\n215\n252\n253\n261\n281\n294\n293\n299\n300\n301\n307\n333\n324\n322\n323\n335\n319\n312\n313\n312\n320\n323\n324\n336\n341\n347\n357\n358\n363\n357\n334\n348\n364\n365\n367\n370\n369\n373\n344\n328\n330\n327\n... |
# Copyright 2019 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... | """Bash runfiles library init code for test_rules.bzl."""
init_bash_runfiles = ['# --- begin runfiles.bash initialization ---', '# Copy-pasted from Bazel Bash runfiles library (tools/bash/runfiles/runfiles.bash).', 'set -euo pipefail', 'if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/nul... |
class TierFulfillmentMessages(object):
RROR_PROCESSING_TIER_REQUEST = 'There has been an error processing the tier config request. Error description: {}'
class BasePurchaseMessages:
pass
class BaseChangeMessages:
pass
class BaseSuspendMessages:
NOTHING_TO_DO = 'Suspend method for request {} - Nothi... | class Tierfulfillmentmessages(object):
rror_processing_tier_request = 'There has been an error processing the tier config request. Error description: {}'
class Basepurchasemessages:
pass
class Basechangemessages:
pass
class Basesuspendmessages:
nothing_to_do = 'Suspend method for request {} - Nothing... |
#! /usr/bin/python
# -*- coding: iso-8859-15 -*-
n = int(input("Ingrese la cantidad de datos: "))
suma = 0
for i in range(n):
x = float(input("Ingrese el dato: "))
suma = suma + x
prom = suma / n
print("El promedio es: " ,prom) | n = int(input('Ingrese la cantidad de datos: '))
suma = 0
for i in range(n):
x = float(input('Ingrese el dato: '))
suma = suma + x
prom = suma / n
print('El promedio es: ', prom) |
"""
.. module:: djstripe.management.
:synopsis: dj-stripe - management module, contains commands.
"""
| """
.. module:: djstripe.management.
:synopsis: dj-stripe - management module, contains commands.
""" |
N = int(input())
AS = [int(x) for x in input().split()]
ok = []
for i in range(N):
for j in range(N):
if i == j:
continue
if AS[i] % AS[j] == 0:
break
else:
ok.append(i)
print(len(ok))
| n = int(input())
as = [int(x) for x in input().split()]
ok = []
for i in range(N):
for j in range(N):
if i == j:
continue
if AS[i] % AS[j] == 0:
break
else:
ok.append(i)
print(len(ok)) |
class Point:
def __init__(self, x: int, y: int):
self.x = x
self.y = y
def getX(self) -> int:
return self.x
def getY(self) -> int:
return self.y
def setX(self, x: int) -> None:
self.x = x
def setY(self, y: int) -> None:
self.y = y
| class Point:
def __init__(self, x: int, y: int):
self.x = x
self.y = y
def get_x(self) -> int:
return self.x
def get_y(self) -> int:
return self.y
def set_x(self, x: int) -> None:
self.x = x
def set_y(self, y: int) -> None:
self.y = y |
#!/usr/bin/env python3
usb_codes = {
0x04:"aA", 0x05:"bB", 0x06:"cC", 0x07:"dD", 0x08:"eE", 0x09:"fF",
0x0A:"gG", 0x0B:"hH", 0x0C:"iI", 0x0D:"jJ", 0x0E:"kK", 0x0F:"lL",
0x10:"mM", 0x11:"nN", 0x12:"oO", 0x13:"pP", 0x14:"qQ", 0x15:"rR",
0x16:"sS", 0x17:"tT", 0x18:"uU", 0x19:"vV", 0x1A:"wW", 0x1B:"xX",
0x1... | usb_codes = {4: 'aA', 5: 'bB', 6: 'cC', 7: 'dD', 8: 'eE', 9: 'fF', 10: 'gG', 11: 'hH', 12: 'iI', 13: 'jJ', 14: 'kK', 15: 'lL', 16: 'mM', 17: 'nN', 18: 'oO', 19: 'pP', 20: 'qQ', 21: 'rR', 22: 'sS', 23: 'tT', 24: 'uU', 25: 'vV', 26: 'wW', 27: 'xX', 28: 'yY', 29: 'zZ', 30: '1!', 31: '2@', 32: '3#', 33: '4$', 34: '5%', 35:... |
# original problems
def easy_sum(a, b):
"""Takes two numbers and returns their sum"""
return a + b
def easy_product(a, b):
"""Takes two numbers and returns their product"""
return a * b
def easy_concat(a, b):
"""Takes two strings and returns their concatenation"""
return a + b
def easy_empty... | def easy_sum(a, b):
"""Takes two numbers and returns their sum"""
return a + b
def easy_product(a, b):
"""Takes two numbers and returns their product"""
return a * b
def easy_concat(a, b):
"""Takes two strings and returns their concatenation"""
return a + b
def easy_emptylist(l):
"""Takes... |
"""
Function analysis module which sets function APIs based
on function's name matching impapi. This should ideally go
early in the module order to get the APIs marked asap.
"""
def analyzeFunction(vw, fva):
fname = vw.getName(fva)
api = vw.getImpApi(fname)
if api == None:
return
rettype,retna... | """
Function analysis module which sets function APIs based
on function's name matching impapi. This should ideally go
early in the module order to get the APIs marked asap.
"""
def analyze_function(vw, fva):
fname = vw.getName(fva)
api = vw.getImpApi(fname)
if api == None:
return
(rettype, re... |
class Solution:
def solve(self, matrix, target):
for r in range(len(matrix)):
for c in range(len(matrix[0])):
if r-1 >= 0: matrix[r][c] += matrix[r-1][c]
if c-1 >= 0: matrix[r][c] += matrix[r][c-1]
if r-1 >= 0 and c-1 >= 0: matrix[r][c] -= matrix[r... | class Solution:
def solve(self, matrix, target):
for r in range(len(matrix)):
for c in range(len(matrix[0])):
if r - 1 >= 0:
matrix[r][c] += matrix[r - 1][c]
if c - 1 >= 0:
matrix[r][c] += matrix[r][c - 1]
i... |
"""
File: settings.py
Author: Luke Mason
Description: Main application development settings file
"""
SCREEN_WIDTH = 1920
SCREEN_HEIGHT = 1080
WIDTH = 800
HEIGHT = 900
PAD = 15
APP_NAME = 'PyGraph' # Str of app name for window title
DEBUG = 1 # Puts the app in debug mode (extra logging to console).
LOG = 1 # Puts... | """
File: settings.py
Author: Luke Mason
Description: Main application development settings file
"""
screen_width = 1920
screen_height = 1080
width = 800
height = 900
pad = 15
app_name = 'PyGraph'
debug = 1
log = 1
color = {'black': (0, 0, 0), 'white': (255, 255, 255), 'focus': (255, 25, 133)}
font = 'Calibri'
font_si... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.