content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class ParseError(Exception):
pass
class NotEnoughInputError(ParseError):
pass
class ImproperInputError(ParseError):
pass
class PlaceholderError(Exception):
pass
| class Parseerror(Exception):
pass
class Notenoughinputerror(ParseError):
pass
class Improperinputerror(ParseError):
pass
class Placeholdererror(Exception):
pass |
# --------------
# Code starts here
# Create the lists
class_1 = ['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio']
class_2 = ['Hilary Mason','Carla Gentry','Corinna Cortes']
# Concatenate both the strings
new_class = class_1 + class_2
print(new_class)
# Append the list
new_class.append('P... | class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.pop(5)
print(new_class)
courses = {'Math': 65, 'English': 70, 'History'... |
#################################################################
#Config
base_data_dir='/home/shawn/data/nist/ECODSEdataset/'
hs_image_dir = base_data_dir + 'RSdata/hs/'
chm_image_dir= base_data_dir + 'RSdata/chm/'
rgb_image_dir= base_data_dir + 'RSdata/camera/'
training_polygons_dir = base_data_dir + 'Task1/ITC/'
p... | base_data_dir = '/home/shawn/data/nist/ECODSEdataset/'
hs_image_dir = base_data_dir + 'RSdata/hs/'
chm_image_dir = base_data_dir + 'RSdata/chm/'
rgb_image_dir = base_data_dir + 'RSdata/camera/'
training_polygons_dir = base_data_dir + 'Task1/ITC/'
prediction_polygons_dir = base_data_dir + 'Task1/predictions/'
image_type... |
"""
Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1.
In other words, one of the first string's permutations is the substring of the second string.
Example 1:
Input: s1 = "ab" s2 = "eidbaooo"
Output: True
Explanation: s2 contains one permutation of s1 ("ba").
Example ... | """
Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1.
In other words, one of the first string's permutations is the substring of the second string.
Example 1:
Input: s1 = "ab" s2 = "eidbaooo"
Output: True
Explanation: s2 contains one permutation of s1 ("ba").
Example ... |
a=4
b=2
# addition operator
print(a+b)
| a = 4
b = 2
print(a + b) |
found_coins = 20
magic_coins = 10
stolen_coins = 3
print(found_coins + magic_coins * 365 - stolen_coins * 52)
stolen_coins = 2
print(found_coins + magic_coins * 365 - stolen_coins * 52)
magic_coins = 13
print(found_coins + magic_coins * 365 - stolen_coins * 52) | found_coins = 20
magic_coins = 10
stolen_coins = 3
print(found_coins + magic_coins * 365 - stolen_coins * 52)
stolen_coins = 2
print(found_coins + magic_coins * 365 - stolen_coins * 52)
magic_coins = 13
print(found_coins + magic_coins * 365 - stolen_coins * 52) |
class BaseCssSelect(object):
"""base class cssselect fields"""
element_method = None
extra_data = False
attr = False
text = False
text_content = False
def __init__(self, add_domain=False, save_start_url=False, save_url=False, many=False, *args, **kwargs):
self.add_domain = add_dom... | class Basecssselect(object):
"""base class cssselect fields"""
element_method = None
extra_data = False
attr = False
text = False
text_content = False
def __init__(self, add_domain=False, save_start_url=False, save_url=False, many=False, *args, **kwargs):
self.add_domain = add_domai... |
class RecordsBase:
pass
class VersionBase:
pass
class VersionsBase:
pass
| class Recordsbase:
pass
class Versionbase:
pass
class Versionsbase:
pass |
# O(n) time | O(1) space
def findLoop(head):
first = head.next
second = head.next.next
while first != second:
first = first.next
second = second.next.next
first = head
while first != second:
first = first.next
second = second.next
return first | def find_loop(head):
first = head.next
second = head.next.next
while first != second:
first = first.next
second = second.next.next
first = head
while first != second:
first = first.next
second = second.next
return first |
class Solution:
# @param {integer} dividend
# @param {integer} divisor
# @return {integer}
def divide(self, dividend, divisor):
if divisor == 0:
return None
sig = 1-2*(1 if dividend * divisor<0 else 0)
dividend,divisor = abs(dividend), abs(divisor)
if divisor ... | class Solution:
def divide(self, dividend, divisor):
if divisor == 0:
return None
sig = 1 - 2 * (1 if dividend * divisor < 0 else 0)
(dividend, divisor) = (abs(dividend), abs(divisor))
if divisor == 1:
return min(max(dividend * sig, -2147483648), 2147483647)
... |
ratings = 0
all_mean = 0
user_mean = 0
item_mean = 0
user_similarity = 0
item_similarity = 0
user_similarity_norm = 0
item_similarity_norm = 0
n_users = 943
n_items = 1682
| ratings = 0
all_mean = 0
user_mean = 0
item_mean = 0
user_similarity = 0
item_similarity = 0
user_similarity_norm = 0
item_similarity_norm = 0
n_users = 943
n_items = 1682 |
# TODO: add/import version support here
class InvalidState(Exception):
"""Used when repomd data reaches an unexpected state"""
pass
class UnsupportedFileListException(Exception):
"""Used when the file list version is unsupported"""
def __init__(self, version):
super().__init__(f'This file lis... | class Invalidstate(Exception):
"""Used when repomd data reaches an unexpected state"""
pass
class Unsupportedfilelistexception(Exception):
"""Used when the file list version is unsupported"""
def __init__(self, version):
super().__init__(f'This file list database version is unsupported. Please... |
_base_ = [
'../_base_/models/resnest50.py', '../_base_/datasets/diseased_bs32_pil_resize.py',
'../_base_/schedules/imagenet_bs256_coslr.py', '../_base_/default_runtime.py'
]
model = dict(
head=dict(
num_classes=2,
topk=(1,))
) | _base_ = ['../_base_/models/resnest50.py', '../_base_/datasets/diseased_bs32_pil_resize.py', '../_base_/schedules/imagenet_bs256_coslr.py', '../_base_/default_runtime.py']
model = dict(head=dict(num_classes=2, topk=(1,))) |
"""
Module
"""
def my_multiplier(value1, value2):
return value1 * value2 * 1000
| """
Module
"""
def my_multiplier(value1, value2):
return value1 * value2 * 1000 |
def hanoi(n, from_tower, to_tower, other_tower):
if n == 1: # recursion bottom
print(f'{from_tower} -> {to_tower}')
else: # recursion step
hanoi(n - 1, from_tower, other_tower, to_tower)
print(f'{from_tower} -> {to_tower}')
hanoi(n - 1, other_tower, to_tower, from_tower)
h... | def hanoi(n, from_tower, to_tower, other_tower):
if n == 1:
print(f'{from_tower} -> {to_tower}')
else:
hanoi(n - 1, from_tower, other_tower, to_tower)
print(f'{from_tower} -> {to_tower}')
hanoi(n - 1, other_tower, to_tower, from_tower)
hanoi(4, 1, 3, 2) |
# Copyright 2017 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... | """Rules that allows select() to differentiate between Apple OS versions."""
def _strip_version(version):
"""Strip trailing characters that aren't digits or '.' from version names.
Some OS versions look like "9.0gm", which is not useful for select()
statements. Thus, we strip the trailing "gm" part.
Args:
... |
# Sample Code For Assignment #3
# Printing Formatted Data in Python
# Copyright (C) 2021 Clinton Garwood
# MIT Open Source Initiative Approved License
# hw_assignment_3.py
# CIS-135 Python
# Resources:
# https://www.w3schools.com/python/ref_string_format.asp
# https://www.w3schools.com/python/python_string_... | my_int = 10
my_string = 'Clinton'
chevy = 'Cheverolet Silverado 586,675 $ 28,595.00'
chevy = 'Cheverolet Equinox 1,270,994 $ 25,000.00'
ti = ('Car Make', 'Car Model', 'Units Sold', 'Starting Price')
sep = ['--------', '---------', '----------', '--------------']
cs = ['Chevrolet', 'Silve... |
class VanillaRNN(nn.Module):
def __init__(self, layers, output_size, hidden_size, vocab_size, embed_size,
device):
super(VanillaRNN, self).__init__()
self.n_layers= layers
self.hidden_size = hidden_size
self.device = device
# Define the embedding
self.embeddings = nn.Embedding(v... | class Vanillarnn(nn.Module):
def __init__(self, layers, output_size, hidden_size, vocab_size, embed_size, device):
super(VanillaRNN, self).__init__()
self.n_layers = layers
self.hidden_size = hidden_size
self.device = device
self.embeddings = nn.Embedding(vocab_size, embed_s... |
__all__ = ("country_codes",)
country_codes = { # talk about ugly lol
"oc": 1,
"eu": 2,
"ad": 3,
"ae": 4,
"af": 5,
"ag": 6,
"ai": 7,
"al": 8,
"am": 9,
"an": 10,
"ao": 11,
"aq": 12,
"ar": 13,
"as": 14,
"at": 15,
"au": 16,
"aw": 17,
"az": 18,
"b... | __all__ = ('country_codes',)
country_codes = {'oc': 1, 'eu': 2, 'ad': 3, 'ae': 4, 'af': 5, 'ag': 6, 'ai': 7, 'al': 8, 'am': 9, 'an': 10, 'ao': 11, 'aq': 12, 'ar': 13, 'as': 14, 'at': 15, 'au': 16, 'aw': 17, 'az': 18, 'ba': 19, 'bb': 20, 'bd': 21, 'be': 22, 'bf': 23, 'bg': 24, 'bh': 25, 'bi': 26, 'bj': 27, 'bm': 28, 'bn... |
# Code strings the E6-B code
# OCR from European patent EP1825626B1.pdf (may have a few errors)
# The codes for the following PRNs have been compared with recorded signals and should be error-free:
# 1 2 3 4 5 7 8 9 11 12 13 14 15 18 19 21 24 25 26 27 30 31 33 36
e6b_strings = {
1: "5mSKpe/wkHoXA3f7IM7e4ejSU9rCSWgxA... | e6b_strings = {1: '5mSKpe/wkHoXA3f7IM7e4ejSU9rCSWgxAQM2tEQna6qxflmVSLGnnGc3n5jfDLga6NkU7klHCTrcuU/0s5Fu5WKkyv1KWgSXIWBuVf/+smyUnXyLCretL33bv4ipsJFRDSCaqj9sg+z7jeIbd+eTqedZ5zp+1jMDlf2TgOjobwpRHg/sjgtlAZg/p8aT////cZ7+QknvKVtXjlFIF9nobrwQkXs7dla+9smquCALIN7lS/2xhyijOTRQ8gsIp6yEqflFOY4TQ0vTB2CH8yyhZa+5T+qWhpJOgxukvXas9i17I... |
#!/usr/bin/env python
#coding: utf-8
class Solution:
# @param gas, a list of integers
# @param cost, a list of integers
# @return an integer
def canCompleteCircuit(self, gas, cost):
total, tank, start = 0, 0, 0
lg = len(gas)
for i in range(lg):
tank = tank + gas[i] ... | class Solution:
def can_complete_circuit(self, gas, cost):
(total, tank, start) = (0, 0, 0)
lg = len(gas)
for i in range(lg):
tank = tank + gas[i] - cost[i]
if tank < 0:
start = i + 1
total += tank
tank = 0
retu... |
# Jadoo, the Space Alien has befriended Koba upon landing on Earth. Since then, he wishes Koba to be more like him. In order to do so he decides to slowly transcribe Koba's DNA into RNA. But he has to write a very short code in order to do the transcription so as not to make Koba aware of the change.
# The four nucleo... | string = input()
flag = True
out = ''
for s in string:
if s == 'A':
out += 'U'
elif s == 'G':
out += 'C'
elif s == 'C':
out += 'G'
elif s == 'T':
out += 'A'
else:
flag = False
if flag:
print(out)
else:
print('Invalid Input') |
class NameTooShortError(ValueError):
pass
raise NameTooShortError("foo")
| class Nametooshorterror(ValueError):
pass
raise name_too_short_error('foo') |
# O((2n)!/((n!((n + 1)!)))) time | O((2n)!/((n!((n + 1)!)))) space -
# where n is the input number
def generateDivTags(numberOfTags):
matchedDivTags = []
generateDivTagsFromPrefix(numberOfTags, numberOfTags, "", matchedDivTags)
return matchedDivTags
def generateDivTagsFromPrefix(openingTagsNeede... | def generate_div_tags(numberOfTags):
matched_div_tags = []
generate_div_tags_from_prefix(numberOfTags, numberOfTags, '', matchedDivTags)
return matchedDivTags
def generate_div_tags_from_prefix(openingTagsNeeded, closingTagsNeeded, prefix, result):
if openingTagsNeeded > 0:
new_prefix = prefix +... |
# md5 : d385b6882bfe47bedf2a2b9547c91a16
# sha1 : 907eec7568423245054be9c59638f0e2bc04afad
# sha256 : a4e40c348031047b966c18f2761ee0460a226905721d2f29327528cb2b213cb1
ord_names = {
1: b'AcquireSRWLockExclusive',
2: b'AcquireSRWLockShared',
3: b'ActivateActCtx',
4: b'ActivateActCtxWorker',
5: b'AddA... | ord_names = {1: b'AcquireSRWLockExclusive', 2: b'AcquireSRWLockShared', 3: b'ActivateActCtx', 4: b'ActivateActCtxWorker', 5: b'AddAtomA', 6: b'AddAtomW', 7: b'AddConsoleAliasA', 8: b'AddConsoleAliasW', 9: b'AddDllDirectory', 10: b'AddIntegrityLabelToBoundaryDescriptor', 11: b'AddLocalAlternateComputerNameA', 12: b'AddL... |
# -*- coding: utf-8 -*-
class Solution:
def countOdds(self, low: int, high: int) -> int:
return (high + 1) // 2 - low // 2
if __name__ == '__main__':
solution = Solution()
assert 3 == solution.countOdds(3, 7)
assert 1 == solution.countOdds(8, 10)
| class Solution:
def count_odds(self, low: int, high: int) -> int:
return (high + 1) // 2 - low // 2
if __name__ == '__main__':
solution = solution()
assert 3 == solution.countOdds(3, 7)
assert 1 == solution.countOdds(8, 10) |
def solution(x, y):
result = 0
if y == 1:
result = (1 + x) * x / 2
elif y == 2:
result = (1 + x) * x / 2 + x
else:
end = x + y - 2
result = (1 + end) * end / 2 + x
return str(result)
| def solution(x, y):
result = 0
if y == 1:
result = (1 + x) * x / 2
elif y == 2:
result = (1 + x) * x / 2 + x
else:
end = x + y - 2
result = (1 + end) * end / 2 + x
return str(result) |
#
# PySNMP MIB module MAU-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MAU-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:49:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint) ... |
capac = int(input())
qtn500 = capac // 500
capac = capac - (qtn500 * 500)
qtn100 = capac // 100
capac = capac - (qtn100 * 100)
qtn25 = capac // 25
capac = capac - (qtn25 * 25)
print(qtn500)
print(qtn100)
print(qtn25)
print(capac) | capac = int(input())
qtn500 = capac // 500
capac = capac - qtn500 * 500
qtn100 = capac // 100
capac = capac - qtn100 * 100
qtn25 = capac // 25
capac = capac - qtn25 * 25
print(qtn500)
print(qtn100)
print(qtn25)
print(capac) |
"""
@author : Hyunwoong
@when : 2019-10-29
@homepage : https://github.com/gusdnd852
"""
def epoch_time(start_time, end_time):
elapsed_time = end_time - start_time
elapsed_mins = int(elapsed_time / 60)
elapsed_secs = int(elapsed_time - (elapsed_mins * 60))
return elapsed_mins, elapsed_secs
| """
@author : Hyunwoong
@when : 2019-10-29
@homepage : https://github.com/gusdnd852
"""
def epoch_time(start_time, end_time):
elapsed_time = end_time - start_time
elapsed_mins = int(elapsed_time / 60)
elapsed_secs = int(elapsed_time - elapsed_mins * 60)
return (elapsed_mins, elapsed_secs) |
def split_all_strings(input_array,splitter,keep_empty=False):
out=[]
while(len(input_array)):
current=input_array.pop(0).split(splitter)
while(len(current)):
i=current.pop(0)
if(len(i) or keep_empty):
out.append(i)
return(out)
if __name__ == '__main__':
test = 'hello world or something like that'.spl... | def split_all_strings(input_array, splitter, keep_empty=False):
out = []
while len(input_array):
current = input_array.pop(0).split(splitter)
while len(current):
i = current.pop(0)
if len(i) or keep_empty:
out.append(i)
return out
if __name__ == '__mai... |
with open("encoded.bmp", "rb") as f:
f.seek(0x7d0)
buf = f.read(0x32 * 8)
flag = ''
bin_flag = ''
for i, c in enumerate(buf):
bin_flag += str(c & 1)
if i % 8 == 7:
flag += chr(int(bin_flag[::-1], 2) + 5)
bin_flag = ''
print(repr(flag))
| with open('encoded.bmp', 'rb') as f:
f.seek(2000)
buf = f.read(50 * 8)
flag = ''
bin_flag = ''
for (i, c) in enumerate(buf):
bin_flag += str(c & 1)
if i % 8 == 7:
flag += chr(int(bin_flag[::-1], 2) + 5)
bin_flag = ''
print(repr(flag)) |
numero = int(input('Digite um numero: '))
count = 1
while count <= numero:
print(count)
count = count + 1
| numero = int(input('Digite um numero: '))
count = 1
while count <= numero:
print(count)
count = count + 1 |
def Trace(tag=''):
pass
def TracePrint(strMsg):
pass
_traceEnabled = False
_traceIndent = 0
| def trace(tag=''):
pass
def trace_print(strMsg):
pass
_trace_enabled = False
_trace_indent = 0 |
# https://programmers.co.kr/learn/courses/30/lessons/42748
def solution(array, commands):
answer = []
for idx in range(len(commands)):
i, j, k = commands[idx]
values = array[i-1:j]
values.sort()
v = values[k-1]
answer.append(v)
return answer | def solution(array, commands):
answer = []
for idx in range(len(commands)):
(i, j, k) = commands[idx]
values = array[i - 1:j]
values.sort()
v = values[k - 1]
answer.append(v)
return answer |
# Copyright 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def _CommonChecks(input_api, output_api):
results = []
results += input_api.RunTests(input_api.canned_checks.GetPylint(
input_api, output_api, ex... | def __common_checks(input_api, output_api):
results = []
results += input_api.RunTests(input_api.canned_checks.GetPylint(input_api, output_api, extra_paths_list=__get_paths_to_prepend(input_api), pylintrc='pylintrc'))
results += __check_no_more_usage_of_deprecated_code(input_api, output_api, deprecated_code... |
class Solution:
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if not nums:
return -1
peak_idx = -1
peak_num = float('-inf')
for idx in range(0, len(nums)):
if nums[idx] > ... | class Solution:
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if not nums:
return -1
peak_idx = -1
peak_num = float('-inf')
for idx in range(0, len(nums)):
if nums[idx] > pe... |
a = source()
b = source2()
c = source3()
d = source4()
e = a
f = b + c
g = 2*c + d
c = 1
print(sink(sink(e), c, sink(f), sink(g, 4*a))) | a = source()
b = source2()
c = source3()
d = source4()
e = a
f = b + c
g = 2 * c + d
c = 1
print(sink(sink(e), c, sink(f), sink(g, 4 * a))) |
def gcd(a: int, b: int) -> int :
if a == 0:
return b
return gcd(b % a, a)
def lcm(a: int, b: int) -> int:
return (a / gcd(a,b))* b | def gcd(a: int, b: int) -> int:
if a == 0:
return b
return gcd(b % a, a)
def lcm(a: int, b: int) -> int:
return a / gcd(a, b) * b |
"""
The :mod:`fatf.accountability` module holds a range of accountability methods.
This module holds a variety of techniques that can be used to assess *privacy*,
*security* and *robustness* of artificial intelligence pipelines and the
machine learning process: *data*, *models* and *predictions*.
"""
# Author: Kacper ... | """
The :mod:`fatf.accountability` module holds a range of accountability methods.
This module holds a variety of techniques that can be used to assess *privacy*,
*security* and *robustness* of artificial intelligence pipelines and the
machine learning process: *data*, *models* and *predictions*.
""" |
def find_lcm(a:int, b:int)->int:
if a <= b: # 1 45000
for i in range(1, a + 1):
if a % i == 0 and b % i == 0:
gcd = i
lcm = int(a * b / gcd)
return lcm
if a > b: # 6, 2
for i in range(1, b + 1):
if a % i == 0 and b % i == 0:
... | def find_lcm(a: int, b: int) -> int:
if a <= b:
for i in range(1, a + 1):
if a % i == 0 and b % i == 0:
gcd = i
lcm = int(a * b / gcd)
return lcm
if a > b:
for i in range(1, b + 1):
if a % i == 0 and b % i == 0:
gcd ... |
"""
PDB Writer
==========
"""
class PdbWriter:
"""
A writer class for ``.pdb`` files.
Examples
--------
*Writing to a File with a Unit Cell*
This writer can write to a file with the unit
cell included for periodic molecules. Note that this always assumes
P1 space group.
.. test... | """
PDB Writer
==========
"""
class Pdbwriter:
"""
A writer class for ``.pdb`` files.
Examples
--------
*Writing to a File with a Unit Cell*
This writer can write to a file with the unit
cell included for periodic molecules. Note that this always assumes
P1 space group.
.. testc... |
class BaseParser:
@classmethod
def parse(cls, headers, entries):
violations = []
for entry in entries:
tokens = cls.parse_entry(headers, entry)
violations.extend(cls.process_tokens(tokens))
return violations
@classmethod
def parse_entry(cls, headers, ent... | class Baseparser:
@classmethod
def parse(cls, headers, entries):
violations = []
for entry in entries:
tokens = cls.parse_entry(headers, entry)
violations.extend(cls.process_tokens(tokens))
return violations
@classmethod
def parse_entry(cls, headers, ent... |
# This is where you store your creds to your wifi, and your API key for Openweathermap.org.
# Rename this file to secrets.py before use and enter your wifi / api details.
secrets = {
'ssid' : 'my_wifi', # Wifi Name to connect to
'password' : 'mypassword123', # Wifi Password
'timezone' ... | secrets = {'ssid': 'my_wifi', 'password': 'mypassword123', 'timezone': 'America/Chicago', 'time_api': 'http://worldtimeapi.org/api/timezone/america/chicago', 'owm_apikey': 'xxxxxxxx', 'owm_cityid': '4887398'} |
# config.py
cfg = {
'name': 'YuFaceDetectNet',
#'min_sizes': [[32, 64, 128], [256], [512]],
#'steps': [32, 64, 128],
'min_sizes': [[10, 16, 24], [32, 48], [64, 96], [128, 192, 256]],
'steps': [8, 16, 32, 64],
'variance': [0.1, 0.2],
'clip': False,
'loc_weight': 1.0,
'gpu_train': Tru... | cfg = {'name': 'YuFaceDetectNet', 'min_sizes': [[10, 16, 24], [32, 48], [64, 96], [128, 192, 256]], 'steps': [8, 16, 32, 64], 'variance': [0.1, 0.2], 'clip': False, 'loc_weight': 1.0, 'gpu_train': True} |
# ----------------------------------------------------------------------
# Copyright (c) 2014 Rafael Gonzalez.
#
# See the LICENSE file for details
# ----------------------------------------------------------------------
class DiscreteValueError(ValueError):
'''Discrete Value is not in range'''
def __str__(sel... | class Discretevalueerror(ValueError):
"""Discrete Value is not in range"""
def __str__(self):
s = self.__doc__
if self.args:
s = '{0}: {1} -> {2}'.format(s, self.args[0], str(self.args[1]))
s = '{0}.'.format(s)
return s
class Validationerror(ValueError):
pass
c... |
# LOCAL DEVELOPMENT CONFIG FILE
# More config options: https://flask.palletsprojects.com/en/1.1.x/config/
# Flask specific values
TESTING = True
APPLICATION_ROOT = "/"
PREFERRED_URL_SCHEME = "http"
# Custom values
# Possible logging levels:
# CRITICAL - FATAL - ERROR - WARNING - INFO - DEBUG - NOTSET
LOGGER_LEVEL = "... | testing = True
application_root = '/'
preferred_url_scheme = 'http'
logger_level = 'DEBUG'
log_file_name = 'pi-car.log'
file_logging = True |
# -*- coding: utf-8 -*-
"""
Sveetoy Demo project to build with Optimus
``__version__`` define the Sass library version, not the demonstration project.
"""
__version__ = "0.9.1"
| """
Sveetoy Demo project to build with Optimus
``__version__`` define the Sass library version, not the demonstration project.
"""
__version__ = '0.9.1' |
"""
Ejercicio 07
Dada una cantidad en metros, se requiere que la convierta a pies y pulgadas, considerando lo siguiente:
1 metro = 39.27 pulgadas; 1 pie = 12 pulgadas.
Entradas
Metros --> Float --> M
Salidas
Pies --> Float --> P_I
Pulgadas --> Float--> P_U
"""
# Instrucciones al usuario
print("Para conocer cual es la... | """
Ejercicio 07
Dada una cantidad en metros, se requiere que la convierta a pies y pulgadas, considerando lo siguiente:
1 metro = 39.27 pulgadas; 1 pie = 12 pulgadas.
Entradas
Metros --> Float --> M
Salidas
Pies --> Float --> P_I
Pulgadas --> Float--> P_U
"""
print('Para conocer cual es la cantidad de pies y pulgada... |
class Equipamento():
def __init__(self, id, numeroEquipamento, marca, modelo, situacao):
self.id = id
self.numeroEquipamento = numeroEquipamento
self.marca=marca
self.modelo = modelo
self.situacao = situacao
def atualizar(self, dados):
try:
id = dados... | class Equipamento:
def __init__(self, id, numeroEquipamento, marca, modelo, situacao):
self.id = id
self.numeroEquipamento = numeroEquipamento
self.marca = marca
self.modelo = modelo
self.situacao = situacao
def atualizar(self, dados):
try:
id = dado... |
def is_prime(a):
if a % 2 == 0:
print("Brawo!!")
return ":)"
return ":("
x = is_prime(4)
print(x)
| def is_prime(a):
if a % 2 == 0:
print('Brawo!!')
return ':)'
return ':('
x = is_prime(4)
print(x) |
PERMISSIONS = (
# 'notify', # leads to unsupported access form
'friends',
'photos',
'audio',
'video',
'stories',
'pages',
'status',
'notes',
# 'messages', # available only after moderation
'wall',
'offline',
'docs',
'groups',
'notifications',
'stats',
... | permissions = ('friends', 'photos', 'audio', 'video', 'stories', 'pages', 'status', 'notes', 'wall', 'offline', 'docs', 'groups', 'notifications', 'stats', 'email', 'market')
bitmasks = {'notify': 1, 'friends': 2, 'photos': 4, 'audio': 8, 'video': 16, 'stories': 64, 'pages': 128, 'status': 1024, 'notes': 2048, 'message... |
a = {}
b = 123
c = ''
d = {}
print(a)
e = 123.456
f = [1, "2", "3.14", False, {}, [4, "5", {}, True]]
g = (1, "2", True, None) | a = {}
b = 123
c = ''
d = {}
print(a)
e = 123.456
f = [1, '2', '3.14', False, {}, [4, '5', {}, True]]
g = (1, '2', True, None) |
def parse_string(input, vars={}):
for var in vars:
input = input.replace(f"${var}$", vars[var])
return input
| def parse_string(input, vars={}):
for var in vars:
input = input.replace(f'${var}$', vars[var])
return input |
"""
Algorithm for calculating the most cost-efficient sequence for converting one string
into another.
The only allowed operations are
--- Cost to copy a character is copy_cost
--- Cost to replace a character is replace_cost
--- Cost to delete a character is delete_cost
--- Cost to insert a character is insert_c... | """
Algorithm for calculating the most cost-efficient sequence for converting one string
into another.
The only allowed operations are
--- Cost to copy a character is copy_cost
--- Cost to replace a character is replace_cost
--- Cost to delete a character is delete_cost
--- Cost to insert a character is insert_cost
"""... |
class ListSecure(list):
def get(self, index, default=None):
try:
return self.__getitem__(index)
except IndexError:
return default
| class Listsecure(list):
def get(self, index, default=None):
try:
return self.__getitem__(index)
except IndexError:
return default |
class Solution:
def firstUniqChar(self, s: str) -> int:
count = collections.Counter(s)
for indx, ch in enumerate(s):
if count[ch] < 2:
return indx
return -1
| class Solution:
def first_uniq_char(self, s: str) -> int:
count = collections.Counter(s)
for (indx, ch) in enumerate(s):
if count[ch] < 2:
return indx
return -1 |
def bitcoinToEuros(bitcoin_amount, bitcoin_value_euros):
euros_value=bitcoin_amount*bitcoin_value_euros
return euros_value
bitcoin_to_euros=25000
valor_bitcoin=bitcoinToEuros(1,bitcoin_to_euros)
print(valor_bitcoin)
if valor_bitcoin<=30000:
print("el valor esta por debajo de 30000", valor_bitcoin)
| def bitcoin_to_euros(bitcoin_amount, bitcoin_value_euros):
euros_value = bitcoin_amount * bitcoin_value_euros
return euros_value
bitcoin_to_euros = 25000
valor_bitcoin = bitcoin_to_euros(1, bitcoin_to_euros)
print(valor_bitcoin)
if valor_bitcoin <= 30000:
print('el valor esta por debajo de 30000', valor_bit... |
# Code generated by font-to-py.py.
# Font: DejaVuSans.ttf
version = '0.26'
def height():
return 12
def max_width():
return 12
def hmap():
return False
def reverse():
return False
def monospaced():
return False
def min_ch():
return 32
def max_ch():
return 126
_font =\
b'\x06\x00\x02\x... | version = '0.26'
def height():
return 12
def max_width():
return 12
def hmap():
return False
def reverse():
return False
def monospaced():
return False
def min_ch():
return 32
def max_ch():
return 126
_font = b'\x06\x00\x02\x00r\x01\x1a\x00\x0c\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\... |
splitString ="The string has been\nsplit over\nserveral\nlines"
print(splitString) # \n movex next string to next line
tabbedString = "1\t2\t3\t4\t5\t6\t7\t8\t9"
print(tabbedString) # \t moves next string with an tab space
# for multiple special charecters
print('The pet shop owner said, "No, no, \'e\'s uh,...he\'s r... | split_string = 'The string has been\nsplit over\nserveral\nlines'
print(splitString)
tabbed_string = '1\t2\t3\t4\t5\t6\t7\t8\t9'
print(tabbedString)
print('The pet shop owner said, "No, no, \'e\'s uh,...he\'s resting".')
print('The pet shop owner said,"No,no \'e \'s uh,... he\'s resting".')
print('The pet shop owner sa... |
def primeFactors(n):
prime_list=[2,3,5,7, 11, 13, 17, 19, 23, 29
, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71
, 73, 79, 83, 89, 97,101,103,107,109,113
,127,131,137,139,149,151,157,163,167,173
,179,181,191,193,197,199,211,223,227,229
,233,239,241,251,257,263,269,271,277,281
,283,293,307,311,313,317,331,337,347,349... | def prime_factors(n):
prime_list = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293,... |
foods = ['bacon', 'tuna', 'ham', 'sausages', 'beef']
for f in foods:
print(f)
print(len(f)) | foods = ['bacon', 'tuna', 'ham', 'sausages', 'beef']
for f in foods:
print(f)
print(len(f)) |
base = [2.7, 3.1, 3.5, 3.8]
def calculate(n: int):
return [n+2.7, n+3.1, n+3.5, n+3.8]
def solve(n: list):
result = []
for roll in n:
for numeral in calculate(roll):
result.append(round(numeral, 1))
return list(dict.fromkeys(result))
print(solve(base)) | base = [2.7, 3.1, 3.5, 3.8]
def calculate(n: int):
return [n + 2.7, n + 3.1, n + 3.5, n + 3.8]
def solve(n: list):
result = []
for roll in n:
for numeral in calculate(roll):
result.append(round(numeral, 1))
return list(dict.fromkeys(result))
print(solve(base)) |
a: int
def Main() -> int:
return a
| a: int
def main() -> int:
return a |
def read_file(filepath):
with open(filepath) as f:
for line in f.readlines():
yield line.strip()
def solution():
grid = [[0 for x in range(1000)] for y in range(1000)]
grid_summary = {}
overlapped_square_count = 0
for line in read_file("input.txt"):
claim_id, rect_detai... | def read_file(filepath):
with open(filepath) as f:
for line in f.readlines():
yield line.strip()
def solution():
grid = [[0 for x in range(1000)] for y in range(1000)]
grid_summary = {}
overlapped_square_count = 0
for line in read_file('input.txt'):
(claim_id, rect_detai... |
# -*- coding: utf-8 -*-
"""Curriculum Learning"""
__authors__ = ['Georgios Pligoropoulos']
DEFAULT_SEED = 16011984 # Default random number generator seed if none provided. | """Curriculum Learning"""
__authors__ = ['Georgios Pligoropoulos']
default_seed = 16011984 |
def Value_Investing(self, training_data, testing_data=""):
if testing_data == "":
percent_taken = 30
index = ((100 - percent_taken) / 100) * len(training_data)
testing_data = training_data[index:]
return 0 | def value__investing(self, training_data, testing_data=''):
if testing_data == '':
percent_taken = 30
index = (100 - percent_taken) / 100 * len(training_data)
testing_data = training_data[index:]
return 0 |
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
if len(s) <= 1: return len(s)
longest = 1
i = 1
curr = s[0]
while i < len(s):
if s[i] in curr:
longest = max(longest, len(curr))
idx = curr.find(s[i])
... | class Solution:
def length_of_longest_substring(self, s: str) -> int:
if len(s) <= 1:
return len(s)
longest = 1
i = 1
curr = s[0]
while i < len(s):
if s[i] in curr:
longest = max(longest, len(curr))
idx = curr.find(s[i]... |
"""Example OneDrive for Office365 local settings file. Copy this file to local.py and change
these settings.
"""
ONEDRIVE_OAUTH_AUTH_ENDPOINT = 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize'
ONEDRIVE_OAUTH_TOKEN_ENDPOINT = 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token'
ONE... | """Example OneDrive for Office365 local settings file. Copy this file to local.py and change
these settings.
"""
onedrive_oauth_auth_endpoint = 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize'
onedrive_oauth_token_endpoint = 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token'
oned... |
t = int(input())
while t:
N = int(input())
S = list(input())
R = list(input())
if S.count('1') == R.count('1'):
print('YES')
else:
print('NO')
t = t-1 | t = int(input())
while t:
n = int(input())
s = list(input())
r = list(input())
if S.count('1') == R.count('1'):
print('YES')
else:
print('NO')
t = t - 1 |
#!/usr/bin/env python
"""
Contains modules for platform-specific methods.
"""
| """
Contains modules for platform-specific methods.
""" |
class TreeNode():
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __repr__(self):
return '<TreeNode {}>'.format(self.val)
def path_sum(root, target_sum):
"""
Given a binary tree and a sum, determine if the tree has
a root-to-leaf path suc... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __repr__(self):
return '<TreeNode {}>'.format(self.val)
def path_sum(root, target_sum):
"""
Given a binary tree and a sum, determine if the tree has
a root-to-leaf path such ... |
class UnknownOSException(Exception):
pass
class ChromeError(Exception):
pass
| class Unknownosexception(Exception):
pass
class Chromeerror(Exception):
pass |
def read_matrix():
r, c = [int(n) for n in input().split(', ')]
matrix = []
for _ in range(r):
row = [int(n) for n in input().split(', ')]
matrix.append(row)
return matrix
matrix = read_matrix()
total_sum = 0
for el in matrix:
total_sum += sum(el)
print(total_sum)
print(matrix) | def read_matrix():
(r, c) = [int(n) for n in input().split(', ')]
matrix = []
for _ in range(r):
row = [int(n) for n in input().split(', ')]
matrix.append(row)
return matrix
matrix = read_matrix()
total_sum = 0
for el in matrix:
total_sum += sum(el)
print(total_sum)
print(matrix) |
# -*- coding: utf-8 -*-
"""Top-level package for Redmine to JIRA Importers plugin."""
__author__ = """Michele Cardone"""
__email__ = 'michele.cardone82@gmail.com'
__version__ = '0.10.0'
| """Top-level package for Redmine to JIRA Importers plugin."""
__author__ = 'Michele Cardone'
__email__ = 'michele.cardone82@gmail.com'
__version__ = '0.10.0' |
class ViewBackgroundLightHandler(object):
def __init__(self, viewOptions, grid, action):
self.viewOptions = viewOptions
self.action = action
self.action.checkable = True
self.action.connect("triggered()", self._onChecked)
# background was 0,0,0 (black). now charcoal
... | class Viewbackgroundlighthandler(object):
def __init__(self, viewOptions, grid, action):
self.viewOptions = viewOptions
self.action = action
self.action.checkable = True
self.action.connect('triggered()', self._onChecked)
self.properties = {viewOptions: {'Gradient background... |
class Clickomania:
def __init__(self, N, M, K, state):
self.row = N
self.column = M
self.color = K
self.score = 0
self.state = state
#This make a copy from the state
def clone(self):
NewClickomania = Clickomania(self.row, self.column, self.color, self.state... | class Clickomania:
def __init__(self, N, M, K, state):
self.row = N
self.column = M
self.color = K
self.score = 0
self.state = state
def clone(self):
new_clickomania = clickomania(self.row, self.column, self.color, self.state)
NewClickomania.score = self... |
f1 = open("name.txt")
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
f1.close()
| f1 = open('name.txt')
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
print(f1.readline())
print(f1.tell())
f1.close() |
class Square:
def __init__(self, side):
self.side = side
def __str__(self):
return 'A square with side %s' % self.side
| class Square:
def __init__(self, side):
self.side = side
def __str__(self):
return 'A square with side %s' % self.side |
# Time: O(n)
# Space: O(1)
class Solution(object):
def isLongPressedName(self, name, typed):
"""
:type name: str
:type typed: str
:rtype: bool
"""
i = 0
for j in range(len(typed)):
if i < len(name) and name[i] == typed[j]:
i += 1
... | class Solution(object):
def is_long_pressed_name(self, name, typed):
"""
:type name: str
:type typed: str
:rtype: bool
"""
i = 0
for j in range(len(typed)):
if i < len(name) and name[i] == typed[j]:
i += 1
elif j == 0 o... |
"""
Given a m * n matrix of ones and zeros, return how many square submatrices have all ones.
Example 1:
Input: matrix =
[
[0,1,1,1],
[1,1,1,1],
[0,1,1,1]
]
Output: 15
Explanation:
There are 10 squares of side 1.
There are 4 squares of side 2.
There is 1 square of side 3.
Total number of squares = 10 + 4 +... | """
Given a m * n matrix of ones and zeros, return how many square submatrices have all ones.
Example 1:
Input: matrix =
[
[0,1,1,1],
[1,1,1,1],
[0,1,1,1]
]
Output: 15
Explanation:
There are 10 squares of side 1.
There are 4 squares of side 2.
There is 1 square of side 3.
Total number of squares = 10 + 4 +... |
SLACK_HOOK = {
'url' : '',
'port': 443,
'method': 'POST',
'channel': '',
'headers': {
'Content-Type': 'application/json'
}
}
GITHUB_TOKEN = ""
REPO_TOPIC = ""
GITHUB_ORG = ""
| slack_hook = {'url': '', 'port': 443, 'method': 'POST', 'channel': '', 'headers': {'Content-Type': 'application/json'}}
github_token = ''
repo_topic = ''
github_org = '' |
workers = 2
bind = '127.0.0.1:8000'
workers = 1
timeout = 60
errorlog = '/usr/local/apps/blog-nestor/nblog.gunicorng.error'
accesslog = '/usr/local/apps/blog-nestor/nblog.gunicorng.access'
| workers = 2
bind = '127.0.0.1:8000'
workers = 1
timeout = 60
errorlog = '/usr/local/apps/blog-nestor/nblog.gunicorng.error'
accesslog = '/usr/local/apps/blog-nestor/nblog.gunicorng.access' |
pay = 1
pay = 2
pay = 3
over
| pay = 1
pay = 2
pay = 3
over |
class Solution(object):
def subsetsWithDup(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
self.nums, self.length = nums, len(nums)
return [[]] + self.subsetHelper(0)
def subsetHelper(self, start):
r... | class Solution(object):
def subsets_with_dup(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
(self.nums, self.length) = (nums, len(nums))
return [[]] + self.subsetHelper(0)
def subset_helper(self, start):
result = [... |
def gcd(i, j):
for n in reversed(range(max(i, j)+1)):
if i % n == 0 and j % n == 0:
return n
def is_coprime(i, j):
return gcd(i, j) == 1
def totient(m):
n = 0
for i in reversed(range(m+1)):
if is_coprime(m, i):
n = n + 1
return n
def test_totient():
... | def gcd(i, j):
for n in reversed(range(max(i, j) + 1)):
if i % n == 0 and j % n == 0:
return n
def is_coprime(i, j):
return gcd(i, j) == 1
def totient(m):
n = 0
for i in reversed(range(m + 1)):
if is_coprime(m, i):
n = n + 1
return n
def test_totient():
... |
print("Strings, (c) Verloka Vadim 2018\n\n\n")
S1 = "Hello, {0}, how are you{1}"
print(S1.format("Vadim", "?"))
print("{:<20}".format("left"))
print("{:>20}".format("right"))
print("{:^20}".format("right"))
print("{:*<20}".format("left"))
print("{:*>20}".format("right"))
print("{:*^20}".format("right"))
print("{:1... | print('Strings, (c) Verloka Vadim 2018\n\n\n')
s1 = 'Hello, {0}, how are you{1}'
print(S1.format('Vadim', '?'))
print('{:<20}'.format('left'))
print('{:>20}'.format('right'))
print('{:^20}'.format('right'))
print('{:*<20}'.format('left'))
print('{:*>20}'.format('right'))
print('{:*^20}'.format('right'))
print('{:1<20}'... |
# Time: O(n)
# Space: O(1)
class Solution(object):
lookup = {'0':'0', '1':'1', '6':'9', '8':'8', '9':'6'}
# @param {string} num
# @return {boolean}
def isStrobogrammatic(self, num):
n = len(num)
for i in range((n+1) / 2):
if num[n-1-i] not in self.lookup or \
... | class Solution(object):
lookup = {'0': '0', '1': '1', '6': '9', '8': '8', '9': '6'}
def is_strobogrammatic(self, num):
n = len(num)
for i in range((n + 1) / 2):
if num[n - 1 - i] not in self.lookup or num[i] != self.lookup[num[n - 1 - i]]:
return False
return... |
[2,1,3]
[5,1,4,null,null,3,6]
[2,1,4,null,null,3,6]
[2,1,4,null,null,8,6]
[]
[1, 1, 1]
[0, 1]
[0, 1, 3]
[10,5,15,null,null,6,20]
[10,5,15,3,11,12,20]
[3,null,30,10,null,null,15,null,45]
[3,null,30,10,null,null,15,null,19]
| [2, 1, 3]
[5, 1, 4, null, null, 3, 6]
[2, 1, 4, null, null, 3, 6]
[2, 1, 4, null, null, 8, 6]
[]
[1, 1, 1]
[0, 1]
[0, 1, 3]
[10, 5, 15, null, null, 6, 20]
[10, 5, 15, 3, 11, 12, 20]
[3, null, 30, 10, null, null, 15, null, 45]
[3, null, 30, 10, null, null, 15, null, 19] |
load("//tools/bzl:maven_jar.bzl", "maven_jar")
AWS_SDK_VER = "2.16.19"
AWS_KINESIS_VER = "2.3.4"
JACKSON_VER = "2.10.4"
def external_plugin_deps():
maven_jar(
name = "junit-platform",
artifact = "org.junit.platform:junit-platform-commons:1.4.0",
sha1 = "34d9983705c953b97abb01e1cd04647f4727... | load('//tools/bzl:maven_jar.bzl', 'maven_jar')
aws_sdk_ver = '2.16.19'
aws_kinesis_ver = '2.3.4'
jackson_ver = '2.10.4'
def external_plugin_deps():
maven_jar(name='junit-platform', artifact='org.junit.platform:junit-platform-commons:1.4.0', sha1='34d9983705c953b97abb01e1cd04647f47272fe5')
maven_jar(name='amazo... |
"""
Constants for use in the game
"""
SHIPS = "Ships"
SYSTEMS = "SolarSystems"
LOCATION = "Location"
STATUS = "Status"
HYPERLANES = "Hyperlanes"
STARS = "Stars"
PLANETS = "Planets"
NAME = "Name"
STATE = "State"
POLL = "Poll"
LIST = "List"
SHIP = "Ship"
MOVE = "Move"
OBSERVE = "Observe"
SUCCESS = "Success"
RESULT_OBJEC... | """
Constants for use in the game
"""
ships = 'Ships'
systems = 'SolarSystems'
location = 'Location'
status = 'Status'
hyperlanes = 'Hyperlanes'
stars = 'Stars'
planets = 'Planets'
name = 'Name'
state = 'State'
poll = 'Poll'
list = 'List'
ship = 'Ship'
move = 'Move'
observe = 'Observe'
success = 'Success'
result_object... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def increasingBST(self, root):
new_head = TreeNode(-1)
self.rearrange(new_head, root)
return new_head.right
def rearr... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def increasing_bst(self, root):
new_head = tree_node(-1)
self.rearrange(new_head, root)
return new_head.right
def rearrange(self, n_head, node):
... |
expected_output = {
"track": {
"1": {
"type": "Interface",
"instance": "Ethernet1/4",
"subtrack": "IP Routing",
"state": "DOWN",
"change_count": 1,
"last_change": "3w5d",
"tracked_by": {
... | expected_output = {'track': {'1': {'type': 'Interface', 'instance': 'Ethernet1/4', 'subtrack': 'IP Routing', 'state': 'DOWN', 'change_count': 1, 'last_change': '3w5d', 'tracked_by': {1: {'name': 'HSRP', 'interface': 'Vlan2', 'id': '2'}, 2: {'name': 'HSRP', 'interface': 'Ethernet1/1', 'id': '1'}, 3: {'name': 'VRRPV3', '... |
scores = {'AA': 10, 'BB': 20, "CC": 30}
print("AA score:", scores['AA'])
print("Before BB score:", scores['BB'])
scores['BB'] = 100
print("After BB score:", scores["BB"])
age = {1, 2, 3}
print(age)
| scores = {'AA': 10, 'BB': 20, 'CC': 30}
print('AA score:', scores['AA'])
print('Before BB score:', scores['BB'])
scores['BB'] = 100
print('After BB score:', scores['BB'])
age = {1, 2, 3}
print(age) |
def mySqrt(x):
if(x==0):
return 0
right = x
left = 0
if right <=2 :
return 1
if right > 10:
left == 10
if (right > 2):
while left <= right:
m = (left+right)//2
if (m * m == x):
return m
if m * m < x:
... | def my_sqrt(x):
if x == 0:
return 0
right = x
left = 0
if right <= 2:
return 1
if right > 10:
left == 10
if right > 2:
while left <= right:
m = (left + right) // 2
if m * m == x:
return m
if m * m < x:
... |
class JwtAuthorizationTicket:
def __init__(self, accessToken, refreshToken):
self.access_token = accessToken
self.refresh_token = refreshToken
class JwtAuthorizationTicketHolder:
def set_ticket(self, ticket):
pass
def get_ticket(self):
pass
class TransientJwtAuthorizat... | class Jwtauthorizationticket:
def __init__(self, accessToken, refreshToken):
self.access_token = accessToken
self.refresh_token = refreshToken
class Jwtauthorizationticketholder:
def set_ticket(self, ticket):
pass
def get_ticket(self):
pass
class Transientjwtauthorizatio... |
"""Screen"""
SCREENSIZE = [640, 640]
SCREENXMIDDLE = SCREENSIZE[0] // 2
CELLSIZE = 32
BOARDBEGINNINGX = 5
BOARDBEGINNINGY = 4
PIECECHOOSEPLACEY = 15
PIECECHOOSEPLACEX1 = 1
PIECECHOOSEPLACEX2 = 7
PIECECHOOSEPLACEX3 = 13
MAINMENUBUTTONPLACEY1 = 150
MAINMENUBUTTONPLACEY2 = 280
MAINMENUBUTTONPLACEY3 = 410
"""Game loop... | """Screen"""
screensize = [640, 640]
screenxmiddle = SCREENSIZE[0] // 2
cellsize = 32
boardbeginningx = 5
boardbeginningy = 4
piecechooseplacey = 15
piecechooseplacex1 = 1
piecechooseplacex2 = 7
piecechooseplacex3 = 13
mainmenubuttonplacey1 = 150
mainmenubuttonplacey2 = 280
mainmenubuttonplacey3 = 410
'Game loop consta... |
class Cart:
def __init__(self):
self._contents = dict()
def __repr__(self):
return "{0} {1}".format(Cart, self.__dict__)
def process(self, order):
if order.add:
if not order.item in self._contents:
self._contents[order.item] = 0
... | class Cart:
def __init__(self):
self._contents = dict()
def __repr__(self):
return '{0} {1}'.format(Cart, self.__dict__)
def process(self, order):
if order.add:
if not order.item in self._contents:
self._contents[order.item] = 0
self._conten... |
SCHEMA = {
'REFERENCE': {
'gender': 'Gender',
'ethnicity': 'Ethnicity',
'economic_status': 'Economic Status',
'enrolled_8th': '8th Grade (FY 2009)',
'enrolled_9th': 'Enrolled in 9th Grade (FY 2010)',
'enrolled_9th_percent': '% Enrolled in 9th Grade (FY 2010)',
... | schema = {'REFERENCE': {'gender': 'Gender', 'ethnicity': 'Ethnicity', 'economic_status': 'Economic Status', 'enrolled_8th': '8th Grade (FY 2009)', 'enrolled_9th': 'Enrolled in 9th Grade (FY 2010)', 'enrolled_9th_percent': '% Enrolled in 9th Grade (FY 2010)', 'enrolled_10th': 'Enrolled in 10th Grade(FY 2011)', 'enrolled... |
data = (
'ddwim', # 0x00
'ddwib', # 0x01
'ddwibs', # 0x02
'ddwis', # 0x03
'ddwiss', # 0x04
'ddwing', # 0x05
'ddwij', # 0x06
'ddwic', # 0x07
'ddwik', # 0x08
'ddwit', # 0x09
'ddwip', # 0x0a
'ddwih', # 0x0b
'ddyu', # 0x0c
'ddyug', # 0x0d
'ddyugg', # 0x0e
'ddyugs... | data = ('ddwim', 'ddwib', 'ddwibs', 'ddwis', 'ddwiss', 'ddwing', 'ddwij', 'ddwic', 'ddwik', 'ddwit', 'ddwip', 'ddwih', 'ddyu', 'ddyug', 'ddyugg', 'ddyugs', 'ddyun', 'ddyunj', 'ddyunh', 'ddyud', 'ddyul', 'ddyulg', 'ddyulm', 'ddyulb', 'ddyuls', 'ddyult', 'ddyulp', 'ddyulh', 'ddyum', 'ddyub', 'ddyubs', 'ddyus', 'ddyuss', ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.